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 */
17 /* The detection of MCA bus is done in the real mode (using BIOS).
18 * The information is exported to the protected code, where this
19 * variable is set to one in case MCA bus was detected.
21 #ifndef MCA_bus__is_a_macro
25 /* This sets up an information callback for /proc/mca/slot?. The
26 * function is called with the buffer, slot, and device pointer (or
27 * some equally informative context information, or nothing, if you
28 * prefer), and is expected to put useful information into the
29 * buffer. The adapter name, id, and POS registers get printed
30 * before this is called though, so don't do it again.
32 * This should be called with a NULL procfn when a module
33 * unregisters, thus preventing kernel crashes and other such
36 typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
38 /* Should only be called by the NMI interrupt handler, this will do some
39 * fancy stuff to figure out what might have generated a NMI.
41 extern void mca_handle_nmi(void);
43 enum MCA_AdapterStatus {
44 MCA_ADAPTER_NORMAL = 0,
46 MCA_ADAPTER_DISABLED = 2,
55 /* index into id_table, set by the bus match routine */
58 /* is there a driver installed? 0 - No, 1 - Yes */
62 /* if a pseudo adapter of the motherboard, this is the motherboard
63 * register value to use for setup cycles */
66 enum MCA_AdapterStatus status;
67 #ifdef CONFIG_MCA_PROC_FS
68 /* name of the proc/mca file */
70 /* /proc info callback */
72 /* device/context info for proc callback */
78 #define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
80 struct mca_bus_accessor_functions {
81 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
82 void (*mca_write_pos)(struct mca_device *, int reg,
84 int (*mca_transform_irq)(struct mca_device *, int irq);
85 int (*mca_transform_ioport)(struct mca_device *,
87 void * (*mca_transform_memory)(struct mca_device *,
94 struct mca_bus_accessor_functions f;
98 #define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
101 const short *id_table;
103 struct device_driver driver;
105 #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
107 /* Ongoing supported API functions */
108 extern struct mca_device *mca_find_device_by_slot(int slot);
109 extern int mca_system_init(void);
110 extern struct mca_bus *mca_attach_bus(int);
112 extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
114 extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
115 extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
117 extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
118 extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
119 extern void *mca_device_transform_memory(struct mca_device *mca_dev,
121 extern int mca_device_claimed(struct mca_device *mca_dev);
122 extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
123 extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
124 static inline char *mca_device_get_name(struct mca_device *mca_dev)
126 return mca_dev ? mca_dev->name : NULL;
129 extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
131 extern struct bus_type mca_bus_type;
133 extern int mca_register_driver(struct mca_driver *drv);
134 extern void mca_unregister_driver(struct mca_driver *drv);
136 /* WARNING: only called by the boot time device setup */
137 extern int mca_register_device(int bus, struct mca_device *mca_dev);
139 #ifdef CONFIG_MCA_PROC_FS
140 extern void mca_do_proc_init(void);
141 extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
143 static inline void mca_do_proc_init(void)
147 static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn *fn, void* dev)
152 #endif /* _LINUX_MCA_H */