1
2
3
4
5
6#ifndef _LINUX_MCA_H
7#define _LINUX_MCA_H
8
9#include <linux/device.h>
10
11#ifdef CONFIG_MCA
12#include <asm/mca.h>
13
14extern int MCA_bus;
15#else
16#define MCA_bus 0
17#endif
18
19
20
21
22
23
24
25
26
27
28
29
30typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
31
32
33
34
35extern void mca_handle_nmi(void);
36
37enum MCA_AdapterStatus {
38 MCA_ADAPTER_NORMAL = 0,
39 MCA_ADAPTER_NONE = 1,
40 MCA_ADAPTER_DISABLED = 2,
41 MCA_ADAPTER_ERROR = 3
42};
43
44struct mca_device {
45 u64 dma_mask;
46 int pos_id;
47 int slot;
48
49
50 int index;
51
52
53 int driver_loaded;
54
55 unsigned char pos[8];
56
57
58 short pos_register;
59
60 enum MCA_AdapterStatus status;
61#ifdef CONFIG_MCA_PROC_FS
62
63 char procname[8];
64
65 MCA_ProcFn procfn;
66
67 void *proc_dev;
68#endif
69 struct device dev;
70 char name[32];
71};
72#define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
73
74struct mca_bus_accessor_functions {
75 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
76 void (*mca_write_pos)(struct mca_device *, int reg,
77 unsigned char byte);
78 int (*mca_transform_irq)(struct mca_device *, int irq);
79 int (*mca_transform_ioport)(struct mca_device *,
80 int region);
81 void * (*mca_transform_memory)(struct mca_device *,
82 void *memory);
83};
84
85struct mca_bus {
86 u64 default_dma_mask;
87 int number;
88 struct mca_bus_accessor_functions f;
89 struct device dev;
90 char name[32];
91};
92#define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
93
94struct mca_driver {
95 const short *id_table;
96 void *driver_data;
97 int integrated_id;
98 struct device_driver driver;
99};
100#define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
101
102
103extern struct mca_device *mca_find_device_by_slot(int slot);
104extern int mca_system_init(void);
105extern struct mca_bus *mca_attach_bus(int);
106
107extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
108 int reg);
109extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
110extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
111 unsigned char byte);
112extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
113extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
114extern void *mca_device_transform_memory(struct mca_device *mca_dev,
115 void *mem);
116extern int mca_device_claimed(struct mca_device *mca_dev);
117extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
118extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
119static inline char *mca_device_get_name(struct mca_device *mca_dev)
120{
121 return mca_dev ? mca_dev->name : NULL;
122}
123
124extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
125
126extern struct bus_type mca_bus_type;
127
128extern int mca_register_driver(struct mca_driver *drv);
129extern int mca_register_driver_integrated(struct mca_driver *, int);
130extern void mca_unregister_driver(struct mca_driver *drv);
131
132
133extern int mca_register_device(int bus, struct mca_device *mca_dev);
134
135#ifdef CONFIG_MCA_PROC_FS
136extern void mca_do_proc_init(void);
137extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
138#else
139static inline void mca_do_proc_init(void)
140{
141}
142
143static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
144{
145}
146#endif
147
148#endif
149