Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / isa.h
1 #ifndef ISA_H
2 #define ISA_H
3
4 FILE_LICENCE ( GPL2_OR_LATER );
5
6 #include <stdint.h>
7 #include <ipxe/isa_ids.h>
8 #include <ipxe/device.h>
9 #include <ipxe/tables.h>
10
11 /** An ISA device */
12 struct isa_device {
13         /** Generic device */
14         struct device dev;
15         /** I/O address */
16         uint16_t ioaddr;
17         /** Driver for this device */
18         struct isa_driver *driver;
19         /** Driver-private data
20          *
21          * Use isa_set_drvdata() and isa_get_drvdata() to access
22          * this field.
23          */
24         void *priv;
25 };
26
27 /*
28  * An individual ISA device, identified by probe address
29  *
30  */
31 typedef uint16_t isa_probe_addr_t;
32
33 /** An ISA driver */
34 struct isa_driver {
35         /** Name */
36         const char *name;
37         /** Probe address list */
38         isa_probe_addr_t *probe_addrs;
39         /** Number of entries in probe address list */
40         unsigned int addr_count;
41         /** Manufacturer ID to be assumed for this device */
42         uint16_t vendor_id;
43         /** Product ID to be assumed for this device */
44         uint16_t prod_id;
45         /**
46          * Probe device
47          *
48          * @v isa       ISA device
49          * @v id        Matching entry in ID table
50          * @ret rc      Return status code
51          */
52         int ( * probe ) ( struct isa_device *isa );
53         /**
54          * Remove device
55          *
56          * @v isa       ISA device
57          */
58         void ( * remove ) ( struct isa_device *isa );
59 };
60
61 /** ISA driver table */
62 #define ISA_DRIVERS __table ( struct isa_driver, "isa_drivers" )
63
64 /** Declare an ISA driver */
65 #define __isa_driver __table_entry ( ISA_DRIVERS, 01 )
66
67 /**
68  * Set ISA driver-private data
69  *
70  * @v isa               ISA device
71  * @v priv              Private data
72  */
73 static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) {
74         isa->priv = priv;
75 }
76
77 /**
78  * Get ISA driver-private data
79  *
80  * @v isa               ISA device
81  * @ret priv            Private data
82  */
83 static inline void * isa_get_drvdata ( struct isa_device *isa ) {
84         return isa->priv;
85 }
86
87 /*
88  * ISA_ROM is parsed by parserom.pl to generate Makefile rules and
89  * files for rom-o-matic.
90  *
91  */
92 #define ISA_ROM( IMAGE, DESCRIPTION )
93
94 #endif /* ISA_H */
95