OpenBSD/sgi on octane2 - sync to HEAD
ここで無謀にもHEADと同期:
$ cvs up
暴挙だとは思うんだけどな〜ついやってもうた
地味に大量のdiff発生:
Index: arch/sgi/sgi/ip27_machdep.c =================================================================== --- arch/sgi/sgi/ip27_machdep.c (繝ェ繝薙ず繝ァ繝ウ 374) +++ arch/sgi/sgi/ip27_machdep.c (菴懈・ュ繧ウ繝斐�) @@ -1,4 +1,4 @@ -/* $OpenBSD: ip27_machdep.c,v 1.4 2009/05/08 18:36:48 miod Exp $ */ +/* $OpenBSD: ip27_machdep.c,v 1.5 2009/05/15 06:29:37 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -403,9 +403,6 @@ } if (rc == 0) printf("spurious interrupt, source %d\n", bit); - - IP27_LHUB_S(HUB_IR_CHANGE, HUB_IR_CLR | bit); - (void)IP27_LHUB_L(HUB_IR0); } /* Index: arch/sgi/sgi/disksubr.c =================================================================== --- arch/sgi/sgi/disksubr.c (繝ェ繝薙ず繝ァ繝ウ 303) +++ arch/sgi/sgi/disksubr.c (菴懈・ュ繧ウ繝斐�) @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.11 2008/09/01 16:28:50 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.12 2009/05/13 01:31:58 krw Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -62,6 +62,7 @@ if ((msg = initdisklabel(lp))) goto done; + lp->d_flags |= D_VENDOR; /* get a buffer and initialize it */ bp = geteblk((int)lp->d_secsize); Index: arch/sgi/sgi/sginode.c =================================================================== --- arch/sgi/sgi/sginode.c (繝ェ繝薙ず繝ァ繝ウ 378) +++ arch/sgi/sgi/sginode.c (菴懈・ュ繧ウ繝斐�) @@ -1,4 +1,5 @@ -/* $OpenBSD: sginode.c,v 1.5 2009/05/08 18:42:07 miod Exp $ */ +#define DEBUG +/* $OpenBSD: sginode.c,v 1.6 2009/05/14 21:08:49 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. * @@ -136,7 +137,11 @@ cpu->type = (cpucomp->cpu_prid >> 8) & 0xff; cpu->vers_maj = (cpucomp->cpu_prid >> 4) & 0x0f; cpu->vers_min = cpucomp->cpu_prid & 0x0f; +#if 0 cpu->fptype = (cpucomp->cpu_fpirr >> 8) & 0xff; +#else + cpu->fptype = cpu->type; +#endif cpu->fpvers_maj = (cpucomp->cpu_fpirr >> 4) & 0x0f; cpu->fpvers_min = cpucomp->cpu_fpirr & 0x0f; Index: arch/sgi/xbow/xbridge.c =================================================================== --- arch/sgi/xbow/xbridge.c (繝ェ繝薙ず繝ァ繝ウ 371) +++ arch/sgi/xbow/xbridge.c (菴懈・ュ繧ウ繝斐�) @@ -1,4 +1,4 @@ -/* $OpenBSD: xbridge.c,v 1.16 2009/05/08 18:37:28 miod Exp $ */ +/* $OpenBSD: xbridge.c,v 1.18 2009/05/15 06:29:39 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -206,6 +206,7 @@ goto fail2; if (sys_config.system_type == SGI_OCTANE) { + /* Unrestricted memory mappings in the large window */ bcopy(xaa->xaa_long_tag, sc->sc_mem_bus_space, sizeof(*sc->sc_mem_bus_space)); sc->sc_mem_bus_space->bus_base += BRIDGE_PCI_MEM_SPACE_BASE; @@ -499,6 +500,7 @@ struct xbridge_softc *xi_bridge; int xi_intrsrc; /* interrupt source on interrupt widget */ int xi_intrbit; /* interrupt source on BRIDGE */ + int xi_device; /* device slot number */ int (*xi_func)(void *); void *xi_arg; @@ -507,6 +509,11 @@ int xi_level; }; +/* how our pci_intr_handle_t are constructed... */ +#define XBRIDGE_INTR_HANDLE(d,b) (0x100 | ((d) << 3) | (b)) +#define XBRIDGE_INTR_DEVICE(h) (((h) >> 3) & 07) +#define XBRIDGE_INTR_BIT(h) ((h) & 07) + int xbridge_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) { @@ -532,7 +539,7 @@ else intr = device ^ 4; - *ihp = intr; + *ihp = XBRIDGE_INTR_HANDLE(device, intr); return 0; } @@ -542,7 +549,7 @@ { static char str[16]; - snprintf(str, sizeof(str), "irq %d", ih); + snprintf(str, sizeof(str), "irq %d", XBRIDGE_INTR_BIT(ih)); return(str); } @@ -553,7 +560,8 @@ struct xbridge_softc *sc = cookie; struct xbridge_intr *xi; uint32_t int_addr; - int intrbit = ih & 0x07; + int intrbit = XBRIDGE_INTR_BIT(ih); + int device = XBRIDGE_INTR_DEVICE(ih); int intrsrc; if (sc->sc_intr[intrbit] != NULL) { @@ -592,6 +600,7 @@ xi->xi_bridge = sc; xi->xi_intrsrc = intrsrc; xi->xi_intrbit = intrbit; + xi->xi_device = device; xi->xi_func = func; xi->xi_arg = arg; xi->xi_level = level; @@ -605,23 +614,31 @@ bus_space_write_4(sc->sc_iot, sc->sc_regh, BRIDGE_IER, bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_IER) | (1 << intrbit)); + /* + * INT_MODE register controls which interrupt pins cause + * ``interrupt clear'' packets to be sent for high->low + * transition. + * We enable such packets to be sent in order not to have to + * clear interrupts ourselves. + */ bus_space_write_4(sc->sc_iot, sc->sc_regh, BRIDGE_INT_MODE, bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_INT_MODE) | (1 << intrbit)); bus_space_write_4(sc->sc_iot, sc->sc_regh, BRIDGE_INT_DEV, bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_INT_DEV) | - (intrbit << (intrbit * 3))); + (device << (intrbit * 3))); (void)bus_space_read_4(sc->sc_iot, sc->sc_regh, WIDGET_TFLUSH); - return (void *)((uint64_t)ih | 8); /* XXX don't return zero */ + return (void *)((uint64_t)ih); } void -xbridge_intr_disestablish(void *cookie, void *ih) +xbridge_intr_disestablish(void *cookie, void *vih) { struct xbridge_softc *sc = cookie; struct xbridge_intr *xi; - int intrbit = (uint64_t)ih & 0x07; + pci_intr_handle_t ih = (pci_intr_handle_t)(uint64_t)vih; + int intrbit = XBRIDGE_INTR_BIT(ih); /* should not happen */ if ((xi = sc->sc_intr[intrbit]) == NULL) @@ -654,44 +671,80 @@ struct xbridge_softc *sc = xi->xi_bridge; uint16_t nasid = 0; /* XXX */ int rc; + int spurious; if (xi == NULL) { - printf("%s: spurious interrupt on source %d\n", - sc->sc_dev.dv_xname, xi->xi_intrsrc); + printf("%s: spurious irq %d\n", + sc->sc_dev.dv_xname, xi->xi_intrbit); return 0; } + /* + * Flush PCI write buffers before servicing the interrupt. + */ + bus_space_read_4(sc->sc_iot, sc->sc_regh, + BRIDGE_DEVICE_WBFLUSH(xi->xi_device)); + + if ((bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_ISR) & + (1 << xi->xi_intrbit)) == 0) { + spurious = 1; +#ifdef DEBUG + printf("%s: irq %d but not pending in ISR %08x\n", + sc->sc_dev.dv_xname, xi->xi_intrbit, + bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_ISR)); +#endif + } else + spurious = 0; + if ((rc = (*xi->xi_func)(xi->xi_arg)) != 0) xi->xi_count.ec_count++; + if (rc == 0 && spurious == 0) + printf("%s: spurious irq %d\n", + sc->sc_dev.dv_xname, xi->xi_intrbit); /* * There is a known BRIDGE race in which, if two interrupts * on two different pins occur within 60nS of each other, - * further interrupts on the first pin do not cause an interrupt - * to be sent. + * further interrupts on the first pin do not cause an + * interrupt to be sent. * - * The workaround against this is to check if our interrupt source - * is still active (i.e. another interrupt is pending), in which - * case we force an interrupt anyway. + * The workaround against this is to check if our interrupt + * source is still active (i.e. another interrupt is pending), + * in which case we force an interrupt anyway. * - * The XBridge even has a nice facility to do this, where we do not - * even have to check if our interrupt is pending. + * The XBridge even has a nice facility to do this, where we + * do not even have to check if our interrupt is pending. */ if (ISSET(sc->sc_flags, XBRIDGE_FLAGS_XBRIDGE)) { bus_space_write_4(sc->sc_iot, sc->sc_regh, BRIDGE_INT_FORCE_PIN(xi->xi_intrbit), 1); } else { - if (bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_ISR) & - (1 << xi->xi_intrbit)) + if (bus_space_read_4(sc->sc_iot, sc->sc_regh, + BRIDGE_ISR) & (1 << xi->xi_intrbit)) IP27_RHUB_PI_S(nasid, 0, HUB_IR_CHANGE, HUB_IR_SET | xi->xi_intrsrc); } - return rc; + return 1; } /* + * Bridge (not XBridge) ugly workaround for the interrupt deadlock + * problem mentioned above. + */ +void +xbridge_timeout(void *v) +{ + struct xbridge_intr *xi = v; + struct xbridge_softc *sc = xi->xi_bridge; + + if ((bus_space_read_4(sc->sc_iot, sc->sc_regh, BRIDGE_ISR) & + (1 << xi->xi_intrbit)) != 0) + xbridge_intr_handler(v); +} + +/* * bus_space helpers */ Index: arch/sgi/xbow/xbridgereg.h =================================================================== --- arch/sgi/xbow/xbridgereg.h (繝ェ繝薙ず繝ァ繝ウ 371) +++ arch/sgi/xbow/xbridgereg.h (菴懈・ュ繧ウ繝斐�) @@ -1,4 +1,4 @@ -/* $OpenBSD: xbridgereg.h,v 1.4 2009/05/06 20:08:47 miod Exp $ */ +/* $OpenBSD: xbridgereg.h,v 1.5 2009/05/14 21:10:33 miod Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -108,6 +108,9 @@ #define BRIDGE_DEVIO_SIZE(d) \ ((d) < 2 ? BRIDGE_DEVIO_LARGE : BRIDGE_DEVIO_SHORT) + +#define BRIDGE_DEVICE_WBFLUSH(d) (0x00000244 + 8 * (d)) + /* * Read Response Buffer configuration registers *
案の定コンパイルが通らない:
/usr/cross/sgi/usr/mips64-unknown-openbsd4.5/bin/mips64-unknown-openbsd4.5-cc -g -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized -Wno-format -Wno-main -Wstack-larger-than-2047 -Wvariable-decl -mno-abicalls -msoft-float -fno-builtin-printf -fno-builtin-log -O2 -pipe -I. -I../../../.. -I../../../../arch -nostdinc -DTIMEZONE="0" -DDST="0" -DARCBIOS -DMULTIPROCESSOR -DPCIVERBOSE -DUSBVERBOSE -DDIAGNOSTIC -DSYSCALL_DEBUG -DVFSDEBUG -DDDB -DMP_LOCKDEBUG -DLOCKDEBUG -DCD9660 -DFFS -DFFS2 -DINET -DINET6 -DMINIROOTSIZE="0x2000" -DRAMDISK_HOOKS -DTGT_OCTANE -DBOOT_CONFIG -D_KERNEL -D__sgi__ -c ../../../../arch/sgi/xbow/xbridge.c ../../../../arch/sgi/xbow/xbridge.c:738: warning: no previous prototype for `xbridge_timeout' *** Error code 1
コンパイル通るの確認してからあげてほしいなぁしかし・・・。