00001 #ifndef EISA_H 00002 #define EISA_H 00003 00004 FILE_LICENCE ( GPL2_OR_LATER ); 00005 00006 #include <stdint.h> 00007 #include <gpxe/isa_ids.h> 00008 #include <gpxe/device.h> 00009 #include <gpxe/tables.h> 00010 00011 /* 00012 * EISA constants 00013 * 00014 */ 00015 00016 #define EISA_MIN_SLOT (0x1) 00017 #define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */ 00018 #define EISA_SLOT_BASE( n ) ( 0x1000 * (n) ) 00019 00020 #define EISA_VENDOR_ID ( 0xc80 ) 00021 #define EISA_PROD_ID ( 0xc82 ) 00022 #define EISA_GLOBAL_CONFIG ( 0xc84 ) 00023 00024 #define EISA_CMD_RESET ( 1 << 2 ) 00025 #define EISA_CMD_ENABLE ( 1 << 0 ) 00026 00027 /** An EISA device ID list entry */ 00028 struct eisa_device_id { 00029 /** Name */ 00030 const char *name; 00031 /** Manufacturer ID */ 00032 uint16_t vendor_id; 00033 /** Product ID */ 00034 uint16_t prod_id; 00035 }; 00036 00037 /** An EISA device */ 00038 struct eisa_device { 00039 /** Generic device */ 00040 struct device dev; 00041 /** Slot number */ 00042 unsigned int slot; 00043 /** I/O address */ 00044 uint16_t ioaddr; 00045 /** Manufacturer ID */ 00046 uint16_t vendor_id; 00047 /** Product ID */ 00048 uint16_t prod_id; 00049 /** Driver for this device */ 00050 struct eisa_driver *driver; 00051 /** Driver-private data 00052 * 00053 * Use eisa_set_drvdata() and eisa_get_drvdata() to access 00054 * this field. 00055 */ 00056 void *priv; 00057 /** Driver name */ 00058 const char *driver_name; 00059 }; 00060 00061 /** An EISA driver */ 00062 struct eisa_driver { 00063 /** EISA ID table */ 00064 struct eisa_device_id *ids; 00065 /** Number of entries in EISA ID table */ 00066 unsigned int id_count; 00067 /** 00068 * Probe device 00069 * 00070 * @v eisa EISA device 00071 * @v id Matching entry in ID table 00072 * @ret rc Return status code 00073 */ 00074 int ( * probe ) ( struct eisa_device *eisa, 00075 const struct eisa_device_id *id ); 00076 /** 00077 * Remove device 00078 * 00079 * @v eisa EISA device 00080 */ 00081 void ( * remove ) ( struct eisa_device *eisa ); 00082 }; 00083 00084 /** EISA driver table */ 00085 #define EISA_DRIVERS __table ( struct eisa_driver, "eisa_drivers" ) 00086 00087 /** Declare an EISA driver */ 00088 #define __eisa_driver __table_entry ( EISA_DRIVERS, 01 ) 00089 00090 extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled ); 00091 00092 /** 00093 * Enable EISA device 00094 * 00095 * @v eisa EISA device 00096 */ 00097 static inline void enable_eisa_device ( struct eisa_device *eisa ) { 00098 eisa_device_enabled ( eisa, 1 ); 00099 } 00100 00101 /** 00102 * Disable EISA device 00103 * 00104 * @v eisa EISA device 00105 */ 00106 static inline void disable_eisa_device ( struct eisa_device *eisa ) { 00107 eisa_device_enabled ( eisa, 0 ); 00108 } 00109 00110 /** 00111 * Set EISA driver-private data 00112 * 00113 * @v eisa EISA device 00114 * @v priv Private data 00115 */ 00116 static inline void eisa_set_drvdata ( struct eisa_device *eisa, void *priv ) { 00117 eisa->priv = priv; 00118 } 00119 00120 /** 00121 * Get EISA driver-private data 00122 * 00123 * @v eisa EISA device 00124 * @ret priv Private data 00125 */ 00126 static inline void * eisa_get_drvdata ( struct eisa_device *eisa ) { 00127 return eisa->priv; 00128 } 00129 00130 #endif /* EISA_H */
1.5.7.1