• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef	ISA_H
2 #define ISA_H
3 
4 FILE_LICENCE ( GPL2_OR_LATER );
5 
6 #include <stdint.h>
7 #include <gpxe/isa_ids.h>
8 #include <gpxe/device.h>
9 #include <gpxe/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 	/** Driver name */
26 	const char *driver_name;
27 };
28 
29 /*
30  * An individual ISA device, identified by probe address
31  *
32  */
33 typedef uint16_t isa_probe_addr_t;
34 
35 /** An ISA driver */
36 struct isa_driver {
37 	/** Name */
38 	const char *name;
39 	/** Probe address list */
40 	isa_probe_addr_t *probe_addrs;
41 	/** Number of entries in probe address list */
42 	unsigned int addr_count;
43 	/** Manufacturer ID to be assumed for this device */
44 	uint16_t vendor_id;
45 	/** Product ID to be assumed for this device */
46 	uint16_t prod_id;
47 	/**
48 	 * Probe device
49 	 *
50 	 * @v isa	ISA device
51 	 * @v id	Matching entry in ID table
52 	 * @ret rc	Return status code
53 	 */
54 	int ( * probe ) ( struct isa_device *isa );
55 	/**
56 	 * Remove device
57 	 *
58 	 * @v isa	ISA device
59 	 */
60 	void ( * remove ) ( struct isa_device *isa );
61 };
62 
63 /** ISA driver table */
64 #define ISA_DRIVERS __table ( struct isa_driver, "isa_drivers" )
65 
66 /** Declare an ISA driver */
67 #define __isa_driver __table_entry ( ISA_DRIVERS, 01 )
68 
69 /**
70  * Set ISA driver-private data
71  *
72  * @v isa		ISA device
73  * @v priv		Private data
74  */
isa_set_drvdata(struct isa_device * isa,void * priv)75 static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) {
76 	isa->priv = priv;
77 }
78 
79 /**
80  * Get ISA driver-private data
81  *
82  * @v isa		ISA device
83  * @ret priv		Private data
84  */
isa_get_drvdata(struct isa_device * isa)85 static inline void * isa_get_drvdata ( struct isa_device *isa ) {
86 	return isa->priv;
87 }
88 
89 /*
90  * ISA_ROM is parsed by parserom.pl to generate Makefile rules and
91  * files for rom-o-matic.
92  *
93  */
94 #define ISA_ROM( IMAGE, DESCRIPTION )
95 
96 #endif /* ISA_H */
97 
98