1 #ifndef _UNDI_H 2 #define _UNDI_H 3 4 /** @file 5 * 6 * UNDI driver 7 * 8 */ 9 10 FILE_LICENCE ( GPL2_OR_LATER ); 11 12 #ifndef ASSEMBLY 13 14 #include <gpxe/device.h> 15 #include <pxe_types.h> 16 17 /** An UNDI device 18 * 19 * This structure is used by assembly code as well as C; do not alter 20 * this structure without editing pxeprefix.S to match. 21 */ 22 struct undi_device { 23 /** PXENV+ structure address */ 24 SEGOFF16_t pxenv; 25 /** !PXE structure address */ 26 SEGOFF16_t ppxe; 27 /** Entry point */ 28 SEGOFF16_t entry; 29 /** Free base memory after load */ 30 UINT16_t fbms; 31 /** Free base memory prior to load */ 32 UINT16_t restore_fbms; 33 /** PCI bus:dev.fn, or @c UNDI_NO_PCI_BUSDEVFN */ 34 UINT16_t pci_busdevfn; 35 /** ISAPnP card select number, or @c UNDI_NO_ISAPNP_CSN */ 36 UINT16_t isapnp_csn; 37 /** ISAPnP read port, or @c UNDI_NO_ISAPNP_READ_PORT */ 38 UINT16_t isapnp_read_port; 39 /** PCI vendor ID 40 * 41 * Filled in only for the preloaded UNDI device by pxeprefix.S 42 */ 43 UINT16_t pci_vendor; 44 /** PCI device ID 45 * 46 * Filled in only for the preloaded UNDI device by pxeprefix.S 47 */ 48 UINT16_t pci_device; 49 /** Flags 50 * 51 * This is the bitwise OR of zero or more UNDI_FL_XXX 52 * constants. 53 */ 54 UINT16_t flags; 55 56 /** Generic device */ 57 struct device dev; 58 /** Driver-private data 59 * 60 * Use undi_set_drvdata() and undi_get_drvdata() to access this 61 * field. 62 */ 63 void *priv; 64 } __attribute__ (( packed )); 65 66 /** 67 * Set UNDI driver-private data 68 * 69 * @v undi UNDI device 70 * @v priv Private data 71 */ undi_set_drvdata(struct undi_device * undi,void * priv)72static inline void undi_set_drvdata ( struct undi_device *undi, void *priv ) { 73 undi->priv = priv; 74 } 75 76 /** 77 * Get UNDI driver-private data 78 * 79 * @v undi UNDI device 80 * @ret priv Private data 81 */ undi_get_drvdata(struct undi_device * undi)82static inline void * undi_get_drvdata ( struct undi_device *undi ) { 83 return undi->priv; 84 } 85 86 #endif /* ASSEMBLY */ 87 88 /** PCI bus:dev.fn field is invalid */ 89 #define UNDI_NO_PCI_BUSDEVFN 0xffff 90 91 /** ISAPnP card select number field is invalid */ 92 #define UNDI_NO_ISAPNP_CSN 0xffff 93 94 /** ISAPnP read port field is invalid */ 95 #define UNDI_NO_ISAPNP_READ_PORT 0xffff 96 97 /** UNDI flag: START_UNDI has been called */ 98 #define UNDI_FL_STARTED 0x0001 99 100 /** UNDI flag: UNDI_STARTUP and UNDI_INITIALIZE have been called */ 101 #define UNDI_FL_INITIALIZED 0x0002 102 103 /** UNDI flag: keep stack resident */ 104 #define UNDI_FL_KEEP_ALL 0x0004 105 106 #endif /* _UNDI_H */ 107