summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/stand
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-09-15 02:02:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-09-15 02:02:45 +0000
commit8c8e2c846f8262a3603ec796149262b47740ecae (patch)
tree34e49ae4689a6115c9c2cdaeebc102d194fddf67 /sys/arch/macppc/stand
parent6a5ac86b44e1672a17310a61c8331dafeca2e085 (diff)
KNF
Diffstat (limited to 'sys/arch/macppc/stand')
-rw-r--r--sys/arch/macppc/stand/Locore.c76
-rw-r--r--sys/arch/macppc/stand/boot.c15
-rw-r--r--sys/arch/macppc/stand/net.c16
-rw-r--r--sys/arch/macppc/stand/netif_of.c16
-rw-r--r--sys/arch/macppc/stand/ofdev.c43
5 files changed, 82 insertions, 84 deletions
diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c
index f14e9f878db..22ab798daee 100644
--- a/sys/arch/macppc/stand/Locore.c
+++ b/sys/arch/macppc/stand/Locore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: Locore.c,v 1.5 2002/03/15 18:19:52 millert Exp $ */
+/* $OpenBSD: Locore.c,v 1.6 2002/09/15 02:02:44 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,7 +142,8 @@ _rtt()
};
openfirmware(&args);
- while (1); /* just in case */
+ while (1)
+ ; /* just in case */
}
int
@@ -159,8 +160,8 @@ OF_finddevice(name)
"finddevice",
1,
1,
- };
-
+ };
+
args.device = name;
if (openfirmware(&args) == -1)
return -1;
@@ -182,7 +183,7 @@ OF_instance_to_package(ihandle)
1,
1,
};
-
+
args.ihandle = ihandle;
if (openfirmware(&args) == -1)
return -1;
@@ -210,7 +211,7 @@ OF_getprop(handle, prop, buf, buflen)
4,
1,
};
-
+
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@@ -242,7 +243,7 @@ OF_setprop(handle, prop, buf, len)
4,
1,
};
-
+
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@@ -268,7 +269,7 @@ OF_open(dname)
1,
1,
};
-
+
args.dname = dname;
if (openfirmware(&args) == -1)
return -1;
@@ -289,7 +290,7 @@ OF_close(handle)
1,
0,
};
-
+
args.handle = handle;
openfirmware(&args);
}
@@ -368,7 +369,7 @@ OF_seek(handle, pos)
3,
1,
};
-
+
args.handle = handle;
args.poshi = (int)(pos >> 32);
args.poslo = (int)pos;
@@ -434,7 +435,7 @@ OF_release(virt, size)
2,
0,
};
-
+
args.virt = virt;
args.size = size;
openfirmware(&args);
@@ -453,7 +454,7 @@ OF_milliseconds()
0,
1,
};
-
+
openfirmware(&args);
return args.ms;
}
@@ -555,11 +556,12 @@ 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 1c1dacd881e..192771e9db7 100644
--- a/sys/arch/macppc/stand/boot.c
+++ b/sys/arch/macppc/stand/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.6 2002/08/13 02:05:56 drahn Exp $ */
+/* $OpenBSD: boot.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */
/*
@@ -55,7 +55,6 @@
#include <lib/libsa/stand.h>
#include <lib/libsa/loadfile.h>
-
#include <machine/cpu.h>
#include <macppc/stand/ofdev.h>
@@ -71,7 +70,7 @@ prom2boot(dev)
char *dev;
{
char *cp, *lp = 0;
-
+
for (cp = dev; *cp; cp++)
if (*cp == ':')
lp = cp;
@@ -109,7 +108,7 @@ parseargs(str, howtop)
}
if (!*cp)
return;
-
+
*cp++ = 0;
while (*cp) {
switch (*cp++) {
@@ -175,15 +174,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 22b1618d6bc..555f95a18cf 100644
--- a/sys/arch/macppc/stand/net.c
+++ b/sys/arch/macppc/stand/net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: net.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */
+/* $OpenBSD: net.c,v 1.2 2002/09/15 02:02:44 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 2ad3d3676a1..f055969e1b0 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.1 2001/09/01 15:39:02 drahn Exp $ */
+/* $OpenBSD: netif_of.c,v 1.2 2002/09/15 02:02:44 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 e6716211e35..5ded35dea90 100644
--- a/sys/arch/macppc/stand/ofdev.c
+++ b/sys/arch/macppc/stand/ofdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofdev.c,v 1.4 2002/09/06 01:17:12 drahn Exp $ */
+/* $OpenBSD: ofdev.c,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */
/* $NetBSD: ofdev.c,v 1.1 1997/04/16 20:29:20 thorpej Exp $ */
/*
@@ -204,9 +204,8 @@ 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;
@@ -225,9 +224,8 @@ 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;
@@ -238,10 +236,9 @@ 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;
}
@@ -278,8 +275,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)
@@ -288,20 +285,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;
}
@@ -311,8 +308,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;
}
@@ -385,9 +382,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) {