Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/stand/boot Misc cleanup from OpenBSD/luna88k.
details: https://anonhg.NetBSD.org/src/rev/a1eeed584438
branches: trunk
changeset: 325677:a1eeed584438
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Jan 03 03:25:25 2014 +0000
description:
Misc cleanup from OpenBSD/luna88k.
- remove unused code
- use proper prefix for structure members for readability
diffstat:
sys/arch/luna68k/stand/boot/autoconf.c | 140 ++++++++++----------------------
sys/arch/luna68k/stand/boot/device.h | 19 +--
sys/arch/luna68k/stand/boot/if_le.c | 10 +-
sys/arch/luna68k/stand/boot/ioconf.c | 16 +-
sys/arch/luna68k/stand/boot/sd.c | 78 +++---------------
5 files changed, 77 insertions(+), 186 deletions(-)
diffs (truncated from 483 to 300 lines):
diff -r 6bbd8c920958 -r a1eeed584438 sys/arch/luna68k/stand/boot/autoconf.c
--- a/sys/arch/luna68k/stand/boot/autoconf.c Fri Jan 03 02:15:43 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/autoconf.c Fri Jan 03 03:25:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.8 2014/01/03 02:03:12 tsutsui Exp $ */
+/* $NetBSD: autoconf.c,v 1.9 2014/01/03 03:25:25 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -195,10 +195,7 @@
hc->hp_alive = 1;
printf("%s%d", hc->hp_driver->d_name, hc->hp_unit);
printf(" at %p,", hc->hp_addr);
- printf(" ipl %d", hc->hp_ipl);
- if (hc->hp_flags)
- printf(" flags 0x%x", hc->hp_flags);
- printf("\n");
+ printf(" ipl %d\n", hc->hp_ipl);
find_slaves(hc);
} else
hc->hp_addr = oaddr;
@@ -218,13 +215,13 @@
hw->hw_name, hw->hw_sc, (u_int)hw->hw_addr, hw->hw_type);
#endif
match_d = NULL;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
- if (hd->hp_alive)
+ for (hd = hp_dinit; hd->hpd_driver; hd++) {
+ if (hd->hpd_alive)
continue;
/* Must not be a slave */
- if (hd->hp_cdriver)
+ if (hd->hpd_cdriver)
continue;
- addr = hd->hp_addr;
+ addr = hd->hpd_addr;
/*
* Exact match; all done.
*/
@@ -243,8 +240,8 @@
if (acdebug) {
if (match_d)
printf("found %s%d\n",
- match_d->hp_driver->d_name,
- match_d->hp_unit);
+ match_d->hpd_driver->d_name,
+ match_d->hpd_unit);
else
printf("not found\n");
}
@@ -260,19 +257,14 @@
* Note, we can still fail if HW won't initialize.
*/
hd = match_d;
- oaddr = hd->hp_addr;
- hd->hp_addr = hw->hw_addr;
- if ((*hd->hp_driver->d_init)(hd)) {
- hd->hp_alive = 1;
- printf("%s%d", hd->hp_driver->d_name, hd->hp_unit);
- printf(" at %p", hd->hp_addr);
- if (hd->hp_ipl)
- printf(", ipl %d", hd->hp_ipl);
- if (hd->hp_flags)
- printf(", flags 0x%x", hd->hp_flags);
- printf("\n");
+ oaddr = hd->hpd_addr;
+ hd->hpd_addr = hw->hw_addr;
+ if ((*hd->hpd_driver->d_init)(hd)) {
+ hd->hpd_alive = 1;
+ printf("%s%d", hd->hpd_driver->d_name, hd->hpd_unit);
+ printf(" at %p\n", hd->hpd_addr);
} else
- hd->hp_addr = oaddr;
+ hd->hpd_addr = oaddr;
return(1);
}
@@ -303,7 +295,7 @@
for (s = 0; s < maxslaves; s++) {
rescan = 1;
match_s = NULL;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
+ for (hd = hp_dinit; hd->hpd_driver; hd++) {
/*
* Rule out the easy ones:
* 1. slave already assigned or not a slave
@@ -311,13 +303,13 @@
* 3. controller specified but not this one
* 4. slave specified but not this one
*/
- if (hd->hp_alive || hd->hp_cdriver == NULL)
+ if (hd->hpd_alive || hd->hpd_cdriver == NULL)
continue;
- if (!dr_type(hc->hp_driver, hd->hp_cdriver->d_name))
+ if (!dr_type(hc->hp_driver, hd->hpd_cdriver->d_name))
continue;
- if (hd->hp_ctlr >= 0 && hd->hp_ctlr != hc->hp_unit)
+ if (hd->hpd_ctlr >= 0 && hd->hpd_ctlr != hc->hp_unit)
continue;
- if (hd->hp_slave >= 0 && hd->hp_slave != s)
+ if (hd->hpd_slave >= 0 && hd->hpd_slave != s)
continue;
/*
* Case 0: first possible match.
@@ -336,7 +328,7 @@
* "reserve" locations for dynamic addition of
* disk/tape drives by fully qualifing the location.
*/
- if (hd->hp_slave == s && hd->hp_ctlr == hc->hp_unit) {
+ if (hd->hpd_slave == s && hd->hpd_ctlr == hc->hp_unit) {
match_s = hd;
rescan = 0;
break;
@@ -345,8 +337,8 @@
* Case 2: right controller, wildcarded slave.
* Remember first and keep looking for an exact match.
*/
- if (hd->hp_ctlr == hc->hp_unit &&
- match_s->hp_ctlr < 0) {
+ if (hd->hpd_ctlr == hc->hp_unit &&
+ match_s->hpd_ctlr < 0) {
match_s = hd;
new_s = s;
continue;
@@ -355,8 +347,8 @@
* Case 3: right slave, wildcarded controller.
* Remember and keep looking for a better match.
*/
- if (hd->hp_slave == s &&
- match_s->hp_ctlr < 0 && match_s->hp_slave < 0) {
+ if (hd->hpd_slave == s &&
+ match_s->hpd_ctlr < 0 && match_s->hpd_slave < 0) {
match_s = hd;
new_c = hc->hp_unit;
continue;
@@ -376,85 +368,39 @@
*/
if (match_s) {
hd = match_s;
- old_c = hd->hp_ctlr;
- old_s = hd->hp_slave;
- if (hd->hp_ctlr < 0)
- hd->hp_ctlr = new_c;
- if (hd->hp_slave < 0)
- hd->hp_slave = new_s;
+ old_c = hd->hpd_ctlr;
+ old_s = hd->hpd_slave;
+ if (hd->hpd_ctlr < 0)
+ hd->hpd_ctlr = new_c;
+ if (hd->hpd_slave < 0)
+ hd->hpd_slave = new_s;
#ifdef DEBUG
if (acdebug)
printf("looking for %s%d at slave %d...",
- hd->hp_driver->d_name,
- hd->hp_unit, hd->hp_slave);
+ hd->hpd_driver->d_name,
+ hd->hpd_unit, hd->hpd_slave);
#endif
- if ((*hd->hp_driver->d_init)(hd)) {
+ if ((*hd->hpd_driver->d_init)(hd)) {
#ifdef DEBUG
if (acdebug)
printf("found\n");
#endif
- printf("%s%d at %s%d, slave %d",
- hd->hp_driver->d_name, hd->hp_unit,
- hc->hp_driver->d_name, hd->hp_ctlr,
- hd->hp_slave);
- if (hd->hp_flags)
- printf(" flags 0x%x", hd->hp_flags);
- printf("\n");
- hd->hp_alive = 1;
- if (hd->hp_dk && dkn < DK_NDRIVE)
- hd->hp_dk = dkn++;
- else
- hd->hp_dk = -1;
+ printf("%s%d at %s%d, slave %d\n",
+ hd->hpd_driver->d_name, hd->hpd_unit,
+ hc->hp_driver->d_name, hd->hpd_ctlr,
+ hd->hpd_slave);
+ hd->hpd_alive = 1;
rescan = 1;
} else {
#ifdef DEBUG
if (acdebug)
printf("not found\n");
#endif
- hd->hp_ctlr = old_c;
- hd->hp_slave = old_s;
- }
- /*
- * XXX: This should be handled better.
- * Re-scan a slave. There are two reasons to do this.
- * 1. It is possible to have both a tape and disk
- * (e.g. 7946) or two disks (e.g. 9122) at the
- * same slave address. Here we need to rescan
- * looking only at entries with a different
- * physical unit number (hp_flags).
- * 2. It is possible that an init failed because the
- * slave was there but of the wrong type. In this
- * case it may still be possible to match the slave
- * to another ioconf entry of a different type.
- * Here we need to rescan looking only at entries
- * of different types.
- * In both cases we avoid looking at undesirable
- * ioconf entries of the same type by setting their
- * alive fields to -1.
- */
- if (rescan) {
- for (hd = hp_dinit; hd->hp_driver; hd++) {
- if (hd->hp_alive)
- continue;
- if (match_s->hp_alive == 1) { /* 1 */
- if (hd->hp_flags == match_s->hp_flags)
- hd->hp_alive = -1;
- } else { /* 2 */
- if (hd->hp_driver == match_s->hp_driver)
- hd->hp_alive = -1;
- }
- }
- s--;
- continue;
+ hd->hpd_ctlr = old_c;
+ hd->hpd_slave = old_s;
}
}
- /*
- * Reset bogon alive fields prior to attempting next slave
- */
- for (hd = hp_dinit; hd->hp_driver; hd++)
- if (hd->hp_alive == -1)
- hd->hp_alive = 0;
}
}
@@ -465,10 +411,10 @@
switch (hw->hw_type) {
case NET:
- found = dr_type(hd->hp_driver, "le");
+ found = dr_type(hd->hpd_driver, "le");
break;
case SCSI:
- found = dr_type(hd->hp_driver, "scsi");
+ found = dr_type(hd->hpd_driver, "scsi");
break;
}
return(found);
diff -r 6bbd8c920958 -r a1eeed584438 sys/arch/luna68k/stand/boot/device.h
--- a/sys/arch/luna68k/stand/boot/device.h Fri Jan 03 02:15:43 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/device.h Fri Jan 03 03:25:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.6 2014/01/03 02:03:12 tsutsui Exp $ */
+/* $NetBSD: device.h,v 1.7 2014/01/03 03:25:25 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -86,16 +86,13 @@
};
struct hp_device {
- struct driver *hp_driver;
- struct driver *hp_cdriver;
- int hp_unit;
- int hp_ctlr;
- int hp_slave;
- uint8_t *hp_addr;
- int hp_dk;
- int hp_flags;
- int hp_alive;
- int hp_ipl;
+ struct driver *hpd_driver;
+ struct driver *hpd_cdriver;
+ int hpd_unit;
+ int hpd_ctlr;
+ int hpd_slave;
+ uint8_t *hpd_addr;
+ int hpd_alive;
};
struct hp_hw {
diff -r 6bbd8c920958 -r a1eeed584438 sys/arch/luna68k/stand/boot/if_le.c
--- a/sys/arch/luna68k/stand/boot/if_le.c Fri Jan 03 02:15:43 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/if_le.c Fri Jan 03 03:25:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $ */
+/* $NetBSD: if_le.c,v 1.4 2014/01/03 03:25:25 tsutsui Exp $ */
/*
* Copyright (c) 2013 Izumi Tsutsui. All rights reserved.
@@ -121,19 +121,19 @@
void *reg, *mem;
uint8_t eaddr[6];
- reg = hd->hp_addr;
+ reg = hd->hpd_addr;
mem = (void *)0x71010000; /* XXX */
Home |
Main Index |
Thread Index |
Old Index