diff options
Diffstat (limited to 'sys/arch')
79 files changed, 1302 insertions, 1228 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c index 16c506ced21..667cf783bee 100644 --- a/sys/arch/macppc/dev/adb.c +++ b/sys/arch/macppc/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: adb.c,v 1.7 2002/09/15 09:01:58 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,8 +158,9 @@ adbattach(parent, self, aux) printf(": via-pmu "); break; } - + printf("%d targets\n", totaladbs); + #if NAED > 0 /* ADB event device for compatibility */ @@ -208,7 +209,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: @@ -263,7 +264,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 e962b05ff5b..12f15323b88 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.6 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: adb_direct.c,v 1.7 2002/09/15 09:01:58 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 ceab025b7cb..1f15ff08d64 100644 --- a/sys/arch/macppc/dev/aed.c +++ b/sys/arch/macppc/dev/aed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aed.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: aed.c,v 1.6 2002/09/15 09:01:58 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 89f993d4040..f787ee85889 100644 --- a/sys/arch/macppc/dev/akbd.c +++ b/sys/arch/macppc/dev/akbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: akbd.c,v 1.13 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: akbd.c,v 1.14 2002/09/15 09:01:58 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 8611bb6b71a..91e68c53a7d 100644 --- a/sys/arch/macppc/dev/ams.c +++ b/sys/arch/macppc/dev/ams.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ams.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: ams.c,v 1.6 2002/09/15 09:01:58 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 70164bdef01..349028810a0 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: apm.c,v 1.7 2002/09/15 09:01:58 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 b8c3a224496..832557c2e53 100644 --- a/sys/arch/macppc/dev/awacs.c +++ b/sys/arch/macppc/dev/awacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awacs.c,v 1.10 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: awacs.c,v 1.11 2002/09/15 09:01:58 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 c0eb8562492..9923b2f2cc4 100644 --- a/sys/arch/macppc/dev/dbdma.c +++ b/sys/arch/macppc/dev/dbdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbdma.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: dbdma.c,v 1.6 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: dbdma.c,v 1.2 1998/08/21 16:13:28 tsubai Exp $ */ /* @@ -43,9 +43,12 @@ 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 { @@ -57,8 +60,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 @@ -66,11 +69,10 @@ 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 @@ -80,8 +82,7 @@ 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 @@ -89,14 +90,15 @@ 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 @@ -104,8 +106,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 @@ -115,8 +117,7 @@ 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 a1de5d39d17..58b6153c375 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.12 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: if_bm.c,v 1.13 2002/09/15 09:01:58 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/if_wi_obio.c b/sys/arch/macppc/dev/if_wi_obio.c index 1b67e7c2802..c16fb3d992d 100644 --- a/sys/arch/macppc/dev/if_wi_obio.c +++ b/sys/arch/macppc/dev/if_wi_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_obio.c,v 1.7 2002/09/15 02:05:09 deraadt Exp $ */ +/* $OpenBSD: if_wi_obio.c,v 1.8 2002/09/15 09:01:58 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -87,6 +87,7 @@ struct cfattach wi_obio_ca = { wi_obio_detach, wi_obio_activate }; + int wi_obio_match(parent, match, aux) struct device *parent; @@ -112,8 +113,7 @@ wi_obio_attach(parent, self, aux) sc->wi_btag = ca->ca_iot; ca->ca_reg[0] += ca->ca_baseaddr; - if (bus_space_map(sc->wi_btag, ca->ca_reg[0], ca->ca_reg[1], 0, - &sc->wi_bhandle)) { + if (bus_space_map(sc->wi_btag, ca->ca_reg[0], ca->ca_reg[1], 0, &sc->wi_bhandle)) { printf("can't map i/o space\n"); } /* FSCKING hackery */ @@ -121,7 +121,7 @@ wi_obio_attach(parent, self, aux) /* Establish the interrupt. */ mac_intr_establish(parent, ca->ca_intr[0], IST_LEVEL, IPL_NET, - wi_intr, psc, "wi_obio"); + wi_intr, psc, "wi_obio"); /* Make sure interrupts are disabled. */ CSR_WRITE_2(sc, WI_INT_EN, 0); diff --git a/sys/arch/macppc/dev/macintr.c b/sys/arch/macppc/dev/macintr.c index f3e57118e1e..240743ccf2f 100644 --- a/sys/arch/macppc/dev/macintr.c +++ b/sys/arch/macppc/dev/macintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macintr.c,v 1.14 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: macintr.c,v 1.15 2002/09/15 09:01:58 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 89dd21aed1f..26b4c33018d 100644 --- a/sys/arch/macppc/dev/mesh.c +++ b/sys/arch/macppc/dev/mesh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mesh.c,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: mesh.c,v 1.6 2002/09/15 09:01:58 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 df321e82615..b4983f6985e 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openpic.c,v 1.17 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: openpic.c,v 1.18 2002/09/15 09:01:58 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 3c08dc45ebd..3f4dcc6e3b6 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.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: uni_n.c,v 1.6 2002/09/15 09:01:58 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 dcb99ca7d23..722e997b614 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.7 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: wdc_obio.c,v 1.8 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */ /*- @@ -180,23 +180,24 @@ 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) { @@ -327,7 +328,8 @@ 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); @@ -451,7 +453,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; } @@ -490,8 +492,7 @@ 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 @@ -512,8 +513,7 @@ 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 fac56d2d6c1..b5176c301b6 100644 --- a/sys/arch/macppc/dev/zs.c +++ b/sys/arch/macppc/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.8 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: zs.c,v 1.9 2002/09/15 09:01:58 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,7 +480,8 @@ 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) { @@ -919,7 +920,7 @@ zs_enable(cs) cs->enabled = 1; return(0); } - + void zs_disable(cs) struct zs_chanstate *cs; @@ -1143,7 +1144,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 bc9b67fb307..241bb36fb63 100644 --- a/sys/arch/macppc/include/apmvar.h +++ b/sys/arch/macppc/include/apmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apmvar.h,v 1.3 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: apmvar.h,v 1.4 2002/09/15 09:01:58 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 8b81c45e8da..b863ccaa57e 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2002/09/15 09:01:58 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 82616fac15a..43a411db94c 100644 --- a/sys/arch/macppc/include/conf.h +++ b/sys/arch/macppc/include/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: conf.h,v 1.8 2002/09/15 09:01:58 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 436bad8bdfb..99c79deeb5a 100644 --- a/sys/arch/macppc/include/cpu.h +++ b/sys/arch/macppc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.7 2002/09/15 09:01:58 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 b9522832a87..6412730c2ec 100644 --- a/sys/arch/macppc/include/disklabel.h +++ b/sys/arch/macppc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 2002/09/15 09:01:58 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,43 +115,44 @@ 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 5af35ede048..4a34f0cd251 100644 --- a/sys/arch/macppc/include/powerpc.h +++ b/sys/arch/macppc/include/powerpc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: powerpc.h,v 1.5 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: powerpc.h,v 1.6 2002/09/15 09:01:58 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 1c1f1737ed4..502ef9e5b27 100644 --- a/sys/arch/macppc/include/vmparam.h +++ b/sys/arch/macppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.10 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: vmparam.h,v 1.11 2002/09/15 09:01:58 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 00b552b8704..0fcb2476e39 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.7 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.8 2002/09/15 09:01:58 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.7 2002/09/15 02:02:43 deraadt Exp $ + * $Id: autoconf.c,v 1.8 2002/09/15 09:01:58 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(void) +cpu_configure() { (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,14 +105,13 @@ cpu_configure(void) 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(void) +diskconf() { /* * Configure root, swap, and dump area. This is @@ -138,7 +137,7 @@ diskconf(void) * Configure swap space and related parameters. */ void -swapconf(void) +swapconf() { register struct swdevt *swp; register int nblks; @@ -146,7 +145,7 @@ swapconf(void) 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; @@ -174,7 +173,7 @@ long dumplo = -1; /* blocks */ */ #if 0 void -dumpconf(void) +dumpconf() { int nblks; /* size of dump area */ int maj; @@ -215,7 +214,8 @@ static struct nam2blk { }; int -findblkmajor(struct device *dv) +findblkmajor(dv) + struct device *dv; { char *name = dv->dv_xname; int i; @@ -223,22 +223,26 @@ findblkmajor(struct device *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(int maj) +findblkname(maj) + 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(char *str, int len, int defpart, dev_t *devp) +getdisk(str, len, defpart, devp) + char *str; + int len, defpart; + dev_t *devp; { register struct device *dv; @@ -250,7 +254,7 @@ getdisk(char *str, int len, int defpart, dev_t *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"); @@ -259,7 +263,10 @@ getdisk(char *str, int len, int defpart, dev_t *devp) } struct device * -parsedisk(char *str, int len, int defpart, dev_t *devp) +parsedisk(str, len, defpart, devp) + char *str; + int len, defpart; + dev_t *devp; { register struct device *dv; register char *cp, c; @@ -303,7 +310,7 @@ parsedisk(char *str, int len, int defpart, dev_t *devp) * change rootdev to correspond to the load device. */ void -setroot(void) +setroot() { int majdev, mindev, unit, part, len; dev_t temp; @@ -319,7 +326,7 @@ setroot(void) printf("bootpath: '%s'\n", bootpath); makebootdev(bootpath); - if (boothowto & RB_DFLTROOT) + if(boothowto & RB_DFLTROOT) return; /* Boot compiled in */ /* @@ -339,13 +346,15 @@ setroot(void) } /* 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); } @@ -353,8 +362,10 @@ setroot(void) 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) { @@ -380,9 +391,9 @@ setroot(void) * 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) @@ -421,7 +432,8 @@ 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. */ @@ -438,10 +450,11 @@ 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; @@ -504,7 +517,9 @@ gotswap: * find a device matching "name" and unit number */ struct device * -getdevunit(char *name, int unit) +getdevunit(name, unit) + char *name; + int unit; { struct device *dev = alldevs.tqh_first; char num[10], fullname[16]; @@ -539,7 +554,8 @@ struct devmap { #define T_DISK 0x21 static struct devmap * -findtype(char **s) +findtype(s) + char **s; { static struct devmap devmap[] = { { "/pci@", NULL, T_BUS }, @@ -559,16 +575,15 @@ findtype(char **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 0 - if (dp->att == NULL) + if (dp->att == NULL) { printf("string [%s] not found\n", *s); -#endif + } return(dp); } @@ -579,7 +594,8 @@ findtype(char **s) * '/pci/mac-io/ide/disk/bsd */ void -makebootdev(char *bp) +makebootdev(bp) + char *bp; { int unit; char *dev, *cp; @@ -587,17 +603,18 @@ makebootdev(char *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) { @@ -609,12 +626,13 @@ makebootdev(char *bp) } int -getpno(char **cp) +getpno(cp) + 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 7c8805fe659..44ae7ace03c 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.4 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: clock.c,v 1.5 2002/09/15 09:01:58 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 6fd64007074..01aadf46fd6 100644 --- a/sys/arch/macppc/macppc/conf.c +++ b/sys/arch/macppc/macppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.18 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.19 2002/09/15 09:01:58 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 ee25b2eff72..f125149359a 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.9 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: cpu.c,v 1.10 2002/09/15 09:01:58 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,18 +159,20 @@ 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) { @@ -192,16 +194,18 @@ 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 @@ -272,7 +276,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; @@ -300,7 +304,7 @@ config_l2cr(int cpu) case L2SIZ_512K: printf(": 512KB"); break; - case L2SIZ_1M: + case L2SIZ_1M: printf(": 1MB"); break; default: @@ -322,10 +326,11 @@ 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 4f2613e8943..af15c6630e2 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.5 2002/09/15 02:02:43 deraadt Exp $ */ -/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ +/* $OpenBSD: db_interface.c,v 1.6 2002/09/15 09:01:58 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 1860de1e74b..cbd6da01c96 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.4 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.5 2002/09/15 09:01:58 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 967cdf419e5..08036462998 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.14 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: dma.c,v 1.15 2002/09/15 09:01:58 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 78ef4c61195..ceb09fca300 100644 --- a/sys/arch/macppc/macppc/genassym.cf +++ b/sys/arch/macppc/macppc/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.6 2002/09/15 02:02:43 deraadt Exp $ +# $OpenBSD: genassym.cf,v 1.7 2002/09/15 09:01:58 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 f4f29342367..bf0dbd49398 100644 --- a/sys/arch/macppc/macppc/locore.S +++ b/sys/arch/macppc/macppc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.6 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: locore.S,v 1.7 2002/09/15 09:01:58 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 18ece7b4bb0..27160b81045 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.41 2002/09/15 02:02:43 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.42 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -249,10 +249,12 @@ 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 @@ -313,8 +315,10 @@ 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(); @@ -326,18 +330,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 */ @@ -377,7 +381,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 @@ -400,10 +404,9 @@ where = 3; */ /* make a copy of the args! */ - strncpy(bootpathbuf, args, sizeof bootpathbuf); - bootpath = &bootpathbuf[0]; - while (*++bootpath && *bootpath != ' ') - ; + strncpy(bootpathbuf, args, 512); + bootpath= &bootpathbuf[0]; + while ( *++bootpath && *bootpath != ' '); if (*bootpath) { *bootpath++ = 0; while (*bootpath) { @@ -450,8 +453,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. @@ -490,17 +493,16 @@ 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); @@ -516,7 +518,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); @@ -558,9 +560,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; @@ -583,9 +585,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; } @@ -743,10 +745,11 @@ 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]; @@ -830,11 +833,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)); @@ -853,7 +856,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. */ @@ -950,8 +953,7 @@ boot(howto) OF_exit(); (fw->boot)(str); printf("boot failed, spinning\n"); - while (1) - /* forever */; + while(1) /* forever */; } /* @@ -964,10 +966,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))) @@ -1019,17 +1021,18 @@ 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 %s not recognized, good luck\n", - name); + printf("System type %snot recognized, good luck\n", + name); } } @@ -1061,7 +1064,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; @@ -1121,7 +1124,8 @@ 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)) { @@ -1132,19 +1136,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; @@ -1174,15 +1178,17 @@ 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); @@ -1235,8 +1241,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 332bab34ec9..31779718616 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: mainbus.c,v 1.7 2002/09/15 09:01:58 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 f2481582d4f..d804df07989 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: mem.c,v 1.8 2002/09/15 09:01:58 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 597d596952d..5cc42375c51 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.15 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.16 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -92,15 +92,17 @@ 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 */ @@ -148,8 +150,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) { @@ -215,7 +217,7 @@ ofrootfound() { int node; struct ofprobe probe; - + if (!(node = OF_peer(0))) panic("No PROM root"); probe.phandle = node; @@ -274,7 +276,7 @@ ofw_do_pending_int() int emsr, dmsr; static int processing; - if (processing) + if(processing) return; processing = 1; @@ -284,11 +286,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; @@ -306,21 +308,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) \ @@ -343,7 +345,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; }; @@ -360,7 +362,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) { @@ -382,7 +384,7 @@ ofwconprobe() return; } - + #define DEVTREE_UNKNOWN 0 #define DEVTREE_USB 1 #define DEVTREE_ADB 2 @@ -466,7 +468,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 } @@ -479,7 +481,7 @@ ofw_find_keyboard() #if NAKBD >0 printf("ADB found\n"); akbd_cnattach(); -#endif +#endif } } @@ -581,7 +583,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)); @@ -626,42 +628,41 @@ 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 @@ -672,12 +673,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 e00cdb6fa20..fdc355175d3 100644 --- a/sys/arch/macppc/macppc/openfirm.c +++ b/sys/arch/macppc/macppc/openfirm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.c,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: openfirm.c,v 1.4 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -236,10 +236,9 @@ 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 @@ -257,25 +256,24 @@ 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 20b9f26a081..a8a609a02cc 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.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: rbus_machdep.c,v 1.3 2002/09/15 09:01:58 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,6 +104,7 @@ 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 7661ab70944..82bfceab5f6 100644 --- a/sys/arch/macppc/pci/macobio.c +++ b/sys/arch/macppc/pci/macobio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macobio.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: macobio.c,v 1.7 2002/09/15 09:01:58 deraadt Exp $ */ /* $NetBSD: obio.c,v 1.6 1999/05/01 10:36:08 tsubai Exp $ */ /*- @@ -132,11 +132,12 @@ 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: @@ -144,10 +145,12 @@ 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"); @@ -200,10 +203,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; @@ -268,7 +271,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) @@ -288,7 +291,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 91bafc73b03..4677bb82b5c 100644 --- a/sys/arch/macppc/pci/mpcpcibus.c +++ b/sys/arch/macppc/pci/mpcpcibus.c @@ -1,8 +1,8 @@ -/* $OpenBSD: mpcpcibus.c,v 1.13 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: mpcpcibus.c,v 1.14 2002/09/15 09:01:59 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,13 +148,12 @@ 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 @@ -169,6 +168,7 @@ mpcpcibrmatch(parent, match, aux) return (found); found = 1; + return found; } @@ -188,20 +188,19 @@ 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 */ @@ -212,15 +211,16 @@ 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,24 +236,27 @@ 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"); } } @@ -269,7 +272,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; @@ -277,8 +280,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 { @@ -325,26 +328,28 @@ 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); } @@ -367,7 +372,8 @@ 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; @@ -376,12 +382,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 @@ -391,24 +397,26 @@ 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; @@ -423,37 +431,40 @@ 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; @@ -478,8 +489,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); } @@ -491,6 +502,7 @@ mpcpcibrattach(parent, self, aux) } pba.pba_dmat = &pci_bus_dma_tag; + pba.pba_busname = "pci"; pba.pba_iot = &sc->sc_iobus_space; @@ -502,11 +514,12 @@ 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); @@ -527,13 +540,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) @@ -542,7 +555,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 @@ -607,7 +620,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]; @@ -629,6 +642,7 @@ 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 */ @@ -641,8 +655,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; @@ -696,12 +710,11 @@ 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, @@ -801,20 +814,23 @@ 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; } @@ -834,9 +850,11 @@ 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); } @@ -874,7 +892,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); } @@ -909,7 +927,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); } @@ -938,13 +956,14 @@ 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; @@ -980,7 +999,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 @@ -1011,7 +1030,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 0ac5ddcb132..a4ce7bc8dfc 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.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pci_addr_fixup.c,v 1.3 2002/09/15 09:01:59 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,25 +118,23 @@ 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; @@ -153,7 +151,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 @@ -186,7 +184,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; @@ -200,7 +198,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); @@ -208,22 +206,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); @@ -231,33 +229,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++; @@ -276,14 +274,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) { @@ -300,7 +298,8 @@ 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); } @@ -355,13 +354,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 @@ -382,7 +381,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); } } @@ -474,7 +473,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 c16136bd24b..94fbc677553 100644 --- a/sys/arch/macppc/pci/pcibrvar.h +++ b/sys/arch/macppc/pci/pcibrvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcibrvar.h,v 1.4 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pcibrvar.h,v 1.5 2002/09/15 09:01:59 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 a60c05a560b..c1a9f67f63f 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.18 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: vgafb.c,v 1.19 2002/09/15 09:01:59 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 4b9d088d773..363aeb72ae0 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.9 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: vgafb_pci.c,v 1.10 2002/09/15 09:01:59 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,9 +164,8 @@ 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) { @@ -174,7 +173,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; @@ -187,13 +186,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 @@ -209,9 +208,8 @@ 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; } @@ -247,10 +245,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) @@ -264,31 +262,30 @@ 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); } @@ -315,7 +312,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))); @@ -326,8 +323,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; @@ -339,10 +336,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"); @@ -371,7 +368,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; */ @@ -381,13 +378,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); } @@ -429,17 +426,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; @@ -452,7 +449,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 4b716ce4854..6e224390448 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.3 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: vgafb_pcivar.h,v 1.4 2002/09/15 09:01:59 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 73c79987425..4aaba1c03ec 100644 --- a/sys/arch/macppc/pci/vgafbvar.h +++ b/sys/arch/macppc/pci/vgafbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafbvar.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: vgafbvar.h,v 1.9 2002/09/15 09:01:59 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 22ab798daee..c2e57cc5241 100644 --- a/sys/arch/macppc/stand/Locore.c +++ b/sys/arch/macppc/stand/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: Locore.c,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */ /* @@ -52,28 +52,28 @@ asm(" bat_init: mfmsr 8 - li 0,0 - mtmsr 0 - isync - - mtibatu 0,0 - mtibatu 1,0 - mtibatu 2,0 - mtibatu 3,0 - mtdbatu 0,0 - mtdbatu 1,0 - mtdbatu 2,0 - mtdbatu 3,0 - - li 9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ - mtibatl 0,9 - mtdbatl 0,9 - li 9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ - mtibatu 0,9 - mtdbatu 0,9 - isync - - mtmsr 8 + li 0,0 + mtmsr 0 + isync + + mtibatu 0,0 + mtibatu 1,0 + mtibatu 2,0 + mtibatu 3,0 + mtdbatu 0,0 + mtdbatu 1,0 + mtdbatu 2,0 + mtdbatu 3,0 + + li 9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ + mtibatl 0,9 + mtdbatl 0,9 + li 9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ + mtibatu 0,9 + mtdbatu 0,9 + isync + + mtmsr 8 isync blr "); @@ -142,8 +142,7 @@ _rtt() }; openfirmware(&args); - while (1) - ; /* just in case */ + while (1); /* just in case */ } int @@ -160,8 +159,8 @@ OF_finddevice(name) "finddevice", 1, 1, - }; - + }; + args.device = name; if (openfirmware(&args) == -1) return -1; @@ -183,7 +182,7 @@ OF_instance_to_package(ihandle) 1, 1, }; - + args.ihandle = ihandle; if (openfirmware(&args) == -1) return -1; @@ -211,7 +210,7 @@ OF_getprop(handle, prop, buf, buflen) 4, 1, }; - + args.phandle = handle; args.prop = prop; args.buf = buf; @@ -243,7 +242,7 @@ OF_setprop(handle, prop, buf, len) 4, 1, }; - + args.phandle = handle; args.prop = prop; args.buf = buf; @@ -269,7 +268,7 @@ OF_open(dname) 1, 1, }; - + args.dname = dname; if (openfirmware(&args) == -1) return -1; @@ -290,7 +289,7 @@ OF_close(handle) 1, 0, }; - + args.handle = handle; openfirmware(&args); } @@ -369,7 +368,7 @@ OF_seek(handle, pos) 3, 1, }; - + args.handle = handle; args.poshi = (int)(pos >> 32); args.poslo = (int)pos; @@ -435,7 +434,7 @@ OF_release(virt, size) 2, 0, }; - + args.virt = virt; args.size = size; openfirmware(&args); @@ -454,7 +453,7 @@ OF_milliseconds() 0, 1, }; - + openfirmware(&args); return args.ms; } @@ -556,12 +555,11 @@ static void setup() { int chosen; - + if ((chosen = OF_finddevice("/chosen")) == -1) _rtt(); - if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != - sizeof(stdin) || - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != + if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != sizeof(stdin) + || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != sizeof(stdout)) _rtt(); if (stdout == 0) { diff --git a/sys/arch/macppc/stand/boot.c b/sys/arch/macppc/stand/boot.c index 192771e9db7..14b94c818b3 100644 --- a/sys/arch/macppc/stand/boot.c +++ b/sys/arch/macppc/stand/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ /* @@ -55,6 +55,7 @@ #include <lib/libsa/stand.h> #include <lib/libsa/loadfile.h> + #include <machine/cpu.h> #include <macppc/stand/ofdev.h> @@ -70,7 +71,7 @@ prom2boot(dev) char *dev; { char *cp, *lp = 0; - + for (cp = dev; *cp; cp++) if (*cp == ':') lp = cp; @@ -108,7 +109,7 @@ parseargs(str, howtop) } if (!*cp) return; - + *cp++ = 0; while (*cp) { switch (*cp++) { @@ -174,15 +175,15 @@ main() u_int32_t entry; void *ssym, *esym; int fd; - + printf("\n>> OpenBSD/macppc Boot\n"); /* * Get the boot arguments from Openfirmware */ - if ((chosen = OF_finddevice("/chosen")) == -1 || - OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || - OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { + if ((chosen = OF_finddevice("/chosen")) == -1 + || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 + || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { printf("Invalid Openfirmware environment\n"); exit(); } diff --git a/sys/arch/macppc/stand/net.c b/sys/arch/macppc/stand/net.c index 555f95a18cf..50acb67b7b6 100644 --- a/sys/arch/macppc/stand/net.c +++ b/sys/arch/macppc/stand/net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: net.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: net.c,v 1.1 1997/04/16 20:29:18 thorpej Exp $ */ /* @@ -76,7 +76,7 @@ net_open(op) struct of_dev *op; { int error = 0; - + /* * On first open, do netif open, mount, etc. */ @@ -119,21 +119,21 @@ net_mountroot() #ifdef DEBUG printf("net_mountroot\n"); #endif - + /* * Get info for NFS boot: our IP address, out hostname, * server IP address, and our root path on the server. * We use BOOTP (RFC951, RFC1532) exclusively as mandated * by PowerPC Reference Platform Specification I.4.2 */ - + bootp(netdev_sock); - + if (myip.s_addr == 0) return ETIMEDOUT; - + printf("Using IP address: %s\n", inet_ntoa(myip)); - + #ifdef DEBUG printf("myip: %s (%s)", hostname, inet_ntoa(myip)); if (gateip.s_addr) @@ -143,7 +143,7 @@ net_mountroot() printf("\n"); #endif printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath); - + /* * Get the NFS file handle (mount). */ diff --git a/sys/arch/macppc/stand/netif_of.c b/sys/arch/macppc/stand/netif_of.c index f055969e1b0..286f5f9594a 100644 --- a/sys/arch/macppc/stand/netif_of.c +++ b/sys/arch/macppc/stand/netif_of.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netif_of.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: netif_of.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */ /* @@ -82,7 +82,7 @@ netif_open(machdep_hint) struct iodesc *io; int fd, error; char addr[32]; - + #ifdef NETIF_DEBUG printf("netif_open..."); #endif @@ -99,12 +99,12 @@ netif_open(machdep_hint) netif_of.nif_devdata = op; io->io_netif = &netif_of; - + /* Put our ethernet address in io->myea */ OF_getprop(OF_instance_to_package(op->handle), - "local-mac-address", io->myea, sizeof io->myea) == -1 && + "local-mac-address", io->myea, sizeof io->myea) == -1 && OF_getprop(OF_instance_to_package(op->handle), - "mac-address", io->myea, sizeof io->myea); + "mac-address", io->myea, sizeof io->myea); #ifdef NETIF_DEBUG printf("OK\n"); @@ -163,7 +163,7 @@ netif_put(desc, pkt, len) struct ether_header *eh; printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", - desc, pkt, len); + desc, pkt, len); eh = pkt; printf("dst: %s ", ether_sprintf(eh->ether_dhost)); printf("src: %s ", ether_sprintf(eh->ether_shost)); @@ -211,7 +211,7 @@ netif_get(desc, pkt, maxlen, timo) #ifdef NETIF_DEBUG printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n", - pkt, maxlen, timo); + pkt, maxlen, timo); #endif tmo_ms = timo * 1000; @@ -220,7 +220,7 @@ netif_get(desc, pkt, maxlen, timo) do { len = OF_read(op->handle, pkt, maxlen); } while ((len == -2 || len == 0) && - ((OF_milliseconds() - tick0) < tmo_ms)); + ((OF_milliseconds() - tick0) < tmo_ms)); #ifdef NETIF_DEBUG printf("netif_get: received len=%d\n", len); diff --git a/sys/arch/macppc/stand/ofdev.c b/sys/arch/macppc/stand/ofdev.c index 5ded35dea90..bd7830d8b17 100644 --- a/sys/arch/macppc/stand/ofdev.c +++ b/sys/arch/macppc/stand/ofdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.c,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: ofdev.c,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: ofdev.c,v 1.1 1997/04/16 20:29:20 thorpej Exp $ */ /* @@ -204,8 +204,9 @@ read_mac_label(devp, buf, lp) int i; char *s; - if (strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE) { + if ((strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0) + || (read != DEV_BSIZE)) + { return ERDLAB; } part = (struct part_map_entry *)buf; @@ -224,8 +225,9 @@ read_mac_label(devp, buf, lp) */ for (i = 0; i < part_cnt; i++) { /* read the appropriate block */ - if (strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE) { + if ((strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0) + || (read != DEV_BSIZE)) + { return ERDLAB; } part = (struct part_map_entry *)buf; @@ -236,9 +238,10 @@ read_mac_label(devp, buf, lp) if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) { /* FOUND OUR PARTITION!!! */ printf("found OpenBSD DPME partition\n"); - if (strategy(devp, F_READ, part->pmPyPartStart, - DEV_BSIZE, buf, &read) == 0 && - read == DEV_BSIZE) { + if(strategy(devp, F_READ, part->pmPyPartStart, + DEV_BSIZE, buf, &read) == 0 + && read == DEV_BSIZE) + { if (!getdisklabel(buf, lp)) { return 0; } @@ -275,8 +278,8 @@ search_label(devp, off, buf, lp, off0) u_long poff; static int recursion; - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) return ERDLAB; if (buf[510] != 0x55 || buf[511] != 0xaa) @@ -285,20 +288,20 @@ search_label(devp, off, buf, lp, off0) if (recursion++ <= 1) off0 += off; for (p = (struct dos_partition *)(buf + DOSPARTOFF), i = 4; - --i >= 0; p++) { + --i >= 0; p++) { if (p->dp_typ == DOSPTYP_OPENBSD || p->dp_typ == DOSPTYP_NETBSD) { poff = get_long(&p->dp_start) + off0; if (strategy(devp, F_READ, poff + LABELSECTOR, - DEV_BSIZE, buf, &read) == 0 && - read == DEV_BSIZE) { + DEV_BSIZE, buf, &read) == 0 + && read == DEV_BSIZE) { if (!getdisklabel(buf, lp)) { recursion--; return 0; } } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) { + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) { recursion--; return ERDLAB; } @@ -308,8 +311,8 @@ search_label(devp, off, buf, lp, off0) recursion--; return 0; } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) { + if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) + || read != DEV_BSIZE) { recursion--; return ERDLAB; } @@ -382,9 +385,9 @@ devopen(of, name, file) ofdev.bsize = DEV_BSIZE; /* First try to find a disklabel without MBR partitions */ if (strategy(&ofdev, F_READ, - LABELSECTOR, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE || - getdisklabel(buf, &label)) { + LABELSECTOR, DEV_BSIZE, buf, &read) != 0 + || read != DEV_BSIZE + || getdisklabel(buf, &label)) { /* Else try MBR partitions */ error = read_mac_label(&ofdev, buf, &label); if (error == ERDLAB) { diff --git a/sys/arch/powerpc/ddb/db_disasm.c b/sys/arch/powerpc/ddb/db_disasm.c index 5ced9720c74..289a39e4273 100644 --- a/sys/arch/powerpc/ddb/db_disasm.c +++ b/sys/arch/powerpc/ddb/db_disasm.c @@ -1,9 +1,9 @@ /* $NetBSD: db_disasm.c,v 1.8 2001/06/12 05:31:44 simonb Exp $ */ -/* $OpenBSD: db_disasm.c,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ - +/* $OpenBSD: db_disasm.c,v 1.4 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1996 Dale Rahn. All rights reserved. * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -28,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #include <sys/param.h> #include <sys/proc.h> @@ -123,7 +123,7 @@ struct db_field { { "sh", Opf_sh }, { "spr", Opf_spr }, { "tbr", Opf_tbr }, - { NULL, 0 } + { NULL, 0 } }; struct opcode { @@ -149,7 +149,7 @@ op_class_func op_cl_x3e, op_cl_x3f; op_class_func *opcodes_base[] = { /*x00*/ op_ill, op_ill, op_base, op_ill, /*x04*/ op_ill, op_ill, op_ill, op_base, -/*x08*/ op_base, op_base, op_base, op_base, +/*x08*/ op_base, op_base, op_base, op_base, /*x0C*/ op_base, op_base, op_base/*XXX*/, op_base/*XXX*/, /*x10*/ op_base, op_base, op_base, op_cl_x13, /*x14*/ op_base, op_base, op_ill, op_base, @@ -168,11 +168,11 @@ op_class_func *opcodes_base[] = { /* This table could be modified to make significant the "reserved" fields * of the opcodes, But I didn't feel like it when typing in the table, - * I would recommend that this table be looked over for errors, + * I would recommend that this table be looked over for errors, * This was derived from the table in Appendix A.2 of (Mot part # MPCFPE/AD) * PowerPC Microprocessor Family: The Programming Environments */ - + const struct opcode opcodes[] = { { "tdi", 0xfc000000, 0x08000000, " %{TO},%{A},%{SIMM}" }, { "twi", 0xfc000000, 0x0c000000, " %{TO},%{A},%{SIMM}" }, @@ -557,7 +557,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu { u_int A; A = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "r%d", A); + pstr += sprintf (pstr, "r%d", A); } break; case Opf_A0: @@ -565,13 +565,13 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu u_int A; A = extract_field(instr, 31 - 15, 5); if (A != 0) { - pstr += sprintf(pstr, "r%d,", A); + pstr += sprintf (pstr, "r%d,", A); } } break; case Opf_AA: if (instr & 0x2) { - pstr += sprintf(pstr,"a"); + pstr += sprintf (pstr,"a"); } break; case Opf_LI: @@ -589,14 +589,14 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu db_find_sym_and_offset(LI, &name, &offset); if (name) { if (offset == 0) { - pstr += sprintf(pstr, "0x%x (%s)", addr + LI, + pstr += sprintf (pstr, "0x%x (%s)", addr + LI, name); } else { - pstr += sprintf(pstr, "0x%x (%s+0x%x)", addr + LI, + pstr += sprintf (pstr, "0x%x (%s+0x%x)", addr + LI, name, offset); } } else { - pstr += sprintf(pstr, "0x%x", addr + LI); + pstr += sprintf (pstr, "0x%x", addr + LI); } } break; @@ -604,7 +604,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu { u_int B; B = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "r%d", B); + pstr += sprintf (pstr, "r%d", B); } break; case Opf_BD: @@ -622,14 +622,14 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu db_find_sym_and_offset(BD, &name, &offset); if (name) { if (offset == 0) { - pstr += sprintf(pstr, "0x%x (%s)", addr + BD, + pstr += sprintf (pstr, "0x%x (%s)", addr + BD, name); } else { - pstr += sprintf(pstr, "0x%x (%s+0x%x)", addr + BD, + pstr += sprintf (pstr, "0x%x (%s+0x%x)", addr + BD, name, offset); } } else { - pstr += sprintf(pstr, "0x%x", addr + BD); + pstr += sprintf (pstr, "0x%x", addr + BD); } } break; @@ -638,7 +638,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu u_int BI; BI = extract_field(instr, 31 - 10, 5); if (BI != 0) { - pstr += sprintf(pstr, "%d,", BI); + pstr += sprintf (pstr, "%d,", BI); } } break; @@ -647,7 +647,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu u_int BI; BI = extract_field(instr, 31 - 10, 5); if (BI != 0) { - pstr += sprintf(pstr, "%d", BI); + pstr += sprintf (pstr, "%d", BI); } } break; @@ -655,10 +655,10 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu { int BO,BI; BO = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr ,"%s", db_BO_op[BO]); + pstr += sprintf (pstr ,"%s", db_BO_op[BO]); if (BO < 8) { BI = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr ,"%s", + pstr += sprintf (pstr ,"%s", db_BOBI_cond[(BI & 0x3)|((BO & 1) << 2)]); } @@ -668,40 +668,40 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu { u_int C; C = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, "r%d, ", C); + pstr += sprintf (pstr, "r%d, ", C); } break; case Opf_CRM: { u_int CRM; CRM = extract_field(instr, 31 - 19, 8); - pstr += sprintf(pstr, "0x%x", CRM); + pstr += sprintf (pstr, "0x%x", CRM); } break; case Opf_FM: { u_int FM; FM = extract_field(instr, 31 - 10, 8); - pstr += sprintf(pstr, "%d", FM); + pstr += sprintf (pstr, "%d", FM); } break; case Opf_LK: if (instr & 0x1) { - pstr += sprintf(pstr,"l"); + pstr += sprintf (pstr,"l"); } break; case Opf_MB: { u_int MB; MB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "%d", MB); + pstr += sprintf (pstr, "%d", MB); } break; case Opf_ME: { u_int ME; ME = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, "%d", ME); + pstr += sprintf (pstr, "%d", ME); } break; case Opf_NB: @@ -711,7 +711,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu if (NB == 0 ) { NB=32; } - pstr += sprintf(pstr, "%d", NB); + pstr += sprintf (pstr, "%d", NB); } break; case Opf_OE: @@ -730,14 +730,14 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu u_int D; /* S and D are the same */ D = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "r%d", D); + pstr += sprintf (pstr, "r%d", D); } break; case Opf_SH: { u_int SH; SH = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "%d", SH); + pstr += sprintf (pstr, "%d", SH); } break; case Opf_SIMM: @@ -748,63 +748,63 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu if (IMM & 0x8000) { IMM |= ~0x7fff; } - pstr += sprintf(pstr, "%d", IMM); + pstr += sprintf (pstr, "%d", IMM); } break; case Opf_UIMM: { u_int32_t IMM; IMM = extract_field(instr, 31 - 31, 16); - pstr += sprintf(pstr, "0x%x", IMM); + pstr += sprintf (pstr, "0x%x", IMM); } break; case Opf_SR: { u_int SR; SR = extract_field(instr, 31 - 15, 3); - pstr += sprintf(pstr, "sr%d", SR); + pstr += sprintf (pstr, "sr%d", SR); } break; case Opf_TO: { u_int TO; TO = extract_field(instr, 31 - 10, 1); - pstr += sprintf(pstr, "%d", TO); + pstr += sprintf (pstr, "%d", TO); } break; case Opf_crbA: { u_int crbA; crbA = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "%d", crbA); + pstr += sprintf (pstr, "%d", crbA); } break; case Opf_crbB: { u_int crbB; crbB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "%d", crbB); + pstr += sprintf (pstr, "%d", crbB); } break; case Opf_crbD: { u_int crfD; crfD = extract_field(instr, 31 - 8, 3); - pstr += sprintf(pstr, "crf%d", crfD); + pstr += sprintf (pstr, "crf%d", crfD); } break; case Opf_crfD: { u_int crfD; crfD = extract_field(instr, 31 - 8, 3); - pstr += sprintf(pstr, "crf%d", crfD); + pstr += sprintf (pstr, "crf%d", crfD); } break; case Opf_crfS: { u_int crfS; crfS = extract_field(instr, 31 - 13, 3); - pstr += sprintf(pstr, "%d", crfS); + pstr += sprintf (pstr, "%d", crfS); } break; break; @@ -814,7 +814,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu mbl = extract_field(instr, 31 - 25, 4); mbh = extract_field(instr, 31 - 26, 1); mb = mbh << 4 | mbl; - pstr += sprintf(pstr, ", %d", mb); + pstr += sprintf (pstr, ", %d", mb); } break; case Opf_sh: @@ -823,7 +823,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu shl = extract_field(instr, 31 - 19, 4); shh = extract_field(instr, 31 - 20, 1); sh = shh << 4 | shl; - pstr += sprintf(pstr, ", %d", sh); + pstr += sprintf (pstr, ", %d", sh); } break; case Opf_spr: @@ -838,112 +838,112 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu /* this table could be written better */ switch (spr) { - case 1: + case 1: reg = "xer"; break; - case 8: + case 8: reg = "lr"; break; - case 9: + case 9: reg = "ctr"; break; - case 18: + case 18: reg = "dsisr"; break; - case 19: + case 19: reg = "dar"; break; - case 22: + case 22: reg = "dec"; break; - case 25: + case 25: reg = "sdr1"; break; - case 26: + case 26: reg = "srr0"; break; - case 27: + case 27: reg = "srr1"; break; - case 272: + case 272: reg = "SPRG0"; break; - case 273: + case 273: reg = "SPRG1"; break; - case 274: + case 274: reg = "SPRG3"; break; - case 275: + case 275: reg = "SPRG3"; break; - case 280: + case 280: reg = "asr"; break; - case 282: + case 282: reg = "aer"; break; - case 287: + case 287: reg = "pvr"; break; - case 528: + case 528: reg = "ibat0u"; break; - case 529: + case 529: reg = "ibat0l"; break; - case 530: + case 530: reg = "ibat1u"; break; - case 531: + case 531: reg = "ibat1l"; break; - case 532: + case 532: reg = "ibat2u"; break; - case 533: + case 533: reg = "ibat2l"; break; - case 534: + case 534: reg = "ibat3u"; break; - case 535: + case 535: reg = "ibat3l"; break; - case 536: + case 536: reg = "dbat0u"; break; - case 537: + case 537: reg = "dbat0l"; break; - case 538: + case 538: reg = "dbat1u"; break; - case 539: + case 539: reg = "dbat1l"; break; - case 540: + case 540: reg = "dbat2u"; break; - case 541: + case 541: reg = "dbat2l"; break; - case 542: + case 542: reg = "dbat3u"; break; - case 543: + case 543: reg = "dbat3l"; break; - case 1013: + case 1013: reg = "dabr"; break; default: reg = 0; } if (reg == 0) { - pstr += sprintf(pstr, "spr%d", spr); + pstr += sprintf (pstr, "spr%d", spr); } else { - pstr += sprintf(pstr, "%s", reg); + pstr += sprintf (pstr, "%s", reg); } } break; @@ -968,9 +968,9 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt, char **ppoutpu reg = 0; } if (reg == 0) { - pstr += sprintf(pstr, "tbr%d", tbr); + pstr += sprintf (pstr, "tbr%d", tbr); } else { - pstr += sprintf(pstr, "%s", reg); + pstr += sprintf (pstr, "%s", reg); } } break; diff --git a/sys/arch/powerpc/ddb/db_memrw.c b/sys/arch/powerpc/ddb/db_memrw.c index d91f2f7558c..02616f7f982 100644 --- a/sys/arch/powerpc/ddb/db_memrw.c +++ b/sys/arch/powerpc/ddb/db_memrw.c @@ -1,29 +1,29 @@ /* $NetBSD: db_memrw.c,v 1.4 2001/05/18 20:38:27 matt Exp $ */ -/* $OpenBSD: db_memrw.c,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ -/* +/* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon + * + * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ diff --git a/sys/arch/powerpc/include/ansi.h b/sys/arch/powerpc/include/ansi.h index 9de2ec7061e..83582fa90a7 100644 --- a/sys/arch/powerpc/include/ansi.h +++ b/sys/arch/powerpc/include/ansi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ansi.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: ansi.h,v 1.9 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: ansi.h,v 1.2 1996/11/15 22:38:57 jtc Exp $ */ /*- @@ -67,7 +67,7 @@ struct __va_list_tag; * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you * lose a bit of ANSI conformance, but your programs will still work. - * + * * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains * defined for ctype.h. diff --git a/sys/arch/powerpc/include/asm.h b/sys/arch/powerpc/include/asm.h index c9df19221fe..4a996b18638 100644 --- a/sys/arch/powerpc/include/asm.h +++ b/sys/arch/powerpc/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: asm.h,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: asm.h,v 1.1 1996/09/30 16:34:20 ws Exp $ */ /* @@ -91,7 +91,7 @@ _TMP_LABEL(y):; \ addis 11, 11, _TMP_LABEL(y)@ha; \ stw 0, 4(1); \ addi 0, 11,_TMP_LABEL(y)@l; \ - bl _mcount; + bl _mcount; #else # define _PROF_PROLOGUE(y) #endif diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h index be0714ff88f..d615387b78c 100644 --- a/sys/arch/powerpc/include/cpu.h +++ b/sys/arch/powerpc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.12 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.13 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -69,7 +69,7 @@ syncicache(void *from, int len) len = len + (((u_int32_t) from) & (CACHELINESIZE - 1)); l = len; - + do { __asm__ __volatile__ ("dcbst 0,%0" :: "r"(p)); p += CACHELINESIZE; @@ -89,10 +89,10 @@ invdcache(void *from, int len) { int l; char *p = from; - + len = len + (((u_int32_t) from) & (CACHELINESIZE - 1)); l = len; - + do { __asm__ __volatile__ ("dcbi 0,%0" :: "r"(p)); p += CACHELINESIZE; diff --git a/sys/arch/powerpc/include/elf_abi.h b/sys/arch/powerpc/include/elf_abi.h index d55a7962915..69246bbbff9 100644 --- a/sys/arch/powerpc/include/elf_abi.h +++ b/sys/arch/powerpc/include/elf_abi.h @@ -1,8 +1,8 @@ -/* $OpenBSD: elf_abi.h,v 1.2 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: elf_abi.h,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -37,7 +37,7 @@ /* From MIPS ABI supplemental */ -/* Architecture dependent Segment types - p_type */ +/* Architecture dependent Segment types - p_type */ /* ??NONE?? */ /* Architecture dependent d_tag field for Elf32_Dyn. */ diff --git a/sys/arch/powerpc/include/exec.h b/sys/arch/powerpc/include/exec.h index e075d671a99..893605087ef 100644 --- a/sys/arch/powerpc/include/exec.h +++ b/sys/arch/powerpc/include/exec.h @@ -1,8 +1,8 @@ -/* $OpenBSD: exec.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: exec.h,v 1.9 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: exec.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ + * $Id: exec.h,v 1.9 2002/09/15 09:01:59 deraadt Exp $ */ #ifndef _POWERPC_EXEC_H_ diff --git a/sys/arch/powerpc/include/ieeefp.h b/sys/arch/powerpc/include/ieeefp.h index 0fd21b947b2..8bd392245f1 100644 --- a/sys/arch/powerpc/include/ieeefp.h +++ b/sys/arch/powerpc/include/ieeefp.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ieeefp.h,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ -/* +/* $OpenBSD: ieeefp.h,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ +/* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. */ diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h index 92f6124a334..3367f3b3798 100644 --- a/sys/arch/powerpc/include/intr.h +++ b/sys/arch/powerpc/include/intr.h @@ -1,8 +1,8 @@ -/* $OpenBSD: intr.h,v 1.20 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: intr.h,v 1.21 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -93,7 +93,7 @@ splx(int newcpl) { __asm__ volatile("":::"memory"); /* reorder protect */ cpl = newcpl; - if (ipending & ~newcpl) + if(ipending & ~newcpl) do_pending_int(); __asm__ volatile("":::"memory"); /* reorder protect */ } @@ -106,7 +106,7 @@ spllower(int newcpl) __asm__ volatile("":::"memory"); /* reorder protect */ oldcpl = cpl; cpl = newcpl; - if (ipending & ~newcpl) + if(ipending & ~newcpl) do_pending_int(); __asm__ volatile("":::"memory"); /* reorder protect */ return(oldcpl); @@ -158,11 +158,11 @@ set_sint(int pending) struct intrhand { struct intrhand *ih_next; int (*ih_fun)(void *); - void *ih_arg; - u_long ih_count; - int ih_level; - int ih_irq; - char *ih_what; + void *ih_arg; + u_long ih_count; + int ih_level; + int ih_irq; + char *ih_what; }; extern int ppc_configed_intr_cnt; #define MAX_PRECONF_INTR 16 diff --git a/sys/arch/powerpc/include/ipkdb.h b/sys/arch/powerpc/include/ipkdb.h index 5ae6fb90709..9eb484cf7b7 100644 --- a/sys/arch/powerpc/include/ipkdb.h +++ b/sys/arch/powerpc/include/ipkdb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ipkdb.h,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: ipkdb.h,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -50,7 +50,7 @@ ipkdbcopy(s,d,n) int n; { char *sp = s, *dp = d; - + while (--n >= 0) *dp++ = *sp++; } @@ -61,7 +61,7 @@ ipkdbzero(d,n) int n; { char *dp = d; - + while (--n >= 0) *dp++ = 0; } @@ -71,7 +71,7 @@ ipkdbcmp(s,d,n) void *s, *d; { char *sp = s, *dp = d; - + while (--n >= 0) if (*sp++ != *dp++) return *--dp - *--sp; diff --git a/sys/arch/powerpc/include/limits.h b/sys/arch/powerpc/include/limits.h index be51e94f159..0ad3045e87f 100644 --- a/sys/arch/powerpc/include/limits.h +++ b/sys/arch/powerpc/include/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.12 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: limits.h,v 1.13 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -39,7 +39,7 @@ #if !defined(_ANSI_SOURCE) #define SIZE_MAX UINT_MAX /* max value for a size_t */ -#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ +#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ #if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) #define SIZE_T_MAX UINT_MAX /* max value for a size_t */ diff --git a/sys/arch/powerpc/include/pio.h b/sys/arch/powerpc/include/pio.h index c0cad78481a..c70360e6006 100644 --- a/sys/arch/powerpc/include/pio.h +++ b/sys/arch/powerpc/include/pio.h @@ -1,8 +1,8 @@ -/* $OpenBSD: pio.h,v 1.8 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pio.h,v 1.9 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -163,16 +163,15 @@ __flash_led(bits, count) { int i, v = 0; - if (bits == 0) { - v = 1; - bits = 3; + if(bits == 0) { + v = 1; bits = 3; } bits &= 3; count += count; v |= (*(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4)) & ~3; - while (count--) { + while(count--) { v ^= bits; - for (i = 100000; i > 0; i--) + for(i = 100000; i > 0; i--) *(volatile u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) = v; } *(u_int8_t *)(MPC106_V_ISA_IO_SPACE + 0x01f4) &= ~3; diff --git a/sys/arch/powerpc/include/pmap.h b/sys/arch/powerpc/include/pmap.h index 74f15684fe5..d61d9e2c378 100644 --- a/sys/arch/powerpc/include/pmap.h +++ b/sys/arch/powerpc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.30 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.31 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ /*- @@ -49,7 +49,7 @@ typedef u_int sr_t; #define SR_NOEXEC 0x10000000 #define SR_VSID 0x00ffffff /* - * bit + * bit * 3 2 2 2 2 1 1 1 1 1 0 * 1 8 7 4 0 9 6 5 2 1 0 * |XXXX|XXXX XXXX|XXXX XXXX|XXXX XXXX XXXX @@ -63,20 +63,20 @@ typedef u_int sr_t; /* V->P mapping data */ #define VP_SR_SIZE 16 #define VP_SR_MASK (VP_SR_SIZE-1) -#define VP_SR_POS 28 +#define VP_SR_POS 28 #define VP_IDX1_SIZE 256 #define VP_IDX1_MASK (VP_IDX1_SIZE-1) -#define VP_IDX1_POS 20 +#define VP_IDX1_POS 20 #define VP_IDX2_SIZE 256 #define VP_IDX2_MASK (VP_IDX2_SIZE-1) -#define VP_IDX2_POS 12 +#define VP_IDX2_POS 12 void pmap_kenter_cache( vaddr_t va, paddr_t pa, vm_prot_t prot, int cacheable); /* cache flags */ -#define PMAP_CACHE_DEFAULT 0 /* WB cache managed mem, devices not */ -#define PMAP_CACHE_CI 1 /* cache inhibit */ -#define PMAP_CACHE_WT 2 /* writethru */ +#define PMAP_CACHE_DEFAULT 0 /* WB cache managed mem, devices not */ +#define PMAP_CACHE_CI 1 /* cache inhibit */ +#define PMAP_CACHE_WT 2 /* writethru */ #define PMAP_CACHE_WB 3 /* writeback */ /* @@ -110,7 +110,7 @@ boolean_t pteclrbits(paddr_t pa, u_int mask, u_int clear); #define pmap_phys_address(x) (x) #define pmap_update(pmap) /* nothing (yet) */ -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) /* * Alternate mapping methods for pool. diff --git a/sys/arch/powerpc/include/profile.h b/sys/arch/powerpc/include/profile.h index 6a1d86323d4..ea974344f06 100644 --- a/sys/arch/powerpc/include/profile.h +++ b/sys/arch/powerpc/include/profile.h @@ -1,8 +1,9 @@ -/* $OpenBSD: profile.h,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: profile.h,v 1.4 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1998 Dale Rahn. All rights reserved. * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #define MCOUNT \ __asm__(" \ .section \".text\" \n\ @@ -49,7 +50,7 @@ stw 10,36(1) \n\ stw 11,40(1) \n\ mr 4, 0 \n\ - mr 3, 11 \n\ + mr 3, 11 \n\ bl __mcount \n\ lwz 3, 8(1) \n\ lwz 4, 12(1) \n\ diff --git a/sys/arch/powerpc/include/reg.h b/sys/arch/powerpc/include/reg.h index 9087382d038..2a7003222b8 100644 --- a/sys/arch/powerpc/include/reg.h +++ b/sys/arch/powerpc/include/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: reg.h,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -61,7 +61,7 @@ struct reg { }; struct vreg { - u_int32_t vreg[32][4]; + u_int32_t vreg[32][4]; u_int64_t vscr; u_int32_t vrsave; u_int32_t pad; diff --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h index bfbbd8b1616..73f270b6aa2 100644 --- a/sys/arch/powerpc/include/types.h +++ b/sys/arch/powerpc/include/types.h @@ -1,5 +1,5 @@ /* $NetBSD: types.h,v 1.1 1996/09/30 16:34:36 ws Exp $ */ -/* $OpenBSD: types.h,v 1.11 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: types.h,v 1.12 2002/09/15 09:01:59 deraadt Exp $ */ /*- * Copyright (C) 1995 Wolfgang Solfrank. @@ -62,7 +62,7 @@ typedef unsigned long vsize_t; typedef unsigned long psize_t; typedef struct label_t { - int val[40]; /* double check this XXX */ + int val[40]; /* double check this XXX */ } label_t; #define __BROKEN_INDIRECT_CONFIG diff --git a/sys/arch/powerpc/include/va-ppc.h b/sys/arch/powerpc/include/va-ppc.h index 255716665e1..b8359bead00 100644 --- a/sys/arch/powerpc/include/va-ppc.h +++ b/sys/arch/powerpc/include/va-ppc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: va-ppc.h,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: va-ppc.h,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ /* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */ #ifndef _WIN32 @@ -249,6 +249,7 @@ __extension__ ({ \ (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ *(dest) = *(src);\ }) + #endif /* __VA_PPC_H__ */ diff --git a/sys/arch/powerpc/pci/pci_machdep.h b/sys/arch/powerpc/pci/pci_machdep.h index 81c415c9a3b..60c1a0535be 100644 --- a/sys/arch/powerpc/pci/pci_machdep.h +++ b/sys/arch/powerpc/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.13 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.14 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -82,7 +82,7 @@ int pci_intr_line(pci_intr_handle_t ih); #define pci_conf_write(c, t, r, v) \ (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) #define pci_intr_map(pa, ihp) \ - (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \ + (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \ (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp)) #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) diff --git a/sys/arch/powerpc/powerpc/Locore.c b/sys/arch/powerpc/powerpc/Locore.c index 40d6522610a..2282f2057fb 100644 --- a/sys/arch/powerpc/powerpc/Locore.c +++ b/sys/arch/powerpc/powerpc/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.7 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: Locore.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -53,7 +53,7 @@ setrunqueue(p) struct prochd *q; struct proc *oldlast; int which = p->p_priority >> 2; - + #ifdef DIAGNOSTIC if (p->p_back) panic("setrunqueue"); @@ -77,7 +77,7 @@ remrunqueue(p) int which = p->p_priority >> 2; struct prochd *q; -#ifdef DIAGNOSTIC +#ifdef DIAGNOSTIC if (!(whichqs & (0x80000000 >> which))) panic("remrunqueue"); #endif diff --git a/sys/arch/powerpc/powerpc/copystr.c b/sys/arch/powerpc/powerpc/copystr.c index 24dce8126fb..a38c844e0b6 100644 --- a/sys/arch/powerpc/powerpc/copystr.c +++ b/sys/arch/powerpc/powerpc/copystr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: copystr.c,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: copystr.c,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ /*- * Copyright (C) 1995 Wolfgang Solfrank. @@ -47,7 +47,7 @@ copystr(kfaddr, kdaddr, len, done) u_char *kfp = (u_char *)kfaddr; u_char *kdp = kdaddr; size_t l; - + for (l = 0; len-- > 0; l++) { if (!(*kdp++ = *kfp++)) { *done = l + 1; diff --git a/sys/arch/powerpc/powerpc/fpu.c b/sys/arch/powerpc/powerpc/fpu.c index 7913c489a96..b2bc9600b9f 100644 --- a/sys/arch/powerpc/powerpc/fpu.c +++ b/sys/arch/powerpc/powerpc/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.3 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: fpu.c,v 1.4 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: fpu.c,v 1.1 1996/09/30 16:34:44 ws Exp $ */ /* @@ -45,47 +45,47 @@ enable_fpu(p) int msr, scratch; struct pcb *pcb = &p->p_addr->u_pcb; struct trapframe *tf = trapframe(p); - + tf->srr1 |= PSL_FP; if (!(pcb->pcb_flags & PCB_FPU)) { bzero(&pcb->pcb_fpu, sizeof pcb->pcb_fpu); pcb->pcb_flags |= PCB_FPU; } asm volatile ("mfmsr %0; ori %1,%0,%2; mtmsr %1; isync" - : "=r"(msr), "=r"(scratch) : "K"(PSL_FP)); + : "=r"(msr), "=r"(scratch) : "K"(PSL_FP)); asm volatile ("lfd 0,0(%0); mtfsf 0xff,0" :: "b"(&pcb->pcb_fpu.fpcsr)); asm ("lfd 0,0(%0);" - "lfd 1,8(%0);" - "lfd 2,16(%0);" - "lfd 3,24(%0);" - "lfd 4,32(%0);" - "lfd 5,40(%0);" - "lfd 6,48(%0);" - "lfd 7,56(%0);" - "lfd 8,64(%0);" - "lfd 9,72(%0);" - "lfd 10,80(%0);" - "lfd 11,88(%0);" - "lfd 12,96(%0);" - "lfd 13,104(%0);" - "lfd 14,112(%0);" - "lfd 15,120(%0);" - "lfd 16,128(%0);" - "lfd 17,136(%0);" - "lfd 18,144(%0);" - "lfd 19,152(%0);" - "lfd 20,160(%0);" - "lfd 21,168(%0);" - "lfd 22,176(%0);" - "lfd 23,184(%0);" - "lfd 24,192(%0);" - "lfd 25,200(%0);" - "lfd 26,208(%0);" - "lfd 27,216(%0);" - "lfd 28,224(%0);" - "lfd 29,232(%0);" - "lfd 30,240(%0);" - "lfd 31,248(%0)" :: "b"(&pcb->pcb_fpu.fpr[0])); + "lfd 1,8(%0);" + "lfd 2,16(%0);" + "lfd 3,24(%0);" + "lfd 4,32(%0);" + "lfd 5,40(%0);" + "lfd 6,48(%0);" + "lfd 7,56(%0);" + "lfd 8,64(%0);" + "lfd 9,72(%0);" + "lfd 10,80(%0);" + "lfd 11,88(%0);" + "lfd 12,96(%0);" + "lfd 13,104(%0);" + "lfd 14,112(%0);" + "lfd 15,120(%0);" + "lfd 16,128(%0);" + "lfd 17,136(%0);" + "lfd 18,144(%0);" + "lfd 19,152(%0);" + "lfd 20,160(%0);" + "lfd 21,168(%0);" + "lfd 22,176(%0);" + "lfd 23,184(%0);" + "lfd 24,192(%0);" + "lfd 25,200(%0);" + "lfd 26,208(%0);" + "lfd 27,216(%0);" + "lfd 28,224(%0);" + "lfd 29,232(%0);" + "lfd 30,240(%0);" + "lfd 31,248(%0)" :: "b"(&pcb->pcb_fpu.fpr[0])); asm volatile ("mtmsr %0; isync" :: "r"(msr)); } @@ -95,41 +95,41 @@ save_fpu(p) { int msr, scratch; struct pcb *pcb = &p->p_addr->u_pcb; - + asm volatile ("mfmsr %0; ori %1,%0,%2; mtmsr %1; isync" - : "=r"(msr), "=r"(scratch) : "K"(PSL_FP)); + : "=r"(msr), "=r"(scratch) : "K"(PSL_FP)); asm ("stfd 0,0(%0);" - "stfd 1,8(%0);" - "stfd 2,16(%0);" - "stfd 3,24(%0);" - "stfd 4,32(%0);" - "stfd 5,40(%0);" - "stfd 6,48(%0);" - "stfd 7,56(%0);" - "stfd 8,64(%0);" - "stfd 9,72(%0);" - "stfd 10,80(%0);" - "stfd 11,88(%0);" - "stfd 12,96(%0);" - "stfd 13,104(%0);" - "stfd 14,112(%0);" - "stfd 15,120(%0);" - "stfd 16,128(%0);" - "stfd 17,136(%0);" - "stfd 18,144(%0);" - "stfd 19,152(%0);" - "stfd 20,160(%0);" - "stfd 21,168(%0);" - "stfd 22,176(%0);" - "stfd 23,184(%0);" - "stfd 24,192(%0);" - "stfd 25,200(%0);" - "stfd 26,208(%0);" - "stfd 27,216(%0);" - "stfd 28,224(%0);" - "stfd 29,232(%0);" - "stfd 30,240(%0);" - "stfd 31,248(%0)" :: "b"(&pcb->pcb_fpu.fpr[0])); + "stfd 1,8(%0);" + "stfd 2,16(%0);" + "stfd 3,24(%0);" + "stfd 4,32(%0);" + "stfd 5,40(%0);" + "stfd 6,48(%0);" + "stfd 7,56(%0);" + "stfd 8,64(%0);" + "stfd 9,72(%0);" + "stfd 10,80(%0);" + "stfd 11,88(%0);" + "stfd 12,96(%0);" + "stfd 13,104(%0);" + "stfd 14,112(%0);" + "stfd 15,120(%0);" + "stfd 16,128(%0);" + "stfd 17,136(%0);" + "stfd 18,144(%0);" + "stfd 19,152(%0);" + "stfd 20,160(%0);" + "stfd 21,168(%0);" + "stfd 22,176(%0);" + "stfd 23,184(%0);" + "stfd 24,192(%0);" + "stfd 25,200(%0);" + "stfd 26,208(%0);" + "stfd 27,216(%0);" + "stfd 28,224(%0);" + "stfd 29,232(%0);" + "stfd 30,240(%0);" + "stfd 31,248(%0)" :: "b"(&pcb->pcb_fpu.fpr[0])); asm volatile ("mffs 0; stfd 0,0(%0)" :: "b"(&pcb->pcb_fpu.fpcsr)); asm volatile ("mtmsr %0; isync" :: "r"(msr)); } diff --git a/sys/arch/powerpc/powerpc/fubyte.c b/sys/arch/powerpc/powerpc/fubyte.c index 7079c932294..c60475ae36f 100644 --- a/sys/arch/powerpc/powerpc/fubyte.c +++ b/sys/arch/powerpc/powerpc/fubyte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fubyte.c,v 1.4 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: fubyte.c,v 1.5 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: fubyte.c,v 1.1 1996/09/30 16:34:45 ws Exp $ */ /*- @@ -43,7 +43,7 @@ fubyte(addr) void *addr; { unsigned char c; - + if (copyin(addr,&c,sizeof(c))) return -1; return c; diff --git a/sys/arch/powerpc/powerpc/in_cksum.c b/sys/arch/powerpc/powerpc/in_cksum.c index c41196437db..a9a6d6a27b3 100644 --- a/sys/arch/powerpc/powerpc/in_cksum.c +++ b/sys/arch/powerpc/powerpc/in_cksum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_cksum.c,v 1.4 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: in_cksum.c,v 1.5 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: in_cksum.c,v 1.1 1996/09/30 16:34:47 ws Exp $ */ /* @@ -56,7 +56,7 @@ in_cksum(m, len) u_int sum = 0; int mlen; int byte_swapped = 0; - + for (; m && len; m = m->m_next) { if (m->m_len == 0) continue; diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index 2a132507aa5..8524f4b53ca 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,8 +1,9 @@ -/* $OpenBSD: pmap.c,v 1.75 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.76 2002/09/15 09:01:59 deraadt Exp $ */ /* * Copyright (c) 2001, 2002 Dale Rahn. All rights reserved. * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -31,7 +32,7 @@ * Effort sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F30602-01-2-0537. - */ + */ #include <sys/param.h> #include <sys/malloc.h> @@ -57,6 +58,7 @@ struct mem_region pmap_allocated[10]; int pmap_cnt_avail; int pmap_cnt_allocated; + void * pmap_pvh; void * pmap_attrib; struct pte *pmap_ptable; @@ -98,6 +100,7 @@ void pmap_page_ro(pmap_t pm, vaddr_t va); #define pmap_simplelock_pv(pm) #define pmap_simpleunlock_pv(pm) + /* VP routines */ void pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted); struct pte_desc *pmap_vp_remove(pmap_t pm, vaddr_t va); @@ -108,6 +111,7 @@ struct pte_desc *pmap_vp_lookup(pmap_t pm, vaddr_t va); int pmap_enter_pv(struct pte_desc *pted, struct pted_pv_head *); void pmap_remove_pv(struct pte_desc *pted); + /* pte hash table routines */ void pte_insert(struct pte_desc *pted); void pmap_hash_remove(struct pte_desc *pted); @@ -169,13 +173,14 @@ VP_IDX2(vaddr_t va) return (va >> VP_IDX2_POS) & VP_IDX2_MASK; } -#if VP_IDX1_SIZE != VP_IDX2_SIZE +#if VP_IDX1_SIZE != VP_IDX2_SIZE #error pmap allocation code expects IDX1 and IDX2 size to be same #endif struct pmapvp { void *vp[VP_IDX1_SIZE]; }; + /* * VP routines, virtual to physical translation information. * These data structures are based off of the pmap, per process. @@ -184,7 +189,7 @@ struct pmapvp { /* * This is used for pmap_kernel() mappings, they are not to be removed * from the vp table because they were statically initialized at the - * initial pmap initialization. This is so that memory allocation + * initial pmap initialization. This is so that memory allocation * is not necessary in the pmap_kernel() mappings. * otherwise bad race conditions can appear. */ @@ -241,7 +246,7 @@ pmap_vp_remove(pmap_t pm, vaddr_t va) * with reference to the pte descriptor that is used to map the page. * This code should track allocations of vp table allocations * so they can be freed efficiently. - * + * * should this be called under splimp? */ void @@ -276,8 +281,8 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted) pmap_simpleunlock_pm(pm); } -/* - * HELPER FUNCTIONS +/* + * HELPER FUNCTIONS */ static inline struct pted_pv_head * pmap_find_pvh(paddr_t pa) @@ -332,7 +337,7 @@ ptesr(sr_t *sr, vaddr_t va) return sr[(u_int)va >> ADDR_SR_SHIFT]; } -static inline int +static inline int pteidx(sr_t sr, vaddr_t va) { int hash; @@ -349,25 +354,25 @@ pteidx(sr_t sr, vaddr_t va) static inline u_int32_t PTED_HID(struct pte_desc *pted) { - return (pted->pted_va & PTED_VA_HID_M); + return (pted->pted_va & PTED_VA_HID_M); } static inline u_int32_t PTED_PTEGIDX(struct pte_desc *pted) { - return (pted->pted_va & PTED_VA_PTEGIDX_M); + return (pted->pted_va & PTED_VA_PTEGIDX_M); } static inline u_int32_t PTED_MANAGED(struct pte_desc *pted) { - return (pted->pted_va & PTED_VA_MANAGED_M); + return (pted->pted_va & PTED_VA_MANAGED_M); } static inline u_int32_t PTED_WIRED(struct pte_desc *pted) { - return (pted->pted_va & PTED_VA_WIRED_M); + return (pted->pted_va & PTED_VA_WIRED_M); } static inline u_int32_t @@ -379,7 +384,7 @@ PTED_VALID(struct pte_desc *pted) /* * PV entries - * manpulate the physical to virtual translations for the entire system. - * + * * QUESTION: should all mapped memory be stored in PV tables? or * is it alright to only store "ram" memory. Currently device mappings * are not stored. @@ -399,7 +404,7 @@ PTED_VALID(struct pte_desc *pted) * it multiple times. * * One issue of making this a single data structure is that two pointers are - * wasted for every page which does not map ram (device mappings), this + * wasted for every page which does not map ram (device mappings), this * should be a low percentage of mapped pages in the system, so should not * have too noticable unnecssary ram consumption. */ @@ -470,7 +475,7 @@ pmap_enter(pm, va, pa, prot, flags) /* Do not have pted for this, get one and put it in VP */ if (pted == NULL) { - pted = pool_get(&pmap_pted_pool, PR_NOWAIT); + pted = pool_get(&pmap_pted_pool, PR_NOWAIT); bzero(pted, sizeof (*pted)); pmap_vp_enter(pm, va, pted); } @@ -493,10 +498,10 @@ pmap_enter(pm, va, pa, prot, flags) */ pte_insert(pted); - if (prot & VM_PROT_EXECUTE) { + if (prot & VM_PROT_EXECUTE) { u_int sn = VP_SR(va); - pm->pm_exec[sn]++; + pm->pm_exec[sn]++; if (pm->pm_sr[sn] & SR_NOEXEC) { pm->pm_sr[sn] &= ~SR_NOEXEC; @@ -506,7 +511,7 @@ pmap_enter(pm, va, pa, prot, flags) if (sn != USER_SR && sn != KERNEL_SR && curpm == pm) asm volatile ("mtsrin %0,%1" :: "r"(pm->pm_sr[sn]), - "r"(sn << ADDR_SR_SHIFT) ); + "r"(sn << ADDR_SR_SHIFT) ); } } @@ -520,7 +525,7 @@ pmap_enter(pm, va, pa, prot, flags) return KERN_SUCCESS; } -/* +/* * Remove the given range of mapping entries. */ void @@ -532,7 +537,7 @@ pmap_remove(pmap_t pm, vaddr_t va, vaddr_t endva) struct pmapvp *vp1; struct pmapvp *vp2; - /* I suspect that if this loop were unrolled better + /* I suspect that if this loop were unrolled better * it would have better performance, testing i_sr and i_vp1 * in the middle loop seems excessive */ @@ -543,7 +548,7 @@ pmap_remove(pmap_t pm, vaddr_t va, vaddr_t endva) vp1 = pm->pm_vp[i_sr]; if (vp1 == NULL) continue; - + if (i_sr == s_sr) s_vp1 = VP_IDX1(va); else @@ -552,7 +557,7 @@ pmap_remove(pmap_t pm, vaddr_t va, vaddr_t endva) if (i_sr == e_sr) e_vp1 = VP_IDX1(endva); else - e_vp1 = VP_IDX1_SIZE-1; + e_vp1 = VP_IDX1_SIZE-1; for (i_vp1 = s_vp1; i_vp1 <= e_vp1; i_vp1++) { vp2 = vp1->vp[i_vp1]; @@ -567,7 +572,7 @@ pmap_remove(pmap_t pm, vaddr_t va, vaddr_t endva) if ((i_sr == e_sr) && (i_vp1 == e_vp1)) e_vp2 = VP_IDX2(endva); else - e_vp2 = VP_IDX2_SIZE; + e_vp2 = VP_IDX2_SIZE; for (i_vp2 = s_vp2; i_vp2 < e_vp2; i_vp2++) { if (vp2->vp[i_vp2] != NULL) { @@ -600,7 +605,7 @@ pmap_remove_pg(pmap_t pm, vaddr_t va) if (pted == NULL || !PTED_VALID(pted)) { splx(s); return; - } + } } else { pted = pmap_vp_remove(pm, va); if (pted == NULL || !PTED_VALID(pted)) { @@ -619,14 +624,14 @@ pmap_remove_pg(pmap_t pm, vaddr_t va) pm->pm_exec[sn]--; if (pm->pm_exec[sn] == 0) { pm->pm_sr[sn] |= SR_NOEXEC; - + /* set the current sr if not kernel used segemnts * and this pmap is current active pmap */ if (sn != USER_SR && sn != KERNEL_SR && curpm == pm) asm volatile ("mtsrin %0,%1" :: "r"(pm->pm_sr[sn]), - "r"(sn << ADDR_SR_SHIFT) ); + "r"(sn << ADDR_SR_SHIFT) ); } } @@ -644,11 +649,11 @@ pmap_remove_pg(pmap_t pm, vaddr_t va) /* * Enter a kernel mapping for the given page. * kernel mappings have a larger set of prerequisites than normal mappings. - * + * * 1. no memory should be allocated to create a kernel mapping. * 2. a vp mapping should already exist, even if invalid. (see 1) * 3. all vp tree mappings should already exist (see 1) - * + * */ void _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache) @@ -674,7 +679,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache) /* XXX - future panic? */ printf("pted not preallocated in pmap_kernel() va %x pa %x \n", va, pa); - pted = pool_get(&pmap_pted_pool, PR_NOWAIT); + pted = pool_get(&pmap_pted_pool, PR_NOWAIT); bzero(pted, sizeof (*pted)); pmap_vp_enter(pm, va, pted); } @@ -698,10 +703,10 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache) pte_insert(pted); pted->pted_va |= PTED_VA_WIRED_M; - if (prot & VM_PROT_EXECUTE) { + if (prot & VM_PROT_EXECUTE) { u_int sn = VP_SR(va); - pm->pm_exec[sn]++; + pm->pm_exec[sn]++; if (pm->pm_sr[sn] & SR_NOEXEC) { pm->pm_sr[sn] &= ~SR_NOEXEC; @@ -711,7 +716,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache) if (sn != USER_SR && sn != KERNEL_SR && curpm == pm) asm volatile ("mtsrin %0,%1" :: "r"(pm->pm_sr[sn]), - "r"(sn << ADDR_SR_SHIFT) ); + "r"(sn << ADDR_SR_SHIFT) ); } } @@ -731,6 +736,7 @@ pmap_kenter_cache(vaddr_t va, paddr_t pa, vm_prot_t prot, int cacheable) _pmap_kenter_pa(va, pa, prot, 0, cacheable); } + /* * remove kernel (pmap_kernel()) mapping, one page */ @@ -774,7 +780,7 @@ pmap_kremove_pg(vaddr_t va) if (sn != USER_SR && sn != KERNEL_SR && curpm == pm) asm volatile ("mtsrin %0,%1" :: "r"(pm->pm_sr[sn]), - "r"(sn << ADDR_SR_SHIFT) ); + "r"(sn << ADDR_SR_SHIFT) ); } } @@ -837,8 +843,8 @@ pmap_hash_remove(struct pte_desc *pted) * mapped. If the mapping was thrown away in exchange for another * page mapping, then this page is not currently in the HASH. */ - if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) == - ptp->pte_hi) { + if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) + == ptp->pte_hi) { pte_zap(ptp, pted); } } @@ -859,6 +865,7 @@ pmap_fill_pte(pmap_t pm, vaddr_t va, paddr_t pa, struct pte_desc *pted, ((va >> ADDR_API_SHIFT) & PTE_API) | PTE_VALID; pte->pte_lo = (pa & PTE_RPGN); + if ((cache == PMAP_CACHE_WB)) pte->pte_lo |= PTE_M; else if ((cache == PMAP_CACHE_WT)) @@ -909,7 +916,7 @@ pteclrbits(paddr_t pa, u_int bit, u_int clear) /* cache did not contain all necessary bits, * need to walk thru pv table to collect all mappings for this - * page, copying bits to the attribute cache + * page, copying bits to the attribute cache * then reread the attribute cache. */ /* need lock for this pv */ @@ -926,7 +933,7 @@ pteclrbits(paddr_t pa, u_int bit, u_int clear) /* determine which pteg mapping is present in */ ptp = pmap_ptable + - (idx ^ (PTED_HID(pted) ? pmap_ptab_mask : 0)) * 8; + (idx ^ (PTED_HID(pted) ? pmap_ptab_mask : 0)) * 8; ptp += PTED_PTEGIDX(pted); /* increment by index into pteg */ /* @@ -935,8 +942,8 @@ pteclrbits(paddr_t pa, u_int bit, u_int clear) * exchange for another page mapping, then this page is * not currently in the HASH. */ - if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) == - ptp->pte_hi) { + if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) + == ptp->pte_hi) { bits |= ptp->pte_lo & (PTE_REF|PTE_CHG); if (clear) { ptp->pte_hi &= ~PTE_VALID; @@ -961,7 +968,7 @@ pteclrbits(paddr_t pa, u_int bit, u_int clear) } /* - * Garbage collects the physical map system for pages which are + * Garbage collects the physical map system for pages which are * no longer used. Success need not be guaranteed -- that is, there * may well be pages which are not referenced, but others may be collected * Called by the pageout daemon when pages are scarce. @@ -969,7 +976,7 @@ pteclrbits(paddr_t pa, u_int bit, u_int clear) void pmap_collect(pmap_t pm) { - /* This could return unused v->p table layers which + /* This could return unused v->p table layers which * are empty. * could malicious programs allocate memory and eat * these wired pages? These are allocated via pool. @@ -1001,7 +1008,7 @@ pmap_zero_page(struct vm_page *pg) bzero((void *)zero_page, PAGE_SIZE); #endif pmap_kremove_pg(zero_page); - + /* simple_unlock(&pmap_zero_page_lock); */ } @@ -1019,7 +1026,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) pmap_kenter_pa(copy_dst_page, dstpa, VM_PROT_READ|VM_PROT_WRITE); bcopy((void *)copy_src_page, (void *)copy_dst_page, PAGE_SIZE); - + pmap_kremove_pg(copy_src_page); pmap_kremove_pg(copy_dst_page); /* simple_unlock(&pmap_copy_page_lock); */ @@ -1055,7 +1062,7 @@ again: splx(s); /* pmap create unlock */ goto again; } - usedsr[tblidx] |= (1 << tbloff); + usedsr[tblidx] |= (1 << tbloff); pmap_id_avail = try + 1; splx(s); /* pmap create unlock */ @@ -1069,10 +1076,10 @@ again: panic("out of pmap slots"); } -/* +/* * Create and return a physical map. */ -pmap_t +pmap_t pmap_create() { pmap_t pmap; @@ -1159,7 +1166,7 @@ pmap_vp_destroy(pmap_t pm) vp2 = vp1->vp[j]; if (vp2 == NULL) continue; - + s = splimp(); pool_put(&pmap_vp_pool, vp2); splx(s); @@ -1187,8 +1194,8 @@ pmap_avail_setup(void) #define MEMMAX 0x40000000 for (mp = pmap_avail; mp->size !=0 ; /* increment in loop */) { if (mp->start + mp->size > MEMMAX) { - int rm_start, rm_end; - + int rm_start; + int rm_end; if (mp->start > MEMMAX) { rm_start = mp->start; rm_end = mp->start+mp->size; @@ -1219,7 +1226,7 @@ pmap_avail_fixup(void) u_int32_t end; mp = pmap_avail; - while (mp->size !=0) { + while(mp->size !=0) { align = round_page(mp->start); if (mp->start != align) { pmap_remove_avail(mp->start, align); @@ -1316,7 +1323,7 @@ pmap_remove_avail(paddr_t base, paddr_t end) } if (mp->size == 0) { mp->start = base; - mp->size = end - base; + mp->size = end - base; pmap_cnt_allocated++; } } @@ -1331,7 +1338,7 @@ pmap_steal_avail(size_t size, int align) for (mp = pmap_avail; mp->size; mp++) { if (mp->size > size) { start = (mp->start + (align -1)) & ~(align -1); - remsize = mp->size - (start - mp->start); + remsize = mp->size - (start - mp->start); if (remsize >= 0) { pmap_remove_avail(start, start+size); return (void *)start; @@ -1348,7 +1355,7 @@ void *msgbuf_addr; * Initialize pmap setup. * ALL of the code which deals with avail needs rewritten as an actual * memory allocation. - */ + */ void pmap_bootstrap(u_int kernelstart, u_int kernelend) { @@ -1417,12 +1424,13 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend) copy_dst_page = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen; ppc_kvm_stolen += PAGE_SIZE; + /* * Initialize kernel pmap and hardware. */ #if NPMAPS >= KERNEL_SEGMENT / 16 - usedsr[KERNEL_SEGMENT / 16 / (sizeof usedsr[0] * 8)] |= - 1 << ((KERNEL_SEGMENT / 16) % (sizeof usedsr[0] * 8)); + usedsr[KERNEL_SEGMENT / 16 / (sizeof usedsr[0] * 8)] + |= 1 << ((KERNEL_SEGMENT / 16) % (sizeof usedsr[0] * 8)); #endif for (i = 0; i < 16; i++) { pmap_kernel()->pm_sr[i] = (KERNEL_SEG0 + i) | SR_NOEXEC; @@ -1434,6 +1442,7 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend) pmap_avail_fixup(); + tlbia(); npgs = 0; @@ -1441,7 +1450,7 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend) npgs += btoc(mp->size); } /* Ok we loose a few pages from this allocation, but hopefully - * not too many + * not too many */ pmap_pvh = pmap_steal_avail(sizeof(struct pted_pv_head *) * npgs, 4); pmap_attrib = pmap_steal_avail(sizeof(char) * npgs, 1); @@ -1472,9 +1481,9 @@ pmap_deactivate(struct proc *p) { } -/* +/* * Get the physical page address for the given pmap/virtual address. - */ + */ boolean_t pmap_extract(pmap_t pm, vaddr_t va, paddr_t *pa) { @@ -1588,7 +1597,7 @@ int copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) { const u_char *uaddr = udaddr; - u_char *kp = kaddr; + u_char *kp = kaddr; u_char *up; u_char c; void *p; @@ -1624,7 +1633,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) curpcb->pcb_onfault = oldh; pmap_popusr(oldsr); return 0; - } + } up++; kp++; l--; @@ -1644,7 +1653,7 @@ int copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done) { u_char *uaddr = (void *)udaddr; - const u_char *kp = kaddr; + const u_char *kp = kaddr; u_char *up; u_char c; void *p; @@ -1680,7 +1689,7 @@ copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done) curpcb->pcb_onfault = oldh; pmap_popusr(oldsr); return 0; - } + } up++; kp++; l--; @@ -1730,6 +1739,7 @@ pmap_syncicache_user_virt(pmap_t pm, vaddr_t va) p += CACHELINESIZE; } while ((l -= CACHELINESIZE) > 0); + if (pm != pmap_kernel()) { pmap_popusr(oldsr); /* USER SEGMENT UNLOCK -MPXXX */ @@ -1766,8 +1776,8 @@ pmap_page_ro(pmap_t pm, vaddr_t va) * exchange for another page mapping, then this page is * not currently in the HASH. */ - if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) == - ptp->pte_hi) { + if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) + == ptp->pte_hi) { ptp->pte_hi &= ~PTE_VALID; __asm__ volatile ("sync"); tlbie(va); @@ -1816,7 +1826,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot) splx(s); return; } - + LIST_FOREACH(pted, pvh, pted_pv_list) { pmap_page_ro(pted->pted_pmap, pted->pted_va); } @@ -1848,8 +1858,9 @@ pmap_real_memory(paddr_t *start, vm_size_t *size) struct mem_region *mp; for (mp = pmap_mem; mp->size; mp++) { - if (((*start + *size) > mp->start) && - (*start < (mp->start + mp->size))) { + if (((*start + *size) > mp->start) + && (*start < (mp->start + mp->size))) + { if (*start < mp->start) { *size -= mp->start - *start; *start = mp->start; @@ -1907,7 +1918,7 @@ pmap_init() pmap_initialized = 1; } -/* +/* * There are two routines, pte_spill_r and pte_spill_v * the _r version only handles kernel faults which are not user * accesses. The _v version handles all user faults and kernel copyin/copyout @@ -1919,7 +1930,7 @@ pte_spill_r(u_int32_t va, u_int32_t msr, u_int32_t dsisr, int exec_fault) pmap_t pm; struct pte_desc *pted; - /* + /* * This function only handles kernel faults, not supervisor copyins. */ if (!(msr & PSL_PR)) { @@ -1943,13 +1954,13 @@ pte_spill_r(u_int32_t va, u_int32_t msr, u_int32_t dsisr, int exec_fault) */ if (!PTED_VALID(pted)) { return 0; - } + } if ((dsisr & (1 << (31-6))) && (pted->pted_pte.pte_lo & 0x1)) { /* write fault and we have a readonly mapping */ return 0; } - if (exec_fault != 0 && - (pted->pted_va & PTED_VA_EXEC_M) == 0) { + if ((exec_fault != 0) + && ((pted->pted_va & PTED_VA_EXEC_M) == 0)) { /* attempted to execute non-executeable page */ return 0; } @@ -1979,8 +1990,8 @@ pte_spill_v(pmap_t pm, u_int32_t va, u_int32_t dsisr, int exec_fault) /* write fault and we have a readonly mapping */ return 0; } - if (exec_fault != 0 && - (pted->pted_va & PTED_VA_EXEC_M) == 0) { + if ((exec_fault != 0) + && ((pted->pted_va & PTED_VA_EXEC_M) == 0)) { /* attempted to execute non-executeable page */ return 0; } @@ -1988,6 +1999,7 @@ pte_spill_v(pmap_t pm, u_int32_t va, u_int32_t dsisr, int exec_fault) return 1; } + /* * should pte_insert code avoid wired mappings? * is the stack safe? @@ -2012,8 +2024,8 @@ pte_insert(struct pte_desc *pted) /* determine if ptp is already mapped */ ptp = pmap_ptable + (idx ^ (PTED_HID(pted) ? pmap_ptab_mask : 0)) * 8; ptp += PTED_PTEGIDX(pted); /* increment by index into pteg */ - if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) || - ptp->pte_hi) { + if ((pted->pted_pte.pte_hi | (PTED_HID(pted) ? PTE_HID : 0)) + == ptp->pte_hi) { pte_zap(ptp,pted); } @@ -2073,9 +2085,9 @@ pte_insert(struct pte_desc *pted) __asm volatile ("sync"); va = ((ptp->pte_hi & PTE_API) << ADDR_API_SHIFT) | - ((((ptp->pte_hi >> PTE_VSID_SHIFT) & SR_VSID) - ^(idx ^ ((ptp->pte_hi & PTE_HID) ? 0x3ff : 0))) - & 0x3ff) << PAGE_SHIFT; + ((((ptp->pte_hi >> PTE_VSID_SHIFT) & SR_VSID) + ^(idx ^ ((ptp->pte_hi & PTE_HID) ? 0x3ff : 0))) + & 0x3ff) << PAGE_SHIFT; tlbie(va); tlbsync(); @@ -2121,6 +2133,7 @@ print_pteg(pmap_t pm, vaddr_t va) ptp[4].pte_lo, ptp[5].pte_lo, ptp[6].pte_lo, ptp[7].pte_lo); } + /* debugger assist function */ int pmap_prtrans(u_int pid, vaddr_t va); @@ -2138,14 +2151,16 @@ pmap_print_pted(struct pte_desc *pted, int(*print)(const char *, ...)) print(" WIRED %d\n", PTED_WIRED(pted) ? 1: 0); print("ptehi %x ptelo %x ptp %x Aptp %x\n", pted->pted_pte.pte_hi, pted->pted_pte.pte_lo, - pmap_ptable + 8*pteidx(ptesr(pted->pted_pmap->pm_sr, va), va), - pmap_ptable + 8*(pteidx(ptesr(pted->pted_pmap->pm_sr, va), va) ^ - pmap_ptab_mask)); + pmap_ptable + + 8*pteidx(ptesr(pted->pted_pmap->pm_sr, va), va), + pmap_ptable + + 8*(pteidx(ptesr(pted->pted_pmap->pm_sr, va), va) + ^ pmap_ptab_mask) + ); } } int pmap_user_read(int size, vaddr_t va); - int pmap_user_read(int size, vaddr_t va) { @@ -2173,6 +2188,7 @@ pmap_user_read(int size, vaddr_t va) return 1; } + return 0; } @@ -2246,7 +2262,7 @@ pmap_prtrans(u_int pid, vaddr_t va) int pmap_show_mappings(paddr_t pa); int -pmap_show_mappings(paddr_t pa) +pmap_show_mappings(paddr_t pa) { struct pted_pv_head *pvh; struct pte_desc *pted; diff --git a/sys/arch/powerpc/powerpc/process_machdep.c b/sys/arch/powerpc/powerpc/process_machdep.c index c8c9a4dac92..952ec03b76c 100644 --- a/sys/arch/powerpc/powerpc/process_machdep.c +++ b/sys/arch/powerpc/powerpc/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.6 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws Exp $ */ /* @@ -46,7 +46,7 @@ process_read_regs(p, regs) bcopy(&(tf->fixreg[0]), &(regs->gpr[0]), sizeof(regs->gpr)); bzero(&(regs->fpr[0]), sizeof(regs->fpr)); - /* + /* * need to do floating point here */ regs->pc = tf->srr0; @@ -71,7 +71,7 @@ process_set_pc(p, addr) caddr_t addr; { struct trapframe *tf = trapframe(p); - + tf->srr0 = (int)addr; return 0; } @@ -82,7 +82,7 @@ process_sstep(p, sstep) int sstep; { struct trapframe *tf = trapframe(p); - + if (sstep) tf->srr1 |= PSL_SE; else @@ -98,7 +98,7 @@ process_write_regs(p, regs) struct trapframe *tf = trapframe(p); bcopy(&(regs->gpr[0]), &(tf->fixreg[0]), sizeof(regs->gpr)); - /* + /* * need to do floating point here */ tf->srr0 = regs->pc; diff --git a/sys/arch/powerpc/powerpc/setjmp.S b/sys/arch/powerpc/powerpc/setjmp.S index 82935ae0142..044529cc127 100644 --- a/sys/arch/powerpc/powerpc/setjmp.S +++ b/sys/arch/powerpc/powerpc/setjmp.S @@ -1,10 +1,11 @@ -/* $OpenBSD: setjmp.S,v 1.5 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: setjmp.S,v 1.6 2002/09/15 09:01:59 deraadt Exp $ */ /* kernel version of this file, does not have signal goop */ /* int setjmp(jmp_buf env) */ /* * Copyright (c) 1996 Dale Rahn. All rights reserved. * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -29,7 +30,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #include <machine/asm.h> #define JMP_r1 0x04 diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 9e41d522221..bb2b48f58db 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.53 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.54 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -259,7 +259,7 @@ trap(frame) } switch (type) { - case EXC_TRC|EXC_USER: + case EXC_TRC|EXC_USER: { sv.sival_int = frame->srr0; trapsignal(p, SIGTRAP, type, TRAP_TRACE, sv); @@ -289,14 +289,14 @@ trap(frame) vm_offset_t va; int ftype; faultbuf *fb; - + map = kernel_map; va = frame->dar; if ((va >> ADDR_SR_SHIFT) == USER_SR) { sr_t user_sr; - + asm ("mfsr %0, %1" - : "=r"(user_sr) : "K"(USER_SR)); + : "=r"(user_sr) : "K"(USER_SR)); va &= ADDR_PIDX | ADDR_POFF; va |= user_sr << ADDR_SR_SHIFT; map = &p->p_vmspace->vm_map; @@ -327,9 +327,10 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); case EXC_DSI|EXC_USER: { int ftype, vftype; - + if (pte_spill_v(p->p_vmspace->vm_map.pmap, - frame->dar, frame->dsisr, 0)) { + frame->dar, frame->dsisr, 0)) + { /* fault handled by spill handler */ break; } @@ -340,7 +341,7 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); } else vftype = ftype = VM_PROT_READ; if (uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->dar), 0, ftype) == 0) { + trunc_page(frame->dar), 0, ftype) == 0) { break; } #if 0 @@ -356,15 +357,16 @@ printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr); case EXC_ISI|EXC_USER: { int ftype; - + if (pte_spill_v(p->p_vmspace->vm_map.pmap, - frame->srr0, 0, 1)) { + frame->srr0, 0, 1)) + { /* fault handled by spill handler */ break; } ftype = VM_PROT_READ | VM_PROT_EXECUTE; if (uvm_fault(&p->p_vmspace->vm_map, - trunc_page(frame->srr0), 0, ftype) == 0) { + trunc_page(frame->srr0), 0, ftype) == 0) { break; } } @@ -385,15 +387,15 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); register_t *params, rval[2]; int nsys, n; register_t args[10]; - + uvmexp.syscalls++; - + nsys = p->p_emul->e_nsysent; callp = p->p_emul->e_sysent; - + code = frame->fixreg[0]; params = frame->fixreg + FIRSTARG; - + switch (code) { case SYS_syscall: /* @@ -447,6 +449,7 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); scdebug_call(p, code, params); #endif + #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) error = systrace_redirect(code, p, params, @@ -481,8 +484,8 @@ syscall_bad: break; } #ifdef SYSCALL_DEBUG - scdebug_ret(p, code, error, rval); -#endif + scdebug_ret(p, code, error, rval); +#endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) ktrsysret(p, code, error, rval[0]); @@ -498,7 +501,7 @@ syscall_bad: break; case EXC_ALI|EXC_USER: - /* alignment exception + /* alignment exception * we check to see if this can be fixed up * by the code that fixes the typical gcc misaligned code * then kill the process if not. @@ -513,7 +516,7 @@ syscall_bad: break; default: - + brain_damage: /* mpc_print_pci_stat(); @@ -539,11 +542,11 @@ mpc_print_pci_stat(); char *errstr[8]; int errnum = 0; - if (frame->srr1 & (1<<(31-11))) { + if (frame->srr1 & (1<<(31-11))) { /* floating point enabled program exception */ errstr[errnum] = "floating point"; errnum++; - } + } if (frame->srr1 & (1<<(31-12))) { /* illegal instruction program exception */ errstr[errnum] = "illegal instruction"; @@ -574,7 +577,7 @@ mpc_print_pci_stat(); } #if 0 printf("pgm iar %x srr1 %x\n", frame->srr0, frame->srr1); -{ +{ int i; for (i = 0; i < errnum; i++) { printf("\t[%s]\n", errstr[i]); @@ -601,7 +604,7 @@ for (i = 0; i < errnum; i++) { * if we do not handle it, kill the process with illegal instruction. */ case EXC_PERF|EXC_USER: -#ifdef ALTIVEC +#ifdef ALTIVEC case EXC_VEC|EXC_USER: if (ppc_vecproc) { save_vec(ppc_vecproc); @@ -714,7 +717,7 @@ badaddr(addr, len) curpcb->pcb_onfault = oldh; return EFAULT; } - switch (len) { + switch(len) { case 4: v = *((volatile u_int32_t *)addr); break; diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c index 0b88576d06a..fff9efff235 100644 --- a/sys/arch/powerpc/powerpc/vm_machdep.c +++ b/sys/arch/powerpc/powerpc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.35 2002/09/15 02:02:44 deraadt Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.36 2002/09/15 09:01:59 deraadt Exp $ */ /* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */ /* @@ -67,7 +67,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) if (p1 == fpuproc) save_fpu(p1); *pcb = p1->p_addr->u_pcb; - + #ifdef ALTIVEC if (p1->p_addr->u_pcb.pcb_vr != NULL) { if (p1 == ppc_vecproc) @@ -83,7 +83,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) pmap_extract(pmap_kernel(), (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal); - + /* * Setup the trap frame for the new process */ @@ -100,13 +100,13 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) } stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */ - + /* * There happens to be a callframe, too. */ cf = (struct callframe *)stktop2; cf->lr = (int)fork_trampoline; - + /* * Below the trap frame, there is another call frame: */ @@ -114,7 +114,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) cf = (struct callframe *)stktop2; cf->r31 = (register_t)func; cf->r30 = (register_t)arg; - + /* * Below that, we allocate the switch frame: */ @@ -132,7 +132,7 @@ cpu_swapin(p) struct proc *p; { struct pcb *pcb = &p->p_addr->u_pcb; - + pmap_extract(pmap_kernel(), (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal); } @@ -147,7 +147,7 @@ pagemove(from, to, size) { vaddr_t va; paddr_t pa; - + for (va = (vm_offset_t)from; size > 0; size -= NBPG) { pmap_extract(pmap_kernel(), va, &pa); pmap_kremove(va, NBPG); @@ -175,17 +175,17 @@ cpu_exit(p) #ifdef ALTIVEC struct pcb *pcb = &p->p_addr->u_pcb; #endif /* ALTIVEC */ - + if (p == fpuproc) /* release the fpu */ fpuproc = 0; #ifdef ALTIVEC if (p == ppc_vecproc) - ppc_vecproc = NULL; /* release the Altivec Unit */ + ppc_vecproc = NULL; /* release the Altivec Unit */ if (pcb->pcb_vr != NULL) pool_put(&ppc_vecpl, pcb->pcb_vr); #endif /* ALTIVEC */ - + (void)splhigh(); switchexit(p); } @@ -203,14 +203,14 @@ cpu_coredump(p, vp, cred, chdr) struct coreseg cseg; struct md_coredump md_core; int error; - + CORE_SETMAGIC(*chdr, COREMAGIC, MID_POWERPC, 0); chdr->c_hdrsize = ALIGN(sizeof *chdr); chdr->c_seghdrsize = ALIGN(sizeof cseg); chdr->c_cpusize = sizeof md_core; process_read_regs(p, &(md_core.regs)); - + CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_POWERPC, CORE_CPU); cseg.c_addr = 0; cseg.c_size = chdr->c_cpusize; @@ -238,7 +238,7 @@ vmapbuf(bp, len) { vm_offset_t faddr, taddr, off; vm_offset_t pa; - + #ifdef DIAGNOSTIC if (!(bp->b_flags & B_PHYS)) panic("vmapbuf"); @@ -267,7 +267,7 @@ vunmapbuf(bp, len) vm_size_t len; { vm_offset_t addr, off; - + #ifdef DIAGNOSTIC if (!(bp->b_flags & B_PHYS)) panic("vunmapbuf"); |