Import 2.1.55pre1
[davej-history.git] / include / linux / mca.h
bloba8df76379df8c4a7ad252aa3f332d9d5a3fbd406
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 );
44 /* adapter state info - returns 0 if no */
45 extern int mca_isadapter( int slot );
46 extern int mca_isenabled( int slot );
48 /* gets a byte out of POS register (stored in memory) */
49 extern unsigned char mca_read_stored_pos( int slot, int reg );
52 This can be expanded later. Right now, it gives us a way of
53 getting meaningful information into the MCA_info structure,
54 so we can have a more interesting /proc/mca.
56 extern void mca_set_adapter_name( int slot, char* name );
57 extern char* mca_get_adapter_name( int slot );
60 This sets up an information callback for /proc/mca/slot?. The
61 function is called with the buffer, slot, and device pointer (or
62 some equally informative context information, or nothing, if you
63 prefer), and is expected to put useful information into the
64 buffer. The adapter name, id, and POS registers get printed
65 before this is called though, so don't do it again.
67 This should be called with a NULL procfn when a module
68 unregisters, thus preventing kernel crashes and other such
69 nastiness.
71 typedef int (*MCA_ProcFn)( char* buf, int slot, void* dev );
72 extern void mca_set_adapter_procfn( int slot, MCA_ProcFn, void* dev );
74 /* These routines actually mess with the hardware POS registers. They
75 temporarily disable the device (and interrupts), so make sure you know
76 what you're doing if you use them. Furthermore, writing to a POS may
77 result in two devices trying to share a resource, which in turn can
78 result in multiple devices sharing memory spaces, IRQs, or even trashing
79 hardware. YOU HAVE BEEN WARNED.
81 You can only access slots with this. Motherboard registers are off
82 limits.
85 /* read a byte from the specified POS register. */
86 extern unsigned char mca_read_pos( int slot, int reg );
88 /* write a byte to the specified POS register. */
89 extern void mca_write_pos( int slot, int reg, unsigned char byte );
91 #endif /* _LINUX_MCA_H */