iPXE
mca.h
Go to the documentation of this file.
1/*
2 * MCA bus driver code
3 *
4 * Abstracted from 3c509.c.
5 *
6 */
7
8FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
9
10#ifndef MCA_H
11#define MCA_H
12
13#include <ipxe/isa_ids.h>
14#include <ipxe/device.h>
15#include <ipxe/tables.h>
16
17/*
18 * MCA constants
19 *
20 */
21#define MCA_MOTHERBOARD_SETUP_REG 0x94
22#define MCA_ADAPTER_SETUP_REG 0x96
23#define MCA_MAX_SLOT_NR 0x07 /* Must be 2^n - 1 */
24#define MCA_POS_REG(n) (0x100+(n))
25
26/* Is there a standard that would define this? */
27#define GENERIC_MCA_VENDOR ISA_VENDOR ( 'M', 'C', 'A' )
28
29/** An MCA device ID list entry */
31 /** Name */
32 const char *name;
33 /** Device ID */
35};
36
37/** An MCA device */
38struct mca_device {
39 /** Generic device */
40 struct device dev;
41 /** Slot number */
42 unsigned int slot;
43 /** POS register values */
44 unsigned char pos[8];
45 /** Driver for this device */
47 /** Driver-private data
48 *
49 * Use mca_set_drvdata() and mca_get_drvdata() to access
50 * this field.
51 */
52 void *priv;
53};
54
55#define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )
56
57/** An MCA driver */
58struct mca_driver {
59 /** MCA ID table */
61 /** Number of entries in MCA ID table */
62 unsigned int id_count;
63 /**
64 * Probe device
65 *
66 * @v mca MCA device
67 * @v id Matching entry in ID table
68 * @ret rc Return status code
69 */
70 int ( * probe ) ( struct mca_device *mca,
71 const struct mca_device_id *id );
72 /**
73 * Remove device
74 *
75 * @v mca MCA device
76 */
77 void ( * remove ) ( struct mca_device *mca );
78};
79
80/** MCA driver table */
81#define MCA_DRIVERS __table ( struct mca_driver, "mca_drivers" )
82
83/** Declare an MCA driver */
84#define __mca_driver __table_entry ( MCA_DRIVERS, 01 )
85
86/**
87 * Set MCA driver-private data
88 *
89 * @v mca MCA device
90 * @v priv Private data
91 */
92static inline void mca_set_drvdata ( struct mca_device *mca, void *priv ) {
93 mca->priv = priv;
94}
95
96/**
97 * Get MCA driver-private data
98 *
99 * @v mca MCA device
100 * @ret priv Private data
101 */
102static inline void * mca_get_drvdata ( struct mca_device *mca ) {
103 return mca->priv;
104}
105
106#endif
unsigned short uint16_t
Definition stdint.h:11
Device model.
uint8_t id
Request identifier.
Definition ena.h:1
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
static void mca_set_drvdata(struct mca_device *mca, void *priv)
Set MCA driver-private data.
Definition mca.h:92
static void * mca_get_drvdata(struct mca_device *mca)
Get MCA driver-private data.
Definition mca.h:102
A hardware device.
Definition device.h:77
An MCA device ID list entry.
Definition mca.h:30
uint16_t id
Device ID.
Definition mca.h:34
const char * name
Name.
Definition mca.h:32
An MCA device.
Definition mca.h:38
unsigned char pos[8]
POS register values.
Definition mca.h:44
struct device dev
Generic device.
Definition mca.h:40
unsigned int slot
Slot number.
Definition mca.h:42
void * priv
Driver-private data.
Definition mca.h:52
struct mca_driver * driver
Driver for this device.
Definition mca.h:46
An MCA driver.
Definition mca.h:58
struct mca_device_id * ids
MCA ID table.
Definition mca.h:60
int(* probe)(struct mca_device *mca, const struct mca_device_id *id)
Probe device.
Definition mca.h:70
void(* remove)(struct mca_device *mca)
Remove device.
Definition mca.h:77
unsigned int id_count
Number of entries in MCA ID table.
Definition mca.h:62
Linker tables.
static struct tlan_private * priv
Definition tlan.c:225