diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-15 17:50:17 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-15 17:50:17 +0000 |
commit | 056696fc91cc56e2f4bb535620fe8c1e5a637117 (patch) | |
tree | bf6af3a40fda17024bbee3d174b3a654646515d1 /sys | |
parent | f39c0b5cfde7ff48a9d49b8b4195ed2572c06a63 (diff) |
The ANSI/KNF trail continues. No binary differences.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/macppc/autoconf.c | 64 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/conf.c | 8 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/cpu.c | 10 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/db_interface.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/disksubr.c | 77 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/dma.c | 131 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 208 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mainbus.c | 32 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 29 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/ofw_machdep.c | 46 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/opendev.c | 30 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/openfirm.c | 51 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/random.c | 7 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/rbus_machdep.c | 20 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/wscons_machdep.c | 19 |
15 files changed, 245 insertions, 492 deletions
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c index b1eeb136526..d0a551404c4 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.11 2003/09/06 17:13:17 drahn Exp $ */ +/* $OpenBSD: autoconf.c,v 1.12 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 1996, 1997 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -37,7 +37,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.11 2003/09/06 17:13:17 drahn Exp $ + * $Id: autoconf.c,v 1.12 2003/10/15 17:50:16 drahn Exp $ */ /* @@ -136,8 +136,8 @@ diskconf() void swapconf() { - register struct swdevt *swp; - register int nblks; + struct swdevt *swp; + int nblks; for (swp = swdevt; swp->sw_dev != NODEV; swp++) { if (bdevsw[major(swp->sw_dev)].d_psize) { @@ -211,21 +211,20 @@ static struct nam2blk { }; int -findblkmajor(dv) - struct device *dv; +findblkmajor(struct device *dv) { char *name = dv->dv_xname; int i; for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i) - if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0) + if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == + 0) return (nam2blk[i].maj); return (-1); } char * -findblkname(maj) - int maj; +findblkname(int maj) { int i; @@ -236,12 +235,9 @@ findblkname(maj) } static struct device * -getdisk(str, len, defpart, devp) - char *str; - int len, defpart; - dev_t *devp; +getdisk(char *str, int len, int defpart, dev_t *devp) { - register struct device *dv; + struct device *dv; if ((dv = parsedisk(str, len, defpart, devp)) == NULL) { printf("use one of:"); @@ -265,8 +261,8 @@ parsedisk(str, len, defpart, devp) int len, defpart; dev_t *devp; { - register struct device *dv; - register char *cp, c; + struct device *dv; + char *cp, c; int majdev, part; if (len == 0) @@ -352,10 +348,8 @@ setroot() printf("boot device: lookup '%s' failed.\n", bootdev); boothowto |= RB_ASKNAME; /* Don't Panic :-) */ /* boothowto |= RB_SINGLE; */ - } - else { + } else printf("boot device: %s.\n", bootdv->dv_xname); - } if (boothowto & RB_ASKNAME) { for (;;) { @@ -395,9 +389,9 @@ setroot() * because swap must be on same device as root, for * network devices this is easy. */ - if (bootdv->dv_class == DV_IFNET) { + if (bootdv->dv_class == DV_IFNET) goto gotswap; - } + for (;;) { printf("swap device "); if (bootdv != NULL) @@ -458,8 +452,7 @@ gotswap: rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 0); nswapdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 1); dumpdev = nswapdev; - } - else { + } else { /* * Root and Swap are on net. */ @@ -525,9 +518,7 @@ gotswap: * find a device matching "name" and unit number */ struct device * -getdevunit(name, unit) - char *name; - int unit; +getdevunit(char *name, int unit) { struct device *dev = alldevs.tqh_first; char num[10], fullname[16]; @@ -542,10 +533,10 @@ getdevunit(name, unit) strlcpy(fullname, name, sizeof fullname); strlcat(fullname, num, sizeof fullname); - while (strcmp(dev->dv_xname, fullname) != 0) { + while (strcmp(dev->dv_xname, fullname) != 0) if ((dev = dev->dv_list.tqe_next) == NULL) return NULL; - } + return dev; } @@ -562,8 +553,7 @@ struct devmap { #define T_DISK 0x21 static struct devmap * -findtype(s) - char **s; +findtype(char **s) { static struct devmap devmap[] = { { "/pci@", NULL, T_BUS }, @@ -589,9 +579,9 @@ findtype(s) } dp++; } - if (dp->att == NULL) { + if (dp->att == NULL) printf("string [%s] not found\n", *s); - } + return(dp); } @@ -602,8 +592,7 @@ findtype(s) * '/pci/mac-io/ide/disk/bsd */ void -makebootdev(bp) - char *bp; +makebootdev(char *bp) { int unit; char *dev, *cp; @@ -611,9 +600,9 @@ makebootdev(bp) cp = bp; do { - while(*cp && *cp != '/') { + while(*cp && *cp != '/') cp++; - } + dp = findtype(&cp); if (!dp->att) { printf("Warning: boot device unrecognized: %s\n", bp); @@ -634,8 +623,7 @@ makebootdev(bp) } int -getpno(cp) - char **cp; +getpno(char **cp) { int val = 0; char *cx = *cp; diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c index 2943b3f124d..43b0aaf72b6 100644 --- a/sys/arch/macppc/macppc/conf.c +++ b/sys/arch/macppc/macppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.23 2003/06/27 16:57:14 nate Exp $ */ +/* $OpenBSD: conf.c,v 1.24 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -250,8 +250,7 @@ dev_t swapdev = makedev(1, 0); * Check whether dev is /dev/mem or /dev/kmem. */ int -iskmemdev(dev) - dev_t dev; +iskmemdev(dev_t dev) { return major(dev) == mem_no && minor(dev) < 2; } @@ -260,8 +259,7 @@ iskmemdev(dev) * Check whether dev is /dev/zero. */ int -iszerodev(dev) - dev_t dev; +iszerodev(dev_t dev) { return major(dev) == mem_no && minor(dev) == 12; } diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index 19fd81436de..a37f150ecdf 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.13 2003/07/02 21:30:13 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.14 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -100,10 +100,7 @@ cpumatch(parent, cfdata, aux) } void -cpuattach(parent, dev, aux) - struct device *parent; - struct device *dev; - void *aux; +cpuattach(struct device *parent, struct device *dev, void *aux) { unsigned int cpu, pvr, hid0; char name[32]; @@ -167,7 +164,7 @@ cpuattach(parent, dev, aux) if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 && !strcmp(name, "cpu") && OF_getprop(qhandle, "clock-frequency", - &clock_freq , sizeof clock_freq ) >= 0) + &clock_freq , sizeof clock_freq ) >= 0) { break; } @@ -210,6 +207,7 @@ cpuattach(parent, dev, aux) /* Disable BTIC on 7450 Rev 2.0 or earlier */ if (cpu == MPC7450 && (pvr & 0xffff) < 0x0200) hid0 &= ~HID0_BTIC; + break; } ppc_mthid0(hid0); diff --git a/sys/arch/macppc/macppc/db_interface.c b/sys/arch/macppc/macppc/db_interface.c index af15c6630e2..6d686390fbb 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.6 2002/09/15 09:01:58 deraadt Exp $ */ +/* $OpenBSD: db_interface.c,v 1.7 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ #include <sys/param.h> @@ -19,8 +19,7 @@ Debugger() } int -ddb_trap_glue(frame) - struct trapframe *frame; +ddb_trap_glue(struct trapframe *frame) { if (!(frame->srr1 & PSL_PR) && (frame->exc == EXC_TRC diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index 9a56d56f7ec..64e8a8eb855 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.7 2003/06/02 23:27:50 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.8 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -47,9 +47,7 @@ #define BOOT_MAGIC_OFF (DOSPARTOFF+NDOSPART*sizeof(struct dos_partition)) void -dk_establish(dk, dev) - struct disk *dk; - struct device *dev; +dk_establish(struct disk *dk, struct device *dev) { } @@ -73,12 +71,8 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - register struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition *dp = osdep->dosparts, *dp2; struct dkbad *bdp = &DKBAD(osdep); @@ -152,20 +146,16 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) if ((*s >= 'a') && (*s <= 'z')) *s = (*s - 'a' + 'A'); - if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) { + if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) { hfspartoff = part->pmPyPartStart; osdep->macparts[1] = *part; } /* currently we ignore all but HFS partitions */ - if (0 == strcmp(part->pmPartType, PART_TYPE_MAC)) { + if (strcmp(part->pmPartType, PART_TYPE_MAC) == 0) { pp->p_offset = part->pmPyPartStart; pp->p_size = part->pmPartBlkCnt; pp->p_fstype = FS_HFS; n++; -#if 0 - printf("found DPME HFS partition [%s], adding to fake\n", - part->pmPartName); -#endif } } lp->d_npartitions = MAXPARTITIONS; @@ -223,7 +213,8 @@ hfs_done: msg = "dos partition I/O error"; goto done; } - bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp)); + bcopy(bp->b_data + DOSPARTOFF, dp, + NDOSPART * sizeof(*dp)); if (ourpart == -1) { /* Search for our MBR partition */ @@ -245,17 +236,20 @@ hfs_done: if (ourpart == -1) goto donot; /* - * This is our MBR partition. need sector address - * for SCSI/IDE, cylinder for ESDI/ST506/RLL + * This is our MBR partition. + * need sector address * for SCSI/IDE, + * cylinder for ESDI/ST506/RLL */ dp2 = &dp[ourpart]; - dospartoff = get_le(&dp2->dp_start) + part_blkno; + dospartoff = get_le(&dp2->dp_start) + + part_blkno; cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); /* XXX build a temporary disklabel */ - lp->d_partitions[0].p_size = get_le(&dp2->dp_size); + lp->d_partitions[0].p_size = + get_le(&dp2->dp_size); lp->d_partitions[0].p_offset = - get_le(&dp2->dp_start) + part_blkno; + get_le(&dp2->dp_start) + part_blkno; if (lp->d_ntracks == 0) lp->d_ntracks = dp2->dp_ehd + 1; if (lp->d_nsectors == 0) @@ -353,7 +347,8 @@ donot: found_disklabel: for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); + dlp <= (struct disklabel *)(bp->b_data + + lp->d_secsize - sizeof(*dlp)); dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) { if (msg == NULL) @@ -422,13 +417,11 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - register struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, + struct cpu_disklabel *osdep) { - register int i; - register struct partition *opp, *npp; + int i; + struct partition *opp, *npp; /* sanity clause */ if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 || @@ -479,11 +472,8 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - register struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, + struct cpu_disklabel *osdep) { struct dos_partition *dp = osdep->dosparts, *dp2; struct buf *bp; @@ -536,13 +526,16 @@ writedisklabel(dev, strat, lp, osdep) NDOSPART * sizeof(*dp)); for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_OPENBSD) + if (get_le(&dp2->dp_size) && dp2->dp_typ == + DOSPTYP_OPENBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_FREEBSD) + if (get_le(&dp2->dp_size) && dp2->dp_typ == + DOSPTYP_FREEBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_NETBSD) + if (get_le(&dp2->dp_size) && dp2->dp_typ == + DOSPTYP_NETBSD) ourpart = i; if (ourpart != -1) { @@ -568,7 +561,8 @@ writedisklabel(dev, strat, lp, osdep) if ((error = biowait(bp)) != 0) goto done; for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); + dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - + sizeof(*dlp)); dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && dkcksum(dlp) == 0) { @@ -599,11 +593,8 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, osdep, wlabel) - struct buf *bp; - struct disklabel *lp; - struct cpu_disklabel *osdep; - int wlabel; +bounds_check_with_label(struct buf *bp, struct disklabel *lp, + struct cpu_disklabel *osdep, int wlabel) { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c index 0445eddb321..90479887d17 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.19 2003/06/02 18:14:16 jason Exp $ */ +/* $OpenBSD: dma.c,v 1.20 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -56,22 +56,17 @@ #include <machine/bus.h> int _dmamem_alloc_range( bus_dma_tag_t t, bus_size_t size, - bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, - int nsegs, int *rsegs, int flags, vm_offset_t low, vm_offset_t high); - + bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, + int nsegs, int *rsegs, int flags, vm_offset_t low, vm_offset_t high); +int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, + struct proc *, int, bus_addr_t *, int *, int); /* * Common function for DMA map creation. May be called by bus-specific * DMA map creation functions. */ int -_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp) - bus_dma_tag_t t; - bus_size_t size; - int nsegments; - bus_size_t maxsegsz; - bus_size_t boundary; - int flags; - bus_dmamap_t *dmamp; +_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, + bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp) { struct powerpc_bus_dmamap *map; void *mapstore; @@ -114,28 +109,17 @@ _dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp) * DMA map destruction functions. */ void -_dmamap_destroy(t, map) - bus_dma_tag_t t; - bus_dmamap_t map; +_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) { free(map, M_DEVBUF); } -int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, - struct proc *, int, bus_addr_t *, int *, int); int -_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first) - bus_dma_tag_t t; - bus_dmamap_t map; - void *buf; - bus_size_t buflen; - struct proc *p; - int flags; - bus_addr_t *lastaddrp; - int *segp; - int first; +_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf, + bus_size_t buflen, struct proc *p, int flags, bus_addr_t *lastaddrp, + int *segp, int first) { bus_size_t sgsize; bus_addr_t curaddr, lastaddr, baddr, bmask; @@ -222,13 +206,8 @@ _dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first) * be called by bus-specific DMA map load functions. */ int -_dmamap_load(t, map, buf, buflen, p, flags) - bus_dma_tag_t t; - bus_dmamap_t map; - void *buf; - bus_size_t buflen; - struct proc *p; - int flags; +_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, bus_size_t buflen, + struct proc *p, int flags) { bus_addr_t lastaddr; int seg, error; @@ -256,11 +235,8 @@ _dmamap_load(t, map, buf, buflen, p, flags) * Like _bus_dmamap_load(), but for mbufs. */ int -_dmamap_load_mbuf(t, map, m0, flags) - bus_dma_tag_t t; - bus_dmamap_t map; - struct mbuf *m0; - int flags; +_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0, + int flags) { bus_addr_t lastaddr; int seg, error, first; @@ -299,11 +275,7 @@ _dmamap_load_mbuf(t, map, m0, flags) * Like _bus_dmamap_load(), but for uios. */ int -_dmamap_load_uio(t, map, uio, flags) - bus_dma_tag_t t; - bus_dmamap_t map; - struct uio *uio; - int flags; +_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio, int flags) { bus_addr_t lastaddr; int seg, i, error, first; @@ -361,13 +333,8 @@ _dmamap_load_uio(t, map, uio, flags) * bus_dmamem_alloc(). */ int -_dmamap_load_raw(t, map, segs, nsegs, size, flags) - bus_dma_tag_t t; - bus_dmamap_t map; - bus_dma_segment_t *segs; - int nsegs; - bus_size_t size; - int flags; +_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs, + int nsegs, bus_size_t size, int flags) { if (nsegs > map->_dm_segcnt || size > map->_dm_size) return (EINVAL); @@ -399,9 +366,7 @@ _dmamap_load_raw(t, map, segs, nsegs, size, flags) * bus-specific DMA map unload functions. */ void -_dmamap_unload(t, map) - bus_dma_tag_t t; - bus_dmamap_t map; +_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map) { /* @@ -417,12 +382,8 @@ _dmamap_unload(t, map) * by bus-specific DMA map synchronization functions. */ void -_dmamap_sync(t, map, offset, len, op) - bus_dma_tag_t t; - bus_dmamap_t map; - bus_addr_t offset; - bus_size_t len; - int op; +_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, +bus_size_t len, int op) { /* Nothing to do here. */ @@ -433,13 +394,9 @@ _dmamap_sync(t, map, offset, len, op) * by bus-specific DMA memory allocation functions. */ int -_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags) - bus_dma_tag_t t; - bus_size_t size, alignment, boundary; - bus_dma_segment_t *segs; - int nsegs; - int *rsegs; - int flags; +_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, + bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, + int flags) { return (_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, flags, 0, 0xf0000000)); @@ -450,10 +407,7 @@ _dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags) * bus-specific DMA memory free functions. */ void -_dmamem_free(t, segs, nsegs) - bus_dma_tag_t t; - bus_dma_segment_t *segs; - int nsegs; +_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs) { struct vm_page *m; bus_addr_t addr; @@ -481,13 +435,8 @@ _dmamem_free(t, segs, nsegs) * bus-specific DMA memory map functions. */ int -_dmamem_map(t, segs, nsegs, size, kvap, flags) - bus_dma_tag_t t; - bus_dma_segment_t *segs; - int nsegs; - size_t size; - caddr_t *kvap; - int flags; +_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, + caddr_t *kvap, int flags) { vm_offset_t va; bus_addr_t addr; @@ -521,10 +470,7 @@ _dmamem_map(t, segs, nsegs, size, kvap, flags) * bus-specific DMA memory unmapping functions. */ void -_dmamem_unmap(t, kva, size) - bus_dma_tag_t t; - caddr_t kva; - size_t size; +_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) { #ifdef DIAGNOSTIC @@ -541,12 +487,8 @@ _dmamem_unmap(t, kva, size) * bus-specific DMA mmap(2)'ing functions. */ paddr_t -_dmamem_mmap(t, segs, nsegs, off, prot, flags) - bus_dma_tag_t t; - bus_dma_segment_t *segs; - int nsegs; - off_t off; - int prot, flags; +_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off, + int prot, int flags) { int i; @@ -581,16 +523,9 @@ _dmamem_mmap(t, segs, nsegs, off, prot, flags) * Called by DMA-safe memory allocation methods. */ int -_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, - flags, low, high) - bus_dma_tag_t t; - bus_size_t size, alignment, boundary; - bus_dma_segment_t *segs; - int nsegs; - int *rsegs; - int flags; - vm_offset_t low; - vm_offset_t high; +_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, + bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, + int flags, vm_offset_t low, vm_offset_t high) { vm_offset_t curaddr, lastaddr; struct vm_page *m; diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 00de6b0cace..041424d5763 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.56 2003/10/08 21:52:46 drahn Exp $ */ +/* $OpenBSD: machdep.c,v 1.57 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -164,6 +164,11 @@ void *ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, int level, int (*func)(void *), void *arg, char *name); int bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, bus_space_handle_t *bshp); +bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t size); +void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t size); + /* * Extent maps to manage I/O. Allocate storage for 8 regions in each, @@ -493,8 +498,7 @@ void ofw_dbg(char *str) void -install_extint(handler) - void (*handler)(void); +install_extint(void (*handler)(void)) { void extint(void); void extsize(void); @@ -550,9 +554,8 @@ cpu_startup() */ sz = MAXBSIZE * nbuf; if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(sz), - NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, - UVM_ADV_NORMAL, 0))) + NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, + UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0))) panic("cpu_startup: cannot allocate VM for buffers"); /* addr = (vaddr_t)buffers; @@ -616,8 +619,7 @@ cpu_startup() * Allocate space for system data structures. */ caddr_t -allocsys(v) - caddr_t v; +allocsys(caddr_t v) { #define valloc(name, type, num) \ v = (caddr_t)(((name) = (type *)v) + (num)) @@ -673,11 +675,8 @@ consinit() * Clear registers on exec */ void -setregs(p, pack, stack, retval) - struct proc *p; - struct exec_package *pack; - u_long stack; - register_t *retval; +setregs(struct proc *p, struct exec_package *pack, u_long stack, + register_t *retval) { u_int32_t newstack; u_int32_t pargs; @@ -704,12 +703,8 @@ setregs(p, pack, stack, retval) * Send a signal to process. */ void -sendsig(catcher, sig, mask, code, type, val) - sig_t catcher; - int sig, mask; - u_long code; - int type; - union sigval val; +sendsig(sig_t catcher, int sig, int mask, u_long code, int type, + union sigval val) { struct proc *p = curproc; struct trapframe *tf; @@ -733,6 +728,7 @@ sendsig(catcher, sig, mask, code, type, val) psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else fp = (struct sigframe *)tf->fixreg[1]; + fp = (struct sigframe *)((int)(fp - 1) & ~0xf); /* @@ -767,10 +763,7 @@ sendsig(catcher, sig, mask, code, type, val) * System call to cleanup state after a signal handler returns. */ int -sys_sigreturn(p, v, retval) - struct proc *p; - void *v; - register_t *retval; +sys_sigreturn(struct proc *p, void *v, register_t *retval) { struct sys_sigreturn_args /* { syscallarg(struct sigcontext *) sigcntxp; @@ -798,14 +791,8 @@ sys_sigreturn(p, v, retval) * None for now. */ int -cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) - int *name; - u_int namelen; - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; - struct proc *p; +cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, + size_t newlen, struct proc *p) { /* all sysctl names at this level are terminal */ if (namelen != 1) @@ -856,8 +843,7 @@ softtty() * Soft networking interrupts. */ void -softnet(isr) - int isr; +softnet(int isr) { #define DONETISR(flag, func) \ if (isr & (1 << flag))\ @@ -867,8 +853,7 @@ softnet(isr) } int -lcsplx(ipl) - int ipl; +lcsplx(int ipl) { int oldcpl; @@ -881,8 +866,7 @@ lcsplx(ipl) * Halt or reboot the machine after syncing/dumping according to howto. */ void -boot(howto) - int howto; +boot(int howto) { static int syncing; static char str[256]; @@ -1026,14 +1010,8 @@ int ppc_configed_intr_cnt = 0; struct intrhand ppc_configed_intr[MAX_PRECONF_INTR]; void * -ppc_intr_establish(lcv, ih, type, level, func, arg, name) - void *lcv; - pci_intr_handle_t ih; - int type; - int level; - int (*func)(void *); - void *arg; - char *name; +ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, int level, + int (*func)(void *), void *arg, char *name) { if (ppc_configed_intr_cnt < MAX_PRECONF_INTR) { ppc_configed_intr[ppc_configed_intr_cnt].ih_fun = func; @@ -1062,12 +1040,8 @@ ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish) /* BUS functions */ int -bus_space_map(t, bpa, size, cacheable, bshp) - bus_space_tag_t t; - bus_addr_t bpa; - bus_size_t size; - int cacheable; - bus_space_handle_t *bshp; +bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, + int cacheable, bus_space_handle_t *bshp) { int error; @@ -1077,10 +1051,9 @@ bus_space_map(t, bpa, size, cacheable, bshp) } bpa |= POWERPC_BUS_TAG_BASE(t); if ((error = extent_alloc_region(devio_ex, bpa, size, EX_NOWAIT | - (ppc_malloc_ok ? EX_MALLOCOK : 0)))) - { + (ppc_malloc_ok ? EX_MALLOCOK : 0)))) return error; - } + if ((bpa >= 0x80000000) && ((bpa+size) < 0xb0000000)) { if (segment8_a_mapped) { *bshp = bpa; @@ -1098,15 +1071,8 @@ bus_space_map(t, bpa, size, cacheable, bshp) } return 0; } -bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); -void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); bus_addr_t -bus_space_unmap_p(t, bsh, size) - bus_space_tag_t t; - bus_space_handle_t bsh; - bus_size_t size; +bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) { bus_addr_t paddr; @@ -1115,10 +1081,7 @@ bus_space_unmap_p(t, bsh, size) return paddr ; } void -bus_space_unmap(t, bsh, size) - bus_space_tag_t t; - bus_space_handle_t bsh; - bus_size_t size; +bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) { bus_addr_t sva; bus_size_t off, len; @@ -1140,10 +1103,9 @@ bus_space_unmap(t, bsh, size) } /* do not free memory which was stolen from the vm system */ if (ppc_malloc_ok && - ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS)) ) - { + ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS))) uvm_km_free(phys_map, sva, len); - } else { + else { pmap_remove(vm_map_pmap(phys_map), sva, sva+len); pmap_update(pmap_kernel()); } @@ -1152,11 +1114,8 @@ bus_space_unmap(t, bsh, size) vm_offset_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE; int -bus_mem_add_mapping(bpa, size, cacheable, bshp) - bus_addr_t bpa; - bus_size_t size; - int cacheable; - bus_space_handle_t *bshp; +bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, + bus_space_handle_t *bshp) { bus_addr_t vaddr; bus_addr_t spa, epa; @@ -1206,32 +1165,23 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) } int -bus_space_alloc(tag, rstart, rend, size, alignment, boundary, cacheable, addrp, handlep) - bus_space_tag_t tag; - bus_addr_t rstart, rend; - bus_size_t size, alignment, boundary; - int cacheable; - bus_addr_t *addrp; - bus_space_handle_t *handlep; +bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, + bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable, + bus_addr_t *addrp, bus_space_handle_t *handlep) { panic("bus_space_alloc: unimplemented"); } void -bus_space_free(tag, handle, size) - bus_space_tag_t tag; - bus_space_handle_t handle; - bus_size_t size; +bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size) { panic("bus_space_free: unimplemented"); } void * -mapiodev(pa, len) - paddr_t pa; - psize_t len; +mapiodev(paddr_t pa, psize_t len) { paddr_t spa; vaddr_t vaddr, va; @@ -1269,9 +1219,7 @@ mapiodev(pa, len) return (void *) (va+off); } void -unmapiodev(kva, p_size) - void *kva; - psize_t p_size; +unmapiodev(void *kva, psize_t p_size) { vaddr_t vaddr; int size; @@ -1304,10 +1252,9 @@ unmapiodev(kva, p_size) #define BUS_SPACE_COPY_N(BYTES,TYPE) \ void \ -__C(bus_space_copy_,BYTES)(v, h1, o1, h2, o2, c) \ - void *v; \ - bus_space_handle_t h1, h2; \ - bus_size_t o1, o2, c; \ +__C(bus_space_copy_,BYTES)(void *v, bus_space_handle_t h1, \ + bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, \ + bus_size_t c) \ { \ TYPE *src, *dst; \ int i; \ @@ -1315,43 +1262,33 @@ __C(bus_space_copy_,BYTES)(v, h1, o1, h2, o2, c) \ src = (TYPE *) (h1+o1); \ dst = (TYPE *) (h2+o2); \ \ - if (h1 == h2 && o2 > o1) { \ - for (i = c; i > 0; i--) { \ + if (h1 == h2 && o2 > o1) \ + for (i = c; i > 0; i--) \ dst[i] = src[i]; \ - } \ - } else { \ - for (i = 0; i < c; i++) { \ + else \ + for (i = 0; i < c; i++) \ dst[i] = src[i]; \ - } \ - } \ } BUS_SPACE_COPY_N(1,u_int8_t) BUS_SPACE_COPY_N(2,u_int16_t) BUS_SPACE_COPY_N(4,u_int32_t) void -bus_space_set_region_1(t, h, o, val, c) - bus_space_tag_t t; - bus_space_handle_t h; - u_int8_t val; - bus_size_t o, c; +bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, + u_int8_t val, bus_size_t c) { u_int8_t *dst; int i; dst = (u_int8_t *) (h+o); - for (i = 0; i < c; i++) { + for (i = 0; i < c; i++) dst[i] = val; - } } void -bus_space_set_region_2(t, h, o, val, c) - bus_space_tag_t t; - bus_space_handle_t h; - u_int16_t val; - bus_size_t o, c; +bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, + u_int16_t val, bus_size_t c) { u_int16_t *dst; int i; @@ -1360,16 +1297,12 @@ bus_space_set_region_2(t, h, o, val, c) if (t->bus_reverse) val = swap16(val); - for (i = 0; i < c; i++) { + for (i = 0; i < c; i++) dst[i] = val; - } } void -bus_space_set_region_4(t, h, o, val, c) - bus_space_tag_t t; - bus_space_handle_t h; - u_int32_t val; - bus_size_t o, c; +bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, + u_int32_t val, bus_size_t c) { u_int32_t *dst; int i; @@ -1378,19 +1311,14 @@ bus_space_set_region_4(t, h, o, val, c) if (t->bus_reverse) val = swap32(val); - for (i = 0; i < c; i++) { + for (i = 0; i < c; i++) dst[i] = val; - } } #define BUS_SPACE_READ_RAW_MULTI_N(BYTES,SHIFT,TYPE) \ void \ -__C(bus_space_read_raw_multi_,BYTES)(bst, h, o, dst, size) \ - bus_space_tag_t bst; \ - bus_space_handle_t h; \ - bus_addr_t o; \ - u_int8_t *dst; \ - bus_size_t size; \ +__C(bus_space_read_raw_multi_,BYTES)(bus_space_tag_t bst, \ + bus_space_handle_t h, bus_addr_t o, u_int8_t *dst, bus_size_t size) \ { \ TYPE *src; \ TYPE *rdst = (TYPE *)dst; \ @@ -1408,12 +1336,9 @@ BUS_SPACE_READ_RAW_MULTI_N(4,2,u_int32_t) #define BUS_SPACE_WRITE_RAW_MULTI_N(BYTES,SHIFT,TYPE) \ void \ -__C(bus_space_write_raw_multi_,BYTES)(bst, h, o, src, size) \ - bus_space_tag_t bst; \ - bus_space_handle_t h; \ - bus_addr_t o; \ - const u_int8_t *src; \ - bus_size_t size; \ +__C(bus_space_write_raw_multi_,BYTES)( bus_space_tag_t bst, \ + bus_space_handle_t h, bus_addr_t o, const u_int8_t *src, \ + bus_size_t size) \ { \ int i; \ TYPE *dst; \ @@ -1431,11 +1356,8 @@ BUS_SPACE_WRITE_RAW_MULTI_N(2,1,u_int16_t) BUS_SPACE_WRITE_RAW_MULTI_N(4,2,u_int32_t) int -bus_space_subregion(t, bsh, offset, size, nbshp) - bus_space_tag_t t; - bus_space_handle_t bsh; - bus_size_t offset, size; - bus_space_handle_t *nbshp; +bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp) { *nbshp = bsh + offset; return (0); @@ -1474,7 +1396,7 @@ kcopy(from, to, size) size_t size; { faultbuf env; - register void *oldh = curproc->p_addr->u_pcb.pcb_onfault; + void *oldh = curproc->p_addr->u_pcb.pcb_onfault; if (setfault(&env)) { curproc->p_addr->u_pcb.pcb_onfault = oldh; @@ -1487,9 +1409,7 @@ kcopy(from, to, size) } void -nameinterrupt(replace, newstr) - int replace; - char *newstr; +nameinterrupt(int replace, char *newstr) { #define NENTRIES 66 char intrname[NENTRIES][30]; diff --git a/sys/arch/macppc/macppc/mainbus.c b/sys/arch/macppc/macppc/mainbus.c index 31779718616..ca9f61b1f63 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.7 2002/09/15 09:01:58 deraadt Exp $ */ +/* $OpenBSD: mainbus.c,v 1.8 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -59,10 +59,7 @@ int mb_matchname(struct confargs *, char *); /*ARGSUSED*/ static int -mbmatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; +mbmatch(struct device *parent, void *cfdata, void *aux) { /* @@ -72,10 +69,7 @@ mbmatch(parent, cfdata, aux) } static void -mbattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; +mbattach(struct device *parent, struct device *self, void *aux) { struct mainbus_softc *sc = (struct mainbus_softc *)self; struct confargs nca; @@ -151,9 +145,7 @@ mbattach(parent, self, aux) } static int -mbprint(aux, pnp) - void *aux; - const char *pnp; +mbprint(void *aux, const char *pnp) { if (pnp) return (QUIET); @@ -161,33 +153,25 @@ mbprint(aux, pnp) } void -mb_intr_establish(ca, handler, val) - struct confargs *ca; - int (*handler)(void *); - void *val; +mb_intr_establish(struct confargs *ca, int (*handler)(void *), void *val) { panic("can never mb_intr_establish"); } void -mb_intr_disestablish(ca) - struct confargs *ca; +mb_intr_disestablish(struct confargs *ca) { panic("can never mb_intr_disestablish"); } caddr_t -mb_cvtaddr(ca) - struct confargs *ca; +mb_cvtaddr(struct confargs *ca) { - return (NULL); } int -mb_matchname(ca, name) - struct confargs *ca; - char *name; +mb_matchname(struct confargs *ca, char *name) { return (strcmp(name, ca->ca_name) == 0); } diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 4b02cfcae85..ba285b7d6df 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.10 2003/08/15 20:32:13 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.11 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -63,10 +63,7 @@ extern int allowaperture; /*ARGSUSED*/ int -mmopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +mmopen(dev_t dev, int flag, int mode, struct proc *p) { switch (minor(dev)) { @@ -94,10 +91,7 @@ mmopen(dev, flag, mode, p) /*ARGSUSED*/ int -mmclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +mmclose(dev_t dev, int flag, int mode, struct proc *p) { #ifdef APERTURE if (minor(dev) == 4) @@ -108,10 +102,7 @@ mmclose(dev, flag, mode, p) /*ARGSUSED*/ int -mmrw(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; +mmrw(dev_t dev, struct uio *uio, int flags) { vm_offset_t v; vm_size_t c; @@ -183,22 +174,14 @@ mmrw(dev, uio, flags) } paddr_t -mmmmap(dev, off, prot) - dev_t dev; - off_t off; - int prot; +mmmmap(dev_t dev, off_t off, int prot) { return (-1); } /*ARGSUSED*/ int -mmioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) { return (EOPNOTSUPP); } diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index d2017b84bd0..4b0b14f2e84 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.19 2003/07/02 21:30:13 drahn Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.20 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -88,8 +88,7 @@ static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; * to provide space for two additional entry beyond the terminating one. */ void -ofw_mem_regions(memp, availp) - struct mem_region **memp, **availp; +ofw_mem_regions(struct mem_region **memp, struct mem_region **availp) { int phandle; @@ -98,17 +97,18 @@ ofw_mem_regions(memp, availp) */ if ((phandle = OF_finddevice("/memory")) == -1 || OF_getprop(phandle, "reg", - OFmem, sizeof OFmem[0] * OFMEM_REGIONS) - <= 0 + OFmem, sizeof OFmem[0] * OFMEM_REGIONS) <= 0 || OF_getprop(phandle, "available", - OFavail, sizeof OFavail[0] * OFMEM_REGIONS) - <= 0) + OFavail, sizeof OFavail[0] * OFMEM_REGIONS) <= 0) panic("no memory?"); + *memp = OFmem; + /* HACK */ if (OFmem[0].size == 0) { *memp = OFavail; } + *availp = OFavail; } @@ -136,6 +136,7 @@ static struct { vm_offset_t pa; int mode; } ofw_mapping[256]; + int save_ofw_mapping() { @@ -149,11 +150,13 @@ save_ofw_mapping() 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) { return 0; } + if (stdout == 0) { /* If the screen is to be console, but not active, open it */ stdout = OF_open("screen"); @@ -307,9 +310,7 @@ static pcitag_t ofw_make_tag( void *cpv, int bus, int dev, int fnc); /* ARGSUSED */ static pcitag_t -ofw_make_tag(cpv, bus, dev, fnc) - void *cpv; - int bus, dev, fnc; +ofw_make_tag(void *cpv, int bus, int dev, int fnc) { return (bus << 16) | (dev << 11) | (fnc << 8); } @@ -600,8 +601,7 @@ of_display_console() } void -of_setbrightness(brightness) - int brightness; +of_setbrightness(int brightness) { #if NVGAFB_PCI > 0 @@ -615,7 +615,10 @@ of_setbrightness(brightness) cons_brightness = brightness; - /* The OF method is called "set-contrast" but affects brightness. Don't ask. */ + /* + * The OF method is called "set-contrast" but affects brightness. + * Don't ask. + */ OF_call_method_1("set-contrast", cons_display_ofh, 1, cons_brightness); /* XXX this routine should also save the brightness settings in the nvram */ @@ -630,29 +633,24 @@ cons_decl(ofw); * Console support functions */ void -ofwcnprobe(cd) - struct consdev *cd; +ofwcnprobe(struct consdev *cd) { cd->cn_pri = CN_DEAD; } void -ofwcninit(cd) - struct consdev *cd; +ofwcninit(struct consdev *cd) { } void -ofwcnputc(dev, c) - dev_t dev; - int c; +ofwcnputc(dev_t dev, int c) { char ch = c; OF_write(OF_stdout, &ch, 1); } int -ofwcngetc(dev) - dev_t dev; +ofwcngetc(dev_t dev) { unsigned char ch = '\0'; int l; @@ -664,9 +662,7 @@ ofwcngetc(dev) } void -ofwcnpollc(dev, on) - dev_t dev; - int on; +ofwcnpollc(dev_t dev, int on) { } diff --git a/sys/arch/macppc/macppc/opendev.c b/sys/arch/macppc/macppc/opendev.c index aa072a95b03..c18cbe30ec3 100644 --- a/sys/arch/macppc/macppc/opendev.c +++ b/sys/arch/macppc/macppc/opendev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendev.c,v 1.5 2002/03/15 18:19:52 millert Exp $ */ +/* $OpenBSD: opendev.c,v 1.6 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -43,8 +43,7 @@ extern void ofw_stack(void); extern void ofbcopy(const void *, void *, size_t); int -OF_instance_to_package(ihandle) - int ihandle; +OF_instance_to_package(int ihandle) { static struct { char *name; @@ -66,10 +65,7 @@ OF_instance_to_package(ihandle) } int -OF_package_to_path(phandle, buf, buflen) - int phandle; - char *buf; - int buflen; +OF_package_to_path(int phandle, char *buf, int buflen) { static struct { char *name; @@ -176,8 +172,7 @@ OF_call_method_1(char *method, int ihandle, int nargs, ...) } int -OF_open(dname) - char *dname; +OF_open(char *dname) { static struct { char *name; @@ -203,8 +198,7 @@ OF_open(dname) } void -OF_close(handle) - int handle; +OF_close(int handle) { static struct { char *name; @@ -226,10 +220,7 @@ OF_close(handle) * This assumes that character devices don't read in multiples of PAGE_SIZE. */ int -OF_read(handle, addr, len) - int handle; - void *addr; - int len; +OF_read(int handle, void *addr, int len) { static struct { char *name; @@ -270,10 +261,7 @@ OF_read(handle, addr, len) } int -OF_write(handle, addr, len) - int handle; - void *addr; - int len; +OF_write(int handle, void *addr, int len) { static struct { char *name; @@ -306,9 +294,7 @@ OF_write(handle, addr, len) } int -OF_seek(handle, pos) - int handle; - u_quad_t pos; +OF_seek(int handle, u_quad_t pos) { static struct { char *name; diff --git a/sys/arch/macppc/macppc/openfirm.c b/sys/arch/macppc/macppc/openfirm.c index fdc355175d3..75e7d01b44b 100644 --- a/sys/arch/macppc/macppc/openfirm.c +++ b/sys/arch/macppc/macppc/openfirm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.c,v 1.4 2002/09/15 09:01:58 deraadt Exp $ */ +/* $OpenBSD: openfirm.c,v 1.5 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -43,8 +43,7 @@ extern void ofw_stack(void); extern void ofbcopy(const void *, void *, size_t); int -OF_peer(phandle) - int phandle; +OF_peer(int phandle) { static struct { char *name; @@ -57,7 +56,7 @@ OF_peer(phandle) 1, 1, }; - + ofw_stack(); args.phandle = phandle; if (openfirmware(&args) == -1) @@ -66,8 +65,7 @@ OF_peer(phandle) } int -OF_child(phandle) - int phandle; +OF_child(int phandle) { static struct { char *name; @@ -80,7 +78,7 @@ OF_child(phandle) 1, 1, }; - + ofw_stack(); args.phandle = phandle; if (openfirmware(&args) == -1) @@ -89,8 +87,7 @@ OF_child(phandle) } int -OF_parent(phandle) - int phandle; +OF_parent(int phandle) { static struct { char *name; @@ -103,7 +100,7 @@ OF_parent(phandle) 1, 1, }; - + ofw_stack(); args.phandle = phandle; if (openfirmware(&args) == -1) @@ -112,11 +109,7 @@ OF_parent(phandle) } int -OF_getprop(handle, prop, buf, buflen) - int handle; - char *prop; - void *buf; - int buflen; +OF_getprop(int handle, char *prop, void *buf, int buflen) { static struct { char *name; @@ -153,10 +146,10 @@ OF_interpret(char *cmd, int nreturns, ...) va_list ap; int i; static struct { - char *name; + char *name; int nargs; int nreturns; - char *cmd; + char *cmd; int status; int results[8]; } args = { @@ -185,8 +178,7 @@ OF_interpret(char *cmd, int nreturns, ...) int -OF_finddevice(name) - char *name; +OF_finddevice(char *name) { static struct { char *name; @@ -198,7 +190,7 @@ OF_finddevice(name) "finddevice", 1, 1, - }; + }; ofw_stack(); args.device = name; @@ -209,8 +201,7 @@ OF_finddevice(name) static void OF_rboot(char *bootspec); static void -OF_rboot(bootspec) - char *bootspec; +OF_rboot(char *bootspec) { static struct { char *name; @@ -222,7 +213,7 @@ OF_rboot(bootspec) 0, }; int l; - + if ((l = strlen(bootspec)) >= NBPG) panic("OF_boot"); ofw_stack(); @@ -232,8 +223,7 @@ OF_rboot(bootspec) void -OF_boot(bootspec) - char *bootspec; +OF_boot(char *bootspec) { OF_rboot(bootspec); printf ("OF_boot returned!"); /* just in case */ @@ -262,18 +252,15 @@ OF_exit() /* XXX What is the reason to have this instead of bcopy/memcpy? */ void -ofbcopy(src, dst, len) - const void *src; - void *dst; - size_t len; +ofbcopy(const void *src, void *dst, size_t len) { const char *sp = src; char *dp = dst; if (src == dst) - return; - - while (len-- > 0) + return; + + while (len-- > 0) *dp++ = *sp++; } diff --git a/sys/arch/macppc/macppc/random.c b/sys/arch/macppc/macppc/random.c index d016e6c5793..5f684701b16 100644 --- a/sys/arch/macppc/macppc/random.c +++ b/sys/arch/macppc/macppc/random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: random.c,v 1.1 2001/09/01 15:44:20 drahn Exp $ */ +/* $OpenBSD: random.c,v 1.2 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 1990,1993 The Regents of the University of California. @@ -79,10 +79,9 @@ random() value = 16807 * _randseed; p = value & (long long) (0xffffffff); q = (value >> 32) & (long long) (0xffffffff); - if (((long long) p + q) < 0x3fffffff) { + if (((long long) p + q) < 0x3fffffff) _randseed = p + q; - } else { + else _randseed = (int)(((long long)p + q ) & 0x3ffffffe) +1; - } return _randseed; } diff --git a/sys/arch/macppc/macppc/rbus_machdep.c b/sys/arch/macppc/macppc/rbus_machdep.c index a8a609a02cc..e44ece92498 100644 --- a/sys/arch/macppc/macppc/rbus_machdep.c +++ b/sys/arch/macppc/macppc/rbus_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rbus_machdep.c,v 1.3 2002/09/15 09:01:58 deraadt Exp $ */ +/* $OpenBSD: rbus_machdep.c,v 1.4 2003/10/15 17:50:16 drahn Exp $ */ /* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */ /* @@ -58,9 +58,7 @@ void macppc_cardbus_init(pci_chipset_tag_t pc, pcitag_t tag); #define RBUS_MEM_SIZE 0x10000000 rbus_tag_t -rbus_pccbb_parent_mem(self, pa) - struct device *self; - struct pci_attach_args *pa; +rbus_pccbb_parent_mem(struct device *self, struct pci_attach_args *pa) { bus_addr_t start; bus_size_t size; @@ -69,7 +67,8 @@ rbus_pccbb_parent_mem(self, pa) macppc_cardbus_init(pa->pa_pc, pa->pa_tag); size = RBUS_MEM_SIZE; - if ((ex = pciaddr_search(PCIADDR_SEARCH_MEM, self, &start, size)) == NULL) + if ((ex = pciaddr_search(PCIADDR_SEARCH_MEM, self, &start, size)) == + NULL) { /* XXX */ printf("failed\n"); @@ -85,9 +84,7 @@ rbus_pccbb_parent_mem(self, pa) #define RBUS_IO_SIZE 0x1000 rbus_tag_t -rbus_pccbb_parent_io(self, pa) - struct device *self; - struct pci_attach_args *pa; +rbus_pccbb_parent_io(struct device *self, struct pci_attach_args *pa) { struct extent *ex; bus_addr_t start; @@ -95,7 +92,8 @@ rbus_pccbb_parent_io(self, pa) size = RBUS_IO_SIZE; - if ((ex = pciaddr_search(PCIADDR_SEARCH_IO, self, &start, size)) == NULL) + if ((ex = pciaddr_search(PCIADDR_SEARCH_IO, self, &start, size)) == + NULL) { /* XXX */ printf("failed\n"); @@ -109,9 +107,7 @@ rbus_pccbb_parent_io(self, pa) * Big ugly hack to enable bridge/fix interrupts */ void -macppc_cardbus_init(pc, tag) - pci_chipset_tag_t pc; - pcitag_t tag; +macppc_cardbus_init(pci_chipset_tag_t pc, pcitag_t tag) { u_int x; static int initted = 0; diff --git a/sys/arch/macppc/macppc/wscons_machdep.c b/sys/arch/macppc/macppc/wscons_machdep.c index ee2f8a3366a..54e26ad33f7 100644 --- a/sys/arch/macppc/macppc/wscons_machdep.c +++ b/sys/arch/macppc/macppc/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.3 2003/06/04 19:36:33 deraadt Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.4 2003/10/15 17:50:16 drahn Exp $ */ /* * Copyright (c) 2001 Aaron Campbell @@ -50,8 +50,7 @@ int wscngetc(dev_t); void wscnpollc(dev_t, int); void -wscnprobe(cp) - struct consdev *cp; +wscnprobe(struct consdev *cp) { int maj; @@ -71,31 +70,25 @@ wscnprobe(cp) } void -wscninit(cp) - struct consdev *cp; +wscninit(struct consdev *cp) { return; } void -wscnputc(dev, i) - dev_t dev; - char i; +wscnputc(dev_t dev, char i) { wsdisplay_cnputc(dev, (int)i); } int -wscngetc(dev) - dev_t dev; +wscngetc(dev_t dev) { return (wskbd_cngetc(dev)); } void -wscnpollc(dev, on) - dev_t dev; - int on; +wscnpollc(dev_t dev, int on) { wskbd_cnpollc(dev, on); } |