diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-05-14 12:27:55 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-07-14 15:51:34 -0400 |
commit | 72fd15c01554694bd8d69652cc9bb77c2cda193b (patch) | |
tree | 57ed33c2247bd755b082131d02cf661bbcc9b540 /Documentation/eisa.txt | |
parent | ef16bcc7f72d5084f2da551c1d88374c014f76a0 (diff) |
eisa.txt: standardize document format
Each text file under Documentation follows a different
format. Some doesn't even have titles!
Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:
- use ReST notation for titles;
- identify literal blocks;
- use :Author: for document authorship;
- use the proper notation for tables;
- adjust whitespaces where needed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/eisa.txt')
-rw-r--r-- | Documentation/eisa.txt | 273 |
1 files changed, 150 insertions, 123 deletions
diff --git a/Documentation/eisa.txt b/Documentation/eisa.txt index a55e4910924e..2806e5544e43 100644 --- a/Documentation/eisa.txt +++ b/Documentation/eisa.txt | |||
@@ -1,4 +1,8 @@ | |||
1 | EISA bus support (Marc Zyngier <maz@wild-wind.fr.eu.org>) | 1 | ================ |
2 | EISA bus support | ||
3 | ================ | ||
4 | |||
5 | :Author: Marc Zyngier <maz@wild-wind.fr.eu.org> | ||
2 | 6 | ||
3 | This document groups random notes about porting EISA drivers to the | 7 | This document groups random notes about porting EISA drivers to the |
4 | new EISA/sysfs API. | 8 | new EISA/sysfs API. |
@@ -14,168 +18,189 @@ detection code is generally also used to probe ISA cards). Moreover, | |||
14 | most EISA drivers are among the oldest Linux drivers so, as you can | 18 | most EISA drivers are among the oldest Linux drivers so, as you can |
15 | imagine, some dust has settled here over the years. | 19 | imagine, some dust has settled here over the years. |
16 | 20 | ||
17 | The EISA infrastructure is made up of three parts : | 21 | The EISA infrastructure is made up of three parts: |
18 | 22 | ||
19 | - The bus code implements most of the generic code. It is shared | 23 | - The bus code implements most of the generic code. It is shared |
20 | among all the architectures that the EISA code runs on. It | 24 | among all the architectures that the EISA code runs on. It |
21 | implements bus probing (detecting EISA cards available on the bus), | 25 | implements bus probing (detecting EISA cards available on the bus), |
22 | allocates I/O resources, allows fancy naming through sysfs, and | 26 | allocates I/O resources, allows fancy naming through sysfs, and |
23 | offers interfaces for driver to register. | 27 | offers interfaces for driver to register. |
24 | 28 | ||
25 | - The bus root driver implements the glue between the bus hardware | 29 | - The bus root driver implements the glue between the bus hardware |
26 | and the generic bus code. It is responsible for discovering the | 30 | and the generic bus code. It is responsible for discovering the |
27 | device implementing the bus, and setting it up to be latter probed | 31 | 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 | 32 | 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 | 33 | 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 | 34 | EISA code. This is the part to implement in order to have EISA |
31 | running on an "new" platform. | 35 | running on an "new" platform. |
32 | 36 | ||
33 | - The driver offers the bus a list of devices that it manages, and | 37 | - The driver offers the bus a list of devices that it manages, and |
34 | implements the necessary callbacks to probe and release devices | 38 | implements the necessary callbacks to probe and release devices |
35 | whenever told to. | 39 | whenever told to. |
36 | 40 | ||
37 | Every function/structure below lives in <linux/eisa.h>, which depends | 41 | Every function/structure below lives in <linux/eisa.h>, which depends |
38 | heavily on <linux/device.h>. | 42 | heavily on <linux/device.h>. |
39 | 43 | ||
40 | ** Bus root driver : | 44 | Bus root driver |
45 | =============== | ||
46 | |||
47 | :: | ||
41 | 48 | ||
42 | int eisa_root_register (struct eisa_root_device *root); | 49 | int eisa_root_register (struct eisa_root_device *root); |
43 | 50 | ||
44 | The eisa_root_register function is used to declare a device as the | 51 | The eisa_root_register function is used to declare a device as the |
45 | root of an EISA bus. The eisa_root_device structure holds a reference | 52 | root of an EISA bus. The eisa_root_device structure holds a reference |
46 | to this device, as well as some parameters for probing purposes. | 53 | to this device, as well as some parameters for probing purposes:: |
47 | 54 | ||
48 | struct eisa_root_device { | 55 | struct eisa_root_device { |
49 | struct device *dev; /* Pointer to bridge device */ | 56 | struct device *dev; /* Pointer to bridge device */ |
50 | struct resource *res; | 57 | struct resource *res; |
51 | unsigned long bus_base_addr; | 58 | unsigned long bus_base_addr; |
52 | int slots; /* Max slot number */ | 59 | int slots; /* Max slot number */ |
53 | int force_probe; /* Probe even when no slot 0 */ | 60 | int force_probe; /* Probe even when no slot 0 */ |
54 | u64 dma_mask; /* from bridge device */ | 61 | u64 dma_mask; /* from bridge device */ |
55 | int bus_nr; /* Set by eisa_root_register */ | 62 | int bus_nr; /* Set by eisa_root_register */ |
56 | struct resource eisa_root_res; /* ditto */ | 63 | struct resource eisa_root_res; /* ditto */ |
57 | }; | 64 | }; |
58 | 65 | ||
59 | node : used for eisa_root_register internal purpose | 66 | ============= ====================================================== |
60 | dev : pointer to the root device | 67 | node used for eisa_root_register internal purpose |
61 | res : root device I/O resource | 68 | dev pointer to the root device |
62 | bus_base_addr : slot 0 address on this bus | 69 | res root device I/O resource |
63 | slots : max slot number to probe | 70 | bus_base_addr slot 0 address on this bus |
64 | force_probe : Probe even when slot 0 is empty (no EISA mainboard) | 71 | slots max slot number to probe |
65 | dma_mask : Default DMA mask. Usually the bridge device dma_mask. | 72 | force_probe Probe even when slot 0 is empty (no EISA mainboard) |
66 | bus_nr : unique bus id, set by eisa_root_register | 73 | dma_mask Default DMA mask. Usually the bridge device dma_mask. |
67 | 74 | bus_nr unique bus id, set by eisa_root_register | |
68 | ** Driver : | 75 | ============= ====================================================== |
69 | 76 | ||
70 | int eisa_driver_register (struct eisa_driver *edrv); | 77 | Driver |
71 | void eisa_driver_unregister (struct eisa_driver *edrv); | 78 | ====== |
79 | |||
80 | :: | ||
81 | |||
82 | int eisa_driver_register (struct eisa_driver *edrv); | ||
83 | void eisa_driver_unregister (struct eisa_driver *edrv); | ||
72 | 84 | ||
73 | Clear enough ? | 85 | Clear enough ? |
74 | 86 | ||
75 | struct eisa_device_id { | 87 | :: |
76 | char sig[EISA_SIG_LEN]; | 88 | |
77 | unsigned long driver_data; | 89 | struct eisa_device_id { |
78 | }; | 90 | char sig[EISA_SIG_LEN]; |
79 | 91 | unsigned long driver_data; | |
80 | struct eisa_driver { | 92 | }; |
81 | const struct eisa_device_id *id_table; | 93 | |
82 | struct device_driver driver; | 94 | struct eisa_driver { |
83 | }; | 95 | const struct eisa_device_id *id_table; |
84 | 96 | struct device_driver driver; | |
85 | id_table : an array of NULL terminated EISA id strings, | 97 | }; |
86 | followed by an empty string. Each string can | 98 | |
87 | optionally be paired with a driver-dependent value | 99 | =============== ==================================================== |
88 | (driver_data). | 100 | id_table an array of NULL terminated EISA id strings, |
89 | 101 | followed by an empty string. Each string can | |
90 | driver : a generic driver, such as described in | 102 | optionally be paired with a driver-dependent value |
91 | Documentation/driver-model/driver.txt. Only .name, | 103 | (driver_data). |
92 | .probe and .remove members are mandatory. | 104 | |
93 | 105 | driver a generic driver, such as described in | |
94 | An example is the 3c59x driver : | 106 | Documentation/driver-model/driver.txt. Only .name, |
95 | 107 | .probe and .remove members are mandatory. | |
96 | static struct eisa_device_id vortex_eisa_ids[] = { | 108 | =============== ==================================================== |
97 | { "TCM5920", EISA_3C592_OFFSET }, | 109 | |
98 | { "TCM5970", EISA_3C597_OFFSET }, | 110 | An example is the 3c59x driver:: |
99 | { "" } | 111 | |
100 | }; | 112 | static struct eisa_device_id vortex_eisa_ids[] = { |
101 | 113 | { "TCM5920", EISA_3C592_OFFSET }, | |
102 | static struct eisa_driver vortex_eisa_driver = { | 114 | { "TCM5970", EISA_3C597_OFFSET }, |
103 | .id_table = vortex_eisa_ids, | 115 | { "" } |
104 | .driver = { | 116 | }; |
105 | .name = "3c59x", | 117 | |
106 | .probe = vortex_eisa_probe, | 118 | static struct eisa_driver vortex_eisa_driver = { |
107 | .remove = vortex_eisa_remove | 119 | .id_table = vortex_eisa_ids, |
108 | } | 120 | .driver = { |
109 | }; | 121 | .name = "3c59x", |
110 | 122 | .probe = vortex_eisa_probe, | |
111 | ** Device : | 123 | .remove = vortex_eisa_remove |
124 | } | ||
125 | }; | ||
126 | |||
127 | Device | ||
128 | ====== | ||
112 | 129 | ||
113 | The sysfs framework calls .probe and .remove functions upon device | 130 | The sysfs framework calls .probe and .remove functions upon device |
114 | discovery and removal (note that the .remove function is only called | 131 | discovery and removal (note that the .remove function is only called |
115 | when driver is built as a module). | 132 | when driver is built as a module). |
116 | 133 | ||
117 | Both functions are passed a pointer to a 'struct device', which is | 134 | Both functions are passed a pointer to a 'struct device', which is |
118 | encapsulated in a 'struct eisa_device' described as follows : | 135 | encapsulated in a 'struct eisa_device' described as follows:: |
119 | 136 | ||
120 | struct eisa_device { | 137 | struct eisa_device { |
121 | struct eisa_device_id id; | 138 | struct eisa_device_id id; |
122 | int slot; | 139 | int slot; |
123 | int state; | 140 | int state; |
124 | unsigned long base_addr; | 141 | unsigned long base_addr; |
125 | struct resource res[EISA_MAX_RESOURCES]; | 142 | struct resource res[EISA_MAX_RESOURCES]; |
126 | u64 dma_mask; | 143 | u64 dma_mask; |
127 | struct device dev; /* generic device */ | 144 | struct device dev; /* generic device */ |
128 | }; | 145 | }; |
129 | 146 | ||
130 | id : EISA id, as read from device. id.driver_data is set from the | 147 | ======== ============================================================ |
131 | matching driver EISA id. | 148 | id EISA id, as read from device. id.driver_data is set from the |
132 | slot : slot number which the device was detected on | 149 | matching driver EISA id. |
133 | state : set of flags indicating the state of the device. Current | 150 | slot slot number which the device was detected on |
134 | flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED. | 151 | state set of flags indicating the state of the device. Current |
135 | res : set of four 256 bytes I/O regions allocated to this device | 152 | flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED. |
136 | dma_mask: DMA mask set from the parent device. | 153 | res set of four 256 bytes I/O regions allocated to this device |
137 | dev : generic device (see Documentation/driver-model/device.txt) | 154 | dma_mask DMA mask set from the parent device. |
155 | dev generic device (see Documentation/driver-model/device.txt) | ||
156 | ======== ============================================================ | ||
138 | 157 | ||
139 | You can get the 'struct eisa_device' from 'struct device' using the | 158 | You can get the 'struct eisa_device' from 'struct device' using the |
140 | 'to_eisa_device' macro. | 159 | 'to_eisa_device' macro. |
141 | 160 | ||
142 | ** Misc stuff : | 161 | Misc stuff |
162 | ========== | ||
163 | |||
164 | :: | ||
143 | 165 | ||
144 | void eisa_set_drvdata (struct eisa_device *edev, void *data); | 166 | void eisa_set_drvdata (struct eisa_device *edev, void *data); |
145 | 167 | ||
146 | Stores data into the device's driver_data area. | 168 | Stores data into the device's driver_data area. |
147 | 169 | ||
148 | void *eisa_get_drvdata (struct eisa_device *edev): | 170 | :: |
171 | |||
172 | void *eisa_get_drvdata (struct eisa_device *edev): | ||
149 | 173 | ||
150 | Gets the pointer previously stored into the device's driver_data area. | 174 | Gets the pointer previously stored into the device's driver_data area. |
151 | 175 | ||
152 | int eisa_get_region_index (void *addr); | 176 | :: |
177 | |||
178 | int eisa_get_region_index (void *addr); | ||
153 | 179 | ||
154 | Returns the region number (0 <= x < EISA_MAX_RESOURCES) of a given | 180 | Returns the region number (0 <= x < EISA_MAX_RESOURCES) of a given |
155 | address. | 181 | address. |
156 | 182 | ||
157 | ** Kernel parameters : | 183 | Kernel parameters |
184 | ================= | ||
158 | 185 | ||
159 | eisa_bus.enable_dev : | 186 | eisa_bus.enable_dev |
187 | A comma-separated list of slots to be enabled, even if the firmware | ||
188 | set the card as disabled. The driver must be able to properly | ||
189 | initialize the device in such conditions. | ||
160 | 190 | ||
161 | A comma-separated list of slots to be enabled, even if the firmware | 191 | eisa_bus.disable_dev |
162 | set the card as disabled. The driver must be able to properly | 192 | A comma-separated list of slots to be enabled, even if the firmware |
163 | initialize the device in such conditions. | 193 | set the card as enabled. The driver won't be called to handle this |
194 | device. | ||
164 | 195 | ||
165 | eisa_bus.disable_dev : | 196 | virtual_root.force_probe |
197 | Force the probing code to probe EISA slots even when it cannot find an | ||
198 | EISA compliant mainboard (nothing appears on slot 0). Defaults to 0 | ||
199 | (don't force), and set to 1 (force probing) when either | ||
200 | CONFIG_ALPHA_JENSEN or CONFIG_EISA_VLB_PRIMING are set. | ||
166 | 201 | ||
167 | A comma-separated list of slots to be enabled, even if the firmware | 202 | Random notes |
168 | set the card as enabled. The driver won't be called to handle this | 203 | ============ |
169 | device. | ||
170 | |||
171 | virtual_root.force_probe : | ||
172 | |||
173 | Force the probing code to probe EISA slots even when it cannot find an | ||
174 | EISA compliant mainboard (nothing appears on slot 0). Defaults to 0 | ||
175 | (don't force), and set to 1 (force probing) when either | ||
176 | CONFIG_ALPHA_JENSEN or CONFIG_EISA_VLB_PRIMING are set. | ||
177 | |||
178 | ** Random notes : | ||
179 | 204 | ||
180 | Converting an EISA driver to the new API mostly involves *deleting* | 205 | Converting an EISA driver to the new API mostly involves *deleting* |
181 | code (since probing is now in the core EISA code). Unfortunately, most | 206 | code (since probing is now in the core EISA code). Unfortunately, most |
@@ -194,9 +219,11 @@ routine. | |||
194 | For example, switching your favorite EISA SCSI card to the "hotplug" | 219 | For example, switching your favorite EISA SCSI card to the "hotplug" |
195 | model is "the right thing"(tm). | 220 | model is "the right thing"(tm). |
196 | 221 | ||
197 | ** Thanks : | 222 | Thanks |
223 | ====== | ||
224 | |||
225 | I'd like to thank the following people for their help: | ||
198 | 226 | ||
199 | I'd like to thank the following people for their help : | ||
200 | - Xavier Benigni for lending me a wonderful Alpha Jensen, | 227 | - Xavier Benigni for lending me a wonderful Alpha Jensen, |
201 | - James Bottomley, Jeff Garzik for getting this stuff into the kernel, | 228 | - James Bottomley, Jeff Garzik for getting this stuff into the kernel, |
202 | - Andries Brouwer for contributing numerous EISA ids, | 229 | - Andries Brouwer for contributing numerous EISA ids, |