2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
9 /* FIXME: This shouldn't happen, but we need everything that previously
10 * included mca.h to compile. Take it out later when the MCA #includes
12 #include <linux/device.h>
14 /* get the platform specific defines */
19 /* The detection of MCA bus is done in the real mode (using BIOS).
20 * The information is exported to the protected code, where this
21 * variable is set to one in case MCA bus was detected.
23 #ifndef MCA_bus__is_a_macro
27 /* This sets up an information callback for /proc/mca/slot?. The
28 * function is called with the buffer, slot, and device pointer (or
29 * some equally informative context information, or nothing, if you
30 * prefer), and is expected to put useful information into the
31 * buffer. The adapter name, id, and POS registers get printed
32 * before this is called though, so don't do it again.
34 * This should be called with a NULL procfn when a module
35 * unregisters, thus preventing kernel crashes and other such
38 typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
40 /* Should only be called by the NMI interrupt handler, this will do some
41 * fancy stuff to figure out what might have generated a NMI.
43 extern void mca_handle_nmi(void);
45 enum MCA_AdapterStatus {
46 MCA_ADAPTER_NORMAL = 0,
48 MCA_ADAPTER_DISABLED = 2,
57 /* index into id_table, set by the bus match routine */
60 /* is there a driver installed? 0 - No, 1 - Yes */
64 /* if a pseudo adapter of the motherboard, this is the motherboard
65 * register value to use for setup cycles */
68 enum MCA_AdapterStatus status;
69 #ifdef CONFIG_MCA_PROC_FS
70 /* name of the proc/mca file */
72 /* /proc info callback */
74 /* device/context info for proc callback */
80 #define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
82 struct mca_bus_accessor_functions {
83 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
84 void (*mca_write_pos)(struct mca_device *, int reg,
86 int (*mca_transform_irq)(struct mca_device *, int irq);
87 int (*mca_transform_ioport)(struct mca_device *,
89 void * (*mca_transform_memory)(struct mca_device *,
96 struct mca_bus_accessor_functions f;
100 #define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
103 const short *id_table;
105 struct device_driver driver;
107 #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
109 /* Ongoing supported API functions */
110 extern struct mca_device *mca_find_device_by_slot(int slot);
111 extern int mca_system_init(void);
112 extern struct mca_bus *mca_attach_bus(int);
114 extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
116 extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
117 extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
119 extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
120 extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
121 extern void *mca_device_transform_memory(struct mca_device *mca_dev,
123 extern int mca_device_claimed(struct mca_device *mca_dev);
124 extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
125 extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
126 static inline char *mca_device_get_name(struct mca_device *mca_dev)
128 return mca_dev ? mca_dev->name : NULL;
131 extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
133 extern struct bus_type mca_bus_type;
135 extern int mca_register_driver(struct mca_driver *drv);
136 extern void mca_unregister_driver(struct mca_driver *drv);
138 /* WARNING: only called by the boot time device setup */
139 extern int mca_register_device(int bus, struct mca_device *mca_dev);
141 #ifdef CONFIG_MCA_PROC_FS
142 extern void mca_do_proc_init(void);
143 extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
145 static inline void mca_do_proc_init(void)
149 static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
154 #endif /* _LINUX_MCA_H */