diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-09-15 09:02:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-09-15 09:02:00 +0000 |
commit | 8f6680cb282c2e34abd90fe05faa4162db0d95bc (patch) | |
tree | 2ee5f1f62f18a077f21d599f3b18a39f701c9275 /sys/arch/macppc/stand | |
parent | 0684ecd769796e91ce28e5f3907744c787dcbe07 (diff) |
backout premature
Diffstat (limited to 'sys/arch/macppc/stand')
-rw-r--r-- | sys/arch/macppc/stand/Locore.c | 76 | ||||
-rw-r--r-- | sys/arch/macppc/stand/boot.c | 15 | ||||
-rw-r--r-- | sys/arch/macppc/stand/net.c | 16 | ||||
-rw-r--r-- | sys/arch/macppc/stand/netif_of.c | 16 | ||||
-rw-r--r-- | sys/arch/macppc/stand/ofdev.c | 43 |
5 files changed, 84 insertions, 82 deletions
diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c index 22ab798daee..c2e57cc5241 100644 --- a/sys/arch/macppc/stand/Locore.c +++ b/sys/arch/macppc/stand/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: Locore.c,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */ /* @@ -52,28 +52,28 @@ asm(" bat_init: mfmsr 8 - li 0,0 - mtmsr 0 - isync - - mtibatu 0,0 - mtibatu 1,0 - mtibatu 2,0 - mtibatu 3,0 - mtdbatu 0,0 - mtdbatu 1,0 - mtdbatu 2,0 - mtdbatu 3,0 - - li 9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ - mtibatl 0,9 - mtdbatl 0,9 - li 9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ - mtibatu 0,9 - mtdbatu 0,9 - isync - - mtmsr 8 + li 0,0 + mtmsr 0 + isync + + mtibatu 0,0 + mtibatu 1,0 + mtibatu 2,0 + mtibatu 3,0 + mtdbatu 0,0 + mtdbatu 1,0 + mtdbatu 2,0 + mtdbatu 3,0 + + li 9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ + mtibatl 0,9 + mtdbatl 0,9 + li 9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ + mtibatu 0,9 + mtdbatu 0,9 + isync + + mtmsr 8 isync blr "); @@ -142,8 +142,7 @@ _rtt() }; openfirmware(&args); - while (1) - ; /* just in case */ + while (1); /* just in case */ } int @@ -160,8 +159,8 @@ OF_finddevice(name) "finddevice", 1, 1, - }; - + }; + args.device = name; if (openfirmware(&args) == -1) return -1; @@ -183,7 +182,7 @@ OF_instance_to_package(ihandle) 1, 1, }; - + args.ihandle = ihandle; if (openfirmware(&args) == -1) return -1; @@ -211,7 +210,7 @@ OF_getprop(handle, prop, buf, buflen) 4, 1, }; - + args.phandle = handle; args.prop = prop; args.buf = buf; @@ -243,7 +242,7 @@ OF_setprop(handle, prop, buf, len) 4, 1, }; - + args.phandle = handle; args.prop = prop; args.buf = buf; @@ -269,7 +268,7 @@ OF_open(dname) 1, 1, }; - + args.dname = dname; if (openfirmware(&args) == -1) return -1; @@ -290,7 +289,7 @@ OF_close(handle) 1, 0, }; - + args.handle = handle; openfirmware(&args); } @@ -369,7 +368,7 @@ OF_seek(handle, pos) 3, 1, }; - + args.handle = handle; args.poshi = (int)(pos >> 32); args.poslo = (int)pos; @@ -435,7 +434,7 @@ OF_release(virt, size) 2, 0, }; - + args.virt = virt; args.size = size; openfirmware(&args); @@ -454,7 +453,7 @@ OF_milliseconds() 0, 1, }; - + openfirmware(&args); return args.ms; } @@ -556,12 +555,11 @@ static void setup() { int chosen; - + if ((chosen = OF_finddevice("/chosen")) == -1) _rtt(); - if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != - sizeof(stdin) || - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != + if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != sizeof(stdin) + || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != sizeof(stdout)) _rtt(); if (stdout == 0) { diff --git a/sys/arch/macppc/stand/boot.c b/sys/arch/macppc/stand/boot.c index 192771e9db7..14b94c818b3 100644 --- a/sys/arch/macppc/stand/boot.c +++ b/sys/arch/macppc/stand/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ /* @@ -55,6 +55,7 @@ #include <lib/libsa/stand.h> #include <lib/libsa/loadfile.h> + #include <machine/cpu.h> #include <macppc/stand/ofdev.h> @@ -70,7 +71,7 @@ prom2boot(dev) char *dev; { char *cp, *lp = 0; - + for (cp = dev; *cp; cp++) if (*cp == ':') lp = cp; @@ -108,7 +109,7 @@ parseargs(str, howtop) } if (!*cp) return; - + *cp++ = 0; while (*cp) { switch (*cp++) { @@ -174,15 +175,15 @@ main() u_int32_t entry; void *ssym, *esym; int fd; - + printf("\n>> OpenBSD/macppc Boot\n"); /* * Get the boot arguments from Openfirmware */ - if ((chosen = OF_finddevice("/chosen")) == -1 || - OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || - OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { + if ((chosen = OF_finddevice("/chosen")) == -1 + || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 + || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { printf("Invalid Openfirmware environment\n"); exit(); } diff --git a/sys/arch/macppc/stand/net.c b/sys/arch/macppc/stand/net.c index 555f95a18cf..50acb67b7b6 100644 --- a/sys/arch/macppc/stand/net.c +++ b/sys/arch/macppc/stand/net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: net.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: net.c,v 1.1 1997/04/16 20:29:18 thorpej Exp $ */ /* @@ -76,7 +76,7 @@ net_open(op) struct of_dev *op; { int error = 0; - + /* * On first open, do netif open, mount, etc. */ @@ -119,21 +119,21 @@ net_mountroot() #ifdef DEBUG printf("net_mountroot\n"); #endif - + /* * Get info for NFS boot: our IP address, out hostname, * server IP address, and our root path on the server. * We use BOOTP (RFC951, RFC1532) exclusively as mandated * by PowerPC Reference Platform Specification I.4.2 */ - + bootp(netdev_sock); - + if (myip.s_addr == 0) return ETIMEDOUT; - + printf("Using IP address: %s\n", inet_ntoa(myip)); - + #ifdef DEBUG printf("myip: %s (%s)", hostname, inet_ntoa(myip)); if (gateip.s_addr) @@ -143,7 +143,7 @@ net_mountroot() printf("\n"); #endif printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath); - + /* * Get the NFS file handle (mount). */ diff --git a/sys/arch/macppc/stand/netif_of.c b/sys/arch/macppc/stand/netif_of.c index f055969e1b0..286f5f9594a 100644 --- a/sys/arch/macppc/stand/netif_of.c +++ b/sys/arch/macppc/stand/netif_of.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netif_of.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: netif_of.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */ /* @@ -82,7 +82,7 @@ netif_open(machdep_hint) struct iodesc *io; int fd, error; char addr[32]; - + #ifdef NETIF_DEBUG printf("netif_open..."); #endif @@ -99,12 +99,12 @@ netif_open(machdep_hint) netif_of.nif_devdata = op; io->io_netif = &netif_of; - + /* Put our ethernet address in io->myea */ OF_getprop(OF_instance_to_package(op->handle), - "local-mac-address", io->myea, sizeof io->myea) == -1 && + "local-mac-address", io->myea, sizeof io->myea) == -1 && OF_getprop(OF_instance_to_package(op->handle), - "mac-address", io->myea, sizeof io->myea); + "mac-address", io->myea, sizeof io->myea); #ifdef NETIF_DEBUG printf("OK\n"); @@ -163,7 +163,7 @@ netif_put(desc, pkt, len) struct ether_header *eh; printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", - desc, pkt, len); + desc, pkt, len); eh = pkt; printf("dst: %s ", ether_sprintf(eh->ether_dhost)); printf("src: %s ", ether_sprintf(eh->ether_shost)); @@ -211,7 +211,7 @@ netif_get(desc, pkt, maxlen, timo) #ifdef NETIF_DEBUG printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n", - pkt, maxlen, timo); + pkt, maxlen, timo); #endif tmo_ms = timo * 1000; @@ -220,7 +220,7 @@ netif_get(desc, pkt, maxlen, timo) do { len = OF_read(op->handle, pkt, maxlen); } while ((len == -2 || len == 0) && - ((OF_milliseconds() - tick0) < tmo_ms)); + ((OF_milliseconds() - tick0) < tmo_ms)); #ifdef NETIF_DEBUG printf("netif_get: received len=%d\n", len); diff --git a/sys/arch/macppc/stand/ofdev.c b/sys/arch/macppc/stand/ofdev.c index 5ded35dea90..bd7830d8b17 100644 --- a/sys/arch/macppc/stand/ofdev.c +++ b/sys/arch/macppc/stand/ofdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.c,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: ofdev.c,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: ofdev.c,v 1.1 1997/04/16 20:29:20 thorpej Exp $ */ /* @@ -204,8 +204,9 @@ read_mac_label(devp, buf, lp) int i; char *s; - if (strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE) { + if ((strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0) + || (read != DEV_BSIZE)) + { return ERDLAB; } part = (struct part_map_entry *)buf; @@ -224,8 +225,9 @@ read_mac_label(devp, buf, lp) */ for (i = 0; i < part_cnt; i++) { /* read the appropriate block */ - if (strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE) { + if ((strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0) + || (read != DEV_BSIZE)) + { return ERDLAB; } part = (struct part_map_entry *)buf; @@ -236,9 +238,10 @@ read_mac_label(devp, buf, lp) if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) { /* FOUND OUR PARTITION!!! */ printf("found OpenBSD DPME partition\n"); - if (strategy(devp, F_READ, part->pmPyPartStart, - DEV_BSIZE, buf, &read) == 0 && - read == DEV_BSIZE) { + if(strategy(devp, F_READ, part->pmPyPartStart, + DEV_BSIZE, buf, &read) == 0 + && read == DEV_BSIZE) + { if (!getdisklabel(buf, lp)) { return 0; } @@ -275,8 +278,8 @@ search_label(devp, off, buf, lp, off0) u_long poff; static int recursion; - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) return ERDLAB; if (buf[510] != 0x55 || buf[511] != 0xaa) @@ -285,20 +288,20 @@ search_label(devp, off, buf, lp, off0) if (recursion++ <= 1) off0 += off; for (p = (struct dos_partition *)(buf + DOSPARTOFF), i = 4; - --i >= 0; p++) { + --i >= 0; p++) { if (p->dp_typ == DOSPTYP_OPENBSD || p->dp_typ == DOSPTYP_NETBSD) { poff = get_long(&p->dp_start) + off0; if (strategy(devp, F_READ, poff + LABELSECTOR, - DEV_BSIZE, buf, &read) == 0 && - read == DEV_BSIZE) { + DEV_BSIZE, buf, &read) == 0 + && read == DEV_BSIZE) { if (!getdisklabel(buf, lp)) { recursion--; return 0; } } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) { + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) { recursion--; return ERDLAB; } @@ -308,8 +311,8 @@ search_label(devp, off, buf, lp, off0) recursion--; return 0; } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) { + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) { recursion--; return ERDLAB; } @@ -382,9 +385,9 @@ devopen(of, name, file) ofdev.bsize = DEV_BSIZE; /* First try to find a disklabel without MBR partitions */ if (strategy(&ofdev, F_READ, - LABELSECTOR, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE || - getdisklabel(buf, &label)) { + LABELSECTOR, DEV_BSIZE, buf, &read) != 0 + || read != DEV_BSIZE + || getdisklabel(buf, &label)) { /* Else try MBR partitions */ error = read_mac_label(&ofdev, buf, &label); if (error == ERDLAB) { |