iPXE
eisa.h
Go to the documentation of this file.
1 #ifndef EISA_H
2 #define EISA_H
3 
4 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5 
6 #include <stdint.h>
7 #include <ipxe/isa_ids.h>
8 #include <ipxe/device.h>
9 #include <ipxe/tables.h>
10 
11 /*
12  * EISA constants
13  *
14  */
15 
16 #define EISA_MIN_SLOT (0x1)
17 #define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */
18 #define EISA_SLOT_BASE( n ) ( 0x1000 * (n) )
19 
20 #define EISA_VENDOR_ID ( 0xc80 )
21 #define EISA_PROD_ID ( 0xc82 )
22 #define EISA_GLOBAL_CONFIG ( 0xc84 )
23 
24 #define EISA_CMD_RESET ( 1 << 2 )
25 #define EISA_CMD_ENABLE ( 1 << 0 )
26 
27 /** An EISA device ID list entry */
29  /** Name */
30  const char *name;
31  /** Manufacturer ID */
33  /** Product ID */
35 };
36 
37 /** An EISA device */
38 struct eisa_device {
39  /** Generic device */
40  struct device dev;
41  /** Slot number */
42  unsigned int slot;
43  /** I/O address */
45  /** Manufacturer ID */
47  /** Product ID */
49  /** Driver for this device */
51  /** Driver-private data
52  *
53  * Use eisa_set_drvdata() and eisa_get_drvdata() to access
54  * this field.
55  */
56  void *priv;
57 };
58 
59 /** An EISA driver */
60 struct eisa_driver {
61  /** EISA ID table */
63  /** Number of entries in EISA ID table */
64  unsigned int id_count;
65  /**
66  * Probe device
67  *
68  * @v eisa EISA device
69  * @v id Matching entry in ID table
70  * @ret rc Return status code
71  */
72  int ( * probe ) ( struct eisa_device *eisa,
73  const struct eisa_device_id *id );
74  /**
75  * Remove device
76  *
77  * @v eisa EISA device
78  */
79  void ( * remove ) ( struct eisa_device *eisa );
80 };
81 
82 /** EISA driver table */
83 #define EISA_DRIVERS __table ( struct eisa_driver, "eisa_drivers" )
84 
85 /** Declare an EISA driver */
86 #define __eisa_driver __table_entry ( EISA_DRIVERS, 01 )
87 
88 extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
89 
90 /**
91  * Enable EISA device
92  *
93  * @v eisa EISA device
94  */
95 static inline void enable_eisa_device ( struct eisa_device *eisa ) {
96  eisa_device_enabled ( eisa, 1 );
97 }
98 
99 /**
100  * Disable EISA device
101  *
102  * @v eisa EISA device
103  */
104 static inline void disable_eisa_device ( struct eisa_device *eisa ) {
105  eisa_device_enabled ( eisa, 0 );
106 }
107 
108 /**
109  * Set EISA driver-private data
110  *
111  * @v eisa EISA device
112  * @v priv Private data
113  */
114 static inline void eisa_set_drvdata ( struct eisa_device *eisa, void *priv ) {
115  eisa->priv = priv;
116 }
117 
118 /**
119  * Get EISA driver-private data
120  *
121  * @v eisa EISA device
122  * @ret priv Private data
123  */
124 static inline void * eisa_get_drvdata ( struct eisa_device *eisa ) {
125  return eisa->priv;
126 }
127 
128 #endif /* EISA_H */
uint16_t prod_id
Product ID.
Definition: eisa.h:34
unsigned short uint16_t
Definition: stdint.h:11
uint16_t vendor_id
Manufacturer ID.
Definition: eisa.h:46
An EISA device.
Definition: eisa.h:38
uint32_t enabled
Bitmask of enabled AENQ groups (host -> device)
Definition: ena.h:14
static void enable_eisa_device(struct eisa_device *eisa)
Enable EISA device.
Definition: eisa.h:95
int(* probe)(struct eisa_device *eisa, const struct eisa_device_id *id)
Probe device.
Definition: eisa.h:72
void eisa_device_enabled(struct eisa_device *eisa, int enabled)
Reset and enable/disable an EISA device.
Definition: eisa.c:20
uint16_t vendor_id
Manufacturer ID.
Definition: eisa.h:32
A hardware device.
Definition: device.h:73
struct eisa_driver * driver
Driver for this device.
Definition: eisa.h:50
An EISA device ID list entry.
Definition: eisa.h:28
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int slot
Slot number.
Definition: eisa.h:42
void(* remove)(struct eisa_device *eisa)
Remove device.
Definition: eisa.h:79
unsigned int id_count
Number of entries in EISA ID table.
Definition: eisa.h:64
uint8_t id
Request identifier.
Definition: ena.h:12
static void disable_eisa_device(struct eisa_device *eisa)
Disable EISA device.
Definition: eisa.h:104
An EISA driver.
Definition: eisa.h:60
static void eisa_set_drvdata(struct eisa_device *eisa, void *priv)
Set EISA driver-private data.
Definition: eisa.h:114
uint16_t ioaddr
I/O address.
Definition: eisa.h:44
static void * eisa_get_drvdata(struct eisa_device *eisa)
Get EISA driver-private data.
Definition: eisa.h:124
static struct tlan_private * priv
Definition: tlan.c:224
struct eisa_device_id * ids
EISA ID table.
Definition: eisa.h:62
Linker tables.
Device model.
struct device dev
Generic device.
Definition: eisa.h:40
uint16_t prod_id
Product ID.
Definition: eisa.h:48
const char * name
Name.
Definition: eisa.h:30
void * priv
Driver-private data.
Definition: eisa.h:56