Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga Minor changes to Amiga PCI MD code:
details: https://anonhg.NetBSD.org/src/rev/084e7aa7301f
branches: trunk
changeset: 769705:084e7aa7301f
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Mon Sep 19 19:15:28 2011 +0000
description:
Minor changes to Amiga PCI MD code:
- Add bus enumeration and resource assignment (PCI_NETBSD_CONFIGURE) to mppb(4) - no more need to run AmigaOS to configure the bus.
- Add PCI configuration address register to p5pb(4).
- Add PCI I/O space support to p5pb(4).
- Move common code from p5pb(4) and mppb(4) to new pci_machdep.c file.
- Fix style.
diffstat:
sys/arch/amiga/conf/DRACO | 6 +-
sys/arch/amiga/conf/GENERIC | 8 +-
sys/arch/amiga/conf/GENERIC.in | 6 +-
sys/arch/amiga/conf/INSTALL | 8 +-
sys/arch/amiga/conf/files.amiga | 3 +-
sys/arch/amiga/include/pci_machdep.h | 30 +++++++-
sys/arch/amiga/pci/mppb.c | 101 ++++++++---------------------
sys/arch/amiga/pci/p5pb.c | 78 +++++++++++++++-------
sys/arch/amiga/pci/p5pbreg.h | 20 +++--
sys/arch/amiga/pci/pci_machdep.c | 120 +++++++++++++++++++++++++++++++++++
10 files changed, 260 insertions(+), 120 deletions(-)
diffs (truncated from 712 to 300 lines):
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/conf/DRACO
--- a/sys/arch/amiga/conf/DRACO Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/conf/DRACO Mon Sep 19 19:15:28 2011 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: DRACO,v 1.141 2011/09/17 16:55:34 rkujawa Exp $
+# $NetBSD: DRACO,v 1.142 2011/09/19 19:15:28 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.82 2011/08/04 17:48:51 rkujawa Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.83 2011/09/17 16:55:34 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.141 $"
+#ident "GENERIC-$Revision: 1.142 $"
maxusers 8
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/conf/GENERIC
--- a/sys/arch/amiga/conf/GENERIC Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/conf/GENERIC Mon Sep 19 19:15:28 2011 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.271 2011/09/17 16:55:34 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.272 2011/09/19 19:15:28 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.82 2011/08/04 17:48:51 rkujawa Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.83 2011/09/17 16:55:34 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.271 $"
+#ident "GENERIC-$Revision: 1.272 $"
maxusers 8
@@ -466,6 +466,8 @@
# PCI bus support
options PCIVERBOSE # verbose PCI device autoconfig messages
#options PCI_CONFIG_DUMP
+options PCI_NETBSD_CONFIGURE
+
p5pb0 at zbus0 # Phase5 PCI bridge (CVPPC/BVPPC)
pci* at p5pb0
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in Mon Sep 19 19:15:28 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.83 2011/09/17 16:55:34 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.84 2011/09/19 19:15:29 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -57,7 +57,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.83 $"
+#ident "GENERIC-$Revision: 1.84 $"
m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
makeoptions COPTS="-Os"
@@ -573,6 +573,8 @@
# PCI bus support
options PCIVERBOSE # verbose PCI device autoconfig messages
#options PCI_CONFIG_DUMP
+options PCI_NETBSD_CONFIGURE
+
p5pb0 at zbus0 # Phase5 PCI bridge (CVPPC/BVPPC)
pci* at p5pb0
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/conf/INSTALL
--- a/sys/arch/amiga/conf/INSTALL Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/conf/INSTALL Mon Sep 19 19:15:28 2011 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: INSTALL,v 1.93 2011/09/17 16:55:34 rkujawa Exp $
+# $NetBSD: INSTALL,v 1.94 2011/09/19 19:15:29 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.82 2011/08/04 17:48:51 rkujawa Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.83 2011/09/17 16:55:34 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.93 $"
+#ident "GENERIC-$Revision: 1.94 $"
makeoptions COPTS="-Os"
@@ -410,6 +410,8 @@
# PCI bus support
options PCIVERBOSE # verbose PCI device autoconfig messages
#options PCI_CONFIG_DUMP
+options PCI_NETBSD_CONFIGURE
+
p5pb0 at zbus0 # Phase5 PCI bridge (CVPPC/BVPPC)
pci* at p5pb0
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/conf/files.amiga Mon Sep 19 19:15:28 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amiga,v 1.147 2011/09/17 16:55:34 rkujawa Exp $
+# $NetBSD: files.amiga,v 1.148 2011/09/19 19:15:29 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -496,6 +496,7 @@
# PCI bus
file arch/amiga/pci/p5pb.c pci
file arch/amiga/pci/mppb.c pci
+file arch/amiga/pci/pci_machdep.c pci
device p5pb: pcibus
attach p5pb at zbus
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/include/pci_machdep.h
--- a/sys/arch/amiga/include/pci_machdep.h Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/include/pci_machdep.h Mon Sep 19 19:15:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.2 2011/09/17 16:55:34 rkujawa Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.3 2011/09/19 19:15:29 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -79,8 +79,13 @@
void (*pc_conf_interrupt)(pci_chipset_tag_t, int, int, int,
int, int *);
- bus_space_tag_t pci_conf_iot;
- bus_space_handle_t pci_conf_ioh;
+ /* PCI configuration address register */
+ bus_space_tag_t pci_conf_addresst;
+ bus_space_handle_t pci_conf_addressh;
+
+ /* PCI configuration data register */
+ bus_space_tag_t pci_conf_datat;
+ bus_space_handle_t pci_conf_datah;
};
@@ -109,5 +114,24 @@
(*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
#define pci_intr_disestablish(c, iv) \
(*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
+#define pci_conf_interrupt(c, b, d, f, s, i) \
+ (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i))
+#define pci_conf_hook(c, b, d, f, i) \
+ (*(c)->pc_conf_hook)((c), (b), (d), (f), (i))
#endif
+
+pcitag_t amiga_pci_make_tag(pci_chipset_tag_t pc, int bus, int device,
+ int function);
+void amiga_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag,
+ int *bp, int *dp, int *fp);
+void * amiga_pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t
+ ih, int level, int (*ih_fun)(void *), void *ih_arg);
+void amiga_pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie);
+const char * amiga_pci_intr_string(pci_chipset_tag_t pc,
+ pci_intr_handle_t ih);
+int amiga_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev,
+ int func, pcireg_t id);
+void amiga_pci_conf_interrupt(pci_chipset_tag_t pc, int bus,
+ int dev, int func, int swiz, int *iline);
+
diff -r 584f1187d9a0 -r 084e7aa7301f sys/arch/amiga/pci/mppb.c
--- a/sys/arch/amiga/pci/mppb.c Mon Sep 19 18:16:06 2011 +0000
+++ b/sys/arch/amiga/pci/mppb.c Mon Sep 19 19:15:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mppb.c,v 1.1 2011/09/17 16:55:34 rkujawa Exp $ */
+/* $NetBSD: mppb.c,v 1.2 2011/09/19 19:15:29 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -73,22 +73,14 @@
pcireg_t mppb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void mppb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
int mppb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno);
-int mppb_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev,
- int func, pcireg_t id);
void mppb_pci_attach_hook (struct device *parent,
struct device *self, struct pcibus_attach_args *pba);
pcitag_t mppb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device,
int function);
void mppb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag,
int *bp, int *dp, int *fp);
-
-void * mppb_pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t
- ih, int level, int (*ih_fun)(void *), void *ih_arg);
-void mppb_pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie);
int mppb_pci_intr_map(const struct pci_attach_args *pa,
pci_intr_handle_t *ihp);
-const char * mppb_pci_intr_string(pci_chipset_tag_t pc,
- pci_intr_handle_t ih);
const struct evcnt * mppb_pci_intr_evcnt(pci_chipset_tag_t pc,
pci_intr_handle_t ih);
@@ -124,6 +116,7 @@
struct pcibus_attach_args pba;
struct zbus_args *zap;
pci_chipset_tag_t pc;
+ struct extent *ioext, *memext;
zap = aux;
sc = device_private(self);
@@ -150,28 +143,40 @@
(zap->pa) + MPPB_IO_BASE, sc->pci_io_area.base);
#endif
- sc->apc.pci_conf_iot = &(sc->pci_conf_area);
+ sc->apc.pci_conf_datat = &(sc->pci_conf_area);
- if (bus_space_map(sc->apc.pci_conf_iot, 0, MPPB_CONF_SIZE, 0,
- &sc->apc.pci_conf_ioh))
+ if (bus_space_map(sc->apc.pci_conf_datat, 0, MPPB_CONF_SIZE, 0,
+ &sc->apc.pci_conf_datah))
aprint_error_dev(self,
"couldn't map PCI configuration data space\n");
/* Initialize the PCI chipset tag. */
sc->apc.pc_conf_v = (void*) pc;
sc->apc.pc_bus_maxdevs = mppb_pci_bus_maxdevs;
- sc->apc.pc_make_tag = mppb_pci_make_tag;
- sc->apc.pc_decompose_tag = mppb_pci_decompose_tag;
+ sc->apc.pc_make_tag = amiga_pci_make_tag;
+ sc->apc.pc_decompose_tag = amiga_pci_decompose_tag;
sc->apc.pc_conf_read = mppb_pci_conf_read;
sc->apc.pc_conf_write = mppb_pci_conf_write;
sc->apc.pc_attach_hook = mppb_pci_attach_hook;
sc->apc.pc_intr_map = mppb_pci_intr_map;
- sc->apc.pc_intr_string = mppb_pci_intr_string;
- sc->apc.pc_intr_establish = mppb_pci_intr_establish;
- sc->apc.pc_intr_disestablish = mppb_pci_intr_disestablish;
- /* XXX: pc_conf_interrupt */
-
+ sc->apc.pc_intr_string = amiga_pci_intr_string;
+ sc->apc.pc_intr_establish = amiga_pci_intr_establish;
+ sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish;
+
+ sc->apc.pc_conf_hook = amiga_pci_conf_hook;
+ sc->apc.pc_conf_interrupt = amiga_pci_conf_interrupt;
+
+ ioext = extent_create("mppbio", MPPB_IO_BASE,
+ MPPB_IO_BASE + MPPB_IO_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT);
+ memext = extent_create("mppbmem", MPPB_MEM_BASE,
+ MPPB_MEM_BASE + MPPB_MEM_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT);
+
+ pci_configure_bus(pc, ioext, memext, NULL, 0, CACHELINE_SIZE);
+
+ extent_destroy(ioext);
+ extent_destroy(memext);
+
pba.pba_iot = &(sc->pci_io_area);
pba.pba_memt = &(sc->pci_mem_area);
pba.pba_dmat = NULL;
@@ -192,12 +197,12 @@
pci_decompose_tag(pc, tag, &bus, &dev, &func);
- data = bus_space_read_4(pc->pci_conf_iot, pc->pci_conf_ioh,
+ data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah,
(MPPB_CONF_STRIDE*dev) + reg);
#ifdef MPPB_DEBUG
aprint_normal("mppb conf read va: %lx, bus: %d, dev: %d, "
"func: %d, reg: %d -r-> data %x\n",
- pc->pci_conf_ioh, bus, dev, func, reg, data);
+ pc->pci_conf_datah, bus, dev, func, reg, data);
#endif
return data;
}
@@ -209,12 +214,12 @@
pci_decompose_tag(pc, tag, &bus, &dev, &func);
- bus_space_write_4(pc->pci_conf_iot, pc->pci_conf_ioh,
+ bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah,
(MPPB_CONF_STRIDE*dev) + reg, val);
#ifdef MPPB_DEBUG
aprint_normal("mppb conf write va: %lx, bus: %d, dev: %d, "
"func: %d, reg: %d -w-> data %x\n",
Home |
Main Index |
Thread Index |
Old Index