Import 2.3.7pre7
[davej-history.git] / include / linux / mca.h
blob5b6a6ebf08b4fc784272e4677ee60347c5567c4e
1 /*
2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
4 */
6 #ifndef _LINUX_MCA_H
7 #define _LINUX_MCA_H
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 extern int MCA_bus;
15 /* maximal number of MCA slots - actually, some machines have less, but
16 they all have sufficient number of POS registers to cover 8. */
17 #define MCA_MAX_SLOT_NR 8
19 /* MCA_NOTFOUND is an error condition. The other two indicate
20 motherboard POS registers contain the adapter. They might be
21 returned by the mca_find_adapter() function, and can be used as
22 arguments to mca_read_stored_pos(). I'm not going to allow direct
23 access to the motherboard registers until we run across an adapter
24 that requires it. We don't know enough about them to know if it's
25 safe.
27 See Documentation/mca.txt or one of the existing drivers for
28 more information.
30 #define MCA_NOTFOUND (-1)
31 #define MCA_INTEGSCSI (MCA_MAX_SLOT_NR)
32 #define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1)
34 /* max number of adapters, including both slots and various integrated
35 things. */
36 #define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+2)
38 /* returns the slot of the first enabled adapter matching id. User can
39 specify a starting slot beyond zero, to deal with detecting multiple
40 devices. Returns MCA_NOTFOUND if id not found. Also checks the
41 integrated adapters. */
42 extern int mca_find_adapter(int id, int start);
43 extern int mca_find_unused_adapter(int id, int start);
45 /* adapter state info - returns 0 if no */
46 extern int mca_isadapter(int slot);
47 extern int mca_isenabled(int slot);
49 extern int mca_is_adapter_used(int slot);
50 extern int mca_mark_as_used(int slot);
51 extern void mca_mark_as_unused(int slot);
53 /* gets a byte out of POS register (stored in memory) */
54 extern unsigned char mca_read_stored_pos(int slot, int reg);
57 This can be expanded later. Right now, it gives us a way of
58 getting meaningful information into the MCA_info structure,
59 so we can have a more interesting /proc/mca.
61 extern void mca_set_adapter_name(int slot, char* name);
62 extern char* mca_get_adapter_name(int slot);
65 This sets up an information callback for /proc/mca/slot?. The
66 function is called with the buffer, slot, and device pointer (or
67 some equally informative context information, or nothing, if you
68 prefer), and is expected to put useful information into the
69 buffer. The adapter name, id, and POS registers get printed
70 before this is called though, so don't do it again.
72 This should be called with a NULL procfn when a module
73 unregisters, thus preventing kernel crashes and other such
74 nastiness.
76 typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
77 extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
79 /* These routines actually mess with the hardware POS registers. They
80 temporarily disable the device (and interrupts), so make sure you know
81 what you're doing if you use them. Furthermore, writing to a POS may
82 result in two devices trying to share a resource, which in turn can
83 result in multiple devices sharing memory spaces, IRQs, or even trashing
84 hardware. YOU HAVE BEEN WARNED.
86 You can only access slots with this. Motherboard registers are off
87 limits.
90 /* read a byte from the specified POS register. */
91 extern unsigned char mca_read_pos(int slot, int reg);
93 /* write a byte to the specified POS register. */
94 extern void mca_write_pos(int slot, int reg, unsigned char byte);
96 /* Should only be called by the NMI interrupt handler, this will do some
97 fancy stuff to figure out what might have generated a NMI. */
98 extern void mca_handle_nmi(void);
100 #endif /* _LINUX_MCA_H */