瀏覽代碼

Make isa_probe_addr a simple integer rather than a struct, to facilitate

specification of ISA_PROBE_ADDRS.
tags/v0.9.3
Michael Brown 19 年之前
父節點
當前提交
9f02376409
共有 7 個文件被更改,包括 29 次插入32 次删除
  1. 6
    3
      src/drivers/bus/isa.c
  2. 6
    6
      src/drivers/net/cs89x0.c
  3. 3
    3
      src/drivers/net/depca.c
  4. 3
    5
      src/drivers/net/eepro.c
  5. 3
    3
      src/drivers/net/skel.c
  6. 4
    6
      src/drivers/net/smc9000.c
  7. 4
    6
      src/include/isa.h

+ 6
- 3
src/drivers/bus/isa.c 查看文件

@@ -13,7 +13,10 @@
13 13
  * instead.  Some cards (e.g. the 3c509) implement a proprietary
14 14
  * ISAPnP-like mechanism.
15 15
  *
16
- * The ISA probe address list can be overridden by config.c; if 
16
+ * The ISA probe address list can be overridden by config.c; if the
17
+ * user specifies ISA_PROBE_ADDRS then that list will be used first.
18
+ * (If ISA_PROBE_ADDRS ends with a zero, the driver's own list will
19
+ * never be used).
17 20
  */
18 21
 
19 22
 /*
@@ -49,7 +52,7 @@ int find_isa_device ( struct isa_device *isa, struct isa_driver *driver ) {
49 52
 		}
50 53
 
51 54
 		/* Set I/O address */
52
-		ioaddr = isa_extra_probe_addrs[i].addr;
55
+		ioaddr = isa_extra_probe_addrs[i];
53 56
 
54 57
 		/* An I/O address of 0 in extra_probe_addrs list means
55 58
 		 * stop probing (i.e. don't continue to the
@@ -80,7 +83,7 @@ int find_isa_device ( struct isa_device *isa, struct isa_driver *driver ) {
80 83
 		}
81 84
 
82 85
 		/* Set I/O address */
83
-		ioaddr = driver->probe_addrs[i].addr;
86
+		ioaddr = driver->probe_addrs[i];
84 87
 
85 88
 		/* Use probe_addr method to see if there's a device
86 89
 		 * present at this address.

+ 6
- 6
src/drivers/net/cs89x0.c 查看文件

@@ -463,7 +463,7 @@ static struct nic_operations cs89x0_operations = {
463 463
 ETH_PROBE - Look for an adapter
464 464
 ***************************************************************************/
465 465
 
466
-static int cs89x0_probe_addr ( uint16_t ioaddr ) {
466
+static int cs89x0_probe_addr ( isa_probe_addr_t ioaddr ) {
467 467
 	/* if they give us an odd I/O address, then do ONE write to
468 468
 	   the address port, to get it back to address zero, where we
469 469
 	   expect to find the EISA signature word. */
@@ -685,14 +685,14 @@ static int cs89x0_probe ( struct dev *dev, struct isa_device *isa ) {
685 685
 	return 1;
686 686
 }
687 687
 	
688
-static struct isa_probe_addr cs89x0_probe_addrs[] = { 
688
+static isa_probe_addr_t cs89x0_probe_addrs[] = { 
689 689
 #ifndef EMBEDDED
690 690
 	/* use "conservative" default values for autoprobing */
691
-	{ 0x300 }, { 0x320 }, { 0x340 }, { 0x200 }, { 0x220 }, { 0x240 },
692
-	{ 0x260 }, { 0x280 }, { 0x2a0 }, { 0x2c0 }, { 0x2e0 },
691
+	0x300, 0x320, 0x340, 0x200, 0x220, 0x240,
692
+	0x260, 0x280, 0x2a0, 0x2c0, 0x2e0,
693 693
 	/* if that did not work, then be more aggressive */
694
-	{ 0x301 }, { 0x321 }, { 0x341 }, { 0x201 }, { 0x221 }, { 0x241 },
695
-	{ 0x261 }, { 0x281 }, { 0x2a1 }, { 0x2c1 }, { 0x2e1 },
694
+	0x301, 0x321, 0x341, 0x201, 0x221, 0x241,
695
+	0x261, 0x281, 0x2a1, 0x2c1, 0x2e1,
696 696
 #else
697 697
 	0x01000300,
698 698
 #endif

+ 3
- 3
src/drivers/net/depca.c 查看文件

@@ -695,7 +695,7 @@ static void depca_irq(struct nic *nic __unused, irq_action_t action __unused)
695 695
 static u8 nicsr;
696 696
 
697 697
 
698
-static int depca_probe1 ( uint16_t ioaddr ) {
698
+static int depca_probe1 ( isa_probe_addr_t ioaddr ) {
699 699
 	u8	data;
700 700
 	/* This is only correct for little endian machines, but then
701 701
 	   Etherboot doesn't work on anything but a PC */
@@ -787,8 +787,8 @@ static int depca_probe ( struct dev *dev, struct isa_device *isa ) {
787 787
 	return 1;
788 788
 }
789 789
 
790
-static struct isa_probe_addr depca_probe_addrs[] = {
791
-	{ 0x300 }, { 0x200 },
790
+static isa_probe_addr_t depca_probe_addrs[] = {
791
+	0x300, 0x200,
792 792
 };
793 793
 
794 794
 static struct isa_driver depca_driver =

+ 3
- 5
src/drivers/net/eepro.c 查看文件

@@ -516,7 +516,7 @@ static int read_eeprom(uint16_t ioaddr, int location)
516 516
 	return (retval);
517 517
 }
518 518
 
519
-static int eepro_probe1 ( uint16_t ioaddr ) {
519
+static int eepro_probe1 ( isa_probe_addr_t ioaddr ) {
520 520
 	int		id, counter;
521 521
 
522 522
 	id = inb(ioaddr + ID_REG);
@@ -600,10 +600,8 @@ static int eepro_probe ( struct dev *dev, struct isa_device *isa ) {
600 600
 	return 1;
601 601
 }
602 602
 
603
-static struct isa_probe_addr eepro_probe_addrs[] = {
604
-	{ 0x300 },
605
-	{ 0x210 }, { 0x240 }, { 0x280 }, { 0x2C0 }, { 0x200 },
606
-	{ 0x320 }, { 0x340 }, { 0x360 },
603
+static isa_probe_addr_t eepro_probe_addrs[] = {
604
+	0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360,
607 605
 };
608 606
 
609 607
 static struct isa_driver eepro_driver =

+ 3
- 3
src/drivers/net/skel.c 查看文件

@@ -349,7 +349,7 @@ ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" );
349 349
  *
350 350
  **************************************************************************
351 351
  */
352
-static int skel_isa_probe_addr ( uint16_t ioaddr __unused ) {
352
+static int skel_isa_probe_addr ( isa_probe_addr_t ioaddr __unused ) {
353 353
 	return 0;
354 354
 }
355 355
 
@@ -372,9 +372,9 @@ static int skel_isa_probe ( struct dev *dev, struct isa_device *isa ) {
372 372
 	return 1;
373 373
 }
374 374
 
375
-static struct isa_probe_addr skel_isa_probe_addrs[] = {
375
+static isa_probe_addr_t skel_isa_probe_addrs[] = {
376 376
 	/*
377
-	   { 0x200 }, { 0x240 },
377
+	   0x200, 0x240,
378 378
 	*/
379 379
 };
380 380
 

+ 4
- 6
src/drivers/net/smc9000.c 查看文件

@@ -108,7 +108,7 @@ static void smc_reset(int ioaddr)
108 108
  *
109 109
  * ---------------------------------------------------------------------
110 110
  */
111
-static int smc9000_probe_addr( unsigned short ioaddr )
111
+static int smc9000_probe_addr( isa_probe_addr_t ioaddr )
112 112
 {
113 113
    word bank;
114 114
    word	revision_register;
@@ -483,11 +483,9 @@ static int smc9000_probe ( struct dev *dev, struct isa_device *isa ) {
483 483
  * change for a slightly different card, you can add it to the array.
484 484
  *
485 485
  */
486
-static struct isa_probe_addr smc9000_probe_addrs[] = {
487
-   { 0x200 }, { 0x220 }, { 0x240 }, { 0x260 },
488
-   { 0x280 }, { 0x2A0 }, { 0x2C0 }, { 0x2E0 },
489
-   { 0x300 }, { 0x320 }, { 0x340 }, { 0x360 },
490
-   { 0x380 }, { 0x3A0 }, { 0x3C0 }, { 0x3E0 },
486
+static isa_probe_addr_t smc9000_probe_addrs[] = {
487
+   0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
488
+   0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0, 0x3C0, 0x3E0,
491 489
 };
492 490
 
493 491
 static struct isa_driver smc9000_driver =

+ 4
- 6
src/include/isa.h 查看文件

@@ -19,9 +19,7 @@ struct isa_device {
19 19
  * An individual ISA device, identified by probe address
20 20
  *
21 21
  */
22
-struct isa_probe_addr {
23
-	uint16_t addr;
24
-} __attribute__ (( packed ));
22
+typedef uint16_t isa_probe_addr_t;
25 23
 
26 24
 /*
27 25
  * An ISA driver, with a probe address list and a probe_addr method.
@@ -32,9 +30,9 @@ struct isa_probe_addr {
32 30
  */
33 31
 struct isa_driver {
34 32
 	const char *name;
35
-	struct isa_probe_addr *probe_addrs;
33
+	isa_probe_addr_t *probe_addrs;
36 34
 	unsigned int addr_count;
37
-	int ( * probe_addr ) ( uint16_t addr );
35
+	int ( * probe_addr ) ( isa_probe_addr_t addr );
38 36
 	uint16_t mfg_id;
39 37
 	uint16_t prod_id;
40 38
 };
@@ -72,7 +70,7 @@ extern int find_isa_boot_device ( struct dev *dev,
72 70
  * config.c defines isa_extra_probe_addrs and isa_extra_probe_addr_count.
73 71
  *
74 72
  */
75
-extern struct isa_probe_addr isa_extra_probe_addrs[];
73
+extern isa_probe_addr_t isa_extra_probe_addrs[];
76 74
 extern unsigned int isa_extra_probe_addr_count;
77 75
 
78 76
 #endif /* ISA_H */

Loading…
取消
儲存