]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - Documentation/eisa.txt
HID: multitouch: validate indexes details
[mirror_ubuntu-artful-kernel.git] / Documentation / eisa.txt
CommitLineData
1da177e4
LT
1EISA bus support (Marc Zyngier <maz@wild-wind.fr.eu.org>)
2
3This document groups random notes about porting EISA drivers to the
4new EISA/sysfs API.
5
6Starting from version 2.5.59, the EISA bus is almost given the same
7status as other much more mainstream busses such as PCI or USB. This
8has been possible through sysfs, which defines a nice enough set of
9abstractions to manage busses, devices and drivers.
10
11Although the new API is quite simple to use, converting existing
12drivers to the new infrastructure is not an easy task (mostly because
13detection code is generally also used to probe ISA cards). Moreover,
14most EISA drivers are among the oldest Linux drivers so, as you can
15imagine, some dust has settled here over the years.
16
17The EISA infrastructure is made up of three parts :
18
19 - The bus code implements most of the generic code. It is shared
20 among all the architectures that the EISA code runs on. It
3f6dee9b 21 implements bus probing (detecting EISA cards available on the bus),
1da177e4
LT
22 allocates I/O resources, allows fancy naming through sysfs, and
23 offers interfaces for driver to register.
24
25 - The bus root driver implements the glue between the bus hardware
26 and the generic bus code. It is responsible for discovering the
27 device implementing the bus, and setting it up to be latter probed
28 by the bus code. This can go from something as simple as reserving
29 an I/O region on x86, to the rather more complex, like the hppa
30 EISA code. This is the part to implement in order to have EISA
31 running on an "new" platform.
32
33 - The driver offers the bus a list of devices that it manages, and
34 implements the necessary callbacks to probe and release devices
35 whenever told to.
36
37Every function/structure below lives in <linux/eisa.h>, which depends
38heavily on <linux/device.h>.
39
40** Bus root driver :
41
42int eisa_root_register (struct eisa_root_device *root);
43
44The eisa_root_register function is used to declare a device as the
45root of an EISA bus. The eisa_root_device structure holds a reference
46to this device, as well as some parameters for probing purposes.
47
48struct eisa_root_device {
49 struct device *dev; /* Pointer to bridge device */
50 struct resource *res;
51 unsigned long bus_base_addr;
52 int slots; /* Max slot number */
53 int force_probe; /* Probe even when no slot 0 */
54 u64 dma_mask; /* from bridge device */
55 int bus_nr; /* Set by eisa_root_register */
56 struct resource eisa_root_res; /* ditto */
57};
58
59node : used for eisa_root_register internal purpose
60dev : pointer to the root device
61res : root device I/O resource
62bus_base_addr : slot 0 address on this bus
63slots : max slot number to probe
64force_probe : Probe even when slot 0 is empty (no EISA mainboard)
4ae0edc2 65dma_mask : Default DMA mask. Usually the bridge device dma_mask.
1da177e4
LT
66bus_nr : unique bus id, set by eisa_root_register
67
68** Driver :
69
70int eisa_driver_register (struct eisa_driver *edrv);
71void eisa_driver_unregister (struct eisa_driver *edrv);
72
73Clear enough ?
74
75struct eisa_device_id {
76 char sig[EISA_SIG_LEN];
77 unsigned long driver_data;
78};
79
80struct eisa_driver {
81 const struct eisa_device_id *id_table;
82 struct device_driver driver;
83};
84
85id_table : an array of NULL terminated EISA id strings,
86 followed by an empty string. Each string can
25985edc 87 optionally be paired with a driver-dependent value
1da177e4
LT
88 (driver_data).
89
90driver : a generic driver, such as described in
91 Documentation/driver-model/driver.txt. Only .name,
92 .probe and .remove members are mandatory.
93
94An example is the 3c59x driver :
95
96static struct eisa_device_id vortex_eisa_ids[] = {
97 { "TCM5920", EISA_3C592_OFFSET },
98 { "TCM5970", EISA_3C597_OFFSET },
99 { "" }
100};
101
102static struct eisa_driver vortex_eisa_driver = {
103 .id_table = vortex_eisa_ids,
104 .driver = {
105 .name = "3c59x",
106 .probe = vortex_eisa_probe,
107 .remove = vortex_eisa_remove
108 }
109};
110
111** Device :
112
113The sysfs framework calls .probe and .remove functions upon device
114discovery and removal (note that the .remove function is only called
115when driver is built as a module).
116
117Both functions are passed a pointer to a 'struct device', which is
118encapsulated in a 'struct eisa_device' described as follows :
119
120struct eisa_device {
121 struct eisa_device_id id;
122 int slot;
123 int state;
124 unsigned long base_addr;
125 struct resource res[EISA_MAX_RESOURCES];
126 u64 dma_mask;
127 struct device dev; /* generic device */
128};
129
130id : EISA id, as read from device. id.driver_data is set from the
131 matching driver EISA id.
132slot : slot number which the device was detected on
133state : set of flags indicating the state of the device. Current
134 flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED.
135res : set of four 256 bytes I/O regions allocated to this device
136dma_mask: DMA mask set from the parent device.
137dev : generic device (see Documentation/driver-model/device.txt)
138
139You can get the 'struct eisa_device' from 'struct device' using the
140'to_eisa_device' macro.
141
142** Misc stuff :
143
144void eisa_set_drvdata (struct eisa_device *edev, void *data);
145
146Stores data into the device's driver_data area.
147
148void *eisa_get_drvdata (struct eisa_device *edev):
149
150Gets the pointer previously stored into the device's driver_data area.
151
152int eisa_get_region_index (void *addr);
153
154Returns the region number (0 <= x < EISA_MAX_RESOURCES) of a given
155address.
156
157** Kernel parameters :
158
159eisa_bus.enable_dev :
160
161A comma-separated list of slots to be enabled, even if the firmware
162set the card as disabled. The driver must be able to properly
163initialize the device in such conditions.
164
165eisa_bus.disable_dev :
166
167A comma-separated list of slots to be enabled, even if the firmware
168set the card as enabled. The driver won't be called to handle this
169device.
170
171virtual_root.force_probe :
172
173Force the probing code to probe EISA slots even when it cannot find an
3333e9ee 174EISA compliant mainboard (nothing appears on slot 0). Defaults to 0
1da177e4
LT
175(don't force), and set to 1 (force probing) when either
176CONFIG_ALPHA_JENSEN or CONFIG_EISA_VLB_PRIMING are set.
177
178** Random notes :
179
180Converting an EISA driver to the new API mostly involves *deleting*
181code (since probing is now in the core EISA code). Unfortunately, most
bb8187d3 182drivers share their probing routine between ISA, and EISA. Special
1da177e4
LT
183care must be taken when ripping out the EISA code, so other busses
184won't suffer from these surgical strikes...
185
186You *must not* expect any EISA device to be detected when returning
187from eisa_driver_register, since the chances are that the bus has not
188yet been probed. In fact, that's what happens most of the time (the
189bus root driver usually kicks in rather late in the boot process).
190Unfortunately, most drivers are doing the probing by themselves, and
191expect to have explored the whole machine when they exit their probe
192routine.
193
194For example, switching your favorite EISA SCSI card to the "hotplug"
195model is "the right thing"(tm).
196
197** Thanks :
198
199I'd like to thank the following people for their help :
200- Xavier Benigni for lending me a wonderful Alpha Jensen,
201- James Bottomley, Jeff Garzik for getting this stuff into the kernel,
202- Andries Brouwer for contributing numerous EISA ids,
203- Catrin Jones for coping with far too many machines at home.