00001 #ifndef ISA_H 00002 #define ISA_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 /** An ISA device */ 00012 struct isa_device { 00013 /** Generic device */ 00014 struct device dev; 00015 /** I/O address */ 00016 uint16_t ioaddr; 00017 /** Driver for this device */ 00018 struct isa_driver *driver; 00019 /** Driver-private data 00020 * 00021 * Use isa_set_drvdata() and isa_get_drvdata() to access 00022 * this field. 00023 */ 00024 void *priv; 00025 /** Driver name */ 00026 const char *driver_name; 00027 }; 00028 00029 /* 00030 * An individual ISA device, identified by probe address 00031 * 00032 */ 00033 typedef uint16_t isa_probe_addr_t; 00034 00035 /** An ISA driver */ 00036 struct isa_driver { 00037 /** Name */ 00038 const char *name; 00039 /** Probe address list */ 00040 isa_probe_addr_t *probe_addrs; 00041 /** Number of entries in probe address list */ 00042 unsigned int addr_count; 00043 /** Manufacturer ID to be assumed for this device */ 00044 uint16_t vendor_id; 00045 /** Product ID to be assumed for this device */ 00046 uint16_t prod_id; 00047 /** 00048 * Probe device 00049 * 00050 * @v isa ISA device 00051 * @v id Matching entry in ID table 00052 * @ret rc Return status code 00053 */ 00054 int ( * probe ) ( struct isa_device *isa ); 00055 /** 00056 * Remove device 00057 * 00058 * @v isa ISA device 00059 */ 00060 void ( * remove ) ( struct isa_device *isa ); 00061 }; 00062 00063 /** ISA driver table */ 00064 #define ISA_DRIVERS __table ( struct isa_driver, "isa_drivers" ) 00065 00066 /** Declare an ISA driver */ 00067 #define __isa_driver __table_entry ( ISA_DRIVERS, 01 ) 00068 00069 /** 00070 * Set ISA driver-private data 00071 * 00072 * @v isa ISA device 00073 * @v priv Private data 00074 */ 00075 static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) { 00076 isa->priv = priv; 00077 } 00078 00079 /** 00080 * Get ISA driver-private data 00081 * 00082 * @v isa ISA device 00083 * @ret priv Private data 00084 */ 00085 static inline void * isa_get_drvdata ( struct isa_device *isa ) { 00086 return isa->priv; 00087 } 00088 00089 /* 00090 * ISA_ROM is parsed by parserom.pl to generate Makefile rules and 00091 * files for rom-o-matic. 00092 * 00093 */ 00094 #define ISA_ROM( IMAGE, DESCRIPTION ) 00095 00096 #endif /* ISA_H */ 00097
1.5.7.1