diff options
Diffstat (limited to 'sys/arch/macppc')
50 files changed, 875 insertions, 928 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c index ed6bd866dc0..16c506ced21 100644 --- a/sys/arch/macppc/dev/adb.c +++ b/sys/arch/macppc/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.5 2002/06/07 07:14:48 miod Exp $ */ +/* $OpenBSD: adb.c,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */ /*- @@ -60,7 +60,7 @@ int adbprint(void *, const char *); /* * Global variables. */ -int adb_polling; /* Are we polling? (Debugger mode) */ +int adb_polling; /* Are we polling? (Debugger mode) */ #ifdef ADB_DEBUG int adb_debug; /* Output debugging messages */ #endif /* ADB_DEBUG */ @@ -100,7 +100,7 @@ adbmatch(parent, cf, aux) /* HACK ALERT */ 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); extern time_read_t *time_read; @@ -158,9 +158,8 @@ adbattach(parent, self, aux) printf(": via-pmu "); break; } - + printf("%d targets\n", totaladbs); - #if NAED > 0 /* ADB event device for compatibility */ @@ -209,7 +208,7 @@ adbprint(args, name) /* print out what kind of ADB device we have found */ printf("%s addr %d: ", name, aa_args->adbaddr); - switch(aa_args->origaddr) { + switch (aa_args->origaddr) { #ifdef DIAGNOSTIC #if NAED > 0 case 0: @@ -264,7 +263,7 @@ adbprint(args, name) #endif /* DIAGNOSTIC */ } } else /* a device matched and was configured */ - printf(" addr %d: ", aa_args->adbaddr); + printf(" addr %d: ", aa_args->adbaddr); return rv; } diff --git a/sys/arch/macppc/dev/adb_direct.c b/sys/arch/macppc/dev/adb_direct.c index 81592db50bb..e962b05ff5b 100644 --- a/sys/arch/macppc/dev/adb_direct.c +++ b/sys/arch/macppc/dev/adb_direct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb_direct.c,v 1.5 2002/06/07 07:14:48 miod Exp $ */ +/* $OpenBSD: adb_direct.c,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */ /* @@ -36,25 +36,25 @@ * to clean it up as much as I would like. * But it works, so I'm happy. :-) jpw */ - + /* * TO DO: * - We could reduce the time spent in the adb_intr_* routines - * by having them save the incoming and outgoing data directly + * by having them save the incoming and outgoing data directly * in the adbInbound and adbOutbound queues, as it would reduce * the number of times we need to copy the data around. It * would also make the code more readable and easier to follow. - * - (Related to above) Use the header part of adbCommand to + * - (Related to above) Use the header part of adbCommand to * reduce the number of copies we have to do of the data. * - (Related to above) Actually implement the adbOutbound queue. * This is fairly easy once you switch all the intr routines * over to using adbCommand structs directly. * - There is a bug in the state machine of adb_intr_cuda * code that causes hangs, especially on 030 machines, probably - * because of some timing issues. Because I have been unable to - * determine the exact cause of this bug, I used the timeout function - * to check for and recover from this condition. If anyone finds - * the actual cause of this bug, the calls to timeout and the + * because of some timing issues. Because I have been unable to + * determine the exact cause of this bug, I used the timeout function + * to check for and recover from this condition. If anyone finds + * the actual cause of this bug, the calls to timeout and the * adb_cuda_tickle routine can be removed. */ @@ -154,7 +154,7 @@ struct adbCmdHoldEntry { }; /* - * Eventually used for two separate queues, the queue between + * Eventually used for two separate queues, the queue between * the upper and lower halves, and the outgoing packet queue. * TO DO: adbCommand can replace all of adbCmdHoldEntry eventually */ @@ -364,7 +364,7 @@ switch_start: */ /* set up data for adb_pass_up */ memcpy(packet.data, adbInputBuffer, adbInputBuffer[0] + 1); - + if ((adbWaiting == 1) && (adbInputBuffer[4] == adbWaitingCmd) && ((adbInputBuffer[2] == 0x00) || @@ -596,8 +596,8 @@ send_adb_cuda(u_char * in, u_char * buffer, void *compRout, void *data, int if ((s & (1 << 18)) || adb_polling) /* XXX were VIA1 interrupts blocked ? */ /* poll until byte done */ - while ((adbActionState != ADB_ACTION_IDLE) || (ADB_INTR_IS_ON) - || (adbWaiting == 1)) + while ((adbActionState != ADB_ACTION_IDLE) || + (ADB_INTR_IS_ON) || (adbWaiting == 1)) if (ADB_SR_INTR_IS_ON) { /* wait for "interrupt" */ adb_intr_cuda(); /* process it */ adb_soft_intr(); @@ -627,7 +627,7 @@ adb_intr(void *arg) } -/* +/* * adb_pass_up is called by the interrupt-time routines. * It takes the raw packet data that was received from the * device and puts it into the queue that the upper half @@ -635,7 +635,7 @@ adb_intr(void *arg) * will eventually call the upper half routine (adb_soft_intr). * * If in->unsol is 0, then this is either the notification - * that the packet was sent (on a LISTEN, for example), or the + * that the packet was sent (on a LISTEN, for example), or the * response from the device (on a TALK). The completion routine * is called only if the user specified one. * @@ -730,14 +730,14 @@ adb_pass_up(struct adbCommand *in) } #ifdef ADB_DEBUG - if (adb_debug && in->data[1] == 2) + if (adb_debug && in->data[1] == 2) printf_intr("adb: caught error\n"); #endif /* copy the packet data over */ /* * TO DO: If the *_intr routines fed their incoming data - * directly into an adbCommand struct, which is passed to + * directly into an adbCommand struct, which is passed to * this routine, then we could eliminate this copy. */ memcpy(adbInbound[adbInTail].data + 1, in->data + start + 1, len); @@ -792,7 +792,7 @@ adb_soft_intr(void) comprout = adbInbound[adbInHead].compRout; compdata = adbInbound[adbInHead].compData; cmd = adbInbound[adbInHead].cmd; - + /* copy over data to data area if it's valid */ /* * Note that for unsol packets we don't want to copy the @@ -1006,7 +1006,7 @@ adb_reinit(void) * responds at that address. Then move the last device that was moved * back to the original address. Do this for the remaining addresses * that we determined were in use. - * + * * When finished, do this entire process over again with the updated * list of in use addresses. Do this until no new devices have been * found in 20 passes though the in use address list. (This probably @@ -1292,7 +1292,7 @@ adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command) * This function is used by the adb_op_sync routine so it knows when the * function is done. */ -void +void adb_op_comprout(buffer, compdata, cmd) caddr_t buffer, compdata; int cmd; @@ -1302,7 +1302,7 @@ adb_op_comprout(buffer, compdata, cmd) *p = 1; } -void +void adb_setup_hw_type(void) { switch (adbHardware) { @@ -1319,8 +1319,8 @@ adb_setup_hw_type(void) panic("unknown adb hardware"); } } - -int + +int count_adbs(void) { int i; @@ -1335,7 +1335,7 @@ count_adbs(void) return found; } -int +int get_ind_adb_info(ADBDataBlock * info, int index) { if ((index < 1) || (index > 15)) /* check range 1-15 */ @@ -1357,7 +1357,7 @@ get_ind_adb_info(ADBDataBlock * info, int index) return (ADBDevTable[index].currentAddr); } -int +int get_adb_info(ADBDataBlock * info, int adbAddr) { int i; @@ -1377,7 +1377,7 @@ get_adb_info(ADBDataBlock * info, int adbAddr) return (-1); /* not found */ } -int +int set_adb_info(ADBSetInfoBlock * info, int adbAddr) { int i; @@ -1399,7 +1399,7 @@ set_adb_info(ADBSetInfoBlock * info, int adbAddr) /* caller should really use machine-independant version: getPramTime */ /* this version does pseudo-adb access only */ -int +int adb_read_date_time(unsigned long *time) { u_char output[ADB_MAX_MSG_LENGTH]; @@ -1449,7 +1449,7 @@ adb_read_date_time(unsigned long *time) /* caller should really use machine-independant version: setPramTime */ /* this version does pseudo-adb access only */ -int +int adb_set_date_time(unsigned long time) { u_char output[ADB_MAX_MSG_LENGTH]; @@ -1487,7 +1487,7 @@ adb_set_date_time(unsigned long time) } -int +int adb_poweroff(void) { u_char output[ADB_MAX_MSG_LENGTH]; @@ -1524,31 +1524,31 @@ adb_poweroff(void) } } -int +int CountADBs(void) { return (count_adbs()); } -void +void ADBReInit(void) { adb_reinit(); } -int +int GetIndADB(ADBDataBlock * info, int index) { return (get_ind_adb_info(info, index)); } -int +int GetADBInfo(ADBDataBlock * info, int adbAddr) { return (get_adb_info(info, adbAddr)); } -int +int SetADBInfo(ADBSetInfoBlock * info, int adbAddr) { return (set_adb_info(info, adbAddr)); @@ -1595,7 +1595,7 @@ adb_restart() output[1] = 0x01; /* to pram/rtc/soft-power device */ output[2] = 0x11; /* restart */ result = send_adb_cuda((u_char *)output, (u_char *)0, - (void *)0, (void *)0, (int)0); + (void *)0, (void *)0, (int)0); if (result != 0) /* exit if not sent */ return; while (1); /* not return */ diff --git a/sys/arch/macppc/dev/aed.c b/sys/arch/macppc/dev/aed.c index d96c8ed51de..ceab025b7cb 100644 --- a/sys/arch/macppc/dev/aed.c +++ b/sys/arch/macppc/dev/aed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aed.c,v 1.4 2002/06/07 07:14:48 miod Exp $ */ +/* $OpenBSD: aed.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: aed.c,v 1.5 2000/03/23 06:40:33 thorpej Exp $ */ /* @@ -188,7 +188,7 @@ aed_emulate_mouse(event) aed_handoff(&new_event); } } else if (emulmodkey_down) { - switch(event->u.k.key) { + switch (event->u.k.key) { #ifdef ALTXBUTTONS case ADBK_KEYDOWN(ADBK_1): aed_sc->sc_buttons |= 1; /* left down */ diff --git a/sys/arch/macppc/dev/akbd.c b/sys/arch/macppc/dev/akbd.c index e510576115e..89f993d4040 100644 --- a/sys/arch/macppc/dev/akbd.c +++ b/sys/arch/macppc/dev/akbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: akbd.c,v 1.12 2002/06/23 23:19:46 itojun Exp $ */ +/* $OpenBSD: akbd.c,v 1.13 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: akbd.c,v 1.13 2001/01/25 14:08:55 tsubai Exp $ */ /* @@ -266,7 +266,7 @@ akbdattach(parent, self, aux) * Handle putting the keyboard data received from the ADB into * an ADB event record. */ -void +void kbd_adbcomplete(buffer, data_area, adb_command) caddr_t buffer; caddr_t data_area; @@ -307,18 +307,18 @@ kbd_adbcomplete(buffer, data_area, adb_command) } /* - * Given a keyboard ADB event, record the keycodes and call the key + * Given a keyboard ADB event, record the keycodes and call the key * repeat handler, optionally passing the event through the mouse * button emulation handler first. */ static void kbd_processevent(event, ksc) - adb_event_t *event; - struct akbd_softc *ksc; + adb_event_t *event; + struct akbd_softc *ksc; { - adb_event_t new_event; + adb_event_t new_event; - new_event = *event; + new_event = *event; new_event.u.k.key = event->bytes[0]; new_event.bytes[1] = 0xff; akbd_intr(&new_event); @@ -362,11 +362,11 @@ getleds(addr) /* * Set the keyboard LED's. - * + * * Automatically translates from ioctl/softc format to the * actual keyboard register format */ -static int +static int setleds(ksc, leds) struct akbd_softc *ksc; u_char leds; @@ -401,13 +401,13 @@ setleds(ksc, leds) if ((buffer[2] & 0xf8) != leds) return (EIO); else - return (0); + return (0); } /* * Toggle all of the LED's on and off, just for show. */ -static void +static void blinkleds(ksc) struct akbd_softc *ksc; { @@ -427,7 +427,7 @@ blinkleds(ksc) i = 10; do { (void)setleds(ksc, (u_char)0x00); - } while (setleds(ksc, (u_char)0x00) && (i-- > 0)); + } while (setleds(ksc, (u_char)0x00) && (i-- > 0)); return; } @@ -490,7 +490,7 @@ akbd_rawrepeat(void *v) struct akbd_softc *sc = v; int s; - s = spltty(); + s = spltty(); wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep); splx(s); timeout_add(&sc->sc_rawrepeat_ch, hz * REP_DELAYN / 1000); @@ -554,7 +554,7 @@ akbd_intr(event) #ifdef WSDISPLAY_COMPAT_RAWKBD } else if (sc->sc_rawkbd) { char cbuf[MAXKEYS *2]; - int c, j, s; + int c, j, s; int npress; j = npress = 0; diff --git a/sys/arch/macppc/dev/ams.c b/sys/arch/macppc/dev/ams.c index 5289c693e8f..8611bb6b71a 100644 --- a/sys/arch/macppc/dev/ams.c +++ b/sys/arch/macppc/dev/ams.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ams.c,v 1.4 2002/06/07 20:56:38 drahn Exp $ */ +/* $OpenBSD: ams.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */ /* @@ -503,7 +503,7 @@ ms_processevent(event, sc) buttons &= ~button_bit; /* Extended Protocol (up to 6 more buttons) */ for (mask = 0x80; i < max_byte; - i += (mask == 0x80), button_bit <<= 1) { + i += (mask == 0x80), button_bit <<= 1) { /* 0 when button down */ if (!(event->bytes[i] & mask)) buttons |= button_bit; @@ -522,8 +522,8 @@ ms_processevent(event, sc) if (sc->sc_wsmousedev) wsmouse_input(sc->sc_wsmousedev, new_event.u.m.buttons, - new_event.u.m.dx, -new_event.u.m.dy, 0, - WSMOUSE_INPUT_DELTA); + new_event.u.m.dx, -new_event.u.m.dy, 0, + WSMOUSE_INPUT_DELTA); #if NAED > 0 aed_input(&new_event); #endif diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c index 33d286b76ff..70164bdef01 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.5 2002/06/07 07:13:59 miod Exp $ */ +/* $OpenBSD: apm.c,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -117,7 +117,7 @@ apmmatch(parent, match, aux) struct device *parent; void *match, *aux; { - struct adb_attach_args *aa = (void *)aux; + struct adb_attach_args *aa = (void *)aux; if (aa->origaddr != ADBADDR_APM || aa->handler_id != ADBADDR_APM || aa->adbaddr != ADBADDR_APM) @@ -236,7 +236,7 @@ apmioctl(dev, cmd, data, flag, p) error = EBADF; case APM_IOC_SUSPEND: if ((flag & FWRITE) == 0) - error = EBADF; + error = EBADF; break; case APM_IOC_PRN_CTL: if ((flag & FWRITE) == 0) @@ -267,7 +267,7 @@ apmioctl(dev, cmd, data, flag, p) error = EBADF; break; case APM_IOC_GETPOWER: - power = (struct apm_power_info *)data; + power = (struct apm_power_info *)data; pm_battery_info(0, &batt); @@ -292,7 +292,7 @@ apmioctl(dev, cmd, data, flag, p) batt.draw) / 60; power->battery_state = APM_BATT_CHARGING; } else { - power->minutes_left = + power->minutes_left = ((batt.cur_charge * 3600) / (-batt.draw)) / 60; /* XXX - Arbitrary */ @@ -306,7 +306,7 @@ apmioctl(dev, cmd, data, flag, p) } break; - + default: error = ENOTTY; } diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c index 6dde84af2de..b8c3a224496 100644 --- a/sys/arch/macppc/dev/awacs.c +++ b/sys/arch/macppc/dev/awacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awacs.c,v 1.9 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: awacs.c,v 1.10 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */ /*- @@ -102,7 +102,7 @@ int awacs_set_params(void *, int, int, struct audio_params *, struct audio_params *); int awacs_round_blocksize(void *, int); int awacs_trigger_output(void *, void *, void *, int, void (*)(void *), - void *, struct audio_params *); + void *, struct audio_params *); int awacs_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int awacs_halt_output(void *); @@ -582,7 +582,7 @@ awacs_set_params(h, setmode, usemode, play, rec) } for (mode = AUMODE_RECORD; mode != -1; - mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) { + mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) { if ((setmode & mode) == 0) continue; @@ -752,7 +752,7 @@ awacs_set_port(h, mc) /* no change necessary? */ if (mc->un.mask == sc->sc_record_source) return 0; - switch(mc->un.mask) { + switch (mc->un.mask) { case 1<<0: /* CD */ sc->sc_codecctl0 &= ~AWACS_INPUT_MASK; sc->sc_codecctl0 |= AWACS_INPUT_CD; diff --git a/sys/arch/macppc/dev/dbdma.c b/sys/arch/macppc/dev/dbdma.c index 2756fb9a48c..c0eb8562492 100644 --- a/sys/arch/macppc/dev/dbdma.c +++ b/sys/arch/macppc/dev/dbdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbdma.c,v 1.4 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: dbdma.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: dbdma.c,v 1.2 1998/08/21 16:13:28 tsubai Exp $ */ /* @@ -43,12 +43,9 @@ dbdma_start(dmap, dt) DBDMA_ST4_ENDIAN(&dmap->d_intselect, DBDMA_CLEAR_CNTRL((0xffff))); DBDMA_ST4_ENDIAN(&dmap->d_control, DBDMA_CLEAR_CNTRL(( - DBDMA_CNTRL_ACTIVE | - DBDMA_CNTRL_DEAD | - DBDMA_CNTRL_WAKE | - DBDMA_CNTRL_FLUSH | - DBDMA_CNTRL_PAUSE | - DBDMA_CNTRL_RUN))); + DBDMA_CNTRL_ACTIVE | DBDMA_CNTRL_DEAD | + DBDMA_CNTRL_WAKE | DBDMA_CNTRL_FLUSH | + DBDMA_CNTRL_PAUSE | DBDMA_CNTRL_RUN))); /* XXX time-bind it? */ do { @@ -60,8 +57,8 @@ dbdma_start(dmap, dt) DBDMA_ST4_ENDIAN(&dmap->d_cmdptrlo, addr); DBDMA_ST4_ENDIAN(&dmap->d_control, - DBDMA_SET_CNTRL(DBDMA_CNTRL_RUN|DBDMA_CNTRL_WAKE)| - DBDMA_CLEAR_CNTRL(DBDMA_CNTRL_PAUSE|DBDMA_CNTRL_DEAD) ); + DBDMA_SET_CNTRL(DBDMA_CNTRL_RUN|DBDMA_CNTRL_WAKE)| + DBDMA_CLEAR_CNTRL(DBDMA_CNTRL_PAUSE|DBDMA_CNTRL_DEAD) ); } void @@ -69,10 +66,11 @@ dbdma_stop(dmap) dbdma_regmap_t *dmap; { DBDMA_ST4_ENDIAN(&dmap->d_control, DBDMA_CLEAR_CNTRL(DBDMA_CNTRL_RUN) | - DBDMA_SET_CNTRL(DBDMA_CNTRL_FLUSH)); + DBDMA_SET_CNTRL(DBDMA_CNTRL_FLUSH)); while (DBDMA_LD4_ENDIAN(&dmap->d_status) & - (DBDMA_CNTRL_ACTIVE|DBDMA_CNTRL_FLUSH)); + (DBDMA_CNTRL_ACTIVE|DBDMA_CNTRL_FLUSH)) + ; } void @@ -82,7 +80,8 @@ dbdma_flush(dmap) DBDMA_ST4_ENDIAN(&dmap->d_control, DBDMA_SET_CNTRL(DBDMA_CNTRL_FLUSH)); /* XXX time-bind it? */ - while (DBDMA_LD4_ENDIAN(&dmap->d_status) & (DBDMA_CNTRL_FLUSH)); + while (DBDMA_LD4_ENDIAN(&dmap->d_status) & (DBDMA_CNTRL_FLUSH)) + ; } void @@ -90,15 +89,14 @@ dbdma_reset(dmap) dbdma_regmap_t *dmap; { DBDMA_ST4_ENDIAN(&dmap->d_control, - DBDMA_CLEAR_CNTRL( (DBDMA_CNTRL_ACTIVE | - DBDMA_CNTRL_DEAD | - DBDMA_CNTRL_WAKE | - DBDMA_CNTRL_FLUSH | - DBDMA_CNTRL_PAUSE | - DBDMA_CNTRL_RUN ))); + DBDMA_CLEAR_CNTRL((DBDMA_CNTRL_ACTIVE | + DBDMA_CNTRL_DEAD | DBDMA_CNTRL_WAKE | + DBDMA_CNTRL_FLUSH | DBDMA_CNTRL_PAUSE | + DBDMA_CNTRL_RUN))); /* XXX time-bind it? */ - while (DBDMA_LD4_ENDIAN(&dmap->d_status) & DBDMA_CNTRL_RUN); + while (DBDMA_LD4_ENDIAN(&dmap->d_status) & DBDMA_CNTRL_RUN) + ; } void @@ -106,8 +104,8 @@ dbdma_continue(dmap) dbdma_regmap_t *dmap; { DBDMA_ST4_ENDIAN(&dmap->d_control, - DBDMA_SET_CNTRL(DBDMA_CNTRL_RUN | DBDMA_CNTRL_WAKE) | - DBDMA_CLEAR_CNTRL(DBDMA_CNTRL_PAUSE | DBDMA_CNTRL_DEAD)); + DBDMA_SET_CNTRL(DBDMA_CNTRL_RUN | DBDMA_CNTRL_WAKE) | + DBDMA_CLEAR_CNTRL(DBDMA_CNTRL_PAUSE | DBDMA_CNTRL_DEAD)); } void @@ -117,7 +115,8 @@ dbdma_pause(dmap) DBDMA_ST4_ENDIAN(&dmap->d_control,DBDMA_SET_CNTRL(DBDMA_CNTRL_PAUSE)); /* XXX time-bind it? */ - while (DBDMA_LD4_ENDIAN(&dmap->d_status) & DBDMA_CNTRL_ACTIVE); + while (DBDMA_LD4_ENDIAN(&dmap->d_status) & DBDMA_CNTRL_ACTIVE) + ; } dbdma_t diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index 224ccba2810..a1de5d39d17 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bm.c,v 1.11 2002/09/06 01:20:28 drahn Exp $ */ +/* $OpenBSD: if_bm.c,v 1.12 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */ /*- @@ -285,23 +285,23 @@ bmac_attach(parent, self, aux) sc->sc_rxbuf_pa = sc->sc_txbuf_pa + BMAC_BUFLEN * BMAC_TXBUFS; printf(" irq %d,%d: address %s\n", ca->ca_intr[0], ca->ca_intr[2], - ether_sprintf(laddr)); + ether_sprintf(laddr)); mac_intr_establish(parent, ca->ca_intr[0], IST_LEVEL, IPL_NET, - bmac_intr, sc, "bmac intr"); + bmac_intr, sc, "bmac intr"); #ifdef WHY_IS_THIS_XXXX mac_intr_establish(parent, ca->ca_intr[1], IST_LEVEL, IPL_NET, - bmac_tx_intr, sc, "bmac_tx"); + bmac_tx_intr, sc, "bmac_tx"); #endif /* WHY_IS_THIS_XXXX */ mac_intr_establish(parent, ca->ca_intr[2], IST_LEVEL, IPL_NET, - bmac_rint, sc, "bmac rint"); + bmac_rint, sc, "bmac rint"); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_softc = sc; ifp->if_ioctl = bmac_ioctl; ifp->if_start = bmac_start; ifp->if_flags = - IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; + IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; ifp->if_watchdog = bmac_watchdog; IFQ_SET_READY(&ifp->if_snd); @@ -312,7 +312,7 @@ bmac_attach(parent, self, aux) ifmedia_init(&mii->mii_media, 0, bmac_mediachange, bmac_mediastatus); mii_attach(&sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, 0); /* Choose a default media. */ if (LIST_FIRST(&mii->mii_phys) == NULL) { @@ -441,7 +441,7 @@ bmac_init(sc) bmac_write_reg(sc, MADD2, *p); bmac_write_reg(sc, RXCFG, - RxCRCEnable | RxHashFilterEnable | RxRejectOwnPackets); + RxCRCEnable | RxHashFilterEnable | RxRejectOwnPackets); if (ifp->if_flags & IFF_PROMISC) bmac_set_bits(sc, RXCFG, RxPromiscEnable); @@ -489,12 +489,12 @@ bmac_init_dma(sc) for (i = 0; i < BMAC_RXBUFS; i++) { DBDMA_BUILD(cmd, DBDMA_CMD_IN_LAST, 0, BMAC_BUFLEN, - sc->sc_rxbuf_pa + BMAC_BUFLEN * i, - DBDMA_INT_ALWAYS, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); + sc->sc_rxbuf_pa + BMAC_BUFLEN * i, + DBDMA_INT_ALWAYS, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); cmd++; } DBDMA_BUILD(cmd, DBDMA_CMD_NOP, 0, 0, 0, - DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_ALWAYS); + DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_ALWAYS); dbdma_st32(&cmd->d_cmddep, sc->sc_rxdbdma->d_paddr); sc->sc_rxlast = 0; @@ -599,7 +599,7 @@ bmac_rint(v) datalen = count - resid; /* 2 == framelen */ if (datalen < sizeof(struct ether_header)) { printf("%s: short packet len = %d\n", - ifp->if_xname, datalen); + ifp->if_xname, datalen); goto next; } DBDMA_BUILD_CMD(cmd, DBDMA_CMD_STOP, 0, 0, 0, 0); @@ -633,7 +633,7 @@ bmac_rint(v) next: DBDMA_BUILD_CMD(cmd, DBDMA_CMD_IN_LAST, 0, DBDMA_INT_ALWAYS, - DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); + DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); cmd->d_status = 0; cmd->d_resid = 0; @@ -731,10 +731,10 @@ bmac_transmit_packet(sc, pa, len) dbdma_command_t *cmd = sc->sc_txcmd; DBDMA_BUILD(cmd, DBDMA_CMD_OUT_LAST, 0, len, pa, - DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); + DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); cmd++; DBDMA_BUILD(cmd, DBDMA_CMD_STOP, 0, 0, 0, - DBDMA_INT_ALWAYS, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); + DBDMA_INT_ALWAYS, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); dbdma_start(sc->sc_txdma, sc->sc_txdbdma); } @@ -1103,7 +1103,7 @@ bmac_mii_statchg(dev) #ifdef BMAC_DEBUG printf("bmac_mii_statchg 0x%x\n", - IFM_OPTIONS(sc->sc_mii.mii_media_active)); + IFM_OPTIONS(sc->sc_mii.mii_media_active)); #endif } diff --git a/sys/arch/macppc/dev/macintr.c b/sys/arch/macppc/dev/macintr.c index 7175a8b85bd..f3e57118e1e 100644 --- a/sys/arch/macppc/dev/macintr.c +++ b/sys/arch/macppc/dev/macintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macintr.c,v 1.13 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: macintr.c,v 1.14 2002/09/15 02:02:43 deraadt Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -101,7 +101,7 @@ void macintr_attach(struct device *, struct device *, void *); void mac_do_pending_int(void); void mac_ext_intr(void); -struct cfattach macintr_ca = { +struct cfattach macintr_ca = { sizeof(struct macintr_softc), macintr_match, macintr_attach @@ -112,7 +112,7 @@ struct cfdriver macintr_cd = { }; int -macintr_match(parent, cf, aux) +macintr_match(parent, cf, aux) struct device *parent; void *cf; void *aux; @@ -125,7 +125,7 @@ macintr_match(parent, cf, aux) */ if (strcmp(ca->ca_name, "interrupt-controller") == 0 ) { OF_getprop(ca->ca_node, "device_type", type, sizeof(type)); - if (strcmp(type, "interrupt-controller") == 0) { + if (strcmp(type, "interrupt-controller") == 0) { return 1; } } @@ -353,13 +353,13 @@ intr_typename(type) { switch (type) { - case IST_NONE : + case IST_NONE : return ("none"); - case IST_PULSE: + case IST_PULSE: return ("pulsed"); - case IST_EDGE: + case IST_EDGE: return ("edge-triggered"); - case IST_LEVEL: + case IST_LEVEL: return ("level-triggered"); default: panic("intr_typename: invalid type %d", type); @@ -592,7 +592,7 @@ mac_intr_do_pending_int() irq = 31 - cntlzw(hwpend); hwpend &= ~(1L << irq); ih = m_intrhand[irq]; - while(ih) { + while (ih) { (*ih->ih_fun)(ih->ih_arg); ih = ih->ih_next; } @@ -603,18 +603,18 @@ mac_intr_do_pending_int() /*out32rb(INT_ENABLE_REG, ~imen_m);*/ do { - if((ipending & SINT_CLOCK) & ~pcpl) { + if ((ipending & SINT_CLOCK) & ~pcpl) { ipending &= ~SINT_CLOCK; softclock(); } - if((ipending & SINT_NET) & ~pcpl) { + if ((ipending & SINT_NET) & ~pcpl) { extern int netisr; int pisr = netisr; netisr = 0; ipending &= ~SINT_NET; softnet(pisr); } - if((ipending & SINT_TTY) & ~pcpl) { + if ((ipending & SINT_TTY) & ~pcpl) { ipending &= ~SINT_TTY; softtty(); } diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c index d49c29503b2..89dd21aed1f 100644 --- a/sys/arch/macppc/dev/mesh.c +++ b/sys/arch/macppc/dev/mesh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mesh.c,v 1.4 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: mesh.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */ /*- @@ -194,7 +194,7 @@ struct cfattach mesh_ca = { }; -struct cfdriver mesh_cd = { +struct cfdriver mesh_cd = { NULL, "mesh", DV_DULL }; @@ -229,7 +229,7 @@ mesh_attach(parent, self, aux) struct confargs *ca = aux; int i, error; u_int *reg; - + printf("MESH_ATTACH called\n"); reg = ca->ca_reg; @@ -431,10 +431,10 @@ mesh_intr(arg) break; case MESH_MSGIN: mesh_msgin(sc, scb); - printf("mesh_intr:case MESH_MSGIN\n"); + printf("mesh_intr:case MESH_MSGIN\n"); break; case MESH_COMPLETE: - printf("mesh_intr:case MESH_COMPLETE\n"); + printf("mesh_intr:case MESH_COMPLETE\n"); mesh_done(sc, scb); break; @@ -955,7 +955,7 @@ mesh_scsi_cmd(xs) scb->target = sc_link->target; sc->sc_imsglen = 0; /* XXX ? */ - + printf("messh_scsi_cmd,scb->target=%d\n",scb->target); if (flags & SCSI_POLL){ @@ -993,7 +993,7 @@ mesh_scsi_cmd(xs) if (mesh_poll(sc, xs)) printf("mesh: timeout again\n"); } - printf("mesh_scsi_cmd: returning COMPLETE\n"); + printf("mesh_scsi_cmd: returning COMPLETE\n"); return COMPLETE; } @@ -1031,7 +1031,7 @@ mesh_poll(sc, xs) { int count = xs->timeout; printf("in mesh_poll,timeout=%d\n",xs->timeout); - + while (count) { if (mesh_read_reg(sc, MESH_INTERRUPT)) @@ -1105,12 +1105,12 @@ mesh_timeout(arg) printf("mesh: timeout state=%x\n", sc->sc_nextstate); intr = mesh_read_reg(sc, MESH_INTERRUPT); - + exception = mesh_read_reg(sc, MESH_EXCEPTION); - + error = mesh_read_reg(sc, MESH_ERROR); - + status0 = mesh_read_reg(sc, MESH_BUS_STATUS0); status1 = mesh_read_reg(sc, MESH_BUS_STATUS1); @@ -1120,7 +1120,7 @@ printf("intr 0x%02x, except 0x%02x, err 0x%02x\n", intr, exception, error); #endif s = splbio(); - + if (sc->sc_flags & MESH_DMA_ACTIVE) { printf("mesh: resetting dma\n"); dbdma_reset(sc->sc_dmareg); @@ -1128,7 +1128,7 @@ printf("intr 0x%02x, except 0x%02x, err 0x%02x\n", intr, exception, error); scb->xs->error = XS_TIMEOUT; mesh_set_reg(sc, MESH_SEQUENCE, MESH_CMD_BUSFREE); - + sc->sc_nextstate = MESH_COMPLETE; splx(s); diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c index 7acbf97a4a6..df321e82615 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openpic.c,v 1.16 2002/03/14 03:15:55 millert Exp $ */ +/* $OpenBSD: openpic.c,v 1.17 2002/09/15 02:02:43 deraadt Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -498,7 +498,7 @@ openpic_do_pending_int() irq = 31 - cntlzw(hwpend); hwpend &= ~(1L << irq); ih = o_intrhand[irq]; - while(ih) { + while (ih) { (*ih->ih_fun)(ih->ih_arg); ih = ih->ih_next; } @@ -509,18 +509,18 @@ openpic_do_pending_int() /*out32rb(INT_ENABLE_REG, ~imen_o);*/ do { - if((ipending & SINT_CLOCK) & ~pcpl) { + if ((ipending & SINT_CLOCK) & ~pcpl) { ipending &= ~SINT_CLOCK; softclock(); } - if((ipending & SINT_NET) & ~pcpl) { + if ((ipending & SINT_NET) & ~pcpl) { extern int netisr; int pisr = netisr; netisr = 0; ipending &= ~SINT_NET; softnet(pisr); } - if((ipending & SINT_TTY) & ~pcpl) { + if ((ipending & SINT_TTY) & ~pcpl) { ipending &= ~SINT_TTY; softtty(); } diff --git a/sys/arch/macppc/dev/uni_n.c b/sys/arch/macppc/dev/uni_n.c index 759bf2fe3f1..3c08dc45ebd 100644 --- a/sys/arch/macppc/dev/uni_n.c +++ b/sys/arch/macppc/dev/uni_n.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uni_n.c,v 1.4 2002/03/14 03:15:55 millert Exp $ */ +/* $OpenBSD: uni_n.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 1998-2001 Dale Rahn. All rights reserved. @@ -68,7 +68,7 @@ memcmatch(parent, cf, aux) /* allow only one instance */ if (memc_attached == 0) { - if (0 == strcmp (ca->ca_name, "memc")) { + if (0 == strcmp(ca->ca_name, "memc")) { return 1; } } @@ -89,10 +89,10 @@ memcattach(parent, self, aux) if (len > 0) { name[len] = 0; } - if (strcmp (name, "uni-n")== 0) { + if (strcmp(name, "uni-n")== 0) { sc->baseaddr = uni_n_config(ca->ca_node); } - printf (": %s\n", name); + printf(": %s\n", name); } void * uni_n_config(int handle) @@ -104,7 +104,7 @@ uni_n_config(int handle) if (OF_getprop(handle, "name", name, sizeof name) > 0) { /* sanity test */ - if (!strcmp (name, "uni-n")) { + if (!strcmp(name, "uni-n")) { if (OF_getprop(handle, "reg", &address, sizeof address) > 0) { baseaddr = mapiodev(address, NBPG); diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c index d7b40dbd250..dcb99ca7d23 100644 --- a/sys/arch/macppc/dev/wdc_obio.c +++ b/sys/arch/macppc/dev/wdc_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc_obio.c,v 1.6 2002/03/26 16:50:12 drahn Exp $ */ +/* $OpenBSD: wdc_obio.c,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */ /*- @@ -180,24 +180,23 @@ wdc_obio_attach(parent, self, aux) if (bus_space_map(chp->cmd_iot, cmdbase, cmdsize, 0, &chp->cmd_ioh) || bus_space_subregion(chp->cmd_iot, chp->cmd_ioh, - /* WDC_AUXREG_OFFSET<<4 */ 0x160, 1, &chp->ctl_ioh)) - { + /* WDC_AUXREG_OFFSET<<4 */ 0x160, 1, &chp->ctl_ioh)) { printf("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_dev.dv_xname); + sc->sc_wdcdev.sc_dev.dv_xname); return; } chp->data32iot = chp->cmd_iot; chp->data32ioh = chp->cmd_ioh; mac_intr_establish(parent, intr, IST_LEVEL, IPL_BIO, wdcintr, chp, - "wdc_obio"); + "wdc_obio"); sc->sc_wdcdev.set_modes = wdc_obio_adjust_timing; if (use_dma) { sc->sc_dbdma = dbdma_alloc(sc->sc_dmat, WDC_DMALIST_MAX + 1); sc->sc_dmacmd = sc->sc_dbdma->d_addr; sc->sc_dmareg = mapiodev(ca->ca_baseaddr + ca->ca_reg[2], - ca->ca_reg[3]); + ca->ca_reg[3]); sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA; sc->sc_wdcdev.DMA_cap = 2; if (strcmp(ca->ca_name, "ata-4") == 0) { @@ -328,8 +327,7 @@ wdc_obio_adjust_timing(chp) inact_tick = DMA_REC_MIN; half_tick = 0; /* XXX */ /* mask: 0xfffff800 */ - conf |= - (half_tick << 21) | + conf |= (half_tick << 21) | (inact_tick << 16) | (act_tick << 11); } bus_space_write_4(chp->cmd_iot, chp->cmd_ioh, CONFIG_REG, conf); @@ -453,7 +451,7 @@ wdc_obio_dma_init(v, channel, drive, databuf, datalen, read) } DBDMA_BUILD(cmdp, DBDMA_CMD_STOP, 0, 0, 0, - DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); + DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); return 0; } @@ -492,7 +490,8 @@ wdc_obio_read_reg(chp, reg) { #ifdef DIAGNOSTIC if (reg & _WDC_WRONLY) { - printf ("wdc_obio_read_reg: reading from a write-only register %d\n", reg); + printf("wdc_obio_read_reg: reading from a write-only register %d\n", + reg); } #endif @@ -513,7 +512,8 @@ wdc_obio_write_reg(chp, reg, val) { #ifdef DIAGNOSTIC if (reg & _WDC_RDONLY) { - printf ("wdc_obio_write_reg: writing to a read-only register %d\n", reg); + printf("wdc_obio_write_reg: writing to a read-only register %d\n", + reg); } #endif diff --git a/sys/arch/macppc/dev/zs.c b/sys/arch/macppc/dev/zs.c index 03803abc61b..fac56d2d6c1 100644 --- a/sys/arch/macppc/dev/zs.c +++ b/sys/arch/macppc/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.7 2002/09/06 13:56:51 drahn Exp $ */ +/* $OpenBSD: zs.c,v 1.8 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: zs.c,v 1.17 2001/06/19 13:42:15 wiz Exp $ */ /* @@ -365,12 +365,12 @@ zsc_attach(parent, self, aux) * We used to disable chip interrupts here, but we now * do that in zscnprobe, just in case MacOS left the chip on. */ - + xcs->cs_chip = 0; - + /* Stash away a copy of the final H/W flags. */ xcs->cs_hwflags = zsc_args.hwflags; - + /* * Look for a child driver for this channel. * The child attach will setup the hardware. @@ -480,8 +480,7 @@ zshard(arg) if (zsc == NULL) continue; rval |= zsc_intr_hard(zsc); - if (zsc->zsc_cs[0]->cs_softreq) - { + if (zsc->zsc_cs[0]->cs_softreq) { /* zsc_req_softint(zsc); */ /* We are at splzs here, so no need to lock. */ if (zssoftpending == 0) { @@ -920,7 +919,7 @@ zs_enable(cs) cs->enabled = 1; return(0); } - + void zs_disable(cs) struct zs_chanstate *cs; @@ -1144,7 +1143,7 @@ zs_abort(struct zs_chanstate *channel) void zscnpollc(dev, on) dev_t dev; - int on; + int on; { /* * Need to tell zs driver to acknowledge all interrupts or we get diff --git a/sys/arch/macppc/include/apmvar.h b/sys/arch/macppc/include/apmvar.h index 3ffa92794d0..bc9b67fb307 100644 --- a/sys/arch/macppc/include/apmvar.h +++ b/sys/arch/macppc/include/apmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apmvar.h,v 1.2 2001/10/03 20:06:01 drahn Exp $ */ +/* $OpenBSD: apmvar.h,v 1.3 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 2001 Alexander Guy @@ -54,7 +54,7 @@ #define APM_BATT_LIFE_UNKNOWN 0xff #define APM_NOEVENT 0x0000 -#define APM_STANDBY_REQ 0x0001 +#define APM_STANDBY_REQ 0x0001 #define APM_SUSPEND_REQ 0x0002 #define APM_NORMAL_RESUME 0x0003 #define APM_CRIT_RESUME 0x0004 /* suspend/resume happened @@ -80,9 +80,9 @@ * * This software may be used, modified, copied, and distributed, in * both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its + * these terms are retained. Under no circumstances is the author + * responsible for the proper functioning of this software, nor does + * the author assume any responsibility for damages incurred with its * use. * * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index b0c97daf0ca..8b81c45e8da 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.6 2002/06/11 03:50:14 drahn Exp $ */ +/* $OpenBSD: bus.h,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -82,7 +82,7 @@ static __inline CAT3(u_int,m,_t) \ CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_addr_t ba) \ { \ - if(bst->bus_reverse) \ + if (bst->bus_reverse) \ return CAT3(in,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ else \ return CAT(in,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ @@ -99,7 +99,7 @@ static __inline void \ CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_addr_t ba, CAT3(u_int,m,_t) x) \ { \ - if(bst->bus_reverse) \ + if (bst->bus_reverse) \ CAT3(out,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), x); \ else \ CAT(out,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), x); \ @@ -112,7 +112,7 @@ bus_space_write(4,32) #define bus_space_write_8 !!! bus_space_write_8 unimplemented !!! #define bus_space_read_multi(n, m) \ -static __inline void \ +static __inline void \ CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_size_t ba, CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ { \ @@ -130,7 +130,7 @@ bus_space_read_multi(4,32) #define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! #define bus_space_write_multi(n, m) \ -static __inline void \ +static __inline void \ CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_size_t ba, const CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ { \ @@ -476,8 +476,8 @@ bus_space_copy_4(void *v, bus_space_handle_t h1, bus_space_handle_t h2, #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ /* Compatibility defines */ -#define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ -#define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE +#define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ +#define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE #define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */ @@ -489,7 +489,7 @@ bus_space_copy_4(void *v, bus_space_handle_t h1, bus_space_handle_t h2, #define BUS_DMA_BUS2 0x020 #define BUS_DMA_BUS3 0x040 #define BUS_DMA_BUS4 0x080 -#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */ +#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */ #define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */ #define BUS_DMA_STREAMING 0x400 /* hint: sequential, unidirectional */ diff --git a/sys/arch/macppc/include/conf.h b/sys/arch/macppc/include/conf.h index b8a2c326134..82616fac15a 100644 --- a/sys/arch/macppc/include/conf.h +++ b/sys/arch/macppc/include/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.6 2002/07/10 22:21:30 mickey Exp $ */ +/* $OpenBSD: conf.h,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ /* @@ -38,8 +38,8 @@ cdev_decl(mm); /* open, close, write, ioctl, kqueue */ #define cdev_apm_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ + dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ + (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ (dev_type_mmap((*))) enodev, D_KQFILTER, dev_init(c,n,kqfilter) } diff --git a/sys/arch/macppc/include/cpu.h b/sys/arch/macppc/include/cpu.h index 1b639da885d..436bad8bdfb 100644 --- a/sys/arch/macppc/include/cpu.h +++ b/sys/arch/macppc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.5 2002/06/08 15:45:29 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -36,7 +36,7 @@ #include <powerpc/cpu.h> -/* +/* * CTL_MACHDEP definitions. */ #define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ diff --git a/sys/arch/macppc/include/disklabel.h b/sys/arch/macppc/include/disklabel.h index 300836b658a..b9522832a87 100644 --- a/sys/arch/macppc/include/disklabel.h +++ b/sys/arch/macppc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.2 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: disklabel.h,v 1.3 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -106,8 +106,8 @@ get_le(p) /* HFS/DPME */ /* partition map structure from Inside Macintosh: Devices, SCSI Manager - * pp. 13-14. The partition map always begins on physical block 1. - * + * pp. 13-14. The partition map always begins on physical block 1. + * * With the exception of block 0, all blocks on the disk must belong to * exactly one partition. The partition map itself belongs to a partition * of type `APPLE_PARTITION_MAP', and is not limited in size by anything @@ -115,44 +115,43 @@ get_le(p) * the first partition listed. */ struct part_map_entry { -#define PART_ENTRY_MAGIC 0x504d - u_int16_t pmSig; /* partition signature */ - u_int16_t pmSigPad; /* (reserved) */ - u_int32_t pmMapBlkCnt; /* number of blocks in partition map */ - u_int32_t pmPyPartStart; /* first physical block of partition */ - u_int32_t pmPartBlkCnt; /* number of blocks in partition */ - char pmPartName[32]; /* partition name */ - char pmPartType[32]; /* partition type */ - u_int32_t pmLgDataStart; /* first logical block of data area */ - u_int32_t pmDataCnt; /* number of blocks in data area */ - u_int32_t pmPartStatus; /* partition status information */ - u_int32_t pmLgBootStart; /* first logical block of boot code */ - u_int32_t pmBootSize; /* size of boot code, in bytes */ - u_int32_t pmBootLoad; /* boot code load address */ - u_int32_t pmBootLoad2; /* (reserved) */ - u_int32_t pmBootEntry; /* boot code entry point */ - u_int32_t pmBootEntry2; /* (reserved) */ - u_int32_t pmBootCksum; /* boot code checksum */ - char pmProcessor[16]; /* processor type (e.g. "68020") */ - u_int8_t pmBootArgs[128]; /* A/UX boot arguments */ +#define PART_ENTRY_MAGIC 0x504d + u_int16_t pmSig; /* partition signature */ + u_int16_t pmSigPad; /* (reserved) */ + u_int32_t pmMapBlkCnt; /* number of blocks in partition map */ + u_int32_t pmPyPartStart; /* first physical block of partition */ + u_int32_t pmPartBlkCnt; /* number of blocks in partition */ + char pmPartName[32]; /* partition name */ + char pmPartType[32]; /* partition type */ + u_int32_t pmLgDataStart; /* first logical block of data area */ + u_int32_t pmDataCnt; /* number of blocks in data area */ + u_int32_t pmPartStatus; /* partition status information */ + u_int32_t pmLgBootStart; /* first logical block of boot code */ + u_int32_t pmBootSize; /* size of boot code, in bytes */ + u_int32_t pmBootLoad; /* boot code load address */ + u_int32_t pmBootLoad2; /* (reserved) */ + u_int32_t pmBootEntry; /* boot code entry point */ + u_int32_t pmBootEntry2; /* (reserved) */ + u_int32_t pmBootCksum; /* boot code checksum */ + char pmProcessor[16]; /* processor type (e.g. "68020") */ + u_int8_t pmBootArgs[128]; /* A/UX boot arguments */ /* we do not index the disk image as an array, * leave out the on disk padding */ #if 0 - u_int8_t pad[248]; /* pad to end of block */ + u_int8_t pad[248]; /* pad to end of block */ #endif }; -#define PART_TYPE_DRIVER "APPLE_DRIVER" -#define PART_TYPE_DRIVER43 "APPLE_DRIVER43" -#define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA" -#define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT" -#define PART_TYPE_FWDRIVER "APPLE_FWDRIVER" -#define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS" -#define PART_TYPE_FREE "APPLE_FREE" -#define PART_TYPE_MAC "APPLE_HFS" -#define PART_TYPE_OPENBSD "OPENBSD" - +#define PART_TYPE_DRIVER "APPLE_DRIVER" +#define PART_TYPE_DRIVER43 "APPLE_DRIVER43" +#define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA" +#define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT" +#define PART_TYPE_FWDRIVER "APPLE_FWDRIVER" +#define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS" +#define PART_TYPE_FREE "APPLE_FREE" +#define PART_TYPE_MAC "APPLE_HFS" +#define PART_TYPE_OPENBSD "OPENBSD" struct cpu_disklabel { struct dos_partition dosparts[NDOSPART]; diff --git a/sys/arch/macppc/include/powerpc.h b/sys/arch/macppc/include/powerpc.h index 632d6fa07a7..5af35ede048 100644 --- a/sys/arch/macppc/include/powerpc.h +++ b/sys/arch/macppc/include/powerpc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: powerpc.h,v 1.4 2002/08/20 02:50:43 drahn Exp $ */ +/* $OpenBSD: powerpc.h,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */ /* @@ -70,7 +70,7 @@ struct firmware { exit_f *exit; boot_f *boot; vmon_f *vmon; - + #ifdef FW_HAS_PUTC boot_f *putc; #endif diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h index d0fbe708873..1c1f1737ed4 100644 --- a/sys/arch/macppc/include/vmparam.h +++ b/sys/arch/macppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.9 2002/03/13 18:27:36 drahn Exp $ */ +/* $OpenBSD: vmparam.h,v 1.10 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -62,7 +62,7 @@ * Size of shared memory map */ #ifndef SHMMAXPGS -#define SHMMAXPGS 4096 +#define SHMMAXPGS 4096 #endif /* @@ -79,7 +79,7 @@ * It is related to human patience and other factors which don't really * change over time. */ -#define MAXSLP 20 +#define MAXSLP 20 /* * Would like to have MAX addresses = 0, but this doesn't (currently) work diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c index 1212c33e7d1..00b552b8704 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.6 2002/09/15 00:55:56 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.7 2002/09/15 02:02:43 deraadt 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.6 2002/09/15 00:55:56 deraadt Exp $ + * $Id: autoconf.c,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ /* @@ -68,9 +68,9 @@ void swapconf(void); extern void dumpconf(void); int findblkmajor(struct device *); char *findblkname(int); -static struct device * getdisk(char *, int, int, dev_t *); +static struct device *getdisk(char *, int, int, dev_t *); struct device * getdevunit(char *, int); -static struct devmap * findtype(char **); +static struct devmap *findtype(char **); void makebootdev(char *cp); int getpno(char **); void diskconf(void); @@ -89,12 +89,12 @@ struct device *bootdv = NULL; * This is done at boot time. */ void -cpu_configure() +cpu_configure(void) { (void)splhigh(); /* To be really sure.. */ calc_delayconst(); - if(config_rootfound("mainbus", "mainbus") == 0) + if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); (void)spl0(); @@ -105,13 +105,14 @@ cpu_configure() md_diskconf = diskconf; cold = 0; } + /* * Now that we are fully operational, we can checksum the * disks, and using some heuristics, hopefully are able to * always determine the correct root disk. */ void -diskconf() +diskconf(void) { /* * Configure root, swap, and dump area. This is @@ -137,7 +138,7 @@ diskconf() * Configure swap space and related parameters. */ void -swapconf() +swapconf(void) { register struct swdevt *swp; register int nblks; @@ -145,7 +146,7 @@ swapconf() for (swp = swdevt; swp->sw_dev != NODEV; swp++) { if (bdevsw[major(swp->sw_dev)].d_psize) { nblks = - (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev); + (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev); if (nblks != -1 && (swp->sw_nblks == 0 || swp->sw_nblks > nblks)) swp->sw_nblks = nblks; @@ -173,7 +174,7 @@ long dumplo = -1; /* blocks */ */ #if 0 void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ int maj; @@ -214,8 +215,7 @@ static struct nam2blk { }; int -findblkmajor(dv) - struct device *dv; +findblkmajor(struct device *dv) { char *name = dv->dv_xname; int i; @@ -223,26 +223,22 @@ findblkmajor(dv) for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i) if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0) return (nam2blk[i].maj); - return (-1); + return (-1); } char * -findblkname(maj) - int maj; +findblkname(int maj) { int i; for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); i++) if (nam2blk[i].maj == maj) return (nam2blk[i].name); - return (NULL); + return (NULL); } 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; @@ -254,7 +250,7 @@ getdisk(str, len, defpart, devp) printf(" %s[a-p]", dv->dv_xname); #ifdef NFSCLIENT if (dv->dv_class == DV_IFNET) - printf(" %s", dv->dv_xname); + printf(" %s", dv->dv_xname); #endif } printf("\n"); @@ -263,10 +259,7 @@ getdisk(str, len, defpart, devp) } struct device * -parsedisk(str, len, defpart, devp) - char *str; - int len, defpart; - dev_t *devp; +parsedisk(char *str, int len, int defpart, dev_t *devp) { register struct device *dv; register char *cp, c; @@ -310,7 +303,7 @@ parsedisk(str, len, defpart, devp) * change rootdev to correspond to the load device. */ void -setroot() +setroot(void) { int majdev, mindev, unit, part, len; dev_t temp; @@ -326,7 +319,7 @@ setroot() printf("bootpath: '%s'\n", bootpath); makebootdev(bootpath); - if(boothowto & RB_DFLTROOT) + if (boothowto & RB_DFLTROOT) return; /* Boot compiled in */ /* @@ -346,15 +339,13 @@ setroot() } /* Lookup boot device from boot if not set by configuration */ - if(bootdv == NULL) { + if (bootdv == NULL) bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp); - } - if(bootdv == NULL) { + if (bootdv == NULL) { 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); } @@ -362,10 +353,8 @@ setroot() for (;;) { printf("root device "); if (bootdv != NULL) - printf("(default %s%c)", - bootdv->dv_xname, - bootdv->dv_class == DV_DISK - ? 'a' : ' '); + printf("(default %s%c)", bootdv->dv_xname, + bootdv->dv_class == DV_DISK ? 'a' : ' '); printf(": "); len = getsn(buf, sizeof(buf)); if (len == 0 && bootdv != NULL) { @@ -391,9 +380,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) @@ -432,8 +421,7 @@ gotswap: dumpdev = nswapdev; swdevt[0].sw_dev = nswapdev; swdevt[1].sw_dev = NODEV; - } - else if(mountroot == NULL) { + } else if (mountroot == NULL) { /* * `swap generic': Use the device the ROM told us to use. */ @@ -450,11 +438,10 @@ 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. - */ + */ nswapdev = dumpdev = NODEV; } swdevt[0].sw_dev = nswapdev; @@ -517,9 +504,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]; @@ -554,8 +539,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 }, @@ -575,15 +559,16 @@ findtype(s) struct devmap *dp = &devmap[0]; while (dp->att) { - if (strncmp (*s, dp->att, strlen(dp->att)) == 0) { + if (strncmp(*s, dp->att, strlen(dp->att)) == 0) { *s += strlen(dp->att); break; } dp++; } - if (dp->att == NULL) { +#if 0 + if (dp->att == NULL) printf("string [%s] not found\n", *s); - } +#endif return(dp); } @@ -594,8 +579,7 @@ findtype(s) * '/pci/mac-io/ide/disk/bsd */ void -makebootdev(bp) - char *bp; +makebootdev(char *bp) { int unit; char *dev, *cp; @@ -603,18 +587,17 @@ 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); return; } - } while((dp->type & T_IFACE) == 0); + } while ((dp->type & T_IFACE) == 0); dev = dp->dev; - while(*cp && *cp != '/') + while (*cp && *cp != '/') cp++; dp = findtype(&cp); if (!dp->att || dp->type != T_DISK) { @@ -626,13 +609,12 @@ makebootdev(bp) } int -getpno(cp) - char **cp; +getpno(char **cp) { int val = 0; char *cx = *cp; - while(*cx && *cx >= '0' && *cx <= '9') { + while (*cx && *cx >= '0' && *cx <= '9') { val = val * 10 + *cx - '0'; cx++; } diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index d01f1f56f8e..7c8805fe659 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.3 2002/06/09 04:13:13 drahn Exp $ */ +/* $OpenBSD: clock.c,v 1.4 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -58,12 +58,12 @@ static volatile u_long lasttb; /* * BCD to decimal and decimal to BCD. */ -#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) -#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) +#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) +#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) -#define SECDAY (24 * 60 * 60) -#define SECYR (SECDAY * 365) -#define LEAPYEAR(y) (((y) & 3) == 0) +#define SECDAY (24 * 60 * 60) +#define SECYR (SECDAY * 365) +#define LEAPYEAR(y) (((y) & 3) == 0) #define YEAR0 1900 typedef int (clock_read_t)(int *sec, int *min, int *hour, int *day, @@ -97,17 +97,17 @@ inittodr(base) int badbase = 0, waszero = base == 0; - if (base < 5 * SECYR) { - /* - * If base is 0, assume filesystem time is just unknown - * instead of preposterous. Don't bark. - */ - if (base != 0) - printf("WARNING: preposterous time in file system\n"); - /* not going to use it anyway, if the chip is readable */ - base = 21*SECYR + 186*SECDAY + SECDAY/2; - badbase = 1; - } + if (base < 5 * SECYR) { + /* + * If base is 0, assume filesystem time is just unknown + * instead of preposterous. Don't bark. + */ + if (base != 0) + printf("WARNING: preposterous time in file system\n"); + /* not going to use it anyway, if the chip is readable */ + base = 21*SECYR + 186*SECDAY + SECDAY/2; + badbase = 1; + } if (clock_read != NULL ) { (*clock_read)( &sec, &min, &hour, &day, &mon, &year); @@ -163,7 +163,7 @@ const short dayyr[12] = static u_long chiptotime(sec, min, hour, day, mon, year) - int sec, min, hour, day, mon, year; + int sec, min, hour, day, mon, year; { int days, yr; @@ -249,7 +249,7 @@ decr_intr(frame) * Reenable interrupts */ asm volatile ("mfmsr %0; ori %0, %0, %1; mtmsr %0" - : "=r"(msr) : "K"(PSL_EE)); + : "=r"(msr) : "K"(PSL_EE)); /* * Do standard timer interrupt stuff. @@ -269,7 +269,7 @@ cpu_initclocks() { int msr, scratch; 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)); asm volatile ("mftb %0" : "=r"(lasttb)); asm volatile ("mtdec %0" :: "r"(ticks_per_intr)); asm volatile ("mtmsr %0" :: "r"(msr)); @@ -286,10 +286,10 @@ calc_delayconst() * Get this info during autoconf? XXX */ for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - 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) { + 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) { /* * Should check for correct CPU here? XXX */ @@ -320,7 +320,7 @@ mftb() u_quad_t tb; asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b" - : "=r"(tb), "=r"(scratch)); + : "=r"(tb), "=r"(scratch)); return tb; } @@ -336,7 +336,7 @@ microtime(tvp) int msr, scratch; 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)); asm ("mftb %0" : "=r"(tb)); ticks = (tb - lasttb) * ns_per_tick; *tvp = time; @@ -364,8 +364,8 @@ delay(n) tbh = tb >> 32; tbl = tb; asm ("1: mftbu %0; cmplw %0,%1; blt 1b; bgt 2f;" - " mftb %0; cmplw %0,%2; blt 1b; 2:" - :: "r"(scratch), "r"(tbh), "r"(tbl)); + " mftb %0; cmplw %0,%2; blt 1b; 2:" + :: "r"(scratch), "r"(tbh), "r"(tbl)); tb = mftb(); } diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c index 1b5afa73b0e..6fd64007074 100644 --- a/sys/arch/macppc/macppc/conf.c +++ b/sys/arch/macppc/macppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.17 2002/09/06 13:56:51 drahn Exp $ */ +/* $OpenBSD: conf.c,v 1.18 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -170,7 +170,7 @@ struct cdevsw cdevsw[] = { cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */ cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */ cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */ - cdev_apm_init(NAPM,apm), /* 25: APM interface */ + cdev_apm_init(NAPM,apm), /* 25: APM interface */ cdev_notdef(), /* 26 */ cdev_notdef(), /* 27 */ cdev_notdef(), /* 28 */ diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index 092ef496f2a..ee25b2eff72 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.8 2002/06/21 06:26:50 itojun Exp $ */ +/* $OpenBSD: cpu.c,v 1.9 2002/09/15 02:02:43 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -141,7 +141,7 @@ cpuattach(parent, dev, aux) case MPC7450: if ((pvr & 0xf) < 3) snprintf(cpu_model, sizeof(cpu_model), "7450"); - else + else snprintf(cpu_model, sizeof(cpu_model), "7451"); break; case MPC7455: @@ -159,20 +159,18 @@ cpuattach(parent, dev, aux) /* This should only be executed on openfirmware systems... */ for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "cpu") - && OF_getprop(qhandle, "clock-frequency", - &clock_freq , sizeof clock_freq ) >= 0) - { + if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 && + !strcmp(name, "cpu") && + OF_getprop(qhandle, "clock-frequency", &clock_freq, + sizeof clock_freq ) >= 0) break; + if ((phandle = OF_child(qhandle))) + continue; + while (qhandle) { + if ((phandle = OF_peer(qhandle))) + break; + qhandle = OF_parent(qhandle); } - if ((phandle = OF_child(qhandle))) - continue; - while (qhandle) { - if ((phandle = OF_peer(qhandle))) - break; - qhandle = OF_parent(qhandle); - } } if (clock_freq != 0) { @@ -194,18 +192,16 @@ cpuattach(parent, dev, aux) case MPC7455: /* select DOZE mode */ hid0 &= ~(HID0_NAP | HID0_SLEEP); - hid0 |= HID0_DOZE | HID0_DPM; + hid0 |= HID0_DOZE | HID0_DPM; } asm ("mtspr %0,1008" : "=r" (hid0)); - /* if processor is G3 or G4, configure l2 cache */ - if ( (cpu == MPC750) || (cpu == MPC7400) || (cpu == IBM750FX) - || (cpu == MPC7410) || (cpu == MPC7450) || (cpu == MPC7455)) { + /* if processor is G3 or G4, configure l2 cache */ + if ((cpu == MPC750) || (cpu == MPC7400) || (cpu == IBM750FX) || + (cpu == MPC7410) || (cpu == MPC7450) || (cpu == MPC7455)) { config_l2cr(cpu); } printf("\n"); - - } #define L2CR 1017 @@ -276,7 +272,7 @@ config_l2cr(int cpu) do { asm volatile ("mfspr %0, 1017" : "=r"(x)); } while (x & L2CR_L2IP); - + /* Enable L2 cache. */ l2cr &= ~L2CR_L2I; l2cr |= L2CR_L2E; @@ -304,7 +300,7 @@ config_l2cr(int cpu) case L2SIZ_512K: printf(": 512KB"); break; - case L2SIZ_1M: + case L2SIZ_1M: printf(": 1MB"); break; default: @@ -326,11 +322,10 @@ config_l2cr(int cpu) default: printf(" unknown type"); } - + if (l2cr & L2CR_L2PE) - printf(" with parity"); + printf(" with parity"); #endif } else printf(": L2 cache not enabled"); - } diff --git a/sys/arch/macppc/macppc/db_interface.c b/sys/arch/macppc/macppc/db_interface.c index b5c8aed047e..4f2613e8943 100644 --- a/sys/arch/macppc/macppc/db_interface.c +++ b/sys/arch/macppc/macppc/db_interface.c @@ -1,5 +1,5 @@ -/* $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 $ */ +/* $OpenBSD: db_interface.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ #include <sys/param.h> #include <sys/proc.h> @@ -22,13 +22,13 @@ int ddb_trap_glue(frame) struct trapframe *frame; { - if (!(frame->srr1 & PSL_PR) - && (frame->exc == EXC_TRC - || (frame->exc == EXC_PGM && (frame->srr1 & 0x20000)) - || frame->exc == EXC_BPT)) { + if (!(frame->srr1 & PSL_PR) && + (frame->exc == EXC_TRC || + (frame->exc == EXC_PGM && (frame->srr1 & 0x20000)) || + frame->exc == EXC_BPT)) { bcopy(frame->fixreg, DDB_REGS->tf.fixreg, - 32 * sizeof(u_int32_t)); + 32 * sizeof(u_int32_t)); DDB_REGS->tf.srr0 = frame->srr0; DDB_REGS->tf.srr1 = frame->srr1; @@ -37,7 +37,7 @@ ddb_trap_glue(frame) cnpollc(FALSE); bcopy(DDB_REGS->tf.fixreg, frame->fixreg, - 32 * sizeof(u_int32_t)); + 32 * sizeof(u_int32_t)); return 1; } diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index 7c624719aec..1860de1e74b 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.3 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.4 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -130,11 +130,11 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) part = (struct part_map_entry *)bp->b_data; /* if first partition is not valid, assume not HFS/DPME partitioned */ - if (part->pmSig != PART_ENTRY_MAGIC) { + if (part->pmSig != PART_ENTRY_MAGIC) { msg = "DPME partition invalid"; osdep->macparts[0].pmSig = 0; /* make invalid */ goto hfs_done; - } + } osdep->macparts[0] = *part; part_cnt = part->pmMapBlkCnt; n = 0; @@ -201,7 +201,7 @@ hfs_done: dospartoff = 0; cyl = LABELSECTOR / lp->d_secpercyl; if (dp) { - daddr_t part_blkno = DOSBBSECTOR; + daddr_t part_blkno = DOSBBSECTOR; unsigned long extoff = 0; int wander = 1, loop = 0; n = 0; @@ -211,7 +211,7 @@ hfs_done: * Map the partitions to disklabel entries i-p */ while (wander && n < 8 && loop < 8) { - loop++; + loop++; wander = 0; if (part_blkno < extoff) part_blkno = extoff; @@ -222,7 +222,7 @@ hfs_done: bp->b_flags = B_BUSY | B_READ; bp->b_cylin = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -364,7 +364,7 @@ found_disklabel: if (msg == NULL) msg = "no disk label"; } else if (dlp->d_npartitions > MAXPARTITIONS || - dkcksum(dlp) != 0) + dkcksum(dlp) != 0) msg = "disk label corrupted"; else { *lp = *dlp; diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c index e97be65635c..967cdf419e5 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.13 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: dma.c,v 1.14 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -187,10 +187,10 @@ _dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first) } else { if (curaddr == lastaddr && (map->dm_segs[seg].ds_len + sgsize) <= - map->_dm_maxsegsz && + map->_dm_maxsegsz && (map->_dm_boundary == 0 || - (map->dm_segs[seg].ds_addr & bmask) == - (curaddr & bmask))) + (map->dm_segs[seg].ds_addr & bmask) == + (curaddr & bmask))) map->dm_segs[seg].ds_len += sgsize; else { if (++seg >= map->_dm_segcnt) diff --git a/sys/arch/macppc/macppc/genassym.cf b/sys/arch/macppc/macppc/genassym.cf index b80754e872e..78ef4c61195 100644 --- a/sys/arch/macppc/macppc/genassym.cf +++ b/sys/arch/macppc/macppc/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.5 2002/03/21 03:02:32 drahn Exp $ +# $OpenBSD: genassym.cf,v 1.6 2002/09/15 02:02:43 deraadt Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -39,7 +39,7 @@ include <sys/time.h> include <sys/proc.h> include <uvm/uvm_extern.h> -include <machine/pcb.h> +include <machine/pcb.h> include <machine/pmap.h> export FRAMELEN diff --git a/sys/arch/macppc/macppc/locore.S b/sys/arch/macppc/macppc/locore.S index f7619dbf436..f4f29342367 100644 --- a/sys/arch/macppc/macppc/locore.S +++ b/sys/arch/macppc/macppc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.5 2002/09/06 14:24:35 drahn Exp $ */ +/* $OpenBSD: locore.S,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */ /* @@ -59,7 +59,7 @@ fwargsave: .long 0 .long 0 .globl _C_LABEL(where) - .type _C_LABEL(where),@object + .type _C_LABEL(where),@object _C_LABEL(where): .long 0 /* @@ -67,7 +67,7 @@ _C_LABEL(where): .long 0 */ _ENTRY(_C_LABEL(kernel_text)) _ENTRY(_ASM_LABEL(start)) -/* arguments to start +/* arguments to start * r1 - stack provided by firmware/bootloader * r3 - unused * r4 - unused @@ -82,7 +82,7 @@ start: stw 6, fwargsave@l(3) stw 7, fwargsave@l+4(3) #ifdef SUPPORT_PPC1BUG - mr 0,5 + mr 0,5 cmpwi 0,0,0 bne 1f /* need additional tests for other systems??? */ @@ -107,7 +107,7 @@ start: beq 1f add 9,6,7 lwz 9, -4(9) - cmpwi 9,0 + cmpwi 9,0 beq 1f lis 8,_C_LABEL(esym)@ha stw 9,_C_LABEL(esym)@l(8) @@ -126,7 +126,7 @@ start: mr 4,1 /* end of mem reserved for kernel */ xor 0,0,0 stwu 0,-16(1) /* end of stack chain */ - + li 0, 2 lis 9,_C_LABEL(where)@ha stw 0,_C_LABEL(where)@l(9) @@ -189,7 +189,7 @@ _C_LABEL(idle): or. 9,9,9 bne- _C_LABEL(sw1) /* at least one queue non-empty */ - + ori 3,3,PSL_EE /* reenable ints again */ mtmsr 3 isync @@ -199,7 +199,7 @@ _C_LABEL(idle): oris 3, 3, PSL_POW@h mtmsr 3 isync - + /* May do some power saving here? */ b _C_LABEL(idle) @@ -219,12 +219,12 @@ _ENTRY(_C_LABEL(switchexit)) * Schedule the vmspace and stack to be freed (the proc arg is * already in r3). */ - bl _C_LABEL(exit2) + bl _C_LABEL(exit2) /* Fall through to cpu_switch to actually select another proc */ - li 3,0 /* indicate exited process */ + li 3,0 /* indicate exited process */ + - /* Fall through to cpu_switch to actually select another proc */ /* @@ -267,7 +267,7 @@ _C_LABEL(sw1): addi 4,4,_C_LABEL(qs)@l slwi 3,10,3 add 3,3,4 /* select queue */ - + lwz 31,P_FORW(3) /* unlink first proc from queue */ lwz 4,P_FORW(31) stw 4,P_FORW(3) @@ -372,7 +372,7 @@ switch_return: .data intstk: .space INTSTK /* interrupt stack */ .global _C_LABEL(intr_depth) - .type _C_LABEL(intr_depth),@object + .type _C_LABEL(intr_depth),@object _C_LABEL(intr_depth): .long -1 /* in-use marker */ #define SPILLSTK 1024 /* 1K spill stack */ @@ -406,24 +406,24 @@ _C_LABEL(trapsize) = .-_C_LABEL(trapcode) /* * For ALI: has to save DSISR and DAR */ - .globl _C_LABEL(alitrap),_C_LABEL(alisize) + .globl _C_LABEL(alitrap),_C_LABEL(alisize) _C_LABEL(alitrap): - mtsprg 1,1 /* save SP */ - stmw 28,tempsave(0) /* free r28-r31 */ - mfdar 30 - mfdsisr 31 - stmw 30,tempsave+16(0) - mflr 28 /* save LR */ - mfcr 29 /* save CR */ + mtsprg 1,1 /* save SP */ + stmw 28,tempsave(0) /* free r28-r31 */ + mfdar 30 + mfdsisr 31 + stmw 30,tempsave+16(0) + mflr 28 /* save LR */ + mfcr 29 /* save CR */ /* Test whether we already had PR set */ - mfsrr1 31 - mtcr 31 - bc 4,17,1f /* branch if PSL_PR is clear */ - lis 1,_C_LABEL(curpcb)@ha - lwz 1,_C_LABEL(curpcb)@l(1) - addi 1,1,USPACE /* stack is top of user struct */ + mfsrr1 31 + mtcr 31 + bc 4,17,1f /* branch if PSL_PR is clear */ + lis 1,_C_LABEL(curpcb)@ha + lwz 1,_C_LABEL(curpcb)@l(1) + addi 1,1,USPACE /* stack is top of user struct */ 1: - bla s_trap + bla s_trap _C_LABEL(alisize) = .-_C_LABEL(alitrap) /* @@ -753,24 +753,24 @@ _C_LABEL(tlbdsmiss): _C_LABEL(tlbdsmsize) = .-_C_LABEL(tlbdsmiss) #ifdef DDB -#define ddbsave 0xde0 /* primary save area for DDB */ +#define ddbsave 0xde0 /* primary save area for DDB */ /* * In case of DDB we want a separate trap catcher for it */ - .local ddbstk - .comm ddbstk,INTSTK,8 /* ddb stack */ - - .globl _C_LABEL(ddblow),_C_LABEL(ddbsize) + .local ddbstk + .comm ddbstk,INTSTK,8 /* ddb stack */ + + .globl _C_LABEL(ddblow),_C_LABEL(ddbsize) _C_LABEL(ddblow): - mtsprg 1,1 /* save SP */ - stmw 28,ddbsave(0) /* free r28-r31 */ - mflr 28 /* save LR */ - mfcr 29 /* save CR */ - lis 1,ddbstk+INTSTK@ha /* get new SP */ - addi 1,1,ddbstk+INTSTK@l - bla ddbtrap + mtsprg 1,1 /* save SP */ + stmw 28,ddbsave(0) /* free r28-r31 */ + mflr 28 /* save LR */ + mfcr 29 /* save CR */ + lis 1,ddbstk+INTSTK@ha /* get new SP */ + addi 1,1,ddbstk+INTSTK@l + bla ddbtrap _C_LABEL(ddbsize) = .-_C_LABEL(ddblow) -#endif /* DDB */ +#endif /* DDB */ #if NIPKDB > 0 @@ -982,7 +982,7 @@ s_dsitrap: mflr 30 /* save trap type */ mfctr 31 /* & CTR */ mfdar 3 - mfsrr1 4 + mfsrr1 4 mfdsisr 5 li 6, 0 s_pte_spill: @@ -1037,7 +1037,7 @@ s_isitrap: mflr 30 /* save trap type */ mfctr 31 /* & ctr */ mfsrr0 3 - mfsrr1 4 + mfsrr1 4 li 5, 0 li 6, 1 b s_pte_spill /* above */ @@ -1173,7 +1173,7 @@ decrintr: .globl _C_LABEL(ipkdb_trap) .type _C_LABEL(ipkdb_trap),@function _C_LABEL(ipkdb_trap): - + mtsprg 2,2 mfmsr 3 mtsrr1 3 @@ -1277,10 +1277,10 @@ _C_LABEL(ipkdbsbyte): stw 5,0(9) /* restore previous fault handler */ dcbst 0,9 /* and flush data... */ sync - icbi 0,9 /* and instruction caches */ + icbi 0,9 /* and instruction caches */ blr #endif /* NIPKDB > 0 */ - + /* * int setfault() * @@ -1328,10 +1328,10 @@ _C_LABEL(esigcode): .data - .globl _C_LABEL(intrnames) - .type _C_LABEL(intrnames),@object - .globl _C_LABEL(eintrnames) - .type _C_LABEL(eintrnames),@object + .globl _C_LABEL(intrnames) + .type _C_LABEL(intrnames),@object + .globl _C_LABEL(eintrnames) + .type _C_LABEL(eintrnames),@object _C_LABEL(intrnames): .string "irq0" "irq1" "irq2" "irq3" .string "irq4" "irq5" "irq6" "irq7" @@ -1349,14 +1349,14 @@ _C_LABEL(intrnames): .string "irq52" "irq53" "irq54" "irq55" .string "irq56" "irq57" "irq58" "irq59" .string "irq60" "irq61" "irq62" "irq63" - .string "clock" + .string "clock" .space 512 _C_LABEL(eintrnames): .align 4 - .globl _C_LABEL(intrcnt) - .type _C_LABEL(intrcnt),@object - .globl _C_LABEL(eintrcnt) - .type _C_LABEL(eintrcnt),@object + .globl _C_LABEL(intrcnt) + .type _C_LABEL(intrcnt),@object + .globl _C_LABEL(eintrcnt) + .type _C_LABEL(eintrcnt),@object _C_LABEL(intrcnt): .long 0,0,0,0 .long 0,0,0,0 @@ -1377,24 +1377,24 @@ _C_LABEL(intrcnt): .long 0 _C_LABEL(eintrcnt): -#ifdef DDB +#ifdef DDB /* * Deliberate entry to ddbtrap */ - .globl _C_LABEL(ddb_trap) + .globl _C_LABEL(ddb_trap) _C_LABEL(ddb_trap): - mtsprg 1,1 - mfmsr 3 - mtsrr1 3 - andi. 3,3,~(PSL_EE|PSL_ME)@l - mtmsr 3 /* disable interrupts */ + mtsprg 1,1 + mfmsr 3 + mtsrr1 3 + andi. 3,3,~(PSL_EE|PSL_ME)@l + mtmsr 3 /* disable interrupts */ isync - stmw 28,ddbsave(0) - mflr 28 - li 29,EXC_BPT - mtlr 29 - mfcr 29 - mtsrr0 28 + stmw 28,ddbsave(0) + mflr 28 + li 29,EXC_BPT + mtlr 29 + mfcr 29 + mtsrr0 28 /* * Now the ddb trap catching code. @@ -1402,21 +1402,21 @@ _C_LABEL(ddb_trap): ddbtrap: FRAME_SETUP(ddbsave) /* Call C trap code: */ - addi 3,1,8 - bl _C_LABEL(ddb_trap_glue) - or. 3,3,3 - bne ddbleave + addi 3,1,8 + bl _C_LABEL(ddb_trap_glue) + or. 3,3,3 + bne ddbleave /* This wasn't for DDB, so switch to real trap: */ - lwz 3,FRAME_EXC+8(1) /* save exception */ - stw 3,ddbsave+8(0) + lwz 3,FRAME_EXC+8(1) /* save exception */ + stw 3,ddbsave+8(0) FRAME_LEAVE(ddbsave) - mtsprg 1,1 /* prepare for entrance to realtrap */ - stmw 28,tempsave(0) - mflr 28 - mfcr 29 - lwz 31,ddbsave+8(0) - mtlr 31 - b realtrap + mtsprg 1,1 /* prepare for entrance to realtrap */ + stmw 28,tempsave(0) + mflr 28 + mfcr 29 + lwz 31,ddbsave+8(0) + mtlr 31 + b realtrap ddbleave: FRAME_LEAVE(ddbsave) rfi diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 0b55a10a21a..18ece7b4bb0 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.40 2002/09/11 22:29:47 drahn Exp $ */ +/* $OpenBSD: machdep.c,v 1.41 2002/09/15 02:02:43 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -249,12 +249,10 @@ where = 3; */ /* IBAT0 used for initial 256 MB segment */ __asm__ volatile ("mtibatl 0,%0; mtibatu 0,%1" - :: "r"(battable[0].batl), "r"(battable[0].batu)); + :: "r"(battable[0].batl), "r"(battable[0].batu)); /* DBAT0 used similar */ __asm__ volatile ("mtdbatl 0,%0; mtdbatu 0,%1" - :: "r"(battable[0].batl), "r"(battable[0].batu)); - - + :: "r"(battable[0].batl), "r"(battable[0].batu)); /* * Set up trap vectors @@ -315,10 +313,8 @@ where = 3; * should be a 'ba 0xf20 written' at address 0xf00, but we * do not generate EXC_PERF exceptions... */ - syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100); - uvmexp.pagesize = 4096; uvm_setpagesize(); @@ -330,18 +326,18 @@ where = 3; /* use BATs to map 1GB memory, no pageable BATs now */ if (physmem > btoc(0x10000000)) { __asm__ volatile ("mtdbatl 1,%0; mtdbatu 1,%1" - :: "r"(BATL(0x10000000, BAT_M)), - "r"(BATU(0x10000000))); + :: "r"(BATL(0x10000000, BAT_M)), + "r"(BATU(0x10000000))); } if (physmem > btoc(0x20000000)) { __asm__ volatile ("mtdbatl 2,%0; mtdbatu 2,%1" - :: "r"(BATL(0x20000000, BAT_M)), - "r"(BATU(0x20000000))); + :: "r"(BATL(0x20000000, BAT_M)), + "r"(BATU(0x20000000))); } if (physmem > btoc(0x30000000)) { __asm__ volatile ("mtdbatl 3,%0; mtdbatu 3,%1" - :: "r"(BATL(0x30000000, BAT_M)), - "r"(BATU(0x30000000))); + :: "r"(BATL(0x30000000, BAT_M)), + "r"(BATU(0x30000000))); } #if 0 /* now that we know physmem size, map physical memory with BATs */ @@ -381,7 +377,7 @@ where = 3; (fw->vmon)(); __asm__ volatile ("eieio; mfmsr %0; ori %0,%0,%1; mtmsr %0; sync;isync" - : "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI)); + : "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI)); /* * use the memory provided by pmap_bootstrap for message buffer @@ -404,9 +400,10 @@ where = 3; */ /* make a copy of the args! */ - strncpy(bootpathbuf, args, 512); - bootpath= &bootpathbuf[0]; - while ( *++bootpath && *bootpath != ' '); + strncpy(bootpathbuf, args, sizeof bootpathbuf); + bootpath = &bootpathbuf[0]; + while (*++bootpath && *bootpath != ' ') + ; if (*bootpath) { *bootpath++ = 0; while (*bootpath) { @@ -453,8 +450,8 @@ where = 3; */ devio_ex = extent_create("devio", 0x80000000, 0xffffffff, M_DEVBUF, - (caddr_t)devio_ex_storage, sizeof(devio_ex_storage), - EX_NOCOALESCE|EX_NOWAIT); + (caddr_t)devio_ex_storage, sizeof(devio_ex_storage), + EX_NOCOALESCE|EX_NOWAIT); /* * Now we can set up the console as mapping is enabled. @@ -493,16 +490,17 @@ where = 3; */ (void)power4e_get_eth_addr(); - pool_init(&ppc_vecpl, sizeof(struct vreg), 16, 0, 0, "ppcvec", NULL); + pool_init(&ppc_vecpl, sizeof(struct vreg), 16, 0, 0, "ppcvec", NULL); } -void ofw_dbg(char *str) + +void +ofw_dbg(char *str) { int i = strlen (str); OF_write(OF_stdout, str, i); } - void install_extint(handler) void (*handler)(void); @@ -518,7 +516,7 @@ install_extint(handler) panic("install_extint: too far away"); #endif __asm__ volatile ("mfmsr %0; andi. %1, %0, %2; mtmsr %1" - : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE)); + : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE)); extint_call = (extint_call & 0xfc000003) | offset; bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); syncicache((void *)&extint_call, sizeof extint_call); @@ -560,9 +558,9 @@ 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; @@ -585,9 +583,9 @@ cpu_startup() pg = uvm_pagealloc(NULL, 0, NULL, 0); if (pg == NULL) panic("cpu_startup: not enough memory for" - " buffer cache"); + " buffer cache"); pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg), - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } @@ -745,11 +743,10 @@ sendsig(catcher, sig, mask, code, type, val) /* * Allocate stack space for signal handler. */ - if ((psp->ps_flags & SAS_ALTSTACK) - && !oldonstack - && (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct sigframe *)(psp->ps_sigstk.ss_sp - + psp->ps_sigstk.ss_size); + if ((psp->ps_flags & SAS_ALTSTACK) && + !oldonstack && (psp->ps_sigonstack & sigmask(sig))) { + fp = (struct sigframe *)(psp->ps_sigstk.ss_sp + + psp->ps_sigstk.ss_size); psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else fp = (struct sigframe *)tf->fixreg[1]; @@ -833,11 +830,11 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) switch (name[0]) { case CPU_ALLOWAPERTURE: #ifdef APERTURE - if (securelevel > 0) - return (sysctl_rdint(oldp, oldlenp, newp, + if (securelevel > 0) + return (sysctl_rdint(oldp, oldlenp, newp, allowaperture)); else - return (sysctl_int(oldp, oldlenp, newp, newlen, + return (sysctl_int(oldp, oldlenp, newp, newlen, &allowaperture)); #else return (sysctl_rdint(oldp, oldlenp, newp, 0)); @@ -856,7 +853,7 @@ dumpsys() volatile int cpl, ipending, astpending, tickspending; int imask[7]; -/* +/* * this is a hack interface to allow zs to work better until * a true soft interrupt mechanism is created. */ @@ -953,7 +950,8 @@ boot(howto) OF_exit(); (fw->boot)(str); printf("boot failed, spinning\n"); - while(1) /* forever */; + while (1) + /* forever */; } /* @@ -966,10 +964,10 @@ power4e_get_eth_addr() char name[32]; for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "network") - && OF_getprop(qhandle, "local-mac-address", - &ofw_eth_addr, sizeof ofw_eth_addr) >= 0) { + if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 && + !strcmp(name, "network") && + OF_getprop(qhandle, "local-mac-address", + &ofw_eth_addr, sizeof ofw_eth_addr) >= 0) { return(0); } if ((phandle = OF_child(qhandle))) @@ -1021,18 +1019,17 @@ systype(char *name) { NULL,"",0} }; for (i = 0; systypes[i].name != NULL; i++) { - if (strncmp( name , systypes[i].name, - strlen (systypes[i].name)) == 0) - { + if (strncmp(name, systypes[i].name, + strlen(systypes[i].name)) == 0) { system_type = systypes[i].type; printf("recognized system type of %s as %s\n", - name, systypes[i].systypename); + name, systypes[i].systypename); break; } } if (system_type == OFWMACH) { - printf("System type %snot recognized, good luck\n", - name); + printf("System type %s not recognized, good luck\n", + name); } } @@ -1064,7 +1061,7 @@ ppc_intr_establish(lcv, ih, type, level, func, arg, name) ppc_configed_intr_cnt++; } else { panic("ppc_intr_establish called before interrupt controller" - " configured: driver %s too many interrupts\n", name); + " configured: driver %s too many interrupts\n", name); } /* disestablish is going to be tricky to supported for these :-) */ return (void *)ppc_configed_intr_cnt; @@ -1124,8 +1121,7 @@ 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)) { @@ -1136,19 +1132,19 @@ bus_space_map(t, bpa, size, cacheable, bshp) } if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) { if (extent_free(devio_ex, bpa, size, EX_NOWAIT | - (ppc_malloc_ok ? EX_MALLOCOK : 0))) - { + (ppc_malloc_ok ? EX_MALLOCOK : 0))) { printf("bus_space_map: pa 0x%x, size 0x%x\n", - bpa, size); + bpa, size); printf("bus_space_map: can't free region\n"); } } return 0; } bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); + bus_size_t size); void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); + bus_size_t size); + bus_addr_t bus_space_unmap_p(t, bsh, size) bus_space_tag_t t; @@ -1178,17 +1174,15 @@ bus_space_unmap(t, bsh, size) if (pmap_extract(pmap_kernel(), sva, &bpa) == TRUE) { if (extent_free(devio_ex, bpa | (bsh & PAGE_MASK), size, EX_NOWAIT | - (ppc_malloc_ok ? EX_MALLOCOK : 0))) - { + (ppc_malloc_ok ? EX_MALLOCOK : 0))) { printf("bus_space_map: pa 0x%x, size 0x%x\n", - bpa, size); + bpa, size); printf("bus_space_map: can't free region\n"); } } /* 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 { pmap_remove(vm_map_pmap(phys_map), sva, sva+len); @@ -1241,8 +1235,8 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) #endif for (; len > 0; len -= PAGE_SIZE) { pmap_kenter_cache(vaddr, spa, - VM_PROT_READ | VM_PROT_WRITE, - cacheable ? PMAP_CACHE_WT : PMAP_CACHE_DEFAULT); + VM_PROT_READ | VM_PROT_WRITE, + cacheable ? PMAP_CACHE_WT : PMAP_CACHE_DEFAULT); spa += PAGE_SIZE; vaddr += PAGE_SIZE; } diff --git a/sys/arch/macppc/macppc/mainbus.c b/sys/arch/macppc/macppc/mainbus.c index 441e04cf8e7..332bab34ec9 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.5 2002/06/09 04:13:13 drahn Exp $ */ +/* $OpenBSD: mainbus.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -124,7 +124,7 @@ mbattach(parent, self, aux) sizeof(name)) <= 0) { if (OF_getprop(node, "name", name, sizeof(name)) <= 0) - printf ("name not found on node %x\n", + 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 1e5ddccf773..f2481582d4f 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.6 2002/06/09 04:13:13 drahn Exp $ */ +/* $OpenBSD: mem.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -74,14 +74,14 @@ mmopen(dev, flag, mode, p) { switch (minor(dev)) { - case 0: - case 1: - case 2: - case 12: - break; + case 0: + case 1: + case 2: + case 12: + break; #ifdef APERTURE case 4: - if (suser(p->p_ucred, &p->p_acflag) != 0 || !allowaperture) + if (suser(p->p_ucred, &p->p_acflag) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() */ @@ -188,8 +188,8 @@ mmrw(dev, uio, flags) paddr_t mmmmap(dev, off, prot) - dev_t dev; - off_t off; + dev_t dev; + off_t off; int prot; { return (-1); diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index 54f339d05a9..597d596952d 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.14 2002/09/11 22:35:01 drahn Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.15 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -92,17 +92,15 @@ ofw_mem_regions(memp, availp) struct mem_region **memp, **availp; { int phandle; - + /* * Get memory. */ - if ((phandle = OF_finddevice("/memory")) == -1 - || OF_getprop(phandle, "reg", - OFmem, sizeof OFmem[0] * OFMEM_REGIONS) - <= 0 - || OF_getprop(phandle, "available", - OFavail, sizeof OFavail[0] * OFMEM_REGIONS) - <= 0) + if ((phandle = OF_finddevice("/memory")) == -1 || + OF_getprop(phandle, "reg", OFmem, + sizeof OFmem[0] * OFMEM_REGIONS) <= 0 || + OF_getprop(phandle, "available", OFavail, + sizeof OFavail[0] * OFMEM_REGIONS) <= 0) panic("no memory?"); *memp = OFmem; /* HACK */ @@ -150,8 +148,8 @@ save_ofw_mapping() 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) { @@ -217,7 +215,7 @@ ofrootfound() { int node; struct ofprobe probe; - + if (!(node = OF_peer(0))) panic("No PROM root"); probe.phandle = node; @@ -276,7 +274,7 @@ ofw_do_pending_int() int emsr, dmsr; static int processing; - if(processing) + if (processing) return; processing = 1; @@ -286,11 +284,11 @@ ofw_do_pending_int() pcpl = splhigh(); /* Turn off all */ - if((ipending & SINT_CLOCK) && ((pcpl & imask[IPL_CLOCK]) == 0)) { + if ((ipending & SINT_CLOCK) && ((pcpl & imask[IPL_CLOCK]) == 0)) { ipending &= ~SINT_CLOCK; softclock(); } - if((ipending & SINT_NET) && ((pcpl & imask[IPL_NET]) == 0) ) { + if ((ipending & SINT_NET) && ((pcpl & imask[IPL_NET]) == 0) ) { extern int netisr; int pisr = netisr; netisr = 0; @@ -308,21 +306,21 @@ ofw_do_pending_int() static pcitag_t ofw_make_tag( void *cpv, int bus, int dev, int fnc); /* ARGSUSED */ -static pcitag_t +static pcitag_t ofw_make_tag(cpv, bus, dev, fnc) - void *cpv; - int bus, dev, fnc; + void *cpv; + int bus, dev, fnc; { - return (bus << 16) | (dev << 11) | (fnc << 8); + return (bus << 16) | (dev << 11) | (fnc << 8); } -#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 -#define OFW_PCI_PHYS_HI_BUSSHIFT 16 -#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 -#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 -#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 -#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 - +#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 +#define OFW_PCI_PHYS_HI_BUSSHIFT 16 +#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 +#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 +#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 +#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 + #define pcibus(x) \ (((x) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) #define pcidev(x) \ @@ -345,7 +343,7 @@ int cons_backlight_available; #include "vgafb_pci.h" struct usb_kbd_ihandles { - struct usb_kbd_ihandles *next; + struct usb_kbd_ihandles *next; int ihandle; }; @@ -362,7 +360,7 @@ ofwconprobe() /* handle different types of console */ bzero(type, sizeof(type)); - if (OF_getprop(stdout_node, "device_type", type, sizeof(type)) == -1) { + if (OF_getprop(stdout_node, "device_type", type, sizeof(type)) == -1) { return; /* XXX */ } if (strcmp(type, "display") == 0) { @@ -384,7 +382,7 @@ ofwconprobe() return; } - + #define DEVTREE_UNKNOWN 0 #define DEVTREE_USB 1 #define DEVTREE_ADB 2 @@ -468,7 +466,7 @@ ofw_find_keyboard() #if NUKBD > 0 printf("USB and ADB found, using USB\n"); ukbd_cnattach(); -#else +#else ofw_have_kbd = OFW_HAVE_ADBKBD; /* ??? */ #endif } @@ -481,7 +479,7 @@ ofw_find_keyboard() #if NAKBD >0 printf("ADB found\n"); akbd_cnattach(); -#endif +#endif } } @@ -583,7 +581,7 @@ of_display_console() vgafb_pci_console(cons_membus, addr[1].phys_lo, addr[1].size_lo, - cons_membus, + cons_membus, cons_addr, addr[0].size_lo, &pa, pcibus(addr[1].phys_hi), pcidev(addr[1].phys_hi), pcifunc(addr[1].phys_hi)); @@ -628,41 +626,42 @@ of_setbrightness(brightness) cons_decl(ofw); -/* +/* * Console support functions */ void ofwcnprobe(cd) - struct consdev *cd; + struct consdev *cd; { cd->cn_pri = CN_DEAD; } void ofwcninit(cd) - struct consdev *cd; + struct consdev *cd; { } + void ofwcnputc(dev, c) dev_t dev; int c; { char ch = c; - + OF_write(OF_stdout, &ch, 1); } int ofwcngetc(dev) dev_t dev; { - unsigned char ch = '\0'; - int l; + unsigned char ch = '\0'; + int l; - while ((l = OF_read(OF_stdin, &ch, 1)) != 1) - if (l != -2 && l != 0) - return -1; - return ch; + while ((l = OF_read(OF_stdin, &ch, 1)) != 1) + if (l != -2 && l != 0) + return -1; + return ch; } void @@ -673,12 +672,12 @@ ofwcnpollc(dev, on) } struct consdev consdev_ofw = { - ofwcnprobe, - ofwcninit, - ofwcngetc, - ofwcnputc, - ofwcnpollc, - NULL, + ofwcnprobe, + ofwcninit, + ofwcngetc, + ofwcnputc, + ofwcnpollc, + NULL, }; void diff --git a/sys/arch/macppc/macppc/openfirm.c b/sys/arch/macppc/macppc/openfirm.c index 8ffaa76be3d..e00cdb6fa20 100644 --- a/sys/arch/macppc/macppc/openfirm.c +++ b/sys/arch/macppc/macppc/openfirm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.c,v 1.2 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: openfirm.c,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -236,9 +236,10 @@ OF_boot(bootspec) char *bootspec; { OF_rboot(bootspec); - printf ("OF_boot returned!"); /* just in case */ + printf("OF_boot returned!"); /* just in case */ OF_exit(); - while(1); + while (1) + ; } void @@ -256,24 +257,25 @@ OF_exit() ofw_stack(); openfirmware(&args); - panic ("OF_exit returned!"); /* just in case */ - while (1); + panic("OF_exit returned!"); /* just in case */ + while (1) + ; } /* 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; + const void *src; + void *dst; + size_t len; { - const char *sp = src; - char *dp = dst; + const char *sp = src; + char *dp = dst; - if (src == dst) - return; - - while (len-- > 0) - *dp++ = *sp++; + if (src == dst) + return; + + while (len-- > 0) + *dp++ = *sp++; } diff --git a/sys/arch/macppc/macppc/rbus_machdep.c b/sys/arch/macppc/macppc/rbus_machdep.c index b801620c47f..20b9f26a081 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.1 2002/07/23 17:53:24 drahn Exp $ */ +/* $OpenBSD: rbus_machdep.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */ /* @@ -59,8 +59,8 @@ void macppc_cardbus_init(pci_chipset_tag_t pc, pcitag_t tag); rbus_tag_t rbus_pccbb_parent_mem(self, pa) - struct device *self; - struct pci_attach_args *pa; + struct device *self; + struct pci_attach_args *pa; { bus_addr_t start; bus_size_t size; @@ -69,8 +69,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"); } @@ -95,8 +95,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"); } @@ -104,7 +104,6 @@ rbus_pccbb_parent_io(self, pa) return rbus_new_root_share(pa->pa_iot, ex, start, size, 0); } - /* * Big ugly hack to enable bridge/fix interrupts */ diff --git a/sys/arch/macppc/pci/macobio.c b/sys/arch/macppc/pci/macobio.c index 8a5edc7b17c..7661ab70944 100644 --- a/sys/arch/macppc/pci/macobio.c +++ b/sys/arch/macppc/pci/macobio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macobio.c,v 1.5 2002/09/06 13:56:51 drahn Exp $ */ +/* $OpenBSD: macobio.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: obio.c,v 1.6 1999/05/01 10:36:08 tsubai Exp $ */ /*- @@ -132,12 +132,11 @@ macobio_attach(parent, self, aux) node = OF_finddevice("mac-io"); if (node == -1) node = OF_finddevice("/pci/mac-io"); - if (OF_getprop(node, "assigned-addresses", reg, sizeof(reg)) - == (sizeof (reg[0]) * 5)) - { + if (OF_getprop(node, "assigned-addresses", reg, + sizeof(reg)) == (sizeof (reg[0]) * 5)) { /* always ??? */ heathrow_FCR = mapiodev(reg[2] + HEATHROW_FCR_OFFSET, - 4); + 4); } break; case PCI_PRODUCT_APPLE_KEYLARGO: @@ -145,12 +144,10 @@ macobio_attach(parent, self, aux) node = OF_finddevice("mac-io"); if (node == -1) node = OF_finddevice("/pci/mac-io"); - if (OF_getprop(node, "assigned-addresses", reg, sizeof(reg)) - == (sizeof (reg[0]) * 5)) - { - sc->obiomem = mapiodev(reg[2], 0x100); + if (OF_getprop(node, "assigned-addresses", reg, + sizeof(reg)) == (sizeof (reg[0]) * 5)) { + sc->obiomem = mapiodev(reg[2], 0x100); } - break; default: printf(": unknown macobio controller\n"); @@ -203,10 +200,10 @@ macobio_attach(parent, self, aux) ca.ca_nreg = OF_getprop(child, "reg", reg, sizeof(reg)); ca.ca_nintr = OF_getprop(child, "AAPL,interrupts", intr, - sizeof(intr)); + sizeof(intr)); if (ca.ca_nintr == -1) ca.ca_nintr = OF_getprop(child, "interrupts", intr, - sizeof(intr)); + sizeof(intr)); ca.ca_reg = reg; ca.ca_intr = intr; @@ -271,7 +268,7 @@ mac_intr_establish(lcv, irq, type, level, ih_fun, ih_arg, name) char *name; { return (*mac_intr_establish_func)(lcv, irq, type, level, ih_fun, - ih_arg, name); + ih_arg, name); } void mac_intr_disestablish(lcp, arg) @@ -291,7 +288,7 @@ macobio_modem_power(int enable) val = in32rb(sc->obiomem + 0x40); if (enable) val = val & ~((u_int32_t)1<<25); - else + else val = val | ((u_int32_t)1<<25); out32rb(sc->obiomem + 0x40, val); } diff --git a/sys/arch/macppc/pci/mpcpcibus.c b/sys/arch/macppc/pci/mpcpcibus.c index 4584a164095..91bafc73b03 100644 --- a/sys/arch/macppc/pci/mpcpcibus.c +++ b/sys/arch/macppc/pci/mpcpcibus.c @@ -1,8 +1,8 @@ -/* $OpenBSD: mpcpcibus.c,v 1.12 2002/09/06 13:44:03 drahn Exp $ */ +/* $OpenBSD: mpcpcibus.c,v 1.13 2002/09/15 02:02:44 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -75,27 +75,27 @@ void mpc_decompose_tag(void *, pcitag_t, int *, int *, int *); pcireg_t mpc_conf_read(void *, pcitag_t, int); void mpc_conf_write(void *, pcitag_t, int, pcireg_t); -int mpc_intr_map(void *, pcitag_t, int, int, pci_intr_handle_t *); +int mpc_intr_map(void *, pcitag_t, int, int, pci_intr_handle_t *); const char *mpc_intr_string(void *, pci_intr_handle_t); int mpc_intr_line(void *, pci_intr_handle_t); -void *mpc_intr_establish(void *, pci_intr_handle_t, - int, int (*func)(void *), void *, char *); -void mpc_intr_disestablish(void *, void *); -int mpc_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); +void *mpc_intr_establish(void *, pci_intr_handle_t, + int, int (*func)(void *), void *, char *); +void mpc_intr_disestablish(void *, void *); +int mpc_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); u_int32_t mpc_gen_config_reg(void *cpv, pcitag_t tag, int offset); int of_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); int find_node_intr (int parent, u_int32_t *addr, u_int32_t *intr); u_int32_t pci_iack(void); struct cfattach mpcpcibr_ca = { - sizeof(struct pcibr_softc), mpcpcibrmatch, mpcpcibrattach, + sizeof(struct pcibr_softc), mpcpcibrmatch, mpcpcibrattach, }; struct cfdriver mpcpcibr_cd = { NULL, "mpcpcibr", DV_DULL, }; -static int mpcpcibrprint(void *, const char *pnp); +static int mpcpcibrprint(void *, const char *pnp); struct pcibr_config mpc_config; @@ -148,12 +148,13 @@ srom_crc32( const unsigned char *databuf, size_t datalen) { - u_int idx, bit, data, crc = 0xFFFFFFFFUL; + u_int idx, bit, data, crc = 0xFFFFFFFFUL; - for (idx = 0; idx < datalen; idx++) - for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) - crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0); - return crc; + for (idx = 0; idx < datalen; idx++) + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? + TULIP_CRC32_POLY : 0); + return crc; } int @@ -168,7 +169,6 @@ mpcpcibrmatch(parent, match, aux) return (found); found = 1; - return found; } @@ -188,19 +188,20 @@ mpcpcibrattach(parent, self, aux) char *bridge; int of_node = 0; - switch(system_type) { + switch (system_type) { case OFWMACH: case PWRSTK: { - int handle; + int handle; int err; unsigned int val; + handle = ppc_open_pci_bridge(); /* if open fails something odd has happened, * we did this before during probe... */ err = OF_call_method("config-l@", handle, 1, 1, - 0x80000000, &val); + 0x80000000, &val); if (err == 0) { switch (val) { /* supported ppc-pci bridges */ @@ -211,16 +212,15 @@ mpcpcibrattach(parent, self, aux) bridge = "MPC106"; break; default: - ; + break; } - } - - /* read the PICR1 register to find what + + /* read the PICR1 register to find what * address map is being used */ err = OF_call_method("config-l@", handle, 1, 1, - 0x800000a8, &val); + 0x800000a8, &val); if (val & 0x00010000) { map = 1; /* map A */ pci_map_a = 1; @@ -236,27 +236,24 @@ mpcpcibrattach(parent, self, aux) sc->sc_membus_space.bus_reverse = 1; sc->sc_iobus_space.bus_base = MPC106_P_PCI_IO_SPACE; sc->sc_iobus_space.bus_reverse = 1; - if ( bus_space_map(&(sc->sc_iobus_space), 0, NBPG, 0, - &lcp->ioh_cf8) != 0 ) - { + if (bus_space_map(&(sc->sc_iobus_space), 0, NBPG, 0, + &lcp->ioh_cf8) != 0) { panic("mpcpcibus: unable to map self\n"); } lcp->ioh_cfc = lcp->ioh_cf8; } else { sc->sc_membus_space.bus_base = - MPC106_P_PCI_MEM_SPACE_MAP_B; + MPC106_P_PCI_MEM_SPACE_MAP_B; sc->sc_membus_space.bus_reverse = 1; sc->sc_iobus_space.bus_base = - MPC106_P_PCI_IO_SPACE_MAP_B; + MPC106_P_PCI_IO_SPACE_MAP_B; sc->sc_iobus_space.bus_reverse = 1; - if ( bus_space_map(&(sc->sc_iobus_space), 0xfec00000, - NBPG, 0, &lcp->ioh_cf8) != 0 ) - { + if (bus_space_map(&(sc->sc_iobus_space), 0xfec00000, + NBPG, 0, &lcp->ioh_cf8) != 0) { panic("mpcpcibus: unable to map self\n"); } - if ( bus_space_map(&(sc->sc_iobus_space), 0xfee00000, - NBPG, 0, &lcp->ioh_cfc) != 0 ) - { + if (bus_space_map(&(sc->sc_iobus_space), 0xfee00000, + NBPG, 0, &lcp->ioh_cfc) != 0) { panic("mpcpcibus: unable to map self\n"); } } @@ -272,7 +269,7 @@ mpcpcibrattach(parent, self, aux) lcp->lc_iot = &sc->sc_iobus_space; lcp->lc_memt = &sc->sc_membus_space; - lcp->lc_pc.pc_intr_v = lcp; + lcp->lc_pc.pc_intr_v = lcp; lcp->lc_pc.pc_intr_map = mpc_intr_map; lcp->lc_pc.pc_intr_string = mpc_intr_string; lcp->lc_pc.pc_intr_line = mpc_intr_line; @@ -280,8 +277,8 @@ mpcpcibrattach(parent, self, aux) lcp->lc_pc.pc_intr_disestablish = mpc_intr_disestablish; - printf(": %s, Revision 0x%x, ", bridge, - mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); + printf(": %s, Revision 0x%x, ", bridge, + mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); if (map == 1) { printf("Using Map A\n"); } else { @@ -328,28 +325,26 @@ mpcpcibrattach(parent, self, aux) u_int32_t range_store[32]; struct ranges_new *prange = (void *)&range_store; - len=OF_getprop(ca->ca_node, "compatible", compat, - sizeof (compat)); + len = OF_getprop(ca->ca_node, "compatible", compat, + sizeof (compat)); if (len <= 0 ) { - len=OF_getprop(ca->ca_node, "name", compat, - sizeof (compat)); + len = OF_getprop(ca->ca_node, "name", compat, + sizeof (compat)); if (len <= 0) { printf(" compatible and name not" - " found\n"); + " found\n"); return; } - compat[len] = 0; - if (strcmp (compat, "bandit") != 0) { + compat[len] = 0; + if (strcmp(compat, "bandit") != 0) { printf(" compatible not found and name" - " %s found\n", compat); + " %s found\n", compat); return; } } - compat[len] = 0; + compat[len] = 0; if ((rangelen = OF_getprop(ca->ca_node, "ranges", - range_store, - sizeof (range_store))) <= 0) - { + range_store, sizeof (range_store))) <= 0) { printf("range lookup failed, node %x\n", ca->ca_node); } @@ -372,8 +367,7 @@ mpcpcibrattach(parent, self, aux) /* find io(config) base, flag == 0x01000000 */ found = 0; - for (i = 0; i < rangelen ; i++) - { + for (i = 0; i < rangelen ; i++) { if (prange[i].flags == 0x01000000) { /* find last? */ found = i; @@ -382,12 +376,12 @@ mpcpcibrattach(parent, self, aux) /* found the io space ranges */ if (prange[found].flags == 0x01000000) { sc->sc_iobus_space.bus_base = - prange[found].base; + prange[found].base; sc->sc_iobus_space.bus_size = - prange[found].size; + prange[found].size; } - /* the mem space ranges + /* the mem space ranges * apple openfirmware always puts full * addresses in config information, * it is not necessary to have correct bus @@ -397,26 +391,24 @@ mpcpcibrattach(parent, self, aux) * 0x80000000 * start with segment 1 not 0, 0 is config. */ - for (i = 0; i < rangelen ; i++) - { + for (i = 0; i < rangelen ; i++) { if (prange[i].flags == 0x02000000) { #if 0 printf("\nfound mem %x %x", - prange[i].base, - prange[i].size); + prange[i].base, + prange[i].size); #endif - + if (base != 0) { if ((base + size) == - prange[i].base) - { + prange[i].base) { size += prange[i].size; } else { base = - prange[i].base; + prange[i].base; size = - prange[i].size; + prange[i].size; } } else { base = prange[i].base; @@ -431,40 +423,37 @@ mpcpcibrattach(parent, self, aux) addr_offset = 0; for (i = 0; config_offsets[i].compat != NULL; i++) { if (strcmp(config_offsets[i].compat, compat) - == 0) - { - addr_offset = config_offsets[i].addr; - data_offset = config_offsets[i].data; + == 0) { + addr_offset = config_offsets[i].addr; + data_offset = config_offsets[i].data; lcp->config_type = - config_offsets[i].config_type; + config_offsets[i].config_type; break; } } if (addr_offset == 0) { printf("unable to find match for" - " compatible %s\n", compat); + " compatible %s\n", compat); return; } #ifdef DEBUG_FIXUP printf(" mem base %x sz %x io base %x sz %x\n config addr %x" - " config data %x\n", - sc->sc_membus_space.bus_base, - sc->sc_membus_space.bus_size, - sc->sc_iobus_space.bus_base, - sc->sc_iobus_space.bus_size, - addr_offset, data_offset); + " config data %x\n", + sc->sc_membus_space.bus_base, + sc->sc_membus_space.bus_size, + sc->sc_iobus_space.bus_base, + sc->sc_iobus_space.bus_size, + addr_offset, data_offset); #endif - if ( bus_space_map(&(sc->sc_iobus_space), addr_offset, - NBPG, 0, &lcp->ioh_cf8) != 0 ) - { + if (bus_space_map(&(sc->sc_iobus_space), addr_offset, + NBPG, 0, &lcp->ioh_cf8) != 0) { panic("mpcpcibus: unable to map self\n"); } - if ( bus_space_map(&(sc->sc_iobus_space), data_offset, - NBPG, 0, &lcp->ioh_cfc) != 0 ) - { + if (bus_space_map(&(sc->sc_iobus_space), data_offset, + NBPG, 0, &lcp->ioh_cfc) != 0) { panic("mpcpcibus: unable to map self\n"); } of_node = ca->ca_node; @@ -489,8 +478,8 @@ mpcpcibrattach(parent, self, aux) lcp->lc_pc.pc_intr_establish = mpc_intr_establish; lcp->lc_pc.pc_intr_disestablish = mpc_intr_disestablish; - printf(": %s, Revision 0x%x\n", compat, - mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); + printf(": %s, Revision 0x%x\n", compat, + mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); pci_addr_fixup(sc, &lcp->lc_pc, 32); } @@ -502,7 +491,6 @@ mpcpcibrattach(parent, self, aux) } pba.pba_dmat = &pci_bus_dma_tag; - pba.pba_busname = "pci"; pba.pba_iot = &sc->sc_iobus_space; @@ -514,12 +502,11 @@ mpcpcibrattach(parent, self, aux) if (of_node != 0) { int nn; - for (node = OF_child(of_node); node; node = nn) - { + for (node = OF_child(of_node); node; node = nn) { char name[32]; int len; len = OF_getprop(node, "name", name, - sizeof(name)); + sizeof(name)); name[len] = 0; fix_node_irq(node, &pba); @@ -540,13 +527,13 @@ mpcpcibrattach(parent, self, aux) config_found(self, &pba, mpcpcibrprint); } - -#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 -#define OFW_PCI_PHYS_HI_BUSSHIFT 16 -#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 -#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 -#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 -#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 + +#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 +#define OFW_PCI_PHYS_HI_BUSSHIFT 16 +#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 +#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 +#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 +#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 #define pcibus(x) \ (((x) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) @@ -555,7 +542,7 @@ mpcpcibrattach(parent, self, aux) #define pcifunc(x) \ (((x) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT) -/* +/* * Find PCI IRQ from OF */ int @@ -620,7 +607,7 @@ fix_node_irq(node, pba) int node; struct pcibus_attach_args *pba; { - struct { + struct { u_int32_t phys_hi, phys_mid, phys_lo; u_int32_t size_hi, size_lo; } addr [8]; @@ -642,7 +629,6 @@ fix_node_irq(node, pba) */ len = OF_getprop(node, "AAPL,interrupts", &intr, 4); if (len != 4) { - parent = OF_parent(node); /* we want the first interrupt, set size_hi to 1 */ @@ -655,8 +641,8 @@ fix_node_irq(node, pba) */ tag = pci_make_tag(pc, pcibus(addr[0].phys_hi), - pcidev(addr[0].phys_hi), - pcifunc(addr[0].phys_hi)); + pcidev(addr[0].phys_hi), + pcifunc(addr[0].phys_hi)); intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG); intr &= ~PCI_INTERRUPT_LINE_MASK; @@ -710,11 +696,12 @@ of_ether_hw_addr(struct ppc_pci_chipset *lcpc, u_int8_t *oaddr) struct pcibr_config *lcp = lcpc->pc_conf_v; int of_node = lcp->node; int node, nn; + for (node = OF_child(of_node); node; node = nn) { char name[32]; int len; len = OF_getprop(node, "name", name, - sizeof(name)); + sizeof(name)); name[len] = 0; len = OF_getprop(node, "local-mac-address", laddr, @@ -814,23 +801,20 @@ mpc_gen_config_reg(cpv, tag, offset) * that 11-15 is reserved. */ reg = 1 << (dev) | fcn << 8 | offset; - } else { if (dev > 15) { - return 0xffffffff; + return 0xffffffff; } /* - * config type 1 + * config type 1 */ - reg = tag | offset | 1; - + reg = tag | offset | 1; } } else { /* config mechanism #2, type 0 * standard cf8/cfc config */ - reg = 0x80000000 | tag | offset; - + reg = 0x80000000 | tag | offset; } return reg; } @@ -850,11 +834,9 @@ mpc_conf_read(cpv, tag, offset) faultbuf env; void *oldh; - - if (offset & 3 || offset < 0 || offset >= 0x100) { -#ifdef DEBUG_CONFIG - printf ("pci_conf_read: bad reg %x\n", offset); +#ifdef DEBUG_CONFIG + printf("pci_conf_read: bad reg %x\n", offset); #endif /* DEBUG_CONFIG */ return(~0); } @@ -892,7 +874,7 @@ mpc_conf_read(cpv, tag, offset) unsigned int bus, dev, fcn; mpc_decompose_tag(cpv, tag, &bus, &dev, &fcn); printf("mpc_conf_read bus %x dev %x fcn %x offset %x", bus, dev, fcn, - offset); + offset); printf(" daddr %x reg %x",daddr, reg); printf(" data %x\n", data); } @@ -927,7 +909,7 @@ mpc_conf_write(cpv, tag, offset, data) unsigned int bus, dev, fcn; mpc_decompose_tag(cpv, tag, &bus, &dev, &fcn); printf("mpc_conf_write bus %x dev %x fcn %x offset %x", bus, - dev, fcn, offset); + dev, fcn, offset); printf(" daddr %x reg %x",daddr, reg); printf(" data %x\n", data); } @@ -956,14 +938,13 @@ mpc_intr_map(lcv, bustag, buspin, line, ihp) int error = 0; *ihp = -1; - if (buspin == 0) { - /* No IRQ used. */ - error = 1; - } - else if (buspin > 4) { - printf("mpc_intr_map: bad interrupt pin %d\n", buspin); - error = 1; - } + if (buspin == 0) { + /* No IRQ used. */ + error = 1; + } else if (buspin > 4) { + printf("mpc_intr_map: bad interrupt pin %d\n", buspin); + error = 1; + } if (!error) *ihp = line; @@ -999,7 +980,7 @@ mpc_intr_establish(lcv, ih, level, func, arg, name) char *name; { return (*intr_establish_func)(lcv, ih, IST_LEVEL, level, func, arg, - name); + name); } void @@ -1030,7 +1011,7 @@ mpc_cfg_write_1(cp, reg, val) int s; s = splhigh(); bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, - MPC106_REGOFFS(reg)); + MPC106_REGOFFS(reg)); bus_space_write_1(cp->lc_iot, cp->ioh_cfc, 0, val); splx(s); } diff --git a/sys/arch/macppc/pci/pci_addr_fixup.c b/sys/arch/macppc/pci/pci_addr_fixup.c index 2055be6a380..0ac5ddcb132 100644 --- a/sys/arch/macppc/pci/pci_addr_fixup.c +++ b/sys/arch/macppc/pci/pci_addr_fixup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_addr_fixup.c,v 1.1 2002/07/23 17:53:25 drahn Exp $ */ +/* $OpenBSD: pci_addr_fixup.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: pci_addr_fixup.c,v 1.7 2000/08/03 20:10:45 nathanw Exp $ */ /*- @@ -85,22 +85,22 @@ pci_addr_fixup(sc, pc, maxbus) pci_chipset_tag_t pc; int maxbus; { - const char *verbose_header = + const char *verbose_header = "[%s]-----------------------\n" " device vendor product\n" " register space address size\n" "--------------------------------------------\n"; - const char *verbose_footer = + const char *verbose_footer = "--------------------------[%3d devices bogus]\n"; sc->extent_mem = extent_create("PCI I/O memory space", - sc->sc_membus_space.bus_base, + sc->sc_membus_space.bus_base, sc->sc_membus_space.bus_base + sc->sc_membus_space.bus_size, M_DEVBUF, 0, 0, EX_NOWAIT); KASSERT(sc->extent_mem); sc->extent_port = extent_create("PCI I/O port space", #if 1 - sc->sc_iobus_space.bus_base, + sc->sc_iobus_space.bus_base, sc->sc_iobus_space.bus_base + sc->sc_iobus_space.bus_size, #else PCIADDR_PORT_START, PCIADDR_PORT_END, @@ -108,7 +108,7 @@ pci_addr_fixup(sc, pc, maxbus) M_DEVBUF, 0, 0, EX_NOWAIT); KASSERT(sc->extent_port); - /* + /* * 1. check & reserve system BIOS setting. */ PCIBIOS_PRINTV((verbose_header, "System BIOS Setting")); @@ -118,23 +118,25 @@ pci_addr_fixup(sc, pc, maxbus) { struct extent_region *rp; struct extent *ex = sc->extent_mem; + for (rp = LIST_FIRST(&ex->ex_regions); - rp; rp = LIST_NEXT(rp, er_link)) { - } + rp; rp = LIST_NEXT(rp, er_link)) + ; } { struct extent_region *rp; struct extent *ex = sc->extent_port; + for (rp = LIST_FIRST(&ex->ex_regions); - rp; rp = LIST_NEXT(rp, er_link)) { - } + rp; rp = LIST_NEXT(rp, er_link)) + ; } if (sc->nbogus == 0) return; /* no need to fixup */ - /* - * 4. do fixup + /* + * 4. do fixup */ PCIBIOS_PRINTV((verbose_header, "PCIBIOS fixup stage")); sc->nbogus = 0; @@ -151,7 +153,7 @@ pciaddr_resource_reserve(sc, pc, tag) { if (pcibr_flags & PCIBR_VERBOSE) pciaddr_print_devid(pc, tag); - pciaddr_resource_manage(sc, pc, tag, pciaddr_do_resource_reserve); + pciaddr_resource_manage(sc, pc, tag, pciaddr_do_resource_reserve); } void @@ -184,7 +186,7 @@ pciaddr_resource_manage(sc, pc, tag, func) printf("WARNING: unknown PCI device header.\n"); sc->nbogus++; return; - case 0: + case 0: reg_start = PCI_MAPREG_START; reg_end = PCI_MAPREG_END; break; @@ -198,7 +200,7 @@ pciaddr_resource_manage(sc, pc, tag, func) break; } error = 0; - + for (mapreg = reg_start; mapreg < reg_end; mapreg += width) { /* inquire PCI device bus space requirement */ val = pci_conf_read(pc, tag, mapreg); @@ -206,22 +208,22 @@ pciaddr_resource_manage(sc, pc, tag, func) mask = pci_conf_read(pc, tag, mapreg); pci_conf_write(pc, tag, mapreg, val); - + type = PCI_MAPREG_TYPE(val); width = 4; if (type == PCI_MAPREG_TYPE_MEM) { - if (PCI_MAPREG_MEM_TYPE(val) == + if (PCI_MAPREG_MEM_TYPE(val) == PCI_MAPREG_MEM_TYPE_64BIT) { /* XXX We could examine the upper 32 bits - * XXX of the BAR here, but we are totally - * XXX unprepared to handle a non-zero value, - * XXX either here or anywhere else in - * XXX i386-land. + * XXX of the BAR here, but we are totally + * XXX unprepared to handle a non-zero value, + * XXX either here or anywhere else in + * XXX i386-land. * XXX So just arrange to not look at the * XXX upper 32 bits, lest we misinterpret - * XXX it as a 32-bit BAR set to zero. + * XXX it as a 32-bit BAR set to zero. */ - width = 8; + width = 8; } addr = PCI_MAPREG_MEM_ADDR(val); size = PCI_MAPREG_MEM_SIZE(mask); @@ -229,33 +231,33 @@ pciaddr_resource_manage(sc, pc, tag, func) } else { /* XXX some devices give 32bit value */ addr = (PCI_MAPREG_IO_ADDR(val) & PCIADDR_PORT_END) | - sc->sc_iobus_space.bus_base, + sc->sc_iobus_space.bus_base, size = PCI_MAPREG_IO_SIZE(mask); ex = sc->extent_port; } - + if (!size) /* unused register */ continue; /* reservation/allocation phase */ error += (*func) (sc, pc, tag, mapreg, ex, type, &addr, size); - PCIBIOS_PRINTV(("\t%02xh %s 0x%08x 0x%08x\n", - mapreg, type ? "port" : "mem ", - (unsigned int)addr, (unsigned int)size)); + PCIBIOS_PRINTV(("\t%02xh %s 0x%08x 0x%08x\n", + mapreg, type ? "port" : "mem ", + (unsigned int)addr, (unsigned int)size)); } - + /* enable/disable PCI device */ - val = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); + val = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); if (error == 0) val |= (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | - PCI_COMMAND_MASTER_ENABLE); + PCI_COMMAND_MASTER_ENABLE); else val &= ~(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | - PCI_COMMAND_MASTER_ENABLE); + PCI_COMMAND_MASTER_ENABLE); pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, val); - + if (error) sc->nbogus++; @@ -274,14 +276,14 @@ pciaddr_do_resource_allocate(sc, pc, tag, mapreg, ex, type, addr, size) { bus_addr_t start; int error; - + if (*addr) /* no need to allocate */ return (0); /* XXX Don't allocate if device is AGP device to avoid conflict. */ - if (pciaddr_device_is_agp(pc, tag)) + if (pciaddr_device_is_agp(pc, tag)) return (0); - + start = (type == PCI_MAPREG_TYPE_MEM ? sc->sc_membus_space.bus_base : sc->sc_iobus_space.bus_base); if (start < ex->ex_start || start + size - 1 >= ex->ex_end) { @@ -298,8 +300,7 @@ pciaddr_do_resource_allocate(sc, pc, tag, mapreg, ex, type, addr, size) /* write new address to PCI device configuration header */ pci_conf_write(pc, tag, mapreg, *addr); /* check */ - if (!pcibr_flags & PCIBR_VERBOSE) - { + if (!pcibr_flags & PCIBR_VERBOSE) { printf("pci_addr_fixup: "); pciaddr_print_devid(pc, tag); } @@ -354,13 +355,13 @@ pciaddr_print_devid(pc, tag) pci_chipset_tag_t pc; pcitag_t tag; { - int bus, device, function; + int bus, device, function; pcireg_t id; - + id = pci_conf_read(pc, tag, PCI_ID_REG); pci_decompose_tag(pc, tag, &bus, &device, &function); - printf("%03d:%02d:%d %04x:%04x\n", bus, device, function, - PCI_VENDOR(id), PCI_PRODUCT(id)); + printf("%03d:%02d:%d %04x:%04x\n", bus, device, function, + PCI_VENDOR(id), PCI_PRODUCT(id)); } int @@ -381,7 +382,7 @@ pciaddr_device_is_agp(pc, tag) off != 0; off = PCI_CAPLIST_NEXT(rval) ) { rval = pci_conf_read(pc, tag, off); - if (PCI_CAPLIST_CAP(rval) == PCI_CAP_AGP) + if (PCI_CAPLIST_CAP(rval) == PCI_CAP_AGP) return (1); } } @@ -473,7 +474,7 @@ pci_device_foreach(sc, pc, maxbus, func) bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); if (PCI_HDRTYPE_MULTIFN(bhlcr) || (qd != NULL && - (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0)) + (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0)) nfuncs = 8; else nfuncs = 1; diff --git a/sys/arch/macppc/pci/pcibrvar.h b/sys/arch/macppc/pci/pcibrvar.h index 39dba16855c..c16136bd24b 100644 --- a/sys/arch/macppc/pci/pcibrvar.h +++ b/sys/arch/macppc/pci/pcibrvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcibrvar.h,v 1.3 2002/07/23 17:53:25 drahn Exp $ */ +/* $OpenBSD: pcibrvar.h,v 1.4 2002/09/15 02:02:44 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -45,7 +45,7 @@ struct pcibr_config { int config_type; int bus; int pci_init_done; - int node; + int node; }; struct pcibr_softc { diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c index 87b9d239289..a60c05a560b 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.17 2002/09/06 13:37:50 drahn Exp $ */ +/* $OpenBSD: vgafb.c,v 1.18 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -54,7 +54,7 @@ struct cfdriver vgafb_cd = { NULL, "vgafb", DV_DULL, }; -void vgafb_setcolor(struct vgafb_config *vc, unsigned int index, +void vgafb_setcolor(struct vgafb_config *vc, unsigned int index, u_int8_t r, u_int8_t g, u_int8_t b); void vgafb_restore_default_colors(struct vgafb_config *vc); @@ -67,7 +67,7 @@ struct vgafb_devconfig vgafb_console_dc; struct wsscreen_descr vgafb_stdscreen = { "std", - 0, 0, /* will be filled in -- XXX shouldn't, it's global */ + 0, 0, /* will be filled in -- XXX shouldn't, it's global */ 0, 0, 0, WSSCREEN_UNDERLINE | WSSCREEN_HILIT | @@ -77,7 +77,7 @@ const struct wsscreen_descr *vgafb_scrlist[] = { &vgafb_stdscreen, /* XXX other formats, graphics screen? */ }; - + struct wsscreen_list vgafb_screenlist = { sizeof(vgafb_scrlist) / sizeof(struct wsscreen_descr *), vgafb_scrlist }; @@ -156,27 +156,27 @@ vgafb_common_setup(iot, memt, vc, iobase, iosize, membase, memsize, mmiobase, mm u_int32_t iobase, membase, mmiobase; size_t iosize, memsize, mmiosize; { - vc->vc_iot = iot; - vc->vc_memt = memt; + vc->vc_iot = iot; + vc->vc_memt = memt; vc->vc_paddr = membase; if (iosize != 0) { - if (bus_space_map(vc->vc_iot, iobase+0x3b0, 0xc, 0, &vc->vc_ioh_b)) - panic("vgafb_common_setup: couldn't map io b"); - if (bus_space_map(vc->vc_iot, iobase+0x3c0, 0x10, 0, &vc->vc_ioh_c)) - panic("vgafb_common_setup: couldn't map io c"); - if (bus_space_map(vc->vc_iot, iobase+0x3d0, 0x10, 0, &vc->vc_ioh_d)) - panic("vgafb_common_setup: couldn't map io d"); + if (bus_space_map(vc->vc_iot, iobase+0x3b0, 0xc, 0, &vc->vc_ioh_b)) + panic("vgafb_common_setup: couldn't map io b"); + if (bus_space_map(vc->vc_iot, iobase+0x3c0, 0x10, 0, &vc->vc_ioh_c)) + panic("vgafb_common_setup: couldn't map io c"); + if (bus_space_map(vc->vc_iot, iobase+0x3d0, 0x10, 0, &vc->vc_ioh_d)) + panic("vgafb_common_setup: couldn't map io d"); } if (mmiosize != 0) { - if (bus_space_map(vc->vc_memt, mmiobase, mmiosize, 0, &vc->vc_mmioh)) - panic("vgafb_common_setup: couldn't map mmio"); + if (bus_space_map(vc->vc_memt, mmiobase, mmiosize, 0, &vc->vc_mmioh)) + panic("vgafb_common_setup: couldn't map mmio"); } /* memsize should only be visible region for console */ memsize = cons_height * cons_linebytes; - if (bus_space_map(vc->vc_memt, membase, memsize, 1, &vc->vc_memh)) - panic("vgafb_common_setup: couldn't map memory"); + if (bus_space_map(vc->vc_memt, membase, memsize, 1, &vc->vc_memh)) + panic("vgafb_common_setup: couldn't map memory"); cons_display_mem_h = vc->vc_memh; vc->vc_ofh = cons_display_ofh; @@ -191,14 +191,14 @@ vgafb_common_setup(iot, memt, vc, iobase, iosize, membase, memsize, mmiobase, mm vc->vc_at = 0x00 | 0xf; /* black bg|white fg */ vc->vc_so_at = 0x00 | 0xf | 0x80; /* black bg|white fg|blink */ - if (cons_depth == 8) { + if (cons_depth == 8) { vgafb_restore_default_colors(vc); } } void vgafb_restore_default_colors(struct vgafb_config *vc) -{ +{ int i; for (i = 0; i < 256; i++) { @@ -217,7 +217,7 @@ vgafb_wsdisplay_attach(parent, vc, console) { struct wsemuldisplaydev_attach_args aa; - aa.console = console; + aa.console = console; aa.scrdata = &vgafb_screenlist; aa.accessops = &vgafb_accessops; aa.accesscookie = vc; @@ -229,8 +229,8 @@ vgafb_wsdisplay_attach(parent, vc, console) vc->vc_backlight_on = WSDISPLAYIO_VIDEO_OFF; vgafb_burn(vc, WSDISPLAYIO_VIDEO_ON, 0); /* paranoia */ } - - config_found(parent, &aa, wsemuldisplaydevprint); + + config_found(parent, &aa, wsemuldisplaydevprint); } int @@ -269,12 +269,12 @@ vgafb_ioctl(v, cmd, data, flag, p) case WSDISPLAYIO_SMODE: /* track the state of the display, * if returning to WSDISPLAYIO_MODE_EMUL - * restore the last palette, workaround for + * restore the last palette, workaround for * bad accellerated X servers that does not restore * the correct palette. */ - if (cons_depth == 8) { + if (cons_depth == 8) { vgafb_restore_default_colors(vc); } @@ -317,7 +317,7 @@ vgafb_ioctl(v, cmd, data, flag, p) if (cons_backlight_available != 0) { vgafb_burn(vc, dp->curval ? WSDISPLAYIO_VIDEO_ON : - WSDISPLAYIO_VIDEO_OFF, 0); + WSDISPLAYIO_VIDEO_OFF, 0); return 0; } else return -1; @@ -335,9 +335,9 @@ vgafb_ioctl(v, cmd, data, flag, p) default: return -1; /* not supported yet */ } - - /* XXX */ - return -1; + + /* XXX */ + return -1; } paddr_t @@ -352,7 +352,7 @@ vgafb_mmap(v, offset, prot) /* memsize... */ if (offset >= 0x00000 && offset < vc->memsize) h = vc->vc_paddr + offset; - /* XXX the following are probably wrong. we want physical addresses + /* XXX the following are probably wrong. we want physical addresses here, not virtual ones */ else if (offset >= 0x10000000 && offset < 0x10040000 ) /* 256KB of iohb */ @@ -402,7 +402,7 @@ vgafb_cnprobe(cp) if (cons_displaytype != 1) { cp->cn_pri = CN_DEAD; return; - } + } cp->cn_pri = CN_INTERNAL; } @@ -413,10 +413,10 @@ vgafb_cnattach(iot, memt, pc, bus, device, function) bus_space_tag_t iot, memt; int bus, device, function; { - long defattr; + long defattr; struct vgafb_devconfig *dc = &vgafb_console_dc; - struct rasops_info *ri = &dc->dc_rinfo; + struct rasops_info *ri = &dc->dc_rinfo; ri->ri_flg = RI_CENTER; ri->ri_depth = cons_depth; @@ -443,7 +443,7 @@ struct { } vgafb_color[256]; void -vgafb_setcolor(vc, index, r, g, b) +vgafb_setcolor(vc, index, r, g, b) struct vgafb_config *vc; unsigned int index; u_int8_t r, g, b; diff --git a/sys/arch/macppc/pci/vgafb_pci.c b/sys/arch/macppc/pci/vgafb_pci.c index 362bbd0a3a1..4b9d088d773 100644 --- a/sys/arch/macppc/pci/vgafb_pci.c +++ b/sys/arch/macppc/pci/vgafb_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb_pci.c,v 1.8 2002/05/22 21:00:03 miod Exp $ */ +/* $OpenBSD: vgafb_pci.c,v 1.9 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */ /* @@ -57,10 +57,10 @@ #define PCI_CHIPID(x) (((x) >> 16) & 0xFFFF) struct vgafb_pci_softc { - struct device sc_dev; - + struct device sc_dev; + pcitag_t sc_pcitag; /* PCI tag, in case we need it. */ - struct vgafb_config *sc_vc; /* VGA configuration */ + struct vgafb_config *sc_vc; /* VGA configuration */ int nscreens; }; @@ -108,13 +108,13 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m for (i = PCI_MAPREG_START; i <= PCI_MAPREG_PPB_END; i += 4) { #ifdef DEBUG_VGAFB printf("vgafb confread %x %x\n", - i, pci_conf_read(pc, pa->pa_tag, i)); + i, pci_conf_read(pc, pa->pa_tag, i)); #endif /* need to check more than just two base addresses? */ if (PCI_MAPREG_TYPE(pci_conf_read(pc, pa->pa_tag, i)) == PCI_MAPREG_TYPE_IO) { retval = pci_io_find(pc, pa->pa_tag, i, - &addr, &size); + &addr, &size); #ifdef DEBUG_VGAFB printf("vgafb_pci_probe: io %x addr %x size %x\n", i, addr, size); #endif @@ -129,7 +129,7 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m } else { retval = pci_mem_find(pc, pa->pa_tag, i, - &addr, &size, &tcacheable); + &addr, &size, &tcacheable); #ifdef DEBUG_VGAFB printf("vgafb_pci_probe: mem %x addr %x size %x\n", i, addr, size); #endif @@ -142,7 +142,7 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m } else if (size <= (1024 * 1024)) { #ifdef DEBUG_VGAFB printf("vgafb_pci_probe: mem %x addr %x size %x iosize %x\n", - i, addr, size, *iosize); + i, addr, size, *iosize); #endif if (*mmiosize == 0) { /* this is mmio, not memory */ @@ -164,8 +164,9 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m } } #ifdef DEBUG_VGAFB - printf("vgafb_pci_probe: id %x ioaddr %x, iosize %x, memaddr %x,\n memsize %x, mmioaddr %x, mmiosize %x\n", - id, *ioaddr, *iosize, *memaddr, *memsize, *mmioaddr, *mmiosize); + printf("vgafb_pci_probe: id %x ioaddr %x, iosize %x, memaddr %x,\n" + " memsize %x, mmioaddr %x, mmiosize %x\n", + id, *ioaddr, *iosize, *memaddr, *memsize, *mmioaddr, *mmiosize); #endif if (*iosize == 0) { if (id == 0) { @@ -173,7 +174,7 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m /* this is only used if on openfirmware system and * the device does not have a iobase config register, * eg CirrusLogic 5434 VGA. (they hardcode iobase to 0 - * thus giving standard PC addresses for the registers) + * thus giving standard PC addresses for the registers) */ int s; u_int32_t sizedata; @@ -186,13 +187,13 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m */ s = splhigh(); sizedata = pci_conf_read(pc, pa->pa_tag, - PCI_COMMAND_STATUS_REG); + PCI_COMMAND_STATUS_REG); sizedata |= (PCI_COMMAND_MASTER_ENABLE | - PCI_COMMAND_IO_ENABLE | - PCI_COMMAND_PARITY_ENABLE | - PCI_COMMAND_SERR_ENABLE); + PCI_COMMAND_IO_ENABLE | + PCI_COMMAND_PARITY_ENABLE | + PCI_COMMAND_SERR_ENABLE); pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, - sizedata); + sizedata); splx(s); #endif @@ -208,8 +209,9 @@ vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, m } } #ifdef DEBUG_VGAFB - printf("vgafb_pci_probe: id %x ioaddr %x, iosize %x, memaddr %x,\n memsize %x, mmioaddr %x, mmiosize %x\n", - id, *ioaddr, *iosize, *memaddr, *memsize, *mmioaddr, *mmiosize); + printf("vgafb_pci_probe: id %x ioaddr %x, iosize %x, memaddr %x,\n" + " memsize %x, mmioaddr %x, mmiosize %x\n", + id, *ioaddr, *iosize, *memaddr, *memsize, *mmioaddr, *mmiosize); #endif return 1; } @@ -245,10 +247,10 @@ vgafb_pci_match(parent, match, aux) PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA) potential = 1; if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA) + PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA) potential = 1; if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_MISC) + PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_MISC) potential = 1; if (!potential) @@ -262,30 +264,31 @@ vgafb_pci_match(parent, match, aux) #ifdef DEBUG_VGAFB { - int i; + int i; pci_chipset_tag_t pc = pa->pa_pc; + for (i = 0x10; i < 0x24; i+=4) { printf("vgafb confread %x %x\n", - i, pci_conf_read(pc, pa->pa_tag, i)); + i, pci_conf_read(pc, pa->pa_tag, i)); } } #endif - memaddr=0xb8000; /* default to isa addresses? */ - ioaddr = 0; /* default to isa addresses? */ + memaddr=0xb8000; /* default to isa addresses? */ + ioaddr = 0; /* default to isa addresses? */ retval = vgafb_pci_probe(pa, myid, &ioaddr, &iosize, - &memaddr, &memsize, &cacheable, &mmioaddr, &mmiosize); + &memaddr, &memsize, &cacheable, &mmioaddr, &mmiosize); if (retval == 0) { return 0; } #if 1 printf("ioaddr %x, iosize %x, memaddr %x, memsize %x mmioaddr %x mmiosize %x\n", - ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); + ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); #endif - if (!vgafb_common_probe(pa->pa_iot, pa->pa_memt, ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize)) - { + if (!vgafb_common_probe(pa->pa_iot, pa->pa_memt, ioaddr, iosize, + memaddr, memsize, mmioaddr, mmiosize)) { printf("vgafb_pci_match: common_probe failed\n"); return (0); } @@ -312,7 +315,7 @@ vgafb_pci_attach(parent, self, aux) myid = id; vgafb_pci_probe(pa, myid, &ioaddr, &iosize, - &memaddr, &memsize, &cacheable, &mmioaddr, &mmiosize); + &memaddr, &memsize, &cacheable, &mmioaddr, &mmiosize); console = (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag))); @@ -323,8 +326,8 @@ vgafb_pci_attach(parent, self, aux) malloc(sizeof(struct vgafb_config), M_DEVBUF, M_WAITOK); /* set up bus-independent VGA configuration */ - vgafb_common_setup(pa->pa_iot, pa->pa_memt, vc, - ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); + vgafb_common_setup(pa->pa_iot, pa->pa_memt, vc, + ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); } vc->vc_mmap = vgafbpcimmap; vc->vc_ioctl = vgafbpciioctl; @@ -336,10 +339,10 @@ vgafb_pci_attach(parent, self, aux) sc->sc_pcitag = pa->pa_tag; if (iosize == 0) { - printf (", no io"); + printf(", no io"); } if (mmiosize != 0) { - printf (", mmio"); + printf(", mmio"); } printf("\n"); @@ -368,7 +371,7 @@ vgafb_pci_console(iot, ioaddr, iosize, memt, memaddr, memsize, pa->pa_iot = iot; pa->pa_memt = memt; pa->pa_tag = vgafb_pci_console_tag; - /* + /* pa->pa_pc = XXX; */ @@ -378,13 +381,13 @@ vgafb_pci_console(iot, ioaddr, iosize, memt, memaddr, memsize, mmiosize =0; #if 0 vgafb_pci_probe(pa, 0, &ioaddr, &iosize, - &memaddr, &memsize, &cacheable, mmioaddr, mmiosize); + &memaddr, &memsize, &cacheable, mmioaddr, mmiosize); #endif /* set up bus-independent VGA configuration */ vgafb_common_setup(iot, memt, vc, - ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); + ioaddr, iosize, memaddr, memsize, mmioaddr, mmiosize); vgafb_cnattach(iot, memt, pc, bus, device, function); } @@ -426,17 +429,17 @@ vgafb_alloc_screen(v, type, cookiep, curxp, curyp, attrp) if (sc->nscreens > 0) return (ENOMEM); - + *cookiep = &sc->sc_vc->dc_rinfo; /* one and only for now */ *curxp = 0; *curyp = 0; sc->sc_vc->dc_rinfo.ri_ops.alloc_attr(&sc->sc_vc->dc_rinfo, 0, 0, 0, &defattr); *attrp = defattr; - sc->nscreens++; + sc->nscreens++; return (0); } - + void vgafb_free_screen(v, cookie) void *v; @@ -449,7 +452,7 @@ vgafb_free_screen(v, cookie) sc->nscreens--; } - + int vgafb_show_screen(v, cookie, waitok, cb, cbarg) void *v; diff --git a/sys/arch/macppc/pci/vgafb_pcivar.h b/sys/arch/macppc/pci/vgafb_pcivar.h index 69b387eaa41..4b716ce4854 100644 --- a/sys/arch/macppc/pci/vgafb_pcivar.h +++ b/sys/arch/macppc/pci/vgafb_pcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb_pcivar.h,v 1.2 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vgafb_pcivar.h,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */ /* @@ -30,11 +30,11 @@ #define DEVICE_IS_VGA_PCI(class, id) \ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \ - PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \ + PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \ - PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_MISC) || \ - (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \ - PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0) + PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_MISC) || \ + (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \ + PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0) void vgafb_pci_console(bus_space_tag_t, u_int32_t ioaddr, u_int32_t iosize, diff --git a/sys/arch/macppc/pci/vgafbvar.h b/sys/arch/macppc/pci/vgafbvar.h index 2ea89b9690b..73c79987425 100644 --- a/sys/arch/macppc/pci/vgafbvar.h +++ b/sys/arch/macppc/pci/vgafbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafbvar.h,v 1.7 2002/05/22 21:00:03 miod Exp $ */ +/* $OpenBSD: vgafbvar.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ */ /* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */ /* @@ -55,7 +55,7 @@ struct vgafb_config { caddr_t, int, struct proc *); paddr_t (*vc_mmap)(void *, off_t, int); - struct rasops_info dc_rinfo; /* raster display data*/ + struct rasops_info dc_rinfo; /* raster display data*/ bus_addr_t membase; bus_size_t memsize; 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) { |