diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-02-20 18:46:21 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-02-20 18:46:21 +0000 |
commit | b64a4b43e18473c2dab6c606ac57aa8f966612e5 (patch) | |
tree | 4632a00a606e5e9947811546b082a4ab0dbc40b1 /sys/arch/sgi | |
parent | bab488fcfb90d7b7090fa84aad7392abd3ef2c56 (diff) |
Completely overhault attachment rules on sgi. No more indirect configuration
inherited from OpenBSD/arc machines with ISA bus; mainbus children match on
device name and other hierarchies match on simplified locators.
As a bonus, attachment lines in dmesg will now print their locators.
ok jsing@
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r-- | sys/arch/sgi/conf/GENERIC | 16 | ||||
-rw-r--r-- | sys/arch/sgi/conf/RAMDISK | 11 | ||||
-rw-r--r-- | sys/arch/sgi/conf/files.sgi | 17 | ||||
-rw-r--r-- | sys/arch/sgi/dev/gbe.c | 11 | ||||
-rw-r--r-- | sys/arch/sgi/dev/if_mec.c | 11 | ||||
-rw-r--r-- | sys/arch/sgi/dev/lpt_lbus.c | 163 | ||||
-rw-r--r-- | sys/arch/sgi/dev/mavb.c | 7 | ||||
-rw-r--r-- | sys/arch/sgi/dev/mkbc.c | 10 | ||||
-rw-r--r-- | sys/arch/sgi/dev/power.c | 10 | ||||
-rw-r--r-- | sys/arch/sgi/include/autoconf.h | 44 | ||||
-rw-r--r-- | sys/arch/sgi/localbus/com_lbus.c | 41 | ||||
-rw-r--r-- | sys/arch/sgi/localbus/macebus.c | 133 | ||||
-rw-r--r-- | sys/arch/sgi/localbus/macebus.h | 6 | ||||
-rw-r--r-- | sys/arch/sgi/pci/macepcibridge.c | 4 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/clock_md.c | 26 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 16 |
16 files changed, 109 insertions, 417 deletions
diff --git a/sys/arch/sgi/conf/GENERIC b/sys/arch/sgi/conf/GENERIC index 9f012f731b3..e296c984d14 100644 --- a/sys/arch/sgi/conf/GENERIC +++ b/sys/arch/sgi/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.27 2008/01/06 06:08:01 jsing Exp $ +# $OpenBSD: GENERIC,v 1.28 2008/02/20 18:46:20 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -19,8 +19,6 @@ makeoption LINK_ADDRESS="0xffffffff80100000" # MD options option ARCBIOS # We use arcbios for FW communication. -#option APERTURE - option WSDISPLAY_COMPAT_RAWKBD # Provide raw scancodes; needed for X11 option PCIVERBOSE @@ -50,12 +48,12 @@ gbe0 at mainbus0 # Localbus devices clock0 at macebus0 -mec0 at macebus0 sys 0x18 base 0x00280000 irq 4 -mavb0 at macebus0 sys 0x18 base 0x00300000 irq 7 -mkbc0 at macebus0 sys 0x18 base 0x00320000 irq 6 -com0 at macebus0 sys 0x18 base 0x00390000 irq 5 -com1 at macebus0 sys 0x18 base 0x00398000 irq 5 -power0 at macebus0 sys 0x18 irq 6 +mec0 at macebus0 base 0x00280000 irq 4 +mavb0 at macebus0 base 0x00300000 irq 7 +mkbc0 at macebus0 base 0x00320000 irq 6 +com0 at macebus0 base 0x00390000 irq 5 +com1 at macebus0 base 0x00398000 irq 5 +power0 at macebus0 irq 6 #### PCI Bus macepcibr0 at macebus0 # MACE controller PCI Bus bridge. diff --git a/sys/arch/sgi/conf/RAMDISK b/sys/arch/sgi/conf/RAMDISK index 927ca0682ab..e432ceb51e2 100644 --- a/sys/arch/sgi/conf/RAMDISK +++ b/sys/arch/sgi/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.16 2008/01/06 21:36:08 miod Exp $ +# $OpenBSD: RAMDISK,v 1.17 2008/02/20 18:46:20 miod Exp $ # machine sgi mips64 @@ -51,12 +51,11 @@ macebus0 at mainbus0 # MACE controller localbus. gbe0 at mainbus0 #### Localbus devices - clock0 at macebus0 -mec0 at macebus0 sys 0x18 base 0x00280000 irq 4 -mkbc0 at macebus0 sys 0x18 base 0x00320000 irq 6 -com0 at macebus0 sys 0x18 base 0x00390000 irq 5 -com1 at macebus0 sys 0x18 base 0x00398000 irq 5 +mec0 at macebus0 base 0x00280000 irq 4 +mkbc0 at macebus0 base 0x00320000 irq 6 +com0 at macebus0 base 0x00390000 irq 5 +com1 at macebus0 base 0x00398000 irq 5 #### PCI Bus macepcibr0 at macebus0 # MACE controller PCI Bus bridge. diff --git a/sys/arch/sgi/conf/files.sgi b/sys/arch/sgi/conf/files.sgi index bc321bafa9e..db69ad4d95b 100644 --- a/sys/arch/sgi/conf/files.sgi +++ b/sys/arch/sgi/conf/files.sgi @@ -1,4 +1,4 @@ -# $OpenBSD: files.sgi,v 1.19 2007/12/31 12:46:14 jsing Exp $ +# $OpenBSD: files.sgi,v 1.20 2008/02/20 18:46:20 miod Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -12,6 +12,7 @@ file arch/sgi/sgi/disksubr.c disk file arch/sgi/sgi/autoconf.c file arch/sgi/sgi/bus_dma.c file arch/sgi/sgi/conf.c +file arch/sgi/sgi/ip30_machdep.c tgt_octane file arch/sgi/sgi/machdep.c file arch/sgi/sgi/mutex.c file arch/sgi/sgi/sginode.c tgt_origin200 | tgt_origin2000 @@ -43,7 +44,7 @@ attach cpu at mainbus # # O2 MACE localbus autoconfiguration devices # -define macebus {[sys = - 1], [base = -1], [irq = -1]} +define macebus {[base = -1], [irq = -1]} device macebus attach macebus at mainbus file arch/sgi/localbus/macebus.c macebus @@ -80,8 +81,7 @@ include "dev/pci/files.pci" # Clock device device clock -attach clock at macebus with clock_macebus -attach clock at xbowmux with clock_xbowmux +attach clock at macebus file arch/sgi/sgi/clock_md.c clock # GBE framebuffer @@ -90,13 +90,8 @@ attach gbe at mainbus file arch/sgi/dev/gbe.c gbe needs-flag # 16[45]50-based "com" ports on localbus -attach com at xbowmux with com_xbow -attach com at macebus with com_localbus -file arch/sgi/localbus/com_lbus.c com_localbus | com_xbow - -# PC parallel ports (XXX what chip?) -attach lpt at macebus with lpt_localbus -file arch/sgi/dev/lpt_lbus.c lpt_localbus +attach com at macebus with com_macebus +file arch/sgi/localbus/com_lbus.c com_macebus # MACE MAC-110 ethernet device mec: ether, ifnet, ifmedia, mii diff --git a/sys/arch/sgi/dev/gbe.c b/sys/arch/sgi/dev/gbe.c index d9939581ee5..f189416b562 100644 --- a/sys/arch/sgi/dev/gbe.c +++ b/sys/arch/sgi/dev/gbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gbe.c,v 1.4 2007/12/31 12:46:14 jsing Exp $ */ +/* $OpenBSD: gbe.c,v 1.5 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2007, Joel Sing <jsing@openbsd.org> @@ -164,11 +164,12 @@ struct cfdriver gbe_cd = { int gbe_match(struct device *parent, void *cf, void *aux) { - /* GBE framebuffer only on SGI O2 (for now anyway). */ - if (sys_config.system_type == SGI_O2) - return 1; + struct confargs *ca = aux; - return 0; + if (strcmp(ca->ca_name, gbe_cd.cd_name) != 0) + return 0; + + return 1; } void diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c index ba096a39870..c9b45f11635 100644 --- a/sys/arch/sgi/dev/if_mec.c +++ b/sys/arch/sgi/dev/if_mec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mec.c,v 1.14 2008/01/21 01:39:25 jsing Exp $ */ +/* $OpenBSD: if_mec.c,v 1.15 2008/02/20 18:46:20 miod Exp $ */ /* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */ /* @@ -106,6 +106,8 @@ #include <mips64/arcbios.h> #include <sgi/dev/if_mecreg.h> +#include <sgi/localbus/macebus.h> + #ifdef MEC_DEBUG #define MEC_DEBUG_RESET 0x01 #define MEC_DEBUG_START 0x02 @@ -348,11 +350,6 @@ void mec_shutdown(void *); int mec_match(struct device *parent, void *match, void *aux) { - struct confargs *ca = aux; - - if (ca->ca_sys != SGI_O2 || strcmp(ca->ca_name, mec_cd.cd_name)) - return (0); - return (1); } @@ -481,7 +478,7 @@ mec_attach(struct device *parent, struct device *self, void *aux) ether_ifattach(ifp); /* Establish interrupt handler. */ - BUS_INTR_ESTABLISH(ca, NULL, ca->ca_intr, IST_EDGE, IPL_NET, + macebus_intr_establish(NULL, ca->ca_intr, IST_EDGE, IPL_NET, mec_intr, sc, sc->sc_dev.dv_xname); /* Set hook to stop interface on shutdown. */ diff --git a/sys/arch/sgi/dev/lpt_lbus.c b/sys/arch/sgi/dev/lpt_lbus.c deleted file mode 100644 index d816302c52d..00000000000 --- a/sys/arch/sgi/dev/lpt_lbus.c +++ /dev/null @@ -1,163 +0,0 @@ -/* $OpenBSD: lpt_lbus.c,v 1.4 2005/01/31 21:35:50 grange Exp $ */ - -/* - * Copyright (c) 1993, 1994 Charles Hannum. - * Copyright (c) 1990 William F. Jolitz, TeleMuse - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This software is a component of "386BSD" developed by - * William F. Jolitz, TeleMuse. - * 4. Neither the name of the developer nor the name "386BSD" - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT - * NOT MAKE USE OF THIS WORK. - * - * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS - * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY 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. - */ - -/* - * Device Driver for AT parallel printer port - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> -#include <machine/intr.h> - -#include <dev/ic/lptreg.h> -#include <dev/ic/lptvar.h> - -int lpt_localbus_probe(struct device *, void *, void *); -void lpt_localbus_attach(struct device *, struct device *, void *); - -struct cfattach lpt_pica_ca = { - sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach -}; - -struct cfattach lpt_algor_ca = { - sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach -}; - -int -lpt_localbus_probe(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - struct confargs *ca = aux; - bus_space_tag_t iot; - bus_space_handle_t ioh; - bus_addr_t base; - u_int8_t mask, data; - int i; - -#ifdef DEBUG -#define ABORT \ - do { \ - printf("lpt_localbus_probe: mask %x data %x failed\n", mask, \ - data); \ - return 0; \ - } while (0) -#else -#define ABORT return 0 -#endif - - if (!BUS_MATCHNAME(ca, "lpt")) - return(0); - -/*XXX need to check where to pick up iotag when porting this */ - iot = sys_config.localbus_iot; - base = (bus_addr_t)BUS_CVTADDR(ca); - if (bus_space_map(iot, base, LPT_NPORTS, 0, &ioh)) { - return 0; - } - - mask = 0xff; - - data = 0x55; /* Alternating zeros */ - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - - data = 0xaa; /* Alternating ones */ - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - - for (i = 0; i < CHAR_BIT; i++) { /* Walking zero */ - data = ~(1 << i); - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - } - - for (i = 0; i < CHAR_BIT; i++) { /* Walking one */ - data = (1 << i); - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - } - - bus_space_write_1(iot, ioh, lpt_data, 0); - bus_space_write_1(iot, ioh, lpt_control, 0); - - return 1; -} - -void -lpt_localbus_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct lpt_softc *sc = (void *)self; - struct confargs *ca = aux; - bus_space_tag_t iot; - bus_space_handle_t ioh; - bus_addr_t base; - - printf("\n"); - - sc->sc_state = 0; - iot = sc->sc_iot = &pmonmips_bus_io; - base = (bus_space_handle_t)BUS_CVTADDR(ca); - if (bus_space_map(iot, base, LPT_NPORTS, 0, &ioh)) { - panic("unexpected bus_space_map error"); - } - sc->sc_ioh = ioh; - - bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT); - - BUS_INTR_ESTABLISH(ca, lptintr, sc); -} diff --git a/sys/arch/sgi/dev/mavb.c b/sys/arch/sgi/dev/mavb.c index cbc17bf0731..e3a1bafd8ec 100644 --- a/sys/arch/sgi/dev/mavb.c +++ b/sys/arch/sgi/dev/mavb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mavb.c,v 1.7 2007/05/20 14:17:05 miod Exp $ */ +/* $OpenBSD: mavb.c,v 1.8 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -1065,9 +1065,6 @@ mavb_match(struct device *parent, void *match, void *aux) bus_space_handle_t ioh; u_int64_t control; - if (ca->ca_sys != SGI_O2 || strcmp(ca->ca_name, mavb_cd.cd_name)) - return (0); - if (bus_space_map(ca->ca_iot, ca->ca_baseaddr, MAVB_NREGS, 0, &ioh) != 0) return (0); @@ -1130,7 +1127,7 @@ mavb_attach(struct device *parent, struct device *self, void *aux) sc->sc_dmamap->dm_segs[0].ds_addr); /* Establish interrupt. */ - BUS_INTR_ESTABLISH(ca, NULL, ca->ca_intr, IST_EDGE, IPL_AUDIO, + macebus_intr_establish(NULL, ca->ca_intr, IST_EDGE, IPL_AUDIO, mavb_intr, sc, sc->sc_dev.dv_xname); /* 2. Assert the RESET signal. */ diff --git a/sys/arch/sgi/dev/mkbc.c b/sys/arch/sgi/dev/mkbc.c index 6d3017c92ce..d47ce4ec161 100644 --- a/sys/arch/sgi/dev/mkbc.c +++ b/sys/arch/sgi/dev/mkbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkbc.c,v 1.4 2007/12/14 16:09:23 jsing Exp $ */ +/* $OpenBSD: mkbc.c,v 1.5 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2006, 2007, Joel Sing @@ -159,13 +159,7 @@ int mkbc_poll_write(bus_space_tag_t, bus_space_handle_t, int); int mkbc_match(struct device *parent, void *cf, void *aux) { - struct confargs *ca = aux; - - /* MACE PS/2 controller only on SGI O2 */ - if (ca->ca_sys == SGI_O2) - return 1; - - return 0; + return 1; } void diff --git a/sys/arch/sgi/dev/power.c b/sys/arch/sgi/dev/power.c index 10a395d844d..b2bc3954800 100644 --- a/sys/arch/sgi/dev/power.c +++ b/sys/arch/sgi/dev/power.c @@ -1,4 +1,4 @@ -/* $OpenBSD: power.c,v 1.4 2007/12/27 03:00:51 jsing Exp $ */ +/* $OpenBSD: power.c,v 1.5 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2007 Jasper Lievisse Adriaanse <jasper@openbsd.org> @@ -64,13 +64,7 @@ struct cfdriver power_cd = { int power_match(struct device *parent, void *match, void *aux) { - struct confargs *ca = aux; - - /* Power button only on SGI_O2, for now that is */ - if (ca->ca_sys == SGI_O2) - return (1); - - return (0); + return (1); } void diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h index ac4a7610fd6..0591a58cf1b 100644 --- a/sys/arch/sgi/include/autoconf.h +++ b/sys/arch/sgi/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.11 2007/05/20 14:34:23 miod Exp $ */ +/* $OpenBSD: autoconf.h,v 1.12 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -64,12 +64,6 @@ struct sys_rec { void (*_HitSyncDCache)(vaddr_t, int); void (*_IOSyncDCache)(vaddr_t, int, int); void (*_HitInvalidateDCache)(vaddr_t, int); - /* BUS mappings */ - struct mips_bus_space local; - struct mips_bus_space isa_io; - struct mips_bus_space isa_mem; - struct mips_bus_space pci_io[2]; - struct mips_bus_space pci_mem[2]; /* Console/Serial configuration */ int cons_baudclk; struct mips_bus_space console_io; /* for stupid map designs */ @@ -90,47 +84,11 @@ extern struct sys_rec sys_config; /**/ struct confargs; -typedef int (*intr_handler_t)(void *); - -struct abus { - struct device *ab_dv; /* back-pointer to device */ - int ab_type; /* bus type (see below) */ - void *(*ab_intr_establish) /* bus's set-handler function */ - (void *, u_long, int, int, int (*)(void *), void *, char *); - void (*ab_intr_disestablish) /* bus's unset-handler function */ - (void *, void *); - caddr_t (*ab_cvtaddr) /* convert slot/offset to address */ - (struct confargs *); - int (*ab_matchname) /* see if name matches driver */ - (struct confargs *, char *); -}; - -#define BUS_MAIN 1 /* mainbus */ -#define BUS_LOCAL 2 /* localbus */ -#define BUS_ISABR 3 /* ISA Bridge Bus */ -#define BUS_PLCHLDR 4 /* placeholder */ -#define BUS_PCIBR 5 /* PCI bridge Bus */ - -#define BUS_INTR_ESTABLISH(ca, a, b, c, d, e, f, h) \ - (*(ca)->ca_bus->ab_intr_establish)((a),(b),(c),(d),(e),(f),(h)) -#define BUS_INTR_DISESTABLISH(ca) \ - (*(ca)->ca_bus->ab_intr_establish)(ca) -#define BUS_MATCHNAME(ca, name) \ - (((ca)->ca_bus->ab_matchname) ? \ - (*(ca)->ca_bus->ab_matchname)((ca), (name)) : \ - -1) - struct confargs { char *ca_name; /* Device name. */ - struct abus *ca_bus; /* Bus device resides on. */ bus_space_tag_t ca_iot; bus_space_tag_t ca_memt; bus_dma_tag_t ca_dmat; - u_int32_t ca_num; /* which system */ - u_int32_t ca_sys; /* which system */ - int ca_nreg; - u_int32_t *ca_reg; - int ca_nintr; int32_t ca_intr; bus_addr_t ca_baseaddr; }; diff --git a/sys/arch/sgi/localbus/com_lbus.c b/sys/arch/sgi/localbus/com_lbus.c index 53df5f6db14..530aa1c259f 100644 --- a/sys/arch/sgi/localbus/com_lbus.c +++ b/sys/arch/sgi/localbus/com_lbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_lbus.c,v 1.4 2004/10/20 12:49:15 pefo Exp $ */ +/* $OpenBSD: com_lbus.c,v 1.5 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -40,45 +40,32 @@ #include <dev/ic/comvar.h> #include <dev/ic/ns16550reg.h> -int com_localbus_probe(struct device *, void *, void *); -void com_localbus_attach(struct device *, struct device *, void *); +#include <sgi/localbus/macebus.h> +int com_macebus_probe(struct device *, void *, void *); +void com_macebus_attach(struct device *, struct device *, void *); -struct cfattach com_localbus_ca = { - sizeof(struct com_softc), com_localbus_probe, com_localbus_attach -}; -struct cfattach com_xbow_ca = { - sizeof(struct com_softc), com_localbus_probe, com_localbus_attach +struct cfattach com_macebus_ca = { + sizeof(struct com_softc), com_macebus_probe, com_macebus_attach }; extern void com_raisedtr(void *); extern struct timeout compoll_to; int -com_localbus_probe(parent, match, aux) +com_macebus_probe(parent, match, aux) struct device *parent; void *match, *aux; { bus_space_tag_t iot; bus_space_handle_t ioh; - struct cfdata *cf = match; struct confargs *ca = aux; bus_addr_t iobase, rv = 0; - /* - * Check if this is our com. If low nibble is 0 match - * against system CLASS. Else a perfect match is checked. - */ - if ((ca->ca_sys & 0x000f) == 0) { - if (ca->ca_sys != (sys_config.system_type & 0xfff0)) - return 0; - } else if (ca->ca_sys != sys_config.system_type) - return 0; - - iobase = (bus_addr_t)sys_config.cons_ioaddr[cf->cf_unit]; + iobase = (bus_addr_t)ca->ca_baseaddr; if (iobase) { - iot = sys_config.cons_iot; + iot = ca->ca_iot; /* if it's in use as console, it's there. */ if (!(iobase == comconsaddr && !comconsattached)) { bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh); @@ -91,7 +78,7 @@ com_localbus_probe(parent, match, aux) } void -com_localbus_attach(parent, self, aux) +com_macebus_attach(parent, self, aux) struct device *parent, *self; void *aux; { @@ -103,12 +90,12 @@ com_localbus_attach(parent, self, aux) sc->sc_hwflags = 0; sc->sc_swflags = 0; - iobase = (bus_addr_t)sys_config.cons_ioaddr[sc->sc_dev.dv_unit]; + iobase = (bus_addr_t)ca->ca_baseaddr; intr = ca->ca_intr; sc->sc_iobase = iobase; - sc->sc_frequency = sys_config.cons_baudclk; + sc->sc_frequency = sys_config.cons_baudclk; /* XXX */ - sc->sc_iot = sys_config.cons_iot; + sc->sc_iot = ca->ca_iot; /* if it's in use as console, it's there. */ if (!(iobase == comconsaddr && !comconsattached)) { @@ -128,7 +115,7 @@ com_localbus_attach(parent, self, aux) SET(sc->sc_mcr, MCR_IENABLE); bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_mcr, sc->sc_mcr); - BUS_INTR_ESTABLISH(ca, NULL, intr, IST_EDGE, IPL_TTY, + macebus_intr_establish(NULL, intr, IST_EDGE, IPL_TTY, comintr, (void *)sc, sc->sc_dev.dv_xname); } diff --git a/sys/arch/sgi/localbus/macebus.c b/sys/arch/sgi/localbus/macebus.c index 35eb31fa682..f5cd3ab5c3a 100644 --- a/sys/arch/sgi/localbus/macebus.c +++ b/sys/arch/sgi/localbus/macebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macebus.c,v 1.33 2007/12/14 16:34:29 jsing Exp $ */ +/* $OpenBSD: macebus.c,v 1.34 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se) @@ -59,11 +59,8 @@ int macebusmatch(struct device *, void *, void *); void macebusattach(struct device *, struct device *, void *); int macebusprint(void *, const char *); -int macebusscan(struct device *, void *, void *); +int macebussearch(struct device *, void *, void *); -void *macebus_intr_establish(void *, u_long, int, int, int (*)(void *), - void *, char *); -void macebus_intr_disestablish(void *, void *); void macebus_intr_makemasks(void); void macebus_do_pending_int(int); intrmask_t macebus_iointr(intrmask_t, struct trap_frame *); @@ -79,7 +76,7 @@ struct cfattach macebus_ca = { }; struct cfdriver macebus_cd = { - NULL, "macebus", DV_DULL, 1 + NULL, "macebus", DV_DULL }; bus_space_t macebus_tag = { @@ -143,58 +140,48 @@ macebusmatch(struct device *parent, void *match, void *aux) int macebusprint(void *aux, const char *macebus) { -/* XXXX print flags */ - return (QUIET); -} - - -int -macebusscan(struct device *parent, void *child, void *args) -{ - struct device *dev = child; - struct cfdata *cf = dev->dv_cfdata; - struct confargs lba; - struct abus lbus; - - if (cf->cf_fstate == FSTATE_STAR) { - printf("macebus '*' devs not allowed!\n"); - return 0; - } + struct confargs *ca = aux; - lba.ca_sys = cf->cf_loc[0]; - if (cf->cf_loc[1] == -1) { - lba.ca_baseaddr = 0; - } else { - lba.ca_baseaddr = cf->cf_loc[1]; - } - if (cf->cf_loc[2] == -1) { - lba.ca_intr = 0; - lba.ca_nintr = 0; - } else { - lba.ca_intr = cf->cf_loc[2]; - lba.ca_nintr = 1; - } + if (macebus != NULL) + printf("%s at %s", ca->ca_name, macebus); - lba.ca_bus = &lbus; + if (ca->ca_baseaddr != 0) + printf(" base 0x%08x", ca->ca_baseaddr); + if (ca->ca_intr != 0) + printf(" irq %d", ca->ca_intr); - /* Fill in members needed for probing. */ - lba.ca_bus->ab_type = BUS_LOCAL; - lba.ca_bus->ab_matchname = NULL; - lba.ca_name = cf->cf_driver->cd_name; - lba.ca_num = dev->dv_unit; - lba.ca_iot = &macebus_tag; - lba.ca_memt = &macebus_tag; - lba.ca_dmat = &mace_bus_dma_tag; + return (UNCONF); +} - return (*cf->cf_attach->ca_match)(parent, cf, &lba); +int +macebussearch(struct device *parent, void *child, void *args) +{ + struct cfdata *cf = child; + struct confargs ca; + + ca.ca_name = cf->cf_driver->cd_name; + ca.ca_iot = &macebus_tag; + ca.ca_memt = &macebus_tag; + ca.ca_dmat = &mace_bus_dma_tag; + if (cf->cf_loc[0] == -1) + ca.ca_baseaddr = 0; + else + ca.ca_baseaddr = cf->cf_loc[0]; + if (cf->cf_loc[1] == -1) + ca.ca_intr = 0; + else + ca.ca_intr = cf->cf_loc[1]; + + if ((*cf->cf_attach->ca_match)(parent, cf, &ca) == 0) + return (0); + + config_attach(parent, cf, &ca, macebusprint); + return (1); } void macebusattach(struct device *parent, struct device *self, void *aux) { - struct device *dev; - struct confargs lba; - struct abus lbus; u_int32_t creg; u_int64_t mask; @@ -246,60 +233,18 @@ macebusattach(struct device *parent, struct device *self, void *aux) bus_space_write_8(&macebus_tag, mace_h, MACE_ISA_INT_STAT, 0); /* - * Now attach all devices to macebus in the proper order. - */ - memset(&lba, 0, sizeof(lba)); - memset(&lbus, 0, sizeof(lbus)); - lba.ca_bus = &lbus; - lba.ca_bus->ab_type = BUS_LOCAL; - lba.ca_bus->ab_matchname = NULL; - lba.ca_iot = &macebus_tag; - lba.ca_memt = &macebus_tag; - lba.ca_dmat = &mace_bus_dma_tag; - - /* * On O2 systems all interrupts are handled by the macebus interrupt * handler. Register all except clock. */ - switch (sys_config.system_type) { - case SGI_O2: - set_intr(INTPRI_MACEIO, CR_INT_0, macebus_iointr); - lba.ca_bus->ab_intr_establish = macebus_intr_establish; - lba.ca_bus->ab_intr_disestablish = macebus_intr_disestablish; - register_pending_int_handler(macebus_do_pending_int); - break; - default: - panic("macebusscan: unknown macebus type!"); - } + set_intr(INTPRI_MACEIO, CR_INT_0, macebus_iointr); + register_pending_int_handler(macebus_do_pending_int); /* DEBUG: Set up a handler called when clock interrupts go off. */ set_intr(INTPRI_MACEAUX, CR_INT_5, macebus_aux); - while ((dev = config_search(macebusscan, self, aux)) != NULL) { - struct cfdata *cf; - - cf = dev->dv_cfdata; - lba.ca_sys = cf->cf_loc[0]; - if (cf->cf_loc[1] == -1) - lba.ca_baseaddr = 0; - else - lba.ca_baseaddr = cf->cf_loc[1]; - - if (cf->cf_loc[2] == -1) { - lba.ca_intr = 0; - lba.ca_nintr = 0; - } else { - lba.ca_intr= cf->cf_loc[2]; - lba.ca_nintr = 1; - } - lba.ca_name = cf->cf_driver->cd_name; - lba.ca_num = dev->dv_unit; - - config_attach(self, dev, &lba, macebusprint); - } + config_search(macebussearch, self, aux); } - /* * Bus access primitives. These are really ugly... */ diff --git a/sys/arch/sgi/localbus/macebus.h b/sys/arch/sgi/localbus/macebus.h index 63f69b397ce..f66e3bfdad4 100644 --- a/sys/arch/sgi/localbus/macebus.h +++ b/sys/arch/sgi/localbus/macebus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macebus.h,v 1.10 2007/12/14 10:07:12 jsing Exp $ */ +/* $OpenBSD: macebus.h,v 1.11 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.com). @@ -136,6 +136,8 @@ int mace_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handl void mace_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); int mace_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *); -void *macebus_intr_establish(void *, u_long, int, int, int (*)(void *), void *, char *); +void *macebus_intr_establish(void *, u_long, int, int, int (*)(void *), + void *, char *); +void macebus_intr_disestablish(void *, void *); #endif /* _MACEBUS_H_ */ diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c index 547a163c003..91985478097 100644 --- a/sys/arch/sgi/pci/macepcibridge.c +++ b/sys/arch/sgi/pci/macepcibridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macepcibridge.c,v 1.14 2008/02/16 18:42:21 miod Exp $ */ +/* $OpenBSD: macepcibridge.c,v 1.15 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se) @@ -217,7 +217,7 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux) printf(": mace rev %d, host system O2\n", pcireg); /* Register the PCI ERROR interrupt handler */ - BUS_INTR_ESTABLISH(ca, NULL, 8, IST_LEVEL, IPL_HIGH, + macebus_intr_establish(NULL, 8, IST_LEVEL, IPL_HIGH, mace_pcibr_errintr, (void *)sc, sc->sc_dev.dv_xname); sc->sc_pc.pc_bus_maxdevs = mace_pcibr_bus_maxdevs; diff --git a/sys/arch/sgi/sgi/clock_md.c b/sys/arch/sgi/sgi/clock_md.c index f96133db8c5..33908b98c61 100644 --- a/sys/arch/sgi/sgi/clock_md.c +++ b/sys/arch/sgi/sgi/clock_md.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock_md.c,v 1.10 2007/12/27 02:59:13 jsing Exp $ */ +/* $OpenBSD: clock_md.c,v 1.11 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -49,14 +49,6 @@ extern int clock_started; #define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) #define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) -struct cfattach clock_macebus_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; - -struct cfattach clock_xbowmux_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; - void ds1687_get(struct clock_softc *, time_t, struct tod_time *); void ds1687_set(struct clock_softc *, struct tod_time *); @@ -64,9 +56,7 @@ void md_clk_attach(struct device *parent, struct device *self, void *aux) { struct clock_softc *sc = (struct clock_softc *)self; - struct confargs *ca; - - ca = aux; + struct confargs *ca = aux; switch (sys_config.system_type) { case SGI_O2: @@ -96,11 +86,19 @@ md_clk_attach(struct device *parent, struct device *self, void *aux) sc->sc_clock.clk_hz = 100; sc->sc_clock.clk_profhz = 100; sc->sc_clock.clk_stathz = 0; /* XXX no stat clock yet */ - printf("TODO set up clock."); + /* XXX MK48T35 */ + break; + + case SGI_OCTANE: + sc->sc_clock.clk_init = clock_int5_init; + sc->sc_clock.clk_hz = 100; + sc->sc_clock.clk_profhz = 100; + sc->sc_clock.clk_stathz = 0; /* XXX no stat clock yet */ + /* XXX DS1687 */ break; default: - printf("don't know how to set up clock."); + panic("don't know how to set up clock."); } } diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 66b200715b1..d912cdb0726 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.52 2007/12/18 08:29:02 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.53 2008/02/20 18:46:20 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -288,11 +288,6 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ sys_config.cons_ioaddr[1] = MACE_ISA_SER2_OFFS; sys_config.cons_baudclk = 1843200; /*XXX*/ sys_config.cons_iot = &macebus_tag; - sys_config.local.bus_base = 0x0; /*XXX*/ - sys_config.pci_io[0].bus_base = 0xffffffff00000000;/*XXX*/ - sys_config.pci_mem[0].bus_base = 0xffffffff00000000;/*XXX*/ - sys_config.pci_mem[0].bus_base_dma = 0x00000000;/*XXX*/ - sys_config.pci_mem[0].bus_reverse = my_endian; sys_config.cpu[0].tlbwired = 2; crime_configure_memory(); @@ -321,19 +316,14 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ #if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000) case SGI_O200: bios_printf("Found SGI-IP27, setting up.\n"); - strlcpy(cpu_model, "SGI- Origin200 (IP27)", sizeof(cpu_model)); + strlcpy(cpu_model, "SGI-Origin200 (IP27)", sizeof(cpu_model)); kl_scan_config(0); sys_config.cons_ioaddr[0] = kl_get_console_base(); sys_config.cons_ioaddr[1] = kl_get_console_base() - 8; sys_config.cons_baudclk = 22000000 / 3; /*XXX*/ - sys_config.cons_iot = &xbowmux_tag; - sys_config.local.bus_base = 0x0; /*XXX*/ - sys_config.pci_io[0].bus_base = 0xffffffff00000000;/*XXX*/ - sys_config.pci_mem[0].bus_base = 0xffffffff00000000;/*XXX*/ - sys_config.pci_mem[0].bus_base_dma = 0x00000000;/*XXX*/ - sys_config.pci_mem[0].bus_reverse = my_endian; + sys_config.cons_iot = &xbowbus_tag; sys_config.cpu[0].tlbwired = 2; break; #endif |