summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2004-08-06 20:29:48 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2004-08-06 20:29:48 +0000
commit661b05146bd865cf7ec539cf7861679c8651e8f3 (patch)
tree083d78cbfa1dea9af0217b972795eb7f38032bbc
parent85625c17032332953caf8174c1bdf13f63fe4df2 (diff)
support cardbus bridges and a few pcmcia devices i have working
-rw-r--r--sys/arch/hppa/conf/GENERIC38
-rw-r--r--sys/arch/hppa/conf/RAMDISK36
-rw-r--r--sys/arch/hppa/dev/dino.c40
-rw-r--r--sys/arch/hppa/hppa/conf.c30
-rw-r--r--sys/arch/hppa/include/rbus_machdep.h43
5 files changed, 150 insertions, 37 deletions
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC
index 3d0f2f1d53d..a167d00adef 100644
--- a/sys/arch/hppa/conf/GENERIC
+++ b/sys/arch/hppa/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.52 2004/07/01 19:27:36 mickey Exp $
+# $OpenBSD: GENERIC,v 1.53 2004/08/06 20:29:47 mickey Exp $
# Machine architecture; required by config(8)
machine hppa
@@ -52,6 +52,17 @@ option PCIVERBOSE
#pckbc0 at dino? irq 9
com1 at dino? irq 11
+ppb* at pci? dev ? function ?
+pci* at ppb?
+
+# CardBus bus support
+cbb* at pci? dev ? function ?
+cardslot* at cbb?
+option CARDBUS_DEBUG,CARDSLOT_DEBUG,CARDBUS_MAP_DEBUG
+cardbus* at cardslot?
+option PCMCIADEBUG,PCMCIAVERBOSE
+pcmcia* at cardslot?
+
sti0 at mainbus0 irq 11 # [H]CRX-{8,24,48}[Z] graphics
sti0 at phantomas0 irq 11 # builtin graphics on BC*
sti1 at mainbus0 irq 12
@@ -89,6 +100,7 @@ com1 at gsc0 offset 0x22000 irq 6
com2 at gsc0 offset 0x0 irq 13 # only on asp0 w/o audio (off ?)
com2 at gsc0 offset 0x4040 irq 13 # gecko's fax/voice/modems
com3 at gsc0 offset 0x4060 irq 13
+#com* at pcmcia? function ? # PCMCIA modems
lpt0 at gsc? irq 7 # both com and lpt are on WD16C552
ie0 at gsc0 irq 8 # 82C596DX/CA ether
@@ -123,23 +135,28 @@ pms* at gsckbc? # PS/2 mouse
#bha* at pci? dev ? function ?
#scsibus* at bha?
-ppb* at pci? dev ? function ?
-pci* at ppb?
-
#siop* at mainbus? irq 3 # NCR 53C720 (Fast/Wide Diff)
siop* at pci? dev ? function ? # NCR 538XX SCSI controllers(new)
scsibus* at siop?
+#em* at pci? dev ? function ? # Intel Pro/1000 ethernet
+#ti* at pci? dev ? function ? # Alteon Tigon 1Gb ethernet
+#txp* at pci? dev ? function ? # 3com 3CR990
#fpa* at pci? dev ? function ? # DEC DEFPA FDDI
dc* at pci? dev ? function ? # 21143, "tulip" clone ethernet
+#dc* at cardbus? dev ? function ?
+#ep* at pci? dev ? function ? # 3c59x
+#ep* at cardbus? dev ? function ?
#xl* at pci? dev ? function ? # 3C9xx ethernet
-#em* at pci? dev ? function ? # Intel Pro/1000 ethernet
-#ti* at pci? dev ? function ? # Alteon Tigon 1Gb ethernet
+#xl* at cardbus? dev ? function ?
fxp* at pci? dev ? function ? # EtherExpress 10/100B ethernet
-#txp* at pci? dev ? function ? # 3com 3CR990
+#fxp* at cardbus? dev ? function ?
#ne* at pci? dev ? function ? # NE2000-compatible Ethernet
+ne* at pcmcia? function ?
#an* at pci? dev ? function ? # Cisco/Aironet 802.11DS
+an* at pcmcia? function ?
#wi* at pci? dev ? function ? # WaveLAN IEEE 802.11DS
+wi* at pcmcia? function ?
dcphy* at mii? phy ? # Digital Clone PHYs
amphy* at mii? phy ? # AMD 79C873 PHYs
@@ -149,14 +166,14 @@ inphy* at mii? phy ? # Intel 82555 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
+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
+bmtphy* at mii? phy ? # Broadcom 10/100 PHYs
#eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs
ukphy* at mii? phy ? # generic unknown PHYs
@@ -176,7 +193,8 @@ wsmouse* at hilms? mux 0
#pciide* at pci ? dev ? function ? flags 0x0000
#wdc0 at isa? port 0x1f0 irq 14
#wdc1 at isa? port 0x170 irq 15
-#wd* at wdc? channel ? drive ? flags 0x0000
+wdc* at pcmcia? function ?
+wd* at wdc? channel ? drive ? flags 0x0000
#wd* at pciide? channel ? drive ? flags 0x0000
#atapiscsi* at pciide? channel ?
#scsibus* at atapiscsi?
diff --git a/sys/arch/hppa/conf/RAMDISK b/sys/arch/hppa/conf/RAMDISK
index 40cb192cd5f..5e182b0ea29 100644
--- a/sys/arch/hppa/conf/RAMDISK
+++ b/sys/arch/hppa/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.32 2004/04/30 20:30:30 mickey Exp $
+# $OpenBSD: RAMDISK,v 1.33 2004/08/06 20:29:47 mickey Exp $
#
# Diskless kernel config
#
@@ -66,6 +66,17 @@ option PCIVERBOSE
#pckbc0 at dino? irq 9
com1 at dino? irq 11
+ppb* at pci? dev ? function ?
+pci* at ppb?
+
+# CardBus bus support
+cbb* at pci? dev ? function ?
+cardslot* at cbb?
+option CARDBUS_DEBUG,CARDSLOT_DEBUG,CARDBUS_MAP_DEBUG
+cardbus* at cardslot?
+option PCMCIADEBUG,PCMCIAVERBOSE
+pcmcia* at cardslot?
+
sti0 at mainbus0 irq 11 # [H]CRX-{8,24,48}[Z] graphics
sti0 at phantomas0 irq 11 # builtin graphics on BC*
sti1 at mainbus0 irq 12
@@ -103,6 +114,7 @@ com1 at gsc0 offset 0x22000 irq 6
com2 at gsc0 offset 0x0 irq 13 # only on asp0 w/o audio (off ?)
com2 at gsc0 offset 0x4040 irq 13 # gecko's fax/voice/modems
com3 at gsc0 offset 0x4060 irq 13
+#com* at pcmcia? function ? # PCMCIA modems
lpt0 at gsc? irq 7 # both com and lpt are on WD16C552
ie0 at gsc0 irq 8 # 82C596DX/CA ether
@@ -137,23 +149,28 @@ gsckbd* at gsckbc? # PS/2 keyboard
#bha* at pci? dev ? function ?
#scsibus* at bha?
-ppb* at pci? dev ? function ?
-pci* at ppb?
-
#siop* at mainbus? irq 3 # NCR 53C720 (Fast/Wide Diff)
siop* at pci? dev ? function ? # NCR 538XX SCSI controllers(new)
scsibus* at siop?
+#em* at pci? dev ? function ? # Intel Pro/1000 ethernet
+#ti* at pci? dev ? function ? # Alteon Tigon 1Gb ethernet
+#txp* at pci? dev ? function ? # 3com 3CR990
#fpa* at pci? dev ? function ? # DEC DEFPA FDDI
dc* at pci? dev ? function ? # 21143, "tulip" clone ethernet
+#dc* at cardbus? dev ? function ?
+#ep* at pci? dev ? function ? # 3c59x
+#ep* at cardbus? dev ? function ?
#xl* at pci? dev ? function ? # 3C9xx ethernet
-#em* at pci? dev ? function ? # Intel Pro/1000 ethernet
-#ti* at pci? dev ? function ? # Alteon Tigon 1Gb ethernet
+#xl* at cardbus? dev ? function ?
fxp* at pci? dev ? function ? # EtherExpress 10/100B ethernet
-#txp* at pci? dev ? function ? # 3com 3CR990
+#fxp* at cardbus? dev ? function ?
#ne* at pci? dev ? function ? # NE2000-compatible Ethernet
+ne* at pcmcia? function ?
#an* at pci? dev ? function ? # Cisco/Aironet 802.11DS
+an* at pcmcia? function ?
#wi* at pci? dev ? function ? # WaveLAN IEEE 802.11DS
+wi* at pcmcia? function ?
dcphy* at mii? phy ? # Digital Clone PHYs
amphy* at mii? phy ? # AMD 79C873 PHYs
@@ -163,14 +180,14 @@ inphy* at mii? phy ? # Intel 82555 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
+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
+bmtphy* at mii? phy ? # Broadcom 10/100 PHYs
#eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs
ukphy* at mii? phy ? # generic unknown PHYs
@@ -190,6 +207,7 @@ wskbd* at hilkbd? # mux 1
#pciide* at pci ? dev ? function ? flags 0x0000
#wdc0 at isa? port 0x1f0 irq 14
#wdc1 at isa? port 0x170 irq 15
+#wdc* at pcmcia? fucntion ?
#wd* at wdc? channel ? drive ? flags 0x0000
#wd* at pciide? channel ? drive ? flags 0x0000
#atapiscsi* at pciide? channel ?
diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c
index 4bff063741c..8aa9d75a645 100644
--- a/sys/arch/hppa/dev/dino.c
+++ b/sys/arch/hppa/dev/dino.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dino.c,v 1.10 2004/07/24 15:04:35 mickey Exp $ */
+/* $OpenBSD: dino.c,v 1.11 2004/08/06 20:29:47 mickey Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
@@ -104,7 +104,6 @@ struct dino_softc {
u_int32_t sc_imr;
bus_space_tag_t sc_bt;
bus_space_handle_t sc_bh;
- bus_space_handle_t sc_memh;
bus_dma_tag_t sc_dmat;
volatile struct dino_regs *sc_regs;
@@ -290,7 +289,7 @@ dino_alloc_parent(struct device *self, struct pci_attach_args *pa, int io)
return (NULL);
extent_free(ex, start, size, EX_NOWAIT);
- return rbus_new_root_share(tag, ex, start, size, start);
+ return rbus_new_root_share(tag, ex, start, size, 0);
}
#endif
@@ -301,8 +300,7 @@ dino_iomap(void *v, bus_addr_t bpa, bus_size_t size,
struct dino_softc *sc = v;
int error;
- if (!(flags & BUS_SPACE_MAP_NOEXTENT) &&
- (error = extent_alloc_region(sc->sc_ioex, bpa, size, EX_NOWAIT)))
+ if ((error = extent_alloc_region(sc->sc_ioex, bpa, size, EX_NOWAIT)))
return (error);
if (bshp)
@@ -382,8 +380,23 @@ dino_memalloc(void *v, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
bus_size_t align, bus_size_t boundary, int flags, bus_addr_t *addrp,
bus_space_handle_t *bshp)
{
- /* TODO dino_memalloc */
- return (-1);
+ struct dino_softc *sc = v;
+ volatile struct dino_regs *r = sc->sc_regs;
+ u_int32_t reg;
+
+ if (bus_space_alloc(sc->sc_bt, rstart, rend, size,
+ align, boundary, flags, addrp, bshp))
+ return (ENOMEM);
+
+ reg = r->io_addr_en;
+ reg |= 1 << ((*addrp >> 23) & 0x1f);
+#ifdef DEBUG
+ if (reg & 0x80000001)
+ panic("mapping outside the mem extent range");
+#endif
+ r->io_addr_en = reg;
+
+ return (0);
}
void
@@ -401,7 +414,6 @@ dino_unmap(void *v, bus_space_handle_t bsh, bus_size_t size)
} else
ex = sc->sc_ioex;
- /* XXX gotta follow the BUS_SPACE_MAP_NOEXTENT flag */
if (extent_free(ex, bpa, size, EX_NOWAIT))
printf("dino_unmap: ps 0x%lx, size 0x%lx\n"
"dino_unmap: can't free region\n", bpa, size);
@@ -1458,6 +1470,7 @@ dinoattach(parent, self, aux)
struct confargs *ca = (struct confargs *)aux;
struct pcibus_attach_args pba;
volatile struct dino_regs *r;
+ bus_space_handle_t memh;
bus_addr_t mem_start;
const char *p;
u_int data;
@@ -1475,6 +1488,9 @@ dinoattach(parent, self, aux)
r->pciwor = 0;
r->io_addr_en = 0;
r->gmask &= ~1; /* allow GSC bus req */
+printf("feat %08x ", r->brdg_feat);
+ r->brdg_feat &= ~0xf00;
+ r->brdg_feat |= 3;
#ifdef notyet_card_mode
r->io_control = 0x80;
r->pamr = 0;
@@ -1501,13 +1517,13 @@ dinoattach(parent, self, aux)
/* TODO reserve dino's pci space ? */
- /* XXX assuming that dino attaches the last */
- if (bus_space_alloc(sc->sc_bt, 0xf0800000, 0xff7fffff, DINO_MEM_WINDOW,
- DINO_MEM_CHUNK, EX_NOBOUNDARY, 0, &mem_start, &sc->sc_memh)) {
+ if (dino_memalloc(sc, 0xf0800000, 0xff7fffff, DINO_MEM_WINDOW,
+ DINO_MEM_WINDOW, EX_NOBOUNDARY, 0, &mem_start, &memh)) {
printf(": cannot allocate memory window\n");
bus_space_unmap(sc->sc_bt, sc->sc_bh, PAGE_SIZE);
return;
}
+
snprintf(sc->sc_memexname, sizeof(sc->sc_memexname),
"%s_mem", sc->sc_dv.dv_xname);
if ((sc->sc_memex = extent_create(sc->sc_memexname, mem_start,
@@ -1516,7 +1532,7 @@ dinoattach(parent, self, aux)
printf(": cannot allocate MEM extent map\n");
extent_destroy(sc->sc_ioex);
bus_space_unmap(sc->sc_bt, sc->sc_bh, PAGE_SIZE);
- bus_space_unmap(sc->sc_bt, sc->sc_memh, DINO_MEM_WINDOW);
+ bus_space_free(sc->sc_bt, memh, DINO_MEM_WINDOW);
return;
}
diff --git a/sys/arch/hppa/hppa/conf.c b/sys/arch/hppa/hppa/conf.c
index 75fb856fd99..e20ab551213 100644
--- a/sys/arch/hppa/hppa/conf.c
+++ b/sys/arch/hppa/hppa/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.31 2004/06/17 11:27:48 mickey Exp $ */
+/* $OpenBSD: conf.c,v 1.32 2004/08/06 20:29:47 mickey Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -50,6 +50,9 @@
#include "ss.h"
#include "ses.h"
#include "uk.h"
+#include "wd.h"
+bdev_decl(wd);
+cdev_decl(wd);
#if 0
#include "fd.h"
#else
@@ -68,7 +71,8 @@ struct bdevsw bdevsw[] =
bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
bdev_disk_init(NFD,fd), /* 7: floppy drive */
- /* 8: */
+ bdev_disk_init(NWD,wd), /* 8: ST506 drive */
+ /* 9: */
bdev_lkm_dummy(),
bdev_lkm_dummy(),
bdev_lkm_dummy(),
@@ -158,7 +162,7 @@ struct cdevsw cdevsw[] =
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 32: xfs communication device */
#else
- cdev_notdef(), /* 32 */
+ cdev_notdef(),
#endif
cdev_notdef(), /* 33: ALTQ (deprecated) */
cdev_systrace_init(NSYSTRACE,systrace), /* 34: system call tracing */
@@ -166,6 +170,7 @@ struct cdevsw cdevsw[] =
cdev_crypto_init(NCRYPTO,crypto), /* 36: /dev/crypto */
cdev_ses_init(NSES,ses), /* 37: SCSI SES/SAF-TE */
cdev_ptm_init(NPTY,ptm), /* 38: pseudo-tty ptm device */
+ cdev_disk_init(NWD,wd), /* 39: ST506 disk */
cdev_lkm_dummy(),
cdev_lkm_dummy(),
cdev_lkm_dummy(),
@@ -215,9 +220,22 @@ int chrtoblktbl[] = {
/* 21 */ NODEV,
/* 22 */ NODEV,
/* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ 7,
- /* 25 */ 8,
+ /* 24 */ 7,
+ /* 25 */ NODEV,
+ /* 26 */ NODEV,
+ /* 27 */ NODEV,
+ /* 28 */ NODEV,
+ /* 29 */ NODEV,
+ /* 30 */ NODEV,
+ /* 31 */ NODEV,
+ /* 32 */ NODEV,
+ /* 33 */ NODEV,
+ /* 34 */ NODEV,
+ /* 35 */ NODEV,
+ /* 36 */ NODEV,
+ /* 37 */ NODEV,
+ /* 38 */ NODEV,
+ /* 39 */ NODEV,
};
int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
diff --git a/sys/arch/hppa/include/rbus_machdep.h b/sys/arch/hppa/include/rbus_machdep.h
new file mode 100644
index 00000000000..d980299670d
--- /dev/null
+++ b/sys/arch/hppa/include/rbus_machdep.h
@@ -0,0 +1,43 @@
+/* $OpenBSD: rbus_machdep.h,v 1.1 2004/08/06 20:29:47 mickey Exp $ */
+
+/*
+ * Copyright (c) 2004 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.
+ */
+
+static __inline int
+md_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp)
+{
+ if (bshp)
+ *(bshp) = bpa;
+
+ return (0);
+}
+
+#define md_space_unmap(t,bsh,s,addrp) do { *(addrp) = (bsh); } while (0)
+
+struct pci_attach_args;
+
+#define rbus_pccbb_parent_mem(d, p) (*(p)->pa_pc->pc_alloc_parent)((d), (p), 0)
+#define rbus_pccbb_parent_io(d, p) (*(p)->pa_pc->pc_alloc_parent)((d), (p), 1)