Cosmetics.

This commit is contained in:
tsutsui 2002-03-29 15:15:07 +00:00
parent ecb9aca3ae
commit a59e9106d6
6 changed files with 61 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: Locore.c,v 1.9 2001/09/24 13:22:32 wiz Exp $ */
/* $NetBSD: Locore.c,v 1.10 2002/03/29 15:15:07 tsutsui Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -161,8 +161,8 @@ OF_finddevice(name)
"finddevice",
1,
1,
};
};
args.device = name;
if (openfirmware(&args) == -1)
return -1;
@ -184,7 +184,7 @@ OF_instance_to_package(ihandle)
1,
1,
};
args.ihandle = ihandle;
if (openfirmware(&args) == -1)
return -1;
@ -212,7 +212,7 @@ OF_getprop(handle, prop, buf, buflen)
4,
1,
};
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@ -244,7 +244,7 @@ OF_setprop(handle, prop, buf, len)
4,
1,
};
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@ -270,7 +270,7 @@ OF_open(dname)
1,
1,
};
#ifdef OFW_DEBUG
printf("OF_open(%s) -> ", dname);
#endif
@ -302,7 +302,7 @@ OF_close(handle)
1,
0,
};
#ifdef OFW_DEBUG
printf("OF_close(%d)\n", handle);
#endif
@ -408,7 +408,7 @@ OF_seek(handle, pos)
3,
1,
};
#ifdef OFW_DEBUG
printf("OF_seek(%d, %x, %x) -> ", handle, (int)(pos >> 32), (int)pos);
#endif
@ -481,7 +481,7 @@ OF_release(virt, size)
2,
0,
};
#ifdef OFW_DEBUG
printf("OF_release(%x, %x)\n", virt, size);
#endif
@ -503,7 +503,7 @@ OF_milliseconds()
0,
1,
};
openfirmware(&args);
return args.ms;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.13 2001/08/23 14:17:27 tsubai Exp $ */
/* $NetBSD: boot.c,v 1.14 2002/03/29 15:15:07 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -114,7 +114,7 @@ prom2boot(dev)
char *dev;
{
char *cp;
cp = dev + strlen(dev) - 1;
for (; *cp; cp--) {
if (*cp == ':') {
@ -218,9 +218,7 @@ main()
ofw_version = *cp - '0';
break;
}
#if 0
printf(">> Open Firmware version %d.x\n", ofw_version);
#endif
DPRINTF(">> Open Firmware version %d.x\n", ofw_version);
}
/*
@ -307,7 +305,7 @@ loaded:
entry = marks[MARK_ENTRY];
ssym = (void *)marks[MARK_SYM];
esym = (void *)marks[MARK_END];
printf(" start=0x%x\n", entry);
__syncicache((void *)entry, (u_int)ssym - (u_int)entry);
chain((void *)entry, bootline, ssym, esym);

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.2 1999/05/07 16:19:28 drochner Exp $ */
/* $NetBSD: net.c,v 1.3 2002/03/29 15:15:07 tsutsui Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank.
@ -77,7 +77,7 @@ net_open(op)
struct of_dev *op;
{
int error = 0;
/*
* On first open, do netif open, mount, etc.
*/
@ -120,21 +120,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)
@ -144,7 +144,7 @@ net_mountroot()
printf("\n");
#endif
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
/*
* Get the NFS file handle (mount).
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_of.c,v 1.4 2001/07/22 11:29:48 wiz Exp $ */
/* $NetBSD: netif_of.c,v 1.5 2002/03/29 15:15:07 tsutsui Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank.
@ -76,7 +76,7 @@ netif_open(machdep_hint)
struct iodesc *io;
int fd, error;
char addr[32];
#ifdef NETIF_DEBUG
printf("netif_open...");
#endif
@ -93,7 +93,7 @@ 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 &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofdev.c,v 1.7 2001/08/13 15:38:11 tsubai Exp $ */
/* $NetBSD: ofdev.c,v 1.8 2002/03/29 15:15:08 tsutsui Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -59,34 +59,42 @@ filename(str, ppart)
char savec;
int dhandle;
char devtype[16];
lp = str;
devtype[0] = 0;
*ppart = 0;
for (cp = str; *cp; lp = cp) {
/* For each component of the path name... */
while (*++cp && *cp != '/');
while (*++cp && *cp != '/')
;
savec = *cp;
*cp = 0;
/* ...look whether there is a device with this name */
dhandle = OF_finddevice(str);
*cp = savec;
if (dhandle == -1) {
/* if not, lp is the delimiter between device and path */
/*
* if not, lp is the delimiter between device and path
*/
/* if the last component was a block device... */
if (!strcmp(devtype, "block")) {
/* search for arguments */
for (cp = lp;
--cp >= str && *cp != '/' && *cp != ':';);
--cp >= str && *cp != '/' && *cp != ':';)
;
if (cp >= str && *cp == ':') {
/* found arguments */
for (cp = lp; *--cp != ':' && *cp != ',';);
if (*++cp >= 'a' && *cp <= 'a' + MAXPARTITIONS)
for (cp = lp;
*--cp != ':' && *cp != ',';)
;
if (*++cp >= 'a' &&
*cp <= 'a' + MAXPARTITIONS)
*ppart = *cp;
}
}
return lp;
} else if (OF_getprop(dhandle, "device_type", devtype, sizeof devtype) < 0)
} else if (OF_getprop(dhandle, "device_type", devtype,
sizeof devtype) < 0)
devtype[0] = 0;
}
return 0;
@ -104,14 +112,14 @@ strategy(devdata, rw, blk, size, buf, rsize)
struct of_dev *dev = devdata;
u_quad_t pos;
int n;
if (rw != F_READ)
return EPERM;
if (dev->type != OFDEV_DISK)
panic("strategy");
pos = (u_quad_t)(blk + dev->partoff) * dev->bsize;
for (;;) {
if (OF_seek(dev->handle, pos) < 0)
break;
@ -131,7 +139,7 @@ devclose(of)
struct open_file *of;
{
struct of_dev *op = of->f_devdata;
if (op->type == OFDEV_NET)
net_close(op);
OF_call_method("dma-free", op->handle, 2, 0, op->dmabuf, MAXPHYS);
@ -177,7 +185,7 @@ get_long(p)
const void *p;
{
const unsigned char *cp = p;
return cp[0] | (cp[1] << 8) | (cp[2] << 16) | (cp[3] << 24);
}
@ -197,11 +205,11 @@ search_label(devp, off, buf, lp, off0)
int i;
u_long poff;
static int recursion;
if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read)
|| read != DEV_BSIZE)
return ERDLAB;
if (buf[510] != 0x55 || buf[511] != 0xaa)
return ERDLAB;
@ -296,7 +304,10 @@ devopen(of, name, file)
return ENXIO;
#if 0
if (!strcmp(buf, "block"))
/* For block devices, indicate raw partition (:0 in OpenFirmware) */
/*
* For block devices, indicate raw partition
* (:0 in OpenFirmware)
*/
strcat(fname, ":0");
#endif
if ((handle = OF_open(fname)) == -1)
@ -321,7 +332,10 @@ devopen(of, name, file)
if (error == ERDLAB) {
if (partition)
/* User specified a parititon, but there is none */
/*
* User specified a parititon,
* but there is none
*/
goto bad;
/* No, label, just use complete disk */
ofdev.partoff = 0;
@ -329,7 +343,7 @@ devopen(of, name, file)
part = partition ? partition - 'a' : 0;
ofdev.partoff = label.d_partitions[part].p_offset;
}
of->f_dev = devsw;
of->f_devdata = &ofdev;
file_system[0] = file_system_ufs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */
/* $NetBSD: openfirm.h,v 1.2 2002/03/29 15:15:08 tsutsui Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -52,5 +52,6 @@ int OF_seek __P((int handle, u_quad_t pos));
void *OF_claim __P((void *virt, u_int size, u_int align));
void OF_release __P((void *virt, u_int size));
int OF_milliseconds __P((void));
void OF_chain __P((void *addr, u_int size, void (*entry)(), void *parm, u_int parmlen));
void OF_chain __P((void *addr, u_int size, void (*entry)(), void *parm,
u_int parmlen));