diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-06-09 04:13:14 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-06-09 04:13:14 +0000 |
commit | 6784bdd5dcebb6201a487b01c2c50e0083a88100 (patch) | |
tree | 4f21be322533bbeed49b9d9dd8e7a2fbd8a648ea /sys/arch/macppc | |
parent | 3ebf23a7a8fc5124b32ba9650a4f637a4f0918c2 (diff) |
knf/cleanup/dead code removal.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/macppc/autoconf.c | 28 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/clock.c | 18 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/cpu.c | 7 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/db_interface.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mainbus.c | 9 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 15 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/ofw_machdep.c | 32 |
7 files changed, 59 insertions, 55 deletions
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c index c36dec253e5..1b5f0c14439 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.3 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: autoconf.c,v 1.4 2002/06/09 04:13:13 drahn Exp $ */ /* * Copyright (c) 1996, 1997 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -41,7 +41,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.3 2002/03/14 01:26:36 millert Exp $ + * $Id: autoconf.c,v 1.4 2002/06/09 04:13:13 drahn Exp $ */ /* @@ -66,14 +66,14 @@ struct device *parsedisk(char *, int, int, dev_t *); void setroot(void); void swapconf(void); extern void dumpconf(void); -int findblkmajor(struct device *); -char *findblkname(int); -static struct device * getdisk(char *, int, int, dev_t *); -struct device * getdevunit(char *, int); -static struct devmap * findtype(char **); -void makebootdev(char *cp); -int getpno(char **); -void diskconf(void); +int findblkmajor(struct device *); +char *findblkname(int); +static struct device * getdisk(char *, int, int, dev_t *); +struct device * getdevunit(char *, int); +static struct devmap * findtype(char **); +void makebootdev(char *cp); +int getpno(char **); +void diskconf(void); /* * The following several variables are related to @@ -94,11 +94,6 @@ cpu_configure() (void)splhigh(); /* To be really sure.. */ calc_delayconst(); - /* - if(system_type == OFWMACH) { - ofrootfound(); - } - */ if(config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); (void)spl0(); @@ -328,7 +323,8 @@ setroot() extern char *nfsbootdevname; #endif -printf("bootpath: '%s'\n", bootpath); + printf("bootpath: '%s'\n", bootpath); + makebootdev(bootpath); if(boothowto & RB_DFLTROOT) return; /* Boot compiled in */ diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index 14c3a8ea286..d01f1f56f8e 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.2 2002/03/11 15:30:33 drahn Exp $ */ +/* $OpenBSD: clock.c,v 1.3 2002/06/09 04:13:13 drahn Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -67,7 +67,7 @@ static volatile u_long lasttb; #define YEAR0 1900 typedef int (clock_read_t)(int *sec, int *min, int *hour, int *day, - int *mon, int *yr); + int *mon, int *yr); typedef int (time_read_t)(u_long *sec); typedef int (time_write_t)(u_long sec); @@ -75,10 +75,10 @@ int power4e_getclock(int *, int *, int *, int *, int *, int *); clock_read_t *clock_read = NULL; time_read_t *time_read = NULL; -time_write_t *time_write = NULL; +time_write_t *time_write = NULL; -static u_long -chiptotime(int sec, int min, int hour, int day, int mon, int year); +static u_long chiptotime(int sec, int min, int hour, int day, int mon, + int year); /* * For now we let the machine run with boot time, not changing the clock @@ -120,6 +120,7 @@ inittodr(base) /* force failure */ time.tv_sec = 0; } + if (time.tv_sec == 0) { printf("WARNING: unable to get date/time"); /* @@ -144,6 +145,7 @@ inittodr(base) return; printf("WARNING: clock %s %d days", time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); + if (time.tv_sec < base && deltat > 1000 * SECDAY) { printf(", using FS time"); time.tv_sec = base; @@ -228,6 +230,7 @@ decr_intr(frame) asm ("mftb %0; mfdec %1" : "=r"(tb), "=r"(tick)); for (nticks = 0; tick < 0; nticks++) tick += ticks_per_intr; + asm volatile ("mtdec %0" :: "r"(tick)); /* * lasttb is used during microtime. Set it to the virtual @@ -286,12 +289,13 @@ calc_delayconst() if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 && !strcmp(name, "cpu") && OF_getprop(qhandle, "timebase-frequency", - &ticks_per_sec, sizeof ticks_per_sec) >= 0) { + & ticks_per_sec, sizeof ticks_per_sec) >= 0) { /* * Should check for correct CPU here? XXX */ asm volatile ("mfmsr %0; andi. %1, %0, %2; mtmsr %1" - : "=r"(msr), "=r"(scratch) : "K"((u_short)~PSL_EE)); + : "=r"(msr), "=r"(scratch) + : "K"((u_short)~PSL_EE)); ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; asm volatile ("mtmsr %0" :: "r"(msr)); diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index a8ef9c5d117..7bbbf7a4243 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.5 2002/04/29 00:00:02 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.6 2002/06/09 04:13:13 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -135,11 +135,10 @@ cpuattach(parent, dev, aux) sprintf(cpu_model, "7410"); break; case MPC7450: - if ((pvr & 0xf) < 3) { + if ((pvr & 0xf) < 3) sprintf(cpu_model, "7450"); - } else { + else sprintf(cpu_model, "7451"); - } break; case MPC7455: sprintf(cpu_model, "7455"); diff --git a/sys/arch/macppc/macppc/db_interface.c b/sys/arch/macppc/macppc/db_interface.c index 9495089a11f..b5c8aed047e 100644 --- a/sys/arch/macppc/macppc/db_interface.c +++ b/sys/arch/macppc/macppc/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.3 2002/05/13 17:55:02 drahn Exp $ */ +/* $OpenBSD: db_interface.c,v 1.4 2002/06/09 04:13:13 drahn Exp $ */ /* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ #include <sys/param.h> @@ -24,8 +24,7 @@ ddb_trap_glue(frame) { if (!(frame->srr1 & PSL_PR) && (frame->exc == EXC_TRC - || (frame->exc == EXC_PGM - && (frame->srr1 & 0x20000)) + || (frame->exc == EXC_PGM && (frame->srr1 & 0x20000)) || frame->exc == EXC_BPT)) { bcopy(frame->fixreg, DDB_REGS->tf.fixreg, diff --git a/sys/arch/macppc/macppc/mainbus.c b/sys/arch/macppc/macppc/mainbus.c index c8333b619a5..441e04cf8e7 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.4 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: mainbus.c,v 1.5 2002/06/09 04:13:13 drahn Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -120,9 +120,10 @@ mbattach(parent, self, aux) int node; for (node = OF_child(OF_peer(0)); node; node=OF_peer(node)) { bzero (name, sizeof(name)); - if (OF_getprop(node, "device_type", name, sizeof(name)) <= 0) - { - if (OF_getprop(node, "name", name, sizeof(name)) <= 0) + if (OF_getprop(node, "device_type", name, + sizeof(name)) <= 0) { + if (OF_getprop(node, "name", name, + sizeof(name)) <= 0) printf ("name not found on node %x\n", node); continue; diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 9ebc297fbc9..1e5ddccf773 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.5 2002/02/23 17:17:04 matthieu Exp $ */ +/* $OpenBSD: mem.c,v 1.6 2002/06/09 04:13:13 drahn Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -134,7 +134,7 @@ mmrw(dev, uio, flags) } switch (minor(dev)) { -/* minor device 0 is physical memory */ + /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; c = uio->uio_resid; @@ -143,27 +143,30 @@ mmrw(dev, uio, flags) error = uiomove((caddr_t)v, c, uio); continue; -/* minor device 1 is kernel memory */ + /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; c = min(iov->iov_len, MAXPHYS); error = uiomove((caddr_t)v, c, uio); continue; -/* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is EOF/RATHOLE */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return 0; -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ + /* minor device 12 (/dev/zero) is source of nulls on read, + * rathole on write + */ case 12: if (uio->uio_rw == UIO_WRITE) { c = iov->iov_len; break; } if (zeropage == NULL) { - zeropage = (caddr_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + zeropage = (caddr_t)malloc(PAGE_SIZE, M_TEMP, + M_WAITOK); bzero(zeropage, PAGE_SIZE); } c = min(iov->iov_len, PAGE_SIZE); diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index 1624d159b57..8be7694105b 100644 --- a/sys/arch/macppc/macppc/ofw_machdep.c +++ b/sys/arch/macppc/macppc/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.10 2002/05/22 21:00:00 miod Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.11 2002/06/09 04:13:13 drahn Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -122,6 +122,9 @@ ofw_vmon() fwcall = &fwentry; } +int OF_stdout; +int OF_stdin; + /* code to save and create the necessary mappings for BSD to handle * the vm-setup for OpenFirmware */ @@ -132,10 +135,6 @@ static struct { vm_offset_t pa; int mode; } ofw_mapping[256]; - -int OF_stdout; -int OF_stdin; - int save_ofw_mapping() { @@ -145,13 +144,13 @@ save_ofw_mapping() if ((chosen = OF_finddevice("/chosen")) == -1) { return 0; } - if (OF_getprop(chosen, "stdin", &stdin, sizeof stdin) != sizeof stdin) - { + + if (OF_getprop(chosen, "stdin", &stdin, sizeof stdin) != sizeof stdin) { return 0; } OF_stdin = stdin; - if (OF_getprop(chosen, "stdout", &stdout, sizeof stdout) != sizeof stdout) - { + if (OF_getprop(chosen, "stdout", &stdout, sizeof stdout) + != sizeof stdout) { return 0; } if (stdout == 0) { @@ -165,8 +164,9 @@ save_ofw_mapping() OF_getprop(chosen, "mmu", &mmui, 4); mmu = OF_instance_to_package(mmui); bzero(ofw_mapping, sizeof(ofw_mapping)); - N_mapping = - OF_getprop(mmu, "translations", ofw_mapping, sizeof(ofw_mapping)); + + N_mapping = OF_getprop(mmu, "translations", ofw_mapping, + sizeof(ofw_mapping)); N_mapping /= sizeof(ofw_mapping[0]); fw = &ofw_firmware; @@ -210,6 +210,7 @@ void ofw_do_pending_int(void); extern int system_type; void ofw_intr_init(void); + void ofrootfound() { @@ -226,6 +227,7 @@ ofrootfound() ofw_intr_init(); } } + void ofw_intr_establish() { @@ -234,6 +236,7 @@ ofw_intr_establish() ofw_intr_init(); } } + void ofw_intr_init() { @@ -264,12 +267,13 @@ ofw_intr_init() imask[IPL_HIGH] = 0xffffffff; } + void ofw_do_pending_int() { int pcpl; int emsr, dmsr; -static int processing; + static int processing; if(processing) return; @@ -437,7 +441,6 @@ ofw_find_keyboard() int stdin_node; char iname[32]; int len; - int node; stdin_node = OF_instance_to_package(OF_stdin); len = OF_getprop(stdin_node, "name", iname, 20); @@ -448,8 +451,7 @@ ofw_find_keyboard() * detection walk the OFW tree to find keyboards and what type. */ - node = OF_peer(0); - ofw_recurse_keyboard(node); + ofw_recurse_keyboard(OF_peer(0)); if (ofw_have_kbd == 0) { printf("no keyboard found, hoping USB will be present\n"); |