Browse Source

Added "name" field to bus structure.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
5bace628ae

+ 125
- 94
src/arch/i386/drivers/bus/bios_disks.c View File

@@ -1,24 +1,17 @@
1 1
 #include "realmode.h"
2
-#include "isa_ids.h"
2
+#include "console.h"
3
+#include "disk.h"
3 4
 #include "bios_disks.h"
4 5
 
5 6
 #define CF ( 1 << 0 )
6 7
 #define BIOS_DISK_NONE 0
7 8
 
8
-/*
9
- * Ensure that there is sufficient space in the shared dev_bus
10
- * structure for a struct bios_disk_device.
11
- *
12
- */
13
-DEV_BUS( struct bios_disk_device, bios_disk_dev );
14
-static char bios_disk_magic[0]; /* guaranteed unique symbol */
15
-
16 9
 /*
17 10
  * Reset the disk system using INT 13,0.  Forces both hard disks and
18 11
  * floppy disks to seek back to track 0.
19 12
  *
20 13
  */
21
-void bios_disk_init ( void ) {
14
+static void bios_disk_init ( void ) {
22 15
 	REAL_EXEC ( rm_bios_disk_init,
23 16
 		    "sti\n\t"
24 17
 		    "xorw %%ax,%%ax\n\t"
@@ -36,45 +29,82 @@ void bios_disk_init ( void ) {
36 29
  * Read a single sector from a disk using INT 13,2.
37 30
  *
38 31
  * Returns the BIOS status code (%ah) - 0 indicates success.
32
+ * Automatically retries up to three times to allow time for floppy
33
+ * disks to spin up, calling bios_disk_init() after each failure.
39 34
  *
40 35
  */
41
-unsigned int bios_disk_read_once ( struct bios_disk_device *bios_disk,
42
-				   unsigned int cylinder,
43
-				   unsigned int head,
44
-				   unsigned int sector,
45
-				   struct bios_disk_sector *buf ) {
46
-	uint16_t basemem_buf, status, flags;
47
-	int discard_c, discard_d;
36
+static unsigned int bios_disk_read ( struct bios_disk_device *bios_disk,
37
+				     unsigned int cylinder,
38
+				     unsigned int head,
39
+				     unsigned int sector,
40
+				     struct bios_disk_sector *buf ) {
41
+	uint16_t basemem_buf, ax, flags;
42
+	unsigned int status, discard_c, discard_d;
43
+	int retry = 3;
48 44
 
49 45
 	basemem_buf = BASEMEM_PARAMETER_INIT ( *buf );
50
-	REAL_EXEC ( rm_bios_disk_read,
51
-		    "sti\n\t"
52
-		    "movw $0x0201, %%ax\n\t" /* Read a single sector */
53
-		    "int $0x13\n\t"
54
-		    "pushfw\n\t"
55
-		    "popw %%bx\n\t"
56
-		    "cli\n\t",
57
-		    4,
58
-		    OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( flags ),
59
-				      "=c" ( discard_c ),
60
-				      "=d" ( discard_d ) ),
61
-		    IN_CONSTRAINTS ( "c" ( ( ( cylinder & 0xff ) << 8 ) |
62
-					   ( ( cylinder >> 8 ) & 0x3 ) |
63
-					   sector ),
64
-				     "d" ( ( head << 8 ) | bios_disk->drive ),
65
-				     "b" ( basemem_buf ) ),
66
-		    CLOBBER ( "ebp", "esi", "edi" ) );
46
+	do {
47
+		REAL_EXEC ( rm_bios_disk_read,
48
+			    "sti\n\t"
49
+			    "movw $0x0201, %%ax\n\t" /* Read a single sector */
50
+			    "int $0x13\n\t"
51
+			    "pushfw\n\t"
52
+			    "popw %%bx\n\t"
53
+			    "cli\n\t",
54
+			    4,
55
+			    OUT_CONSTRAINTS ( "=a" ( ax ), "=b" ( flags ),
56
+					      "=c" ( discard_c ),
57
+					      "=d" ( discard_d ) ),
58
+			    IN_CONSTRAINTS ( "c" ( ( (cylinder & 0xff) << 8 ) |
59
+						   ( (cylinder >> 8) & 0x3 ) |
60
+						   sector ),
61
+					     "d" ( ( head << 8 ) |
62
+						   bios_disk->drive ),
63
+					     "b" ( basemem_buf ) ),
64
+			    CLOBBER ( "ebp", "esi", "edi" ) );
65
+		status = ( flags & CF ) ? ( ax >> 8 ) : 0;
66
+	} while ( ( status != 0 ) && ( bios_disk_init(), retry-- ) );
67 67
 	BASEMEM_PARAMETER_DONE ( *buf );
68 68
 
69
-	return ( flags & CF ) ? ( status >> 8 ) : 0; 
69
+	return status;
70
+}
71
+
72
+/*
73
+ * Increment a bus_loc structure to the next possible BIOS disk
74
+ * location.  Leave the structure zeroed and return 0 if there are no
75
+ * more valid locations.
76
+ *
77
+ */
78
+static int bios_disk_next_location ( struct bus_loc *bus_loc ) {
79
+	struct bios_disk_loc *bios_disk_loc
80
+		= ( struct bios_disk_loc * ) bus_loc;
81
+	
82
+	/*
83
+	 * Ensure that there is sufficient space in the shared bus
84
+	 * structures for a struct bios_disk_loc and a struct
85
+	 * bios_disk_dev, as mandated by bus.h.
86
+	 *
87
+	 */
88
+	BUS_LOC_CHECK ( struct bios_disk_loc );
89
+	BUS_DEV_CHECK ( struct bios_disk_device );
90
+
91
+	return ( ++bios_disk_loc->drive );
70 92
 }
71 93
 
72 94
 /*
73 95
  * Fill in parameters for a BIOS disk device based on drive number
74 96
  *
75 97
  */
76
-static int fill_bios_disk_device ( struct bios_disk_device *bios_disk ) {
77
-	uint16_t type, flags;
98
+static int bios_disk_fill_device ( struct bus_dev *bus_dev,
99
+				   struct bus_loc *bus_loc ) {
100
+	struct bios_disk_loc *bios_disk_loc
101
+		= ( struct bios_disk_loc * ) bus_loc;
102
+	struct bios_disk_device *bios_disk
103
+		= ( struct bios_disk_device * ) bus_dev;
104
+	uint16_t flags;
105
+
106
+	/* Store drive in struct bios_disk_device */
107
+	bios_disk->drive = bios_disk_loc->drive;
78 108
        
79 109
 	REAL_EXEC ( rm_bios_disk_exists,
80 110
 		    "sti\n\t"
@@ -82,14 +112,15 @@ static int fill_bios_disk_device ( struct bios_disk_device *bios_disk ) {
82 112
 		    "int $0x13\n\t"
83 113
 		    "pushfw\n\t"
84 114
 		    "popw %%dx\n\t"
115
+		    "movb %%ah, %%al\n\t"
85 116
 		    "cli\n\t",
86 117
 		    2,
87
-		    OUT_CONSTRAINTS ( "=a" ( type ), "=d" ( flags ) ),
118
+		    OUT_CONSTRAINTS ( "=a" ( bios_disk->type ),
119
+				      "=d" ( flags ) ),
88 120
 		    IN_CONSTRAINTS ( "d" ( bios_disk->drive ) ),
89 121
 		    CLOBBER ( "ebx", "ecx", "esi", "edi", "ebp" ) );
90 122
 
91
-	if ( ( flags & CF ) ||
92
-	     ( ( type >> 8 ) == BIOS_DISK_NONE ) )
123
+	if ( ( flags & CF ) || ( bios_disk->type == BIOS_DISK_NONE ) )
93 124
 		return 0;
94 125
 
95 126
 	DBG ( "BIOS disk found valid drive %hhx\n", bios_disk->drive );
@@ -97,72 +128,72 @@ static int fill_bios_disk_device ( struct bios_disk_device *bios_disk ) {
97 128
 }
98 129
 
99 130
 /*
100
- * Find a BIOS disk device matching the specified driver
131
+ * Test whether or not a driver is capable of driving the device.
101 132
  *
102 133
  */
103
-int find_bios_disk_device ( struct bios_disk_device *bios_disk,
104
-			    struct bios_disk_driver *driver ) {
105
-
106
-	/* Initialise struct bios_disk if it's the first time it's been used.
107
-	 */
108
-	if ( bios_disk->magic != bios_disk_magic ) {
109
-		memset ( bios_disk, 0, sizeof ( *bios_disk ) );
110
-		bios_disk->magic = bios_disk_magic;
134
+static int bios_disk_check_driver ( struct bus_dev *bus_dev,
135
+				    struct device_driver *device_driver ) {
136
+	struct bios_disk_device *bios_disk
137
+		= ( struct bios_disk_device * ) bus_dev;
138
+	struct bios_disk_driver *driver
139
+		= ( struct bios_disk_driver * ) device_driver->bus_driver_info;
140
+
141
+	/* Compare against driver's valid ID range */
142
+	if ( ( bios_disk->drive >= driver->min_drive ) &&
143
+	     ( bios_disk->drive <= driver->max_drive ) ) {
144
+		driver->fill_drive_name ( bios_disk->name, bios_disk->drive );
145
+		DBG ( "BIOS disk found drive %hhx (\"%s\") "
146
+		      "matching driver %s\n",
147
+		      bios_disk->drive, bios_disk->name,
148
+		      driver->name );
149
+		return 1;
111 150
 	}
112 151
 
113
-	/* Iterate through all possible BIOS drives, starting where we
114
-	 * left off
115
-	 */
116
-	DBG ( "BIOS disk searching for device matching driver %s\n",
117
-	      driver->name );
118
-	do {
119
-		/* If we've already used this device, skip it */
120
-		if ( bios_disk->already_tried ) {
121
-			bios_disk->already_tried = 0;
122
-			continue;
123
-		}
124
-
125
-		/* Fill in device parameters */
126
-		if ( ! fill_bios_disk_device ( bios_disk ) ) {
127
-			continue;
128
-		}
129
-
130
-		/* Compare against driver's valid ID range */
131
-		if ( ( bios_disk->drive >= driver->min_drive ) &&
132
-		     ( bios_disk->drive <= driver->max_drive ) ) {
133
-			driver->fill_drive_name ( bios_disk->drive,
134
-						  bios_disk->name );
135
-			DBG ( "BIOS_DISK found drive %hhx (\"%s\") "
136
-			      "matching driver %s\n",
137
-			      bios_disk->drive, bios_disk->name,
138
-			      driver->name );
139
-			bios_disk->already_tried = 1;
140
-			return 1;
141
-		}
142
-	} while ( ++bios_disk->drive );
143
-
144
-	/* No device found */
145
-	DBG ( "BIOS disk found no device matching driver %s\n", driver->name );
146 152
 	return 0;
147 153
 }
148 154
 
149 155
 /*
150
- * Find the next MCA device that can be used to boot using the
151
- * specified driver.
156
+ * Describe a BIOS disk device
152 157
  *
153 158
  */
154
-int find_bios_disk_boot_device ( struct dev *dev,
155
-				 struct bios_disk_driver *driver ) {
159
+static char * bios_disk_describe_device ( struct bus_dev *bus_dev ) {
156 160
 	struct bios_disk_device *bios_disk
157
-		= ( struct bios_disk_device * ) dev->bus;
161
+		= ( struct bios_disk_device * ) bus_dev;
162
+	static char bios_disk_description[] = "BIOS disk 00";
158 163
 
159
-	if ( ! find_bios_disk_device ( bios_disk, driver ) )
160
-		return 0;
164
+	sprintf ( bios_disk_description + 10, "%hhx", bios_disk->drive );
165
+	return bios_disk_description;
166
+}
161 167
 
162
-	dev->name = bios_disk->name;
163
-	dev->devid.bus_type = ISA_BUS_TYPE;
164
-	dev->devid.vendor_id = ISA_VENDOR ( 'D', 'S', 'K' );
165
-	dev->devid.device_id = bios_disk->drive;
168
+/*
169
+ * Name a BIOS disk device
170
+ *
171
+ */
172
+static const char * bios_disk_name_device ( struct bus_dev *bus_dev ) {
173
+	struct bios_disk_device *bios_disk
174
+		= ( struct bios_disk_device * ) bus_dev;
175
+	
176
+	return bios_disk->name;
177
+}
178
+
179
+/*
180
+ * BIOS disk bus operations table
181
+ *
182
+ */
183
+struct bus_driver bios_disk_driver __bus_driver = {
184
+	.name			= "BIOS DISK",
185
+	.next_location		= bios_disk_next_location,
186
+	.fill_device		= bios_disk_fill_device,
187
+	.check_driver		= bios_disk_check_driver,
188
+	.describe_device	= bios_disk_describe_device,
189
+	.name_device		= bios_disk_name_device,
190
+};
191
+
192
+/*
193
+ * Fill in a disk structure
194
+ *
195
+ */
196
+void bios_disk_fill_disk ( struct disk *disk __unused,
197
+			   struct bios_disk_device *bios_disk __unused ) {
166 198
 
167
-	return 1;
168 199
 }

+ 8
- 7
src/drivers/bus/eisa.c View File

@@ -108,7 +108,7 @@ static int eisa_check_driver ( struct bus_dev *bus_dev,
108 108
  * Describe an EISA device
109 109
  *
110 110
  */
111
-static char * eisa_describe ( struct bus_dev *bus_dev ) {
111
+static char * eisa_describe_device ( struct bus_dev *bus_dev ) {
112 112
 	struct eisa_device *eisa = ( struct eisa_device * ) bus_dev;
113 113
 	static char eisa_description[] = "EISA 00";
114 114
 
@@ -120,7 +120,7 @@ static char * eisa_describe ( struct bus_dev *bus_dev ) {
120 120
  * Name an EISA device
121 121
  *
122 122
  */
123
-static const char * eisa_name ( struct bus_dev *bus_dev ) {
123
+static const char * eisa_name_device ( struct bus_dev *bus_dev ) {
124 124
 	struct eisa_device *eisa = ( struct eisa_device * ) bus_dev;
125 125
 	
126 126
 	return eisa->name;
@@ -131,11 +131,12 @@ static const char * eisa_name ( struct bus_dev *bus_dev ) {
131 131
  *
132 132
  */
133 133
 struct bus_driver eisa_driver __bus_driver = {
134
-	.next_location	= eisa_next_location,
135
-	.fill_device	= eisa_fill_device,
136
-	.check_driver	= eisa_check_driver,
137
-	.describe	= eisa_describe,
138
-	.name		= eisa_name,
134
+	.name			= "EISA",
135
+	.next_location		= eisa_next_location,
136
+	.fill_device		= eisa_fill_device,
137
+	.check_driver		= eisa_check_driver,
138
+	.describe_device	= eisa_describe_device,
139
+	.name_device		= eisa_name_device,
139 140
 };
140 141
 
141 142
 /*

+ 8
- 7
src/drivers/bus/isa.c View File

@@ -126,7 +126,7 @@ int isa_check_driver ( struct bus_dev *bus_dev,
126 126
  * Describe a ISA device
127 127
  *
128 128
  */
129
-static char * isa_describe ( struct bus_dev *bus_dev ) {
129
+static char * isa_describe_device ( struct bus_dev *bus_dev ) {
130 130
 	struct isa_device *isa = ( struct isa_device * ) bus_dev;
131 131
 	static char isa_description[] = "ISA 0000";
132 132
 
@@ -138,7 +138,7 @@ static char * isa_describe ( struct bus_dev *bus_dev ) {
138 138
  * Name a ISA device
139 139
  *
140 140
  */
141
-static const char * isa_name ( struct bus_dev *bus_dev ) {
141
+static const char * isa_name_device ( struct bus_dev *bus_dev ) {
142 142
 	struct isa_device *isa = ( struct isa_device * ) bus_dev;
143 143
 	
144 144
 	return isa->name;
@@ -149,11 +149,12 @@ static const char * isa_name ( struct bus_dev *bus_dev ) {
149 149
  *
150 150
  */
151 151
 struct bus_driver isa_driver __bus_driver = {
152
-	.next_location	= isa_next_location,
153
-	.fill_device	= isa_fill_device,
154
-	.check_driver	= isa_check_driver,
155
-	.describe	= isa_describe,
156
-	.name		= isa_name,
152
+	.name			= "ISA",
153
+	.next_location		= isa_next_location,
154
+	.fill_device		= isa_fill_device,
155
+	.check_driver		= isa_check_driver,
156
+	.describe_device	= isa_describe_device,
157
+	.name_device		= isa_name_device,
157 158
 };
158 159
 
159 160
 /*

+ 52
- 35
src/drivers/bus/isapnp.c View File

@@ -262,7 +262,7 @@ static int isapnp_find_tag ( uint8_t wanted_tag, uint8_t *buf ) {
262 262
 	uint8_t tag;
263 263
 	uint16_t len;
264 264
 
265
-	DBG ( "ISAPnP read tag" );
265
+	DBG2 ( "ISAPnP read tag" );
266 266
 	do {
267 267
 		tag = isapnp_peek_byte();
268 268
 		if ( ISAPNP_IS_SMALL_TAG ( tag ) ) {
@@ -272,22 +272,23 @@ static int isapnp_find_tag ( uint8_t wanted_tag, uint8_t *buf ) {
272 272
 			len = isapnp_peek_byte() + ( isapnp_peek_byte() << 8 );
273 273
 			tag = ISAPNP_LARGE_TAG_NAME ( tag );
274 274
 		}
275
-		DBG ( " %hhx (%hhx)", tag, len );
275
+		DBG2 ( " %hhx (%hhx)", tag, len );
276 276
 		if ( tag == wanted_tag ) {
277 277
 			isapnp_peek ( buf, len );
278
-			DBG ( "\n" );
278
+			DBG2 ( "\n" );
279 279
 			return 1;
280 280
 		} else {
281 281
 			isapnp_peek ( NULL, len );
282 282
 		}
283 283
 	} while ( tag != ISAPNP_TAG_END );
284
-	DBG ( "\n" );
284
+	DBG2 ( "\n" );
285 285
 	return 0;
286 286
 }
287 287
 
288 288
 /*
289 289
  * Try isolating ISAPnP cards at the current read port.  Return the
290
- * number of ISAPnP cards found.
290
+ * number of ISAPnP cards found.  <0 indicates "try a new read port",
291
+ * 0 indicates "definitely no cards".
291 292
  *
292 293
  * The state diagram on page 18 (PDF page 24) of the PnP ISA spec
293 294
  * gives the best overview of what happens here.
@@ -295,7 +296,8 @@ static int isapnp_find_tag ( uint8_t wanted_tag, uint8_t *buf ) {
295 296
  */
296 297
 static int isapnp_try_isolate ( void ) {
297 298
 	struct isapnp_identifier identifier;
298
-	unsigned int i, j, seen55aa;
299
+	unsigned int i, j;
300
+	unsigned int seen_55aa, seen_life;
299 301
 	unsigned int csn = 0;
300 302
 	uint16_t data;
301 303
 	uint8_t byte;
@@ -336,7 +338,7 @@ static int isapnp_try_isolate ( void ) {
336 338
 
337 339
 		/* Read identifier serially via the ISAPnP read port. */
338 340
 		memset ( &identifier, 0, sizeof ( identifier ) );
339
-		seen55aa = 0;
341
+		seen_55aa = seen_life = 0;
340 342
 		for ( i = 0 ; i < 9 ; i++ ) {
341 343
 			byte = 0;
342 344
 			for ( j = 0 ; j < 8 ; j++ ) {
@@ -345,18 +347,31 @@ static int isapnp_try_isolate ( void ) {
345 347
 				data = ( data << 8 ) | isapnp_read_data ();
346 348
 				isapnp_delay();
347 349
 				byte >>= 1;
348
-				if ( data == 0x55aa ) {
349
-					byte |= 0x80;
350
-					seen55aa = 1;
350
+				if (  data != 0xffff ) {
351
+					seen_life++;
352
+					if ( data == 0x55aa ) {
353
+						byte |= 0x80;
354
+						seen_55aa++;
355
+					}
351 356
 				}
352 357
 			}
353 358
 			( (char *) &identifier )[i] = byte;
354 359
 		}
355
-				
360
+
356 361
 		/* If we didn't see any 55aa patterns, stop here */
357
-		if ( ! seen55aa ) {
358
-			DBG ( "ISAPnP saw %s signs of life\n",
359
-			      csn ? "no futher" : "no" );
362
+		if ( ! seen_55aa ) {
363
+			if ( csn ) {
364
+				DBG ( "ISAPnP found no more cards\n" );
365
+			} else {
366
+				if ( seen_life ) {
367
+					DBG ( "ISAPnP saw life but no cards, "
368
+					      "trying new read port\n" );
369
+					csn = -1;
370
+				} else {
371
+					DBG ( "ISAPnP saw no signs of life, "
372
+					      "abandoning isolation\n" );
373
+				}
374
+			}
360 375
 			break;
361 376
 		}
362 377
 
@@ -364,11 +379,12 @@ static int isapnp_try_isolate ( void ) {
364 379
 		if ( identifier.checksum != isapnp_checksum ( &identifier) ) {
365 380
 			DBG ( "ISAPnP found malformed card "
366 381
 			      ISAPNP_CARD_ID_FMT "\n  with checksum %hhx "
367
-			      "(should be %hhx), abandoning isolation\n",
382
+			      "(should be %hhx), trying new read port\n",
368 383
 			      ISAPNP_CARD_ID_DATA ( &identifier ),
369 384
 			      identifier.checksum,
370 385
 			      isapnp_checksum ( &identifier) );
371
-			/* break; */
386
+			csn = -1;
387
+			break;
372 388
 		}
373 389
 
374 390
 		/* Give the device a CSN */
@@ -391,8 +407,10 @@ static int isapnp_try_isolate ( void ) {
391 407
 	isapnp_wait_for_key ();
392 408
 
393 409
 	/* Return number of cards found */
394
-	DBG ( "ISAPnP found %d cards at read port %hx\n",
395
-	      csn, isapnp_read_port );
410
+	if ( csn > 0 ) {
411
+		DBG ( "ISAPnP found %d cards at read port %hx\n",
412
+		      csn, isapnp_read_port );
413
+	}
396 414
 	return csn;
397 415
 }
398 416
 
@@ -412,7 +430,7 @@ static void isapnp_isolate ( void ) {
412 430
 			continue;
413 431
 		
414 432
 		/* If we detect any ISAPnP cards at this location, stop */
415
-		if ( isapnp_try_isolate () )
433
+		if ( isapnp_try_isolate () >= 0 )
416 434
 			return;
417 435
 	}
418 436
 }
@@ -486,7 +504,6 @@ static int isapnp_fill_device ( struct bus_dev *bus_dev,
486 504
 
487 505
 	/* Need to return 0 if no device exists at this CSN */
488 506
 	if ( identifier.vendor_id & 0x80 ) {
489
-		DBG ( "ISAPnP found no card %hhx\n", isapnp->csn );
490 507
 		cache.csn = isapnp->csn;
491 508
 		cache.first_nonexistent_logdev = 0;
492 509
 		return 0;
@@ -497,10 +514,11 @@ static int isapnp_fill_device ( struct bus_dev *bus_dev,
497 514
 		if ( ! isapnp_find_tag ( ISAPNP_TAG_LOGDEVID,
498 515
 					 ( char * ) &logdevid ) ) {
499 516
 			/* No tag for this device */
500
-			DBG ( "ISAPnP found no device %hhx.%hhx on "
501
-			      "card " ISAPNP_CARD_ID_FMT "\n",
502
-			      isapnp->csn, isapnp->logdev,
503
-			      ISAPNP_CARD_ID_DATA ( &identifier ) );
517
+			if ( isapnp->logdev == 0 ) {
518
+				DBG ( "ISAPnP found no device %hhx.0 on card "
519
+				      ISAPNP_CARD_ID_FMT "\n", isapnp->csn,
520
+				      ISAPNP_CARD_ID_DATA ( &identifier ) );
521
+			}
504 522
 			cache.csn = isapnp->csn;
505 523
 			cache.first_nonexistent_logdev = isapnp->logdev;
506 524
 			return 0;
@@ -548,11 +566,9 @@ static int isapnp_check_driver ( struct bus_dev *bus_dev,
548 566
 		if ( ( isapnp->vendor_id == id->vendor_id ) &&
549 567
 		     ( ISA_PROD_ID ( isapnp->prod_id ) ==
550 568
 		       ISA_PROD_ID ( id->prod_id ) ) ) {
551
-			DBG ( "ISAPnP found ID %hx:%hx "
552
-			      "(\"%s\") (device %s) "
569
+			DBG ( "ISAPnP found ID %hx:%hx (\"%s\") (device %s) "
553 570
 			      "matching driver %s\n",
554
-			      isapnp->vendor_id,
555
-			      isapnp->prod_id,
571
+			      isapnp->vendor_id, isapnp->prod_id,
556 572
 			      isa_id_string( isapnp->vendor_id,
557 573
 					     isapnp->prod_id ),
558 574
 			      id->name, device_driver->name );
@@ -568,7 +584,7 @@ static int isapnp_check_driver ( struct bus_dev *bus_dev,
568 584
  * Describe an ISAPnP device
569 585
  *
570 586
  */
571
-static char * isapnp_describe ( struct bus_dev *bus_dev ) {
587
+static char * isapnp_describe_device ( struct bus_dev *bus_dev ) {
572 588
 	struct isapnp_device *isapnp = ( struct isapnp_device * ) bus_dev;
573 589
 	static char isapnp_description[] = "ISAPnP 00:00";
574 590
 
@@ -581,7 +597,7 @@ static char * isapnp_describe ( struct bus_dev *bus_dev ) {
581 597
  * Name an ISAPnP device
582 598
  *
583 599
  */
584
-static const char * isapnp_name ( struct bus_dev *bus_dev ) {
600
+static const char * isapnp_name_device ( struct bus_dev *bus_dev ) {
585 601
 	struct isapnp_device *isapnp = ( struct isapnp_device * ) bus_dev;
586 602
 	
587 603
 	return isapnp->name;
@@ -592,11 +608,12 @@ static const char * isapnp_name ( struct bus_dev *bus_dev ) {
592 608
  *
593 609
  */
594 610
 struct bus_driver isapnp_driver __bus_driver = {
595
-	.next_location	= isapnp_next_location,
596
-	.fill_device	= isapnp_fill_device,
597
-	.check_driver	= isapnp_check_driver,
598
-	.describe	= isapnp_describe,
599
-	.name		= isapnp_name,
611
+	.name			= "ISAPnP",
612
+	.next_location		= isapnp_next_location,
613
+	.fill_device		= isapnp_fill_device,
614
+	.check_driver		= isapnp_check_driver,
615
+	.describe_device	= isapnp_describe_device,
616
+	.name_device		= isapnp_name_device,
600 617
 };
601 618
 
602 619
 /*

+ 8
- 7
src/drivers/bus/mca.c View File

@@ -110,7 +110,7 @@ static int mca_check_driver ( struct bus_dev *bus_dev,
110 110
  * Describe an MCA device
111 111
  *
112 112
  */
113
-static char * mca_describe ( struct bus_dev *bus_dev ) {
113
+static char * mca_describe_device ( struct bus_dev *bus_dev ) {
114 114
 	struct mca_device *mca = ( struct mca_device * ) bus_dev;
115 115
 	static char mca_description[] = "MCA 00";
116 116
 
@@ -122,7 +122,7 @@ static char * mca_describe ( struct bus_dev *bus_dev ) {
122 122
  * Name an MCA device
123 123
  *
124 124
  */
125
-static const char * mca_name ( struct bus_dev *bus_dev ) {
125
+static const char * mca_name_device ( struct bus_dev *bus_dev ) {
126 126
 	struct mca_device *mca = ( struct mca_device * ) bus_dev;
127 127
 	
128 128
 	return mca->name;
@@ -133,11 +133,12 @@ static const char * mca_name ( struct bus_dev *bus_dev ) {
133 133
  *
134 134
  */
135 135
 struct bus_driver mca_driver __bus_driver = {
136
-	.next_location	= mca_next_location,
137
-	.fill_device	= mca_fill_device,
138
-	.check_driver	= mca_check_driver,
139
-	.describe	= mca_describe,
140
-	.name		= mca_name,
136
+	.name			= "MCA",
137
+	.next_location		= mca_next_location,
138
+	.fill_device		= mca_fill_device,
139
+	.check_driver		= mca_check_driver,
140
+	.describe_device	= mca_describe_device,
141
+	.name_device		= mca_name_device,
141 142
 };
142 143
 
143 144
 /*

+ 8
- 7
src/drivers/bus/pci.c View File

@@ -179,7 +179,7 @@ static int pci_check_driver ( struct bus_dev *bus_dev,
179 179
  * Describe a PCI device
180 180
  *
181 181
  */
182
-static char * pci_describe ( struct bus_dev *bus_dev ) {
182
+static char * pci_describe_device ( struct bus_dev *bus_dev ) {
183 183
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
184 184
 	static char pci_description[] = "PCI 00:00.0";
185 185
 
@@ -193,7 +193,7 @@ static char * pci_describe ( struct bus_dev *bus_dev ) {
193 193
  * Name a PCI device
194 194
  *
195 195
  */
196
-static const char * pci_name ( struct bus_dev *bus_dev ) {
196
+static const char * pci_name_device ( struct bus_dev *bus_dev ) {
197 197
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
198 198
 	
199 199
 	return pci->name;
@@ -204,11 +204,12 @@ static const char * pci_name ( struct bus_dev *bus_dev ) {
204 204
  *
205 205
  */
206 206
 struct bus_driver pci_driver __bus_driver = {
207
-	.next_location	= pci_next_location,
208
-	.fill_device	= pci_fill_device,
209
-	.check_driver	= pci_check_driver,
210
-	.describe	= pci_describe,
211
-	.name		= pci_name,
207
+	.name			= "PCI",
208
+	.next_location		= pci_next_location,
209
+	.fill_device		= pci_fill_device,
210
+	.check_driver		= pci_check_driver,
211
+	.describe_device	= pci_describe_device,
212
+	.name_device		= pci_name_device,
212 213
 };
213 214
 
214 215
 /*

+ 3
- 2
src/include/dev.h View File

@@ -148,13 +148,14 @@ struct bus_dev {
148 148
  *
149 149
  */
150 150
 struct bus_driver {
151
+	const char *name;
151 152
 	int ( *next_location ) ( struct bus_loc *bus_loc );
152 153
 	int ( *fill_device ) ( struct bus_dev *bus_dev,
153 154
 			       struct bus_loc *bus_loc );
154 155
 	int ( *check_driver ) ( struct bus_dev *bus_dev,
155 156
 				struct device_driver *device_driver );
156
-	char * ( *describe ) ( struct bus_dev *bus_dev );
157
-	const char * ( *name ) ( struct bus_dev *bus_dev );
157
+	char * ( *describe_device ) ( struct bus_dev *bus_dev );
158
+	const char * ( *name_device ) ( struct bus_dev *bus_dev );
158 159
 };
159 160
 
160 161
 #define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))

Loading…
Cancel
Save