iPXE
undi.h
Go to the documentation of this file.
00001 #ifndef _UNDI_H
00002 #define _UNDI_H
00003 
00004 /** @file
00005  *
00006  * UNDI driver
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #ifndef ASSEMBLY
00013 
00014 #include <ipxe/device.h>
00015 #include <pxe_types.h>
00016 
00017 /** An UNDI device
00018  *
00019  * This structure is used by assembly code as well as C; do not alter
00020  * this structure without editing pxeprefix.S to match.
00021  */
00022 struct undi_device {
00023         /** PXENV+ structure address */
00024         SEGOFF16_t pxenv;
00025         /** !PXE structure address */
00026         SEGOFF16_t ppxe;
00027         /** Entry point */
00028         SEGOFF16_t entry;
00029         /** Free base memory after load */
00030         UINT16_t fbms;
00031         /** Free base memory prior to load */
00032         UINT16_t restore_fbms;
00033         /** PCI bus:dev.fn, or @c UNDI_NO_PCI_BUSDEVFN */
00034         UINT16_t pci_busdevfn;
00035         /** ISAPnP card select number, or @c UNDI_NO_ISAPNP_CSN */
00036         UINT16_t isapnp_csn;
00037         /** ISAPnP read port, or @c UNDI_NO_ISAPNP_READ_PORT */
00038         UINT16_t isapnp_read_port;
00039         /** PCI vendor ID
00040          *
00041          * Filled in only for the preloaded UNDI device by pxeprefix.S
00042          */
00043         UINT16_t pci_vendor;
00044         /** PCI device ID 
00045          *
00046          * Filled in only for the preloaded UNDI device by pxeprefix.S
00047          */
00048         UINT16_t pci_device;
00049         /** Flags
00050          *
00051          * This is the bitwise OR of zero or more UNDI_FL_XXX
00052          * constants.
00053          */
00054         UINT16_t flags;
00055 
00056         /** Driver-private data
00057          *
00058          * Use undi_set_drvdata() and undi_get_drvdata() to access this
00059          * field.
00060          */
00061         void *priv;
00062 } __attribute__ (( packed ));
00063 
00064 /**
00065  * Set UNDI driver-private data
00066  *
00067  * @v undi              UNDI device
00068  * @v priv              Private data
00069  */
00070 static inline void undi_set_drvdata ( struct undi_device *undi, void *priv ) {
00071         undi->priv = priv;
00072 }
00073 
00074 /**
00075  * Get UNDI driver-private data
00076  *
00077  * @v undi              UNDI device
00078  * @ret priv            Private data
00079  */
00080 static inline void * undi_get_drvdata ( struct undi_device *undi ) {
00081         return undi->priv;
00082 }
00083 
00084 #endif /* ASSEMBLY */
00085 
00086 /** PCI bus:dev.fn field is invalid */
00087 #define UNDI_NO_PCI_BUSDEVFN 0xffff
00088 
00089 /** ISAPnP card select number field is invalid */
00090 #define UNDI_NO_ISAPNP_CSN 0xffff
00091 
00092 /** ISAPnP read port field is invalid */
00093 #define UNDI_NO_ISAPNP_READ_PORT 0xffff
00094 
00095 /** UNDI flag: START_UNDI has been called */
00096 #define UNDI_FL_STARTED 0x0001
00097 
00098 /** UNDI flag: UNDI_STARTUP and UNDI_INITIALIZE have been called */
00099 #define UNDI_FL_INITIALIZED 0x0002
00100 
00101 /** UNDI flag: keep stack resident */
00102 #define UNDI_FL_KEEP_ALL 0x0004
00103 
00104 #endif /* _UNDI_H */