iPXE
isa.h
Go to the documentation of this file.
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 */
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  */
32 
33 /** An ISA driver */
34 struct isa_driver {
35  /** Name */
36  const char *name;
37  /** Probe address list */
39  /** Number of entries in probe address list */
40  unsigned int addr_count;
41  /** Manufacturer ID to be assumed for this device */
43  /** Product ID to be assumed for this device */
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 
isa_probe_addr_t * probe_addrs
Probe address list.
Definition: isa.h:38
unsigned short uint16_t
Definition: stdint.h:11
uint16_t ioaddr
I/O address.
Definition: isa.h:16
const char * name
Name.
Definition: isa.h:36
An ISA device.
Definition: isa.h:12
struct device dev
Generic device.
Definition: isa.h:14
uint16_t prod_id
Product ID to be assumed for this device.
Definition: isa.h:44
int(* probe)(struct isa_device *isa)
Probe device.
Definition: isa.h:52
void * priv
Driver-private data.
Definition: isa.h:24
uint16_t vendor_id
Manufacturer ID to be assumed for this device.
Definition: isa.h:42
A hardware device.
Definition: device.h:73
uint16_t isa_probe_addr_t
Definition: isa.h:31
static void isa_set_drvdata(struct isa_device *isa, void *priv)
Set ISA driver-private data.
Definition: isa.h:73
FILE_LICENCE(GPL2_OR_LATER)
void(* remove)(struct isa_device *isa)
Remove device.
Definition: isa.h:58
static struct tlan_private * priv
Definition: tlan.c:224
Linker tables.
unsigned int addr_count
Number of entries in probe address list.
Definition: isa.h:40
An ISA driver.
Definition: isa.h:34
Device model.
struct isa_driver * driver
Driver for this device.
Definition: isa.h:18
static void * isa_get_drvdata(struct isa_device *isa)
Get ISA driver-private data.
Definition: isa.h:83