Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amiga More work on PCI memory accesses on empb(4).



details:   https://anonhg.NetBSD.org/src/rev/febee226eb52
branches:  trunk
changeset: 779517:febee226eb52
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Fri Jun 01 09:41:35 2012 +0000

description:
More work on PCI memory accesses on empb(4).

diffstat:

 sys/arch/amiga/conf/files.amiga      |   7 +-
 sys/arch/amiga/include/bus.h         |   3 +-
 sys/arch/amiga/include/pci_machdep.h |   4 +-
 sys/arch/amiga/pci/empb.c            |  31 +----------
 sys/arch/amiga/pci/empb_bsm.c        |  95 ++++++++++++++++++++++++++++++++++++
 sys/arch/amiga/pci/empbvar.h         |  64 ++++++++++++++++++++++++
 6 files changed, 172 insertions(+), 32 deletions(-)

diffs (300 lines):

diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga   Fri Jun 01 06:26:38 2012 +0000
+++ b/sys/arch/amiga/conf/files.amiga   Fri Jun 01 09:41:35 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amiga,v 1.157 2012/05/30 18:01:51 rkujawa Exp $
+#      $NetBSD: files.amiga,v 1.158 2012/06/01 09:42:16 rkujawa Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16                       # NOTE THAT AMIGA IS SPECIAL!
@@ -59,6 +59,9 @@
 define amibus_b800
 file   arch/amiga/amiga/amiga_bus_simple_0x800.c       amibus_b800
 
+define  amibus_empb
+file   arch/amiga/pci/empb_bsm.c       amibus_empb
+
 file   arch/amiga/amiga/bus.c
 
 # zorro expansion bus.
@@ -535,7 +538,7 @@
 device cv3dpb: pcibus
 attach cv3dpb at zbus
 
-device empb: pcibus
+device empb: pcibus, amibus_empb
 attach empb at zbus
 
 device emmem {}
diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/include/bus.h
--- a/sys/arch/amiga/include/bus.h      Fri Jun 01 06:26:38 2012 +0000
+++ b/sys/arch/amiga/include/bus.h      Fri Jun 01 09:41:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.26 2012/05/07 18:16:38 tsutsui Exp $ */
+/*     $NetBSD: bus.h,v 1.27 2012/06/01 09:41:35 rkujawa Exp $ */
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -279,6 +279,7 @@
 extern const struct amiga_bus_space_methods amiga_bus_stride_4;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
 extern const struct amiga_bus_space_methods amiga_bus_stride_16;
+extern const struct amiga_bus_space_methods empb_bus_swap;
 
 /*
  * XXX
diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/include/pci_machdep.h
--- a/sys/arch/amiga/include/pci_machdep.h      Fri Jun 01 06:26:38 2012 +0000
+++ b/sys/arch/amiga/include/pci_machdep.h      Fri Jun 01 09:41:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.h,v 1.5 2012/05/07 18:16:38 tsutsui Exp $ */
+/*     $NetBSD: pci_machdep.h,v 1.6 2012/06/01 09:41:35 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -86,6 +86,8 @@
        /* PCI configuration data register */
        bus_space_tag_t pci_conf_datat;
        bus_space_handle_t pci_conf_datah;
+
+       void            *cookie; /* used in some implementations */
 };
 
 
diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/pci/empb.c
--- a/sys/arch/amiga/pci/empb.c Fri Jun 01 06:26:38 2012 +0000
+++ b/sys/arch/amiga/pci/empb.c Fri Jun 01 09:41:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: empb.c,v 1.2 2012/05/31 21:29:02 rkujawa Exp $ */
+/*     $NetBSD: empb.c,v 1.3 2012/06/01 09:41:35 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -46,14 +46,11 @@
 #include <machine/bus.h>
 #include <machine/cpu.h>
 
-#include <m68k/bus_dma.h>
 #include <amiga/dev/zbusvar.h>
 #include <amiga/pci/empbreg.h>
+#include <amiga/pci/empbvar.h>
 #include <amiga/pci/emmemvar.h>
 
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcidevs.h>
 #include <dev/pci/pciconf.h>
 
 #include "opt_pci.h"
@@ -66,27 +63,6 @@
 #define WINDOW_LOCK(s)         (s) = splhigh()
 #define WINDOW_UNLOCK(s)       splx((s)) 
 
-struct empb_softc {
-       device_t                        sc_dev;
-
-       struct bus_space_tag            setup_area;
-       bus_space_tag_t                 setup_area_t;
-       bus_space_handle_t              setup_area_h;
-
-       struct bus_space_tag            pci_confio_area;
-       bus_space_tag_t                 pci_confio_t;
-       bus_space_handle_t              pci_confio_h;
-       uint8_t                         pci_confio_mode;
-
-       struct bus_space_tag            pci_mem_win;
-       uint32_t                        pci_mem_win_size;
-       bus_addr_t                      pci_mem_win_pos;
-       uint16_t                        pci_mem_win_mask;
-
-       struct amiga_pci_chipset        apc;
-
-};
-
 static int     empb_match(struct device *, struct cfdata *, void *);
 static void    empb_attach(struct device *, struct device *, void *);
 
@@ -94,7 +70,6 @@
 
 static void    empb_find_mem(struct empb_softc *sc);
 static void    empb_switch_bridge(struct empb_softc *sc, uint8_t mode);
-static void    empb_switch_window(struct empb_softc *sc, bus_addr_t address);
 
 pcireg_t       empb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
 void           empb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
@@ -317,7 +292,7 @@
 /*
  * Switch memory window position.
  */
-static void
+void
 empb_switch_window(struct empb_softc *sc, bus_addr_t address) 
 {
        int s;
diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/pci/empb_bsm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/empb_bsm.c     Fri Jun 01 09:41:35 2012 +0000
@@ -0,0 +1,95 @@
+/*     $NetBSD: empb_bsm.c,v 1.1 2012/06/01 09:41:35 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+/*
+ * Special bus space methods handling PCI memory window.
+ */
+
+#include <sys/bus.h>
+#include <sys/null.h>
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <amiga/pci/empbreg.h>
+#include <amiga/pci/empbvar.h>
+#include <amiga/pci/emmemvar.h>
+
+
+
+
+const struct amiga_bus_space_methods empb_bus_swap = {
+       /*.bsm =                empb_bsm,
+       .bsms =         empb_bsms,
+       .bsu =          empb_bsu,
+       .bsa =          NULL,
+       .bsf =          NULL,
+
+       .bsr1 =         empb_bsr1,
+       .bsw1 =         empb_bsw1,
+       .bsrm1 =        empb_bsrm1,
+       .bswm1 =        empb_bswm1,
+       .bsrr1 =        empb_bsrr1,
+       .bswr1 =        empb_bswr1,
+       .bssr1 =        empb_bssr1,
+       .bscr1 =        empb_bscr1,
+
+       .bsr2 =         oabs(bsr2_),            // XXX swap? 
+       .bsw2 =         oabs(bsw2_),            // XXX swap? 
+       .bsrs2 =        oabs(bsr2_),
+       .bsws2 =        oabs(bsw2_),
+       .bsrm2 =        oabs(bsrm2_swap_),
+       .bswm2 =        oabs(bswm2_swap_),
+       .bsrms2 =       oabs(bsrm2_),
+       .bswms2 =       oabs(bswm2_),
+       .bsrr2 =        oabs(bsrr2_),           // XXX swap?
+       .bswr2 =        oabs(bswr2_),           // XXX swap? 
+       .bsrrs2 =       oabs(bsrr2_),
+       .bswrs2 =       oabs(bswr2_),
+       .bssr2 =        oabs(bssr2_),           // XXX swap?
+       .bscr2 =        oabs(bscr2_),           // XXX swap? 
+
+       .bsr4 =         oabs(bsr4_swap_),
+       .bsw4 =         oabs(bsw4_swap_),
+       .bsrs4 =        oabs(bsr4_),
+       .bsws4 =        oabs(bsw4_),
+       .bsrm4 =        oabs(bsrm4_),           // XXX swap?
+       .bswm4 =        oabs(bswm4_),           // XXX swap?
+       .bsrms4 =       oabs(bsrm4_),
+       .bswms4 =       oabs(bswm4_),
+       .bsrr4 =        oabs(bsrr4_),           // XXX swap? 
+       .bswr4 =        oabs(bswr4_),           // XXX swap?
+       .bsrrs4 =       oabs(bsrr4_),
+       .bswrs4 =       oabs(bswr4_),
+       .bssr4 =        oabs(bssr4_),           // XXX swap?
+       .bscr4 =        oabs(bscr4_)            // XXX swap? */
+};
+
diff -r d33afe50e2f0 -r febee226eb52 sys/arch/amiga/pci/empbvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/empbvar.h      Fri Jun 01 09:41:35 2012 +0000
@@ -0,0 +1,64 @@
+/*     $NetBSD: empbvar.h,v 1.1 2012/06/01 09:41:35 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/bus.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+
+#include <machine/pci_machdep.h>
+
+struct empb_softc {
+       device_t                        sc_dev;
+
+       struct bus_space_tag            setup_area;
+       bus_space_tag_t                 setup_area_t;
+       bus_space_handle_t              setup_area_h;
+
+       struct bus_space_tag            pci_confio_area;
+       bus_space_tag_t                 pci_confio_t;
+       bus_space_handle_t              pci_confio_h;
+       uint8_t                         pci_confio_mode;
+
+       struct bus_space_tag            pci_mem_win;
+       uint32_t                        pci_mem_win_size;
+       bus_addr_t                      pci_mem_win_pos;
+       uint16_t                        pci_mem_win_mask;
+
+       struct amiga_pci_chipset        apc;
+
+};
+
+
+void   empb_switch_window(struct empb_softc *sc, bus_addr_t address);



Home | Main Index | Thread Index | Old Index