iPXE
eisa.h
Go to the documentation of this file.
1#ifndef EISA_H
2#define EISA_H
3
4FILE_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 */
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 */
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
88extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
89
90/**
91 * Enable EISA device
92 *
93 * @v eisa EISA device
94 */
95static 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 */
104static 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 */
114static 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 */
124static inline void * eisa_get_drvdata ( struct eisa_device *eisa ) {
125 return eisa->priv;
126}
127
128#endif /* EISA_H */
unsigned short uint16_t
Definition stdint.h:11
Device model.
static void enable_eisa_device(struct eisa_device *eisa)
Enable EISA device.
Definition eisa.h:95
static void eisa_set_drvdata(struct eisa_device *eisa, void *priv)
Set EISA driver-private data.
Definition eisa.h:114
static void disable_eisa_device(struct eisa_device *eisa)
Disable EISA device.
Definition eisa.h:104
static void * eisa_get_drvdata(struct eisa_device *eisa)
Get EISA driver-private data.
Definition eisa.h:124
void eisa_device_enabled(struct eisa_device *eisa, int enabled)
Reset and enable/disable an EISA device.
Definition eisa.c:20
uint8_t id
Request identifier.
Definition ena.h:1
uint16_t enabled
Single-entry bitmask of the enabled option value.
Definition ena.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
A hardware device.
Definition device.h:77
An EISA device ID list entry.
Definition eisa.h:28
uint16_t prod_id
Product ID.
Definition eisa.h:34
const char * name
Name.
Definition eisa.h:30
uint16_t vendor_id
Manufacturer ID.
Definition eisa.h:32
An EISA device.
Definition eisa.h:38
struct device dev
Generic device.
Definition eisa.h:40
uint16_t prod_id
Product ID.
Definition eisa.h:48
uint16_t ioaddr
I/O address.
Definition eisa.h:44
unsigned int slot
Slot number.
Definition eisa.h:42
uint16_t vendor_id
Manufacturer ID.
Definition eisa.h:46
struct eisa_driver * driver
Driver for this device.
Definition eisa.h:50
void * priv
Driver-private data.
Definition eisa.h:56
An EISA driver.
Definition eisa.h:60
int(* probe)(struct eisa_device *eisa, const struct eisa_device_id *id)
Probe device.
Definition eisa.h:72
unsigned int id_count
Number of entries in EISA ID table.
Definition eisa.h:64
void(* remove)(struct eisa_device *eisa)
Remove device.
Definition eisa.h:79
struct eisa_device_id * ids
EISA ID table.
Definition eisa.h:62
Linker tables.
static struct tlan_private * priv
Definition tlan.c:225