Module Name:    src
Committed By:   rkujawa
Date:           Fri Jun  1 09:41:35 UTC 2012

Modified Files:
        src/sys/arch/amiga/include: bus.h pci_machdep.h
        src/sys/arch/amiga/pci: empb.c
Added Files:
        src/sys/arch/amiga/pci: empb_bsm.c empbvar.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/include/bus.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/include/pci_machdep.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amiga/pci/empb.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/amiga/pci/empb_bsm.c \
    src/sys/arch/amiga/pci/empbvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/include/bus.h
diff -u src/sys/arch/amiga/include/bus.h:1.26 src/sys/arch/amiga/include/bus.h:1.27
--- src/sys/arch/amiga/include/bus.h:1.26	Mon May  7 18:16:38 2012
+++ src/sys/arch/amiga/include/bus.h	Fri Jun  1 09:41:35 2012
@@ -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_meth
 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

Index: src/sys/arch/amiga/include/pci_machdep.h
diff -u src/sys/arch/amiga/include/pci_machdep.h:1.5 src/sys/arch/amiga/include/pci_machdep.h:1.6
--- src/sys/arch/amiga/include/pci_machdep.h:1.5	Mon May  7 18:16:38 2012
+++ src/sys/arch/amiga/include/pci_machdep.h	Fri Jun  1 09:41:35 2012
@@ -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 @@ struct amiga_pci_chipset {
 	/* PCI configuration data register */
 	bus_space_tag_t pci_conf_datat;
 	bus_space_handle_t pci_conf_datah;
+
+	void		*cookie; /* used in some implementations */
 };
 
 

Index: src/sys/arch/amiga/pci/empb.c
diff -u src/sys/arch/amiga/pci/empb.c:1.2 src/sys/arch/amiga/pci/empb.c:1.3
--- src/sys/arch/amiga/pci/empb.c:1.2	Thu May 31 21:29:02 2012
+++ src/sys/arch/amiga/pci/empb.c	Fri Jun  1 09:41:35 2012
@@ -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_callback(device_t self)
 
 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 @@ empb_find_mem(struct empb_softc *sc)
 /*
  * Switch memory window position.
  */
-static void
+void
 empb_switch_window(struct empb_softc *sc, bus_addr_t address) 
 {
 	int s;

Added files:

Index: src/sys/arch/amiga/pci/empb_bsm.c
diff -u /dev/null src/sys/arch/amiga/pci/empb_bsm.c:1.1
--- /dev/null	Fri Jun  1 09:41:36 2012
+++ src/sys/arch/amiga/pci/empb_bsm.c	Fri Jun  1 09:41:35 2012
@@ -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? */
+};
+
Index: src/sys/arch/amiga/pci/empbvar.h
diff -u /dev/null src/sys/arch/amiga/pci/empbvar.h:1.1
--- /dev/null	Fri Jun  1 09:41:36 2012
+++ src/sys/arch/amiga/pci/empbvar.h	Fri Jun  1 09:41:35 2012
@@ -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);

Reply via email to