diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-29 19:23:03 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-29 19:23:03 +0000 |
commit | a58d72c84fdbb5c793ddbdfe0a20a3af7d07c828 (patch) | |
tree | 8c7926b92158a8a132cb31466b8d73f447359e40 | |
parent | a68d0db58d8c91b26ad7d0ee9fb60cc9d3364235 (diff) |
dino/cujo pci bridge
-rw-r--r-- | sys/arch/hppa/conf/GENERIC | 42 | ||||
-rw-r--r-- | sys/arch/hppa/conf/RAMDISK | 54 | ||||
-rw-r--r-- | sys/arch/hppa/conf/files.hppa | 16 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 41 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/mainbus.c | 24 | ||||
-rw-r--r-- | sys/arch/hppa/include/bus.h | 7 | ||||
-rw-r--r-- | sys/arch/hppa/include/pci_machdep.h | 91 |
7 files changed, 251 insertions, 24 deletions
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index 27d9434ffcb..9a881da043a 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.37 2003/09/28 16:04:49 mickey Exp $ +# $OpenBSD: GENERIC,v 1.38 2003/09/29 19:23:02 mickey Exp $ # Machine architecture; required by config(8) machine hppa @@ -40,7 +40,11 @@ asp* at mainbus0 irq 28 # this one comes w/ Viper and LEDs wax* at mainbus0 irq 24 # Wax may host EISA as well mongoose* at mainbus0 irq 17 # EISA Bus Adapter (i82350 or TI???) #vmeb* at mainbus0 irq ? # VME bus adapter -#dino* at mainbus0 irq ? # PCI bus bridge +dino* at phantomas? irq 26 # PCI bus bridge +pci* at dino? +option PCIVERBOSE +#pckbc0 at dino? irq 23 +#com3 at dino? irq 21 sti0 at mainbus0 irq 11 # [H]CRX-{8,24,48}[Z] graphics sti0 at phantomas0 irq 11 # builtin graphics on BC* @@ -114,6 +118,36 @@ pms* at gsckbc? # PS/2 mouse #ie* at isa? port 0x360 iomem 0xd0000 irq 7 #ie* at isa? port 0x300 irq 10 +ppb* at pci? dev ? function ? +pci* at ppb? + +#pciide* at pci ? dev ? function ? flags 0x0000 + +siop* at pci? dev ? function ? # NCR 538XX SCSI controllers(new) +scsibus* at siop? + +dc* at pci? dev ? function ? # 21143, "tulip" clone ethernet + +dcphy* at mii? phy ? # Digital Clone PHYs +amphy* at mii? phy ? # AMD 79C873 PHYs +#acphy* at mii? phy ? # Altima AC101 PHYs +#exphy* at mii? phy ? # 3Com internal PHYs +#inphy* at mii? phy ? # Intel 82555 PHYs +#iophy* at mii? phy ? # Intel 82553 PHYs +#icsphy* at mii? phy ? # ICS1890 PHYs +lxtphy* at mii? phy ? # Level One LXT-970 PHYs +#nsphy* at mii? phy ? # NS83840 PHYs +#nsphyter* at mii? phy ? # NS83843 PHYs +#mtdphy* at mii? phy ? # Myson MTD972 PHYs +#qsphy* at mii? phy ? # Quality Semi QS6612 PHYs +#sqphy* at mii? phy ? # Seeq 8022[013] PHYs +#tlphy* at mii? phy ? # ThunderLAN PHYs +#tqphy* at mii? phy ? # TDK Semiconductor PHYs +#brgphy* at mii? phy ? # Broadcom 10/100/1000 PHYs +#bmtphy* at mii? phy ? # Broadcom 10/100 PHYs +#eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs +ukphy* at mii? phy ? # generic unknown PHYs + # MI devices #wsdisplay* at vgafb? wsdisplay* at sti? @@ -123,6 +157,10 @@ wsmouse* at pms? mux 0 wsmouse* at hilms? mux 0 #fd* at fdc? drive ? # floppy drives +#wd* at wdc? channel ? drive ? flags 0x0000 +#wd* at pciide? channel ? drive ? flags 0x0000 +#atapiscsi* at pciide? channel ? +#scsibus* at atapiscsi? # These entries find devices on all SCSI busses and assign # unit numers dynamically. diff --git a/sys/arch/hppa/conf/RAMDISK b/sys/arch/hppa/conf/RAMDISK index 9e696535865..93cf86bfc42 100644 --- a/sys/arch/hppa/conf/RAMDISK +++ b/sys/arch/hppa/conf/RAMDISK @@ -1,8 +1,9 @@ -# $OpenBSD: RAMDISK,v 1.19 2003/08/20 20:53:31 mickey Exp $ +# $OpenBSD: RAMDISK,v 1.20 2003/09/29 19:23:02 mickey Exp $ # # Diskless kernel config # +# Machine architecture; required by config(8) machine hppa option DDB # in-kernel debugger @@ -57,14 +58,18 @@ asp* at mainbus0 irq 28 # this one comes w/ Viper and LEDs wax* at mainbus0 irq 24 # Wax may host EISA as well mongoose* at mainbus0 irq 17 # EISA Bus Adapter (i82350 or TI???) #vmeb* at mainbus0 irq ? # VME bus adapter -#dino* at phantomas? irq 26 # PCI bus bridge +dino* at phantomas? irq 26 # PCI bus bridge +pci* at dino? +option PCIVERBOSE +#pckbc0 at dino? irq 23 +#com3 at dino? irq 21 sti0 at mainbus0 irq 11 # [H]CRX-{8,24,48}[Z] graphics sti0 at phantomas0 irq 11 # builtin graphics on BC* sti1 at mainbus0 disable irq 12 #medusa* at mainbus? irq 4 # FDDI -#siop* at mainbus? irq 3 # NCR 53C720 (Fast/Wide Diff) +#siop* at mainbus? irq 3 # NCR 53C720 (Fast/Wide Diff) #scsibus* at siop? # internal i/o space @@ -110,6 +115,7 @@ scsibus* at osiop? #audio* at harmony? gsckbc* at gsc? irq 26 gsckbd* at gsckbc? # PS/2 keyboard +#pms* at gsckbc? # PS/2 mouse #fdc* at gsc? # PC floppy controller (WD37C65C) #option FD_DEBUG @@ -129,14 +135,52 @@ gsckbd* at gsckbc? # PS/2 keyboard #ie* at isa? port 0x360 iomem 0xd0000 irq 7 #ie* at isa? port 0x300 irq 10 +ppb* at pci? dev ? function ? +pci* at ppb? + +#pciide* at pci ? dev ? function ? flags 0x0000 + +#siop* at pci? dev ? function ? # NCR 538XX SCSI controllers(new) +#scsibus* at siop? + +dc* at pci? dev ? function ? # 21143, "tulip" clone ethernet + +dcphy* at mii? phy ? # Digital Clone PHYs +amphy* at mii? phy ? # AMD 79C873 PHYs +#acphy* at mii? phy ? # Altima AC101 PHYs +#exphy* at mii? phy ? # 3Com internal PHYs +#inphy* at mii? phy ? # Intel 82555 PHYs +#iophy* at mii? phy ? # Intel 82553 PHYs +#icsphy* at mii? phy ? # ICS1890 PHYs +lxtphy* at mii? phy ? # Level One LXT-970 PHYs +#nsphy* at mii? phy ? # NS83840 PHYs +#nsphyter* at mii? phy ? # NS83843 PHYs +#mtdphy* at mii? phy ? # Myson MTD972 PHYs +#qsphy* at mii? phy ? # Quality Semi QS6612 PHYs +#sqphy* at mii? phy ? # Seeq 8022[013] PHYs +#tlphy* at mii? phy ? # ThunderLAN PHYs +#tqphy* at mii? phy ? # TDK Semiconductor PHYs +#brgphy* at mii? phy ? # Broadcom 10/100/1000 PHYs +#bmtphy* at mii? phy ? # Broadcom 10/100 PHYs +#eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs +ukphy* at mii? phy ? # generic unknown PHYs + # MI devices #wsdisplay* at vgafb? wsdisplay* at sti? -wskbd* at gsckbd? -wskbd* at hilkbd? +wskbd* at gsckbd? # mux 1 +wskbd* at hilkbd? # mux 1 +#wsmouse* at pms? mux 0 +#wsmouse* at hilms? mux 0 #fd* at fdc? drive ? # floppy drives +#wd* at wdc? channel ? drive ? flags 0x0000 +#wd* at pciide? channel ? drive ? flags 0x0000 +#atapiscsi* at pciide? channel ? +#scsibus* at atapiscsi? +# These entries find devices on all SCSI busses and assign +# unit numers dynamically. sd* at scsibus? target ? lun ? st* at scsibus? target ? lun ? cd* at scsibus? target ? lun ? diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa index 7c1a360feb8..85f2d357163 100644 --- a/sys/arch/hppa/conf/files.hppa +++ b/sys/arch/hppa/conf/files.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: files.hppa,v 1.48 2003/08/20 21:44:03 mickey Exp $ +# $OpenBSD: files.hppa,v 1.49 2003/09/29 19:23:02 mickey Exp $ # # hppa-specific configuration info @@ -32,8 +32,8 @@ include "dev/i2o/files.i2o" # # MI ATAPI drivers # -#include "dev/atapiscsi/files.atapiscsi" -#include "dev/ata/files.ata" +include "dev/atapiscsi/files.atapiscsi" +include "dev/ata/files.ata" # # ISA Bus support @@ -52,6 +52,16 @@ include "dev/eisa/files.eisa" include "dev/pci/files.pci" # +# CardBus support +# +include "dev/cardbus/files.cardbus" + +# +# Machine-independent PCMCIA drivers +# +include "dev/pcmcia/files.pcmcia" + +# # HIL Human Interface Loop devices # include "dev/hil/files.hil" diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 54e99c7714e..b8c309019a9 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.113 2003/09/26 00:07:05 mickey Exp $ */ +/* $OpenBSD: locore.S,v 1.114 2003/09/29 19:23:02 mickey Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -2000,6 +2000,45 @@ $gsc_share copy r9, r1 EXIT(gsc_intr) + .export dino_intr, entry +LEAF_ENTRY(dino_intr) + ldw 8-32(r1), r9 /* arg: ioreg */ + mtctl r1, tr7 + ldw 12(r9), r16 /* irr0 */ + + ldw 12-32(r1), r1 /* next: sub-intr_table */ +$dino_intr_loop + comb,=,n r0, r16, $intr_cont + mfctl tr7, r1 +$dino_ffs + addi 32, r1, r1 + bb,>= r16, 31, $dino_ffs + shd r0, r16, 1, r16 + + copy r1, r9 +$dino_share + mfctl sar, r25 + ldb 1-32(r1), r17 + mtsar r17 + vdepi 1, 1, r24 + mtsar r25 + + ldb 0-32(r1), r17 + ldil L%intrcnt, r25 + ldo R%intrcnt(r25), r25 + sh2add r17, r25, r25 + ldw 0(r25), r17 + addi 1, r17, r17 + stw r17, 0(r25) + + ldw 16-32(r1), r17 + comb,<>,n r0, r17, $dino_share + ldo 32(r17), r1 + + b $dino_intr_loop + copy r9, r1 +EXIT(dino_intr) + .export TLABEL(ibrk), entry ENTRY(TLABEL(ibrk),0) /* If called by a user process then always pass it to trap() */ diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index d13a4bb609f..67c5dc876ee 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.52 2003/09/26 00:10:40 mickey Exp $ */ +/* $OpenBSD: mainbus.c,v 1.53 2003/09/29 19:23:02 mickey Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -74,7 +74,7 @@ extern struct extent *hppa_ex; extern struct pdc_btlb pdc_btlb; int -mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int cachable, +mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { static u_int32_t bmm[0x4000/32]; @@ -83,7 +83,7 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int cachable, #ifdef BTLBDEBUG printf("bus_mem_add_mapping(%x,%x,%scachable,%p)\n", - bpa, size, cachable? "" : "non", bshp); + bpa, size, flags? "" : "non", bshp); #endif if ((bank = vm_physseg_find(atop(bpa), &off)) >= 0) @@ -98,9 +98,9 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int cachable, * all mappings are equal mappings. */ #ifdef DEBUG - if (cachable) { + if (flags & BUS_SPACE_MAP_CACHEABLE) { printf("WARNING: mapping I/O space cachable\n"); - cachable = 0; + flags &= ~BUS_SPACE_MAP_CACHEABLE; } #endif @@ -165,14 +165,15 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int cachable, int mbus_map(void *v, bus_addr_t bpa, bus_size_t size, - int cachable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { int error; - if ((error = extent_alloc_region(hppa_ex, bpa, size, EX_NOWAIT))) + if (!(flags & BUS_SPACE_MAP_NOEXTENT) && + (error = extent_alloc_region(hppa_ex, bpa, size, EX_NOWAIT))) return (error); - if ((error = mbus_add_mapping(bpa, size, cachable, bshp))) { + if ((error = mbus_add_mapping(bpa, size, flags, bshp))) { if (extent_free(hppa_ex, bpa, size, EX_NOWAIT)) { printf("bus_space_map: pa 0x%lx, size 0x%lx\n", bpa, size); @@ -210,7 +211,7 @@ mbus_unmap(void *v, bus_space_handle_t bsh, bus_size_t size) int mbus_alloc(void *v, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, - bus_size_t align, bus_size_t boundary, int cachable, + bus_size_t align, bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp) { u_long bpa; @@ -223,7 +224,7 @@ mbus_alloc(void *v, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, align, 0, boundary, EX_NOWAIT, &bpa))) return (error); - if ((error = mbus_add_mapping(bpa, size, cachable, bshp))) { + if ((error = mbus_add_mapping(bpa, size, flags, bshp))) { if (extent_free(hppa_ex, bpa, size, EX_NOWAIT)) { printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n", bpa, size); @@ -741,6 +742,7 @@ mbus_dmamap_load(void *v, bus_dmamap_t map, void *addr, bus_size_t size, return (EINVAL); seg = 0; + lastaddr = 0; error = _bus_dmamap_load_buffer(NULL, map, addr, size, p, flags, &lastaddr, &seg, 1); if (error == 0) { @@ -772,6 +774,7 @@ mbus_dmamap_load_mbuf(void *v, bus_dmamap_t map, struct mbuf *m0, int flags) first = 1; seg = 0; error = 0; + lastaddr = 0; for (m = m0; m != NULL && error == 0; m = m->m_next) { /* XXX as we later can only flush by pa -- flush now */ fdcache(HPPA_SID_KERNEL, (vaddr_t)m->m_data, m->m_len); @@ -821,6 +824,7 @@ mbus_dmamap_load_uio(void *v, bus_dmamap_t map, struct uio *uio, int flags) first = 1; seg = 0; error = 0; + lastaddr = 0; for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) { /* * Now at the first iovec to load. Load each iovec diff --git a/sys/arch/hppa/include/bus.h b/sys/arch/hppa/include/bus.h index 705a1c15eb2..97c5957d59c 100644 --- a/sys/arch/hppa/include/bus.h +++ b/sys/arch/hppa/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.20 2003/03/29 00:58:50 mickey Exp $ */ +/* $OpenBSD: bus.h,v 1.21 2003/09/29 19:23:02 mickey Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -48,7 +48,7 @@ struct hppa_bus_space_tag { void *hbt_cookie; int (*hbt_map)(void *v, bus_addr_t addr, bus_size_t size, - int cacheable, bus_space_handle_t *bshp); + int flags, bus_space_handle_t *bshp); void (*hbt_unmap)(void *v, bus_space_handle_t bsh, bus_size_t size); int (*hbt_subregion)(void *v, bus_space_handle_t bsh, @@ -56,7 +56,7 @@ struct hppa_bus_space_tag { bus_space_handle_t *nbshp); int (*hbt_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t align, - bus_size_t boundary, int cacheable, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); void (*hbt_free)(void *, bus_space_handle_t, bus_size_t); void (*hbt_barrier)(void *v, bus_space_handle_t h, @@ -171,6 +171,7 @@ extern const struct hppa_bus_space_tag hppa_bustag; #define BUS_SPACE_MAP_LINEAR 0x0002 #define BUS_SPACE_MAP_READONLY 0x0004 #define BUS_SPACE_MAP_PREFETCHABLE 0x0008 +#define BUS_SPACE_MAP_NOEXTENT 0x8000 /* no extent ops */ /* bus access routines */ diff --git a/sys/arch/hppa/include/pci_machdep.h b/sys/arch/hppa/include/pci_machdep.h new file mode 100644 index 00000000000..2460c8229ad --- /dev/null +++ b/sys/arch/hppa/include/pci_machdep.h @@ -0,0 +1,91 @@ +/* $OpenBSD: pci_machdep.h,v 1.1 2003/09/29 19:23:02 mickey Exp $ */ + +/* + * Copyright (c) 2003 Michael Shalayeff + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR OR HIS RELATIVES 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 MIND, 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. + */ + +#ifndef _MACHINE_PCI_MACHDEP_H_ +#define _MACHINE_PCI_MACHDEP_H_ + +/* + * Types provided to machine-independent PCI code + */ +typedef struct hppa_pci_chipset_tag *pci_chipset_tag_t; +typedef u_long pcitag_t; +typedef u_long pci_intr_handle_t; + +struct pci_attach_args; + +struct hppa_pci_chipset_tag { + void *_cookie; + void (*pc_attach_hook)(struct device *, + struct device *, struct pcibus_attach_args *); + int (*pc_bus_maxdevs)(void *, int); + pcitag_t (*pc_make_tag)(void *, int, int, int); + void (*pc_decompose_tag)(void *, pcitag_t, int *, + int *, int *); + pcireg_t (*pc_conf_read)(void *, pcitag_t, int); + void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); + + int (*pc_intr_map)(struct pci_attach_args *, + pci_intr_handle_t *); + const char *(*pc_intr_string)(void *, pci_intr_handle_t); + void *(*pc_intr_establish)(void *, pci_intr_handle_t, + int, int (*)(void *), void *, char *); + void (*pc_intr_disestablish)(void *, void *); + + void *(*pc_alloc_parent)(struct device *, + struct pci_attach_args *, int); +}; + +/* + * Functions provided to machine-independent PCI code. + */ +#define pci_attach_hook(p, s, pba) \ + (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) +#define pci_bus_maxdevs(c, b) \ + (*(c)->pc_bus_maxdevs)((c)->_cookie, (b)) +#define pci_make_tag(c, b, d, f) \ + (*(c)->pc_make_tag)((c)->_cookie, (b), (d), (f)) +#define pci_decompose_tag(c, t, bp, dp, fp) \ + (*(c)->pc_decompose_tag)((c)->_cookie, (t), (bp), (dp), (fp)) +#define pci_conf_read(c, t, r) \ + (*(c)->pc_conf_read)((c)->_cookie, (t), (r)) +#define pci_conf_write(c, t, r, v) \ + (*(c)->pc_conf_write)((c)->_cookie, (t), (r), (v)) +#define pci_intr_map(p, ihp) \ + (*(p)->pa_pc->pc_intr_map)((p), (ihp)) +#define pci_intr_line(ih) (ih) +#define pci_intr_string(c, ih) \ + (*(c)->pc_intr_string)((c)->_cookie, (ih)) +#define pci_intr_establish(c, ih, l, h, a, nm) \ + (*(c)->pc_intr_establish)((c)->_cookie, (ih), (l), (h), (a), (nm)) +#define pci_intr_disestablish(c, iv) \ + (*(c)->pc_intr_disestablish)((c)->_cookie, (iv)) + +#define pciide_machdep_compat_intr_establish(a, b, c, d, e) (NULL) +#define pciide_machdep_compat_intr_disestablish(a, b) ((void)(a), (void)(b)) + +#endif /* _MACHINE_PCI_MACHDEP_H_ */ |