2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
9 /* The detection of MCA bus is done in the real mode (using BIOS).
10 * The information is exported to the protected code, where this
11 * variable is set to one in case MCA bus was detected.
13 #ifndef MCA_bus__is_a_macro
17 /* Maximal number of MCA slots - actually, some machines have less, but
18 * they all have sufficient number of POS registers to cover 8.
20 #define MCA_MAX_SLOT_NR 8
22 /* MCA_NOTFOUND is an error condition. The other two indicate
23 * motherboard POS registers contain the adapter. They might be
24 * returned by the mca_find_adapter() function, and can be used as
25 * arguments to mca_read_stored_pos(). I'm not going to allow direct
26 * access to the motherboard registers until we run across an adapter
27 * that requires it. We don't know enough about them to know if it's
30 * See Documentation/mca.txt or one of the existing drivers for
33 #define MCA_NOTFOUND (-1)
34 #define MCA_INTEGSCSI (MCA_MAX_SLOT_NR)
35 #define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1)
36 #define MCA_MOTHERBOARD (MCA_MAX_SLOT_NR+2)
38 /* Max number of adapters, including both slots and various integrated
41 #define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3)
43 /* Returns the slot of the first enabled adapter matching id. User can
44 * specify a starting slot beyond zero, to deal with detecting multiple
45 * devices. Returns MCA_NOTFOUND if id not found. Also checks the
46 * integrated adapters.
48 extern int mca_find_adapter(int id
, int start
);
49 extern int mca_find_unused_adapter(int id
, int start
);
51 /* adapter state info - returns 0 if no */
52 extern int mca_isadapter(int slot
);
53 extern int mca_isenabled(int slot
);
55 extern int mca_is_adapter_used(int slot
);
56 extern int mca_mark_as_used(int slot
);
57 extern void mca_mark_as_unused(int slot
);
59 /* gets a byte out of POS register (stored in memory) */
60 extern unsigned char mca_read_stored_pos(int slot
, int reg
);
62 /* This can be expanded later. Right now, it gives us a way of
63 * getting meaningful information into the MCA_info structure,
64 * so we can have a more interesting /proc/mca.
66 extern void mca_set_adapter_name(int slot
, char* name
);
67 extern char* mca_get_adapter_name(int slot
);
69 /* This sets up an information callback for /proc/mca/slot?. The
70 * function is called with the buffer, slot, and device pointer (or
71 * some equally informative context information, or nothing, if you
72 * prefer), and is expected to put useful information into the
73 * buffer. The adapter name, id, and POS registers get printed
74 * before this is called though, so don't do it again.
76 * This should be called with a NULL procfn when a module
77 * unregisters, thus preventing kernel crashes and other such
80 typedef int (*MCA_ProcFn
)(char* buf
, int slot
, void* dev
);
81 extern void mca_set_adapter_procfn(int slot
, MCA_ProcFn
, void* dev
);
83 /* These routines actually mess with the hardware POS registers. They
84 * temporarily disable the device (and interrupts), so make sure you know
85 * what you're doing if you use them. Furthermore, writing to a POS may
86 * result in two devices trying to share a resource, which in turn can
87 * result in multiple devices sharing memory spaces, IRQs, or even trashing
88 * hardware. YOU HAVE BEEN WARNED.
90 * You can only access slots with this. Motherboard registers are off
94 /* read a byte from the specified POS register. */
95 extern unsigned char mca_read_pos(int slot
, int reg
);
97 /* write a byte to the specified POS register. */
98 extern void mca_write_pos(int slot
, int reg
, unsigned char byte
);
100 /* Should only be called by the NMI interrupt handler, this will do some
101 * fancy stuff to figure out what might have generated a NMI.
103 extern void mca_handle_nmi(void);
105 #endif /* _LINUX_MCA_H */