iPXE
isa.h
Go to the documentation of this file.
00001 #ifndef ISA_H
00002 #define ISA_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER );
00005 
00006 #include <stdint.h>
00007 #include <ipxe/isa_ids.h>
00008 #include <ipxe/device.h>
00009 #include <ipxe/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 };
00026 
00027 /*
00028  * An individual ISA device, identified by probe address
00029  *
00030  */
00031 typedef uint16_t isa_probe_addr_t;
00032 
00033 /** An ISA driver */
00034 struct isa_driver {
00035         /** Name */
00036         const char *name;
00037         /** Probe address list */
00038         isa_probe_addr_t *probe_addrs;
00039         /** Number of entries in probe address list */
00040         unsigned int addr_count;
00041         /** Manufacturer ID to be assumed for this device */
00042         uint16_t vendor_id;
00043         /** Product ID to be assumed for this device */
00044         uint16_t prod_id;
00045         /**
00046          * Probe device
00047          *
00048          * @v isa       ISA device
00049          * @v id        Matching entry in ID table
00050          * @ret rc      Return status code
00051          */
00052         int ( * probe ) ( struct isa_device *isa );
00053         /**
00054          * Remove device
00055          *
00056          * @v isa       ISA device
00057          */
00058         void ( * remove ) ( struct isa_device *isa );
00059 };
00060 
00061 /** ISA driver table */
00062 #define ISA_DRIVERS __table ( struct isa_driver, "isa_drivers" )
00063 
00064 /** Declare an ISA driver */
00065 #define __isa_driver __table_entry ( ISA_DRIVERS, 01 )
00066 
00067 /**
00068  * Set ISA driver-private data
00069  *
00070  * @v isa               ISA device
00071  * @v priv              Private data
00072  */
00073 static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) {
00074         isa->priv = priv;
00075 }
00076 
00077 /**
00078  * Get ISA driver-private data
00079  *
00080  * @v isa               ISA device
00081  * @ret priv            Private data
00082  */
00083 static inline void * isa_get_drvdata ( struct isa_device *isa ) {
00084         return isa->priv;
00085 }
00086 
00087 /*
00088  * ISA_ROM is parsed by parserom.pl to generate Makefile rules and
00089  * files for rom-o-matic.
00090  *
00091  */
00092 #define ISA_ROM( IMAGE, DESCRIPTION )
00093 
00094 #endif /* ISA_H */
00095