9 #include <linux/kernel.h>
10 #include <linux/device.h>
12 #include <linux/module.h>
15 #include <linux/slab.h>
19 #define SLOT_ADDRESS(r,n) (r->bus_base_addr + (0x1000 * n))
21 #define EISA_DEVINFO(i,s) { .id = { .sig = i }, .name = s }
28 #ifdef CONFIG_EISA_NAMES
32 #define EISA_INFOS (sizeof (eisa_table) / (sizeof (struct eisa_device_info)))
35 #define EISA_MAX_FORCED_DEV 16
38 static unsigned int enable_dev_count;
40 static unsigned int disable_dev_count;
42 static int is_forced_dev(
int *forced_tab,
49 for (i = 0; i < forced_count; i++) {
51 if (forced_tab[i] == x)
60 #ifdef CONFIG_EISA_NAMES
62 for (i = 0; i < EISA_INFOS; i++) {
63 if (!
strcmp(edev->
id.sig, eisa_table[i].
id.sig)) {
66 sizeof(edev->pretty_name));
72 sprintf(edev->pretty_name,
"EISA device %.7s", edev->
id.sig);
76 static char __init *decode_eisa_sig(
unsigned long addr)
83 for (i = 0; i < 4; i++) {
84 #ifdef CONFIG_EISA_VLB_PRIMING
94 sig[
i] =
inb(addr + i);
96 if (!i && (sig[0] & 0x80))
100 sig_str[0] = ((sig[0] >> 2) & 0x1f) + (
'A' - 1);
101 sig_str[1] = (((sig[0] & 3) << 3) | (sig[1] >> 5)) + (
'A' - 1);
102 sig_str[2] = (sig[1] & 0x1f) + (
'A' - 1);
103 rev = (sig[2] << 8) | sig[3];
104 sprintf(sig_str + 3,
"%04X", rev);
141 .match = eisa_bus_match,
142 .uevent = eisa_bus_uevent,
163 return sprintf(buf,
"%s\n", edev->
id.sig);
193 unsigned long sig_addr;
198 sig = decode_eisa_sig(sig_addr);
208 eisa_name_device(edev);
209 edev->
dev.parent = root->
dev;
216 #ifdef CONFIG_EISA_NAMES
217 edev->
res[
i].name = edev->pretty_name;
219 edev->
res[
i].name = edev->
id.sig;
223 if (is_forced_dev(enable_dev, enable_dev_count, root, edev))
226 if (is_forced_dev(disable_dev, disable_dev_count, root, edev))
272 if (!slot && i > 0) {
273 edev->
res[
i].start = edev->
res[
i].end = 0;
281 edev->
res[
i].end = edev->
res[
i].start + 0xff;
287 edev->
res[
i].end = edev->
res[
i].start + 3;
309 if (edev->
res[i].start || edev->
res[i].end)
330 if (eisa_request_resources(root, edev, 0)) {
332 "EISA: Cannot allocate resource for mainboard\n");
339 if (eisa_init_device(root, edev, 0)) {
340 eisa_release_resources(edev);
349 if (eisa_register_device(edev)) {
352 eisa_release_resources(edev);
358 for (c = 0, i = 1; i <= root->
slots; i++) {
365 if (eisa_request_resources(root, edev, i)) {
367 "Cannot allocate resource for EISA slot %d\n",
373 if (eisa_init_device(root, edev, i)) {
374 eisa_release_resources(edev);
382 switch (edev->
state) {
384 printk(
" (forced enabled)");
388 printk(
" (forced disabled)");
400 if (eisa_register_device(edev)) {
403 eisa_release_resources(edev);
413 static struct resource eisa_root_res = {
414 .name =
"EISA root resource",
420 static int eisa_bus_count;
440 root->
bus_nr = eisa_bus_count++;
442 err = eisa_probe(root);