Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/cobalt - Use bus_space(9) to access PCI configurati...
details: https://anonhg.NetBSD.org/src/rev/5aadeae75cbd
branches: trunk
changeset: 569661:5aadeae75cbd
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Aug 28 13:33:31 2004 +0000
description:
- Use bus_space(9) to access PCI configuration registers on GT64111.
- Remove unused pci stuff from mainbus.c.
diffstat:
sys/arch/cobalt/cobalt/mainbus.c | 7 ++-----
sys/arch/cobalt/dev/gt.c | 11 +++++++++--
sys/arch/cobalt/include/pci_machdep.h | 9 +++++++--
sys/arch/cobalt/pci/pci_machdep.c | 24 ++++++++++++------------
4 files changed, 30 insertions(+), 21 deletions(-)
diffs (177 lines):
diff -r b2460fc9faf7 -r 5aadeae75cbd sys/arch/cobalt/cobalt/mainbus.c
--- a/sys/arch/cobalt/cobalt/mainbus.c Sat Aug 28 12:44:22 2004 +0000
+++ b/sys/arch/cobalt/cobalt/mainbus.c Sat Aug 28 13:33:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.8 2003/09/12 14:59:13 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.9 2004/08/28 13:33:31 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@@ -26,20 +26,17 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2003/09/12 14:59:13 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2004/08/28 13:33:31 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <dev/pci/pcivar.h>
-
#include <mips/cpuregs.h>
#include <machine/autoconf.h>
#include "locators.h"
-#include "pci.h"
static int mainbus_match(struct device *, struct cfdata *, void *);
static void mainbus_attach(struct device *, struct device *, void *);
diff -r b2460fc9faf7 -r 5aadeae75cbd sys/arch/cobalt/dev/gt.c
--- a/sys/arch/cobalt/dev/gt.c Sat Aug 28 12:44:22 2004 +0000
+++ b/sys/arch/cobalt/dev/gt.c Sat Aug 28 13:33:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gt.c,v 1.10 2004/08/28 12:32:48 tsutsui Exp $ */
+/* $NetBSD: gt.c,v 1.11 2004/08/28 13:33:31 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.10 2004/08/28 12:32:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.11 2004/08/28 13:33:31 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -59,6 +59,7 @@
bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh;
+ struct cobalt_pci_chipset sc_pc;
};
static int gt_match(struct device *, struct cfdata *, void *);
@@ -92,6 +93,7 @@
struct mainbus_attach_args *ma = aux;
struct gt_softc *sc = (void *)self;
#if NPCI > 0
+ pci_chipset_tag_t pc;
struct pcibus_attach_args pba;
#endif
@@ -111,6 +113,10 @@
~PCI_SYNCMODE) | PCI_PCLK_HIGH);
#if NPCI > 0
+ pc = &sc->sc_pc;
+ pc->pc_bst = sc->sc_bst;
+ pc->pc_bsh = sc->sc_bsh;
+
pba.pba_busname = "pci";
pba.pba_dmat = &pci_bus_dma_tag;
pba.pba_dmat64 = NULL;
@@ -119,6 +125,7 @@
pba.pba_bridgetag = NULL;
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
PCI_FLAGS_MRL_OKAY | /*PCI_FLAGS_MRM_OKAY|*/ PCI_FLAGS_MWI_OKAY;
+ pba.pba_pc = pc;
config_found(self, &pba, gt_print);
#endif
}
diff -r b2460fc9faf7 -r 5aadeae75cbd sys/arch/cobalt/include/pci_machdep.h
--- a/sys/arch/cobalt/include/pci_machdep.h Sat Aug 28 12:44:22 2004 +0000
+++ b/sys/arch/cobalt/include/pci_machdep.h Sat Aug 28 13:33:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.6 2004/07/29 16:55:25 drochner Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.7 2004/08/28 13:33:31 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -50,10 +50,15 @@
/*
* Types provided to machine-independent PCI code
*/
-typedef void *pci_chipset_tag_t;
+typedef struct cobalt_pci_chipset *pci_chipset_tag_t;
typedef u_int32_t pcitag_t;
typedef int pci_intr_handle_t;
+struct cobalt_pci_chipset {
+ bus_space_tag_t pc_bst; /* bus space tag for PCICFG regs */
+ bus_space_handle_t pc_bsh; /* bus space handle for PCICFG regs */
+};
+
/*
* Functions provided to machine-independent PCI code.
*/
diff -r b2460fc9faf7 -r 5aadeae75cbd sys/arch/cobalt/pci/pci_machdep.c
--- a/sys/arch/cobalt/pci/pci_machdep.c Sat Aug 28 12:44:22 2004 +0000
+++ b/sys/arch/cobalt/pci/pci_machdep.c Sat Aug 28 13:33:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.15 2003/09/12 17:55:52 tsutsui Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.16 2004/08/28 13:33:31 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.15 2003/09/12 17:55:52 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.16 2004/08/28 13:33:31 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -43,6 +43,8 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
+#include <cobalt/dev/gtreg.h>
+
/*
* PCI doesn't have any special needs; just use
* the generic versions of these functions.
@@ -103,9 +105,6 @@
*fp = (tag >> 8) & 0x07;
}
-#define PCI_CFG_ADDR ((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x14000cf8))
-#define PCI_CFG_DATA ((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x14000cfc))
-
pcireg_t
pci_conf_read(pc, tag, reg)
pci_chipset_tag_t pc;
@@ -128,9 +127,10 @@
if (bus == 0 && dev == 31)
return 0;
- *PCI_CFG_ADDR = 0x80000000 | tag | reg;
- data = *PCI_CFG_DATA;
- *PCI_CFG_ADDR = 0;
+ bus_space_write_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_ADDR,
+ 0x80000000 | tag | reg);
+ data = bus_space_read_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_DATA);
+ bus_space_write_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_ADDR, 0);
return data;
}
@@ -142,11 +142,11 @@
int reg;
pcireg_t data;
{
- *PCI_CFG_ADDR = 0x80000000 | tag | reg;
- *PCI_CFG_DATA = data;
- *PCI_CFG_ADDR = 0;
- return;
+ bus_space_write_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_ADDR,
+ 0x80000000 | tag | reg);
+ bus_space_write_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_DATA, data);
+ bus_space_write_4(pc->pc_bst, pc->pc_bsh, GT_PCICFG_ADDR, 0);
}
int
Home |
Main Index |
Thread Index |
Old Index