|
@@ -17,8 +17,8 @@
|
17
|
17
|
*
|
18
|
18
|
* The ISA probe address list can be overridden by config.h; if the
|
19
|
19
|
* user specifies ISA_PROBE_ADDRS then that list will be used first.
|
20
|
|
- * (If ISA_PROBE_ADDRS ends with a zero, the driver's own list will
|
21
|
|
- * never be used).
|
|
20
|
+ * (If ISA_PROBE_ONLY is defined, the driver's own list will never be
|
|
21
|
+ * used).
|
22
|
22
|
*/
|
23
|
23
|
|
24
|
24
|
/*
|
|
@@ -34,20 +34,33 @@ static isa_probe_addr_t isa_extra_probe_addrs[] = {
|
34
|
34
|
( sizeof ( isa_extra_probe_addrs ) / sizeof ( isa_extra_probe_addrs[0] ) )
|
35
|
35
|
|
36
|
36
|
#ifdef ISA_PROBE_ONLY
|
37
|
|
-# define ISA_PROBE_IDX_LIMIT isa_extra_probe_addr_count
|
|
37
|
+#define ISA_PROBE_ADDR_COUNT(driver) ( isa_extra_probe_addr_count )
|
38
|
38
|
#else
|
39
|
|
-# define ISA_PROBE_IDX_LIMIT ( ISA_MAX_PROBE_IDX + 1 )
|
|
39
|
+#define ISA_PROBE_ADDR_COUNT(driver) \
|
|
40
|
+ ( isa_extra_probe_addr_count + (driver)->addr_count )
|
40
|
41
|
#endif
|
41
|
42
|
|
|
43
|
+/*
|
|
44
|
+ * Symbols defined by linker
|
|
45
|
+ *
|
|
46
|
+ */
|
|
47
|
+extern struct isa_driver isa_drivers[];
|
|
48
|
+extern struct isa_driver isa_drivers_end[];
|
|
49
|
+
|
42
|
50
|
/*
|
43
|
51
|
* Increment a bus_loc structure to the next possible ISA location.
|
44
|
52
|
* Leave the structure zeroed and return 0 if there are no more valid
|
45
|
53
|
* locations.
|
46
|
54
|
*
|
|
55
|
+ * There is no sensible concept of a device location on an ISA bus, so
|
|
56
|
+ * we use the probe address list for each ISA driver to define the
|
|
57
|
+ * list of ISA locations.
|
|
58
|
+ *
|
47
|
59
|
*/
|
48
|
60
|
static int isa_next_location ( struct bus_loc *bus_loc ) {
|
49
|
61
|
struct isa_loc *isa_loc = ( struct isa_loc * ) bus_loc;
|
50
|
|
-
|
|
62
|
+ struct isa_driver *driver;
|
|
63
|
+
|
51
|
64
|
/*
|
52
|
65
|
* Ensure that there is sufficient space in the shared bus
|
53
|
66
|
* structures for a struct isa_loc and a struct
|
|
@@ -57,8 +70,18 @@ static int isa_next_location ( struct bus_loc *bus_loc ) {
|
57
|
70
|
BUS_LOC_CHECK ( struct isa_loc );
|
58
|
71
|
BUS_DEV_CHECK ( struct isa_device );
|
59
|
72
|
|
60
|
|
- return ( ( ++isa_loc->probe_idx < ISA_PROBE_IDX_LIMIT ) ?
|
61
|
|
- 1 : ( isa_loc->probe_idx = 0 ) );
|
|
73
|
+ /* Move to next probe address within this driver */
|
|
74
|
+ driver = &isa_drivers[isa_loc->driver];
|
|
75
|
+ if ( ++isa_loc->probe_idx < ISA_PROBE_ADDR_COUNT ( driver ) )
|
|
76
|
+ return 1;
|
|
77
|
+
|
|
78
|
+ /* Move to next driver */
|
|
79
|
+ isa_loc->probe_idx = 0;
|
|
80
|
+ if ( ( ++isa_loc->driver, ++driver ) < isa_drivers_end )
|
|
81
|
+ return 1;
|
|
82
|
+
|
|
83
|
+ isa_loc->driver = 0;
|
|
84
|
+ return 0;
|
62
|
85
|
}
|
63
|
86
|
|
64
|
87
|
/*
|
|
@@ -73,17 +96,29 @@ static int isa_fill_device ( struct bus_dev *bus_dev,
|
73
|
96
|
struct isa_loc *isa_loc = ( struct isa_loc * ) bus_loc;
|
74
|
97
|
struct isa_device *isa = ( struct isa_device * ) bus_dev;
|
75
|
98
|
signed int driver_probe_idx;
|
76
|
|
-
|
|
99
|
+
|
|
100
|
+ /* Fill in struct isa from struct isa_loc */
|
|
101
|
+ isa->driver = &isa_drivers[isa_loc->driver];
|
77
|
102
|
driver_probe_idx = isa_loc->probe_idx - isa_extra_probe_addr_count;
|
78
|
103
|
if ( driver_probe_idx < 0 ) {
|
79
|
104
|
isa->ioaddr = isa_extra_probe_addrs[isa_loc->probe_idx];
|
80
|
105
|
} else {
|
81
|
|
- isa->ioaddr = 0;
|
82
|
|
- isa->driver_probe_idx = driver_probe_idx;
|
|
106
|
+ isa->ioaddr = isa->driver->probe_addrs[driver_probe_idx];
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ /* Call driver's probe_addr method to determine if a device is
|
|
110
|
+ * physically present
|
|
111
|
+ */
|
|
112
|
+ if ( isa->driver->probe_addr ( isa->ioaddr ) ) {
|
|
113
|
+ isa->name = isa->driver->name;
|
|
114
|
+ isa->mfg_id = isa->driver->mfg_id;
|
|
115
|
+ isa->prod_id = isa->driver->prod_id;
|
|
116
|
+ DBG ( "ISA found %s device at address %hx\n",
|
|
117
|
+ isa->name, isa->ioaddr );
|
|
118
|
+ return 1;
|
83
|
119
|
}
|
84
|
|
- isa->mfg_id = isa->prod_id = 0;
|
85
|
|
- isa->name = "?";
|
86
|
|
- return 1;
|
|
120
|
+
|
|
121
|
+ return 0;
|
87
|
122
|
}
|
88
|
123
|
|
89
|
124
|
/*
|
|
@@ -97,29 +132,7 @@ int isa_check_driver ( struct bus_dev *bus_dev,
|
97
|
132
|
struct isa_driver *driver
|
98
|
133
|
= ( struct isa_driver * ) device_driver->bus_driver_info;
|
99
|
134
|
|
100
|
|
- /* If ioaddr is zero, it means we're using a driver-specified
|
101
|
|
- * ioaddr
|
102
|
|
- */
|
103
|
|
- if ( ! isa->ioaddr ) {
|
104
|
|
- if ( isa->driver_probe_idx >= driver->addr_count )
|
105
|
|
- return 0;
|
106
|
|
- isa->ioaddr = driver->probe_addrs[isa->driver_probe_idx];
|
107
|
|
- }
|
108
|
|
-
|
109
|
|
- /* Use probe_addr method to see if there's a device
|
110
|
|
- * present at this address.
|
111
|
|
- */
|
112
|
|
- if ( driver->probe_addr ( isa->ioaddr ) ) {
|
113
|
|
- DBG ( "ISA found %s device at address %hx\n",
|
114
|
|
- driver->name, isa->ioaddr );
|
115
|
|
- isa->name = driver->name;
|
116
|
|
- isa->mfg_id = driver->mfg_id;
|
117
|
|
- isa->prod_id = driver->prod_id;
|
118
|
|
- return 1;
|
119
|
|
- }
|
120
|
|
-
|
121
|
|
- /* No device found */
|
122
|
|
- return 0;
|
|
135
|
+ return ( driver == isa->driver );
|
123
|
136
|
}
|
124
|
137
|
|
125
|
138
|
/*
|
|
@@ -128,9 +141,10 @@ int isa_check_driver ( struct bus_dev *bus_dev,
|
128
|
141
|
*/
|
129
|
142
|
static char * isa_describe_device ( struct bus_dev *bus_dev ) {
|
130
|
143
|
struct isa_device *isa = ( struct isa_device * ) bus_dev;
|
131
|
|
- static char isa_description[] = "ISA 0000";
|
|
144
|
+ static char isa_description[] = "ISA 0000 (00)";
|
132
|
145
|
|
133
|
|
- sprintf ( isa_description + 4, "%hx", isa->ioaddr );
|
|
146
|
+ sprintf ( isa_description + 4, "%hx (%hhx)", isa->ioaddr,
|
|
147
|
+ isa->driver - isa_drivers );
|
134
|
148
|
return isa_description;
|
135
|
149
|
}
|
136
|
150
|
|