Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sgimips switch sgimips to common bus_dma and bus_sp...
details: https://anonhg.NetBSD.org/src/rev/88279e6cbbf8
branches: trunk
changeset: 336218:88279e6cbbf8
user: macallan <macallan%NetBSD.org@localhost>
date: Wed Feb 18 16:47:58 2015 +0000
description:
switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
diffstat:
sys/arch/sgimips/conf/files.sgimips | 5 +-
sys/arch/sgimips/dev/crime.c | 8 +-
sys/arch/sgimips/dev/crmfb.c | 13 +-
sys/arch/sgimips/dev/ctl.c | 8 +-
sys/arch/sgimips/dev/dpclock.c | 47 +-
sys/arch/sgimips/dev/dsclock.c | 10 +-
sys/arch/sgimips/dev/imc.c | 8 +-
sys/arch/sgimips/dev/int.c | 12 +-
sys/arch/sgimips/dev/pic.c | 8 +-
sys/arch/sgimips/dev/zs.c | 28 +-
sys/arch/sgimips/gio/gio.c | 12 +-
sys/arch/sgimips/gio/pci_gio.c | 24 +-
sys/arch/sgimips/hpc/hpc.c | 33 +-
sys/arch/sgimips/hpc/if_sq.c | 8 +-
sys/arch/sgimips/hpc/panel.c | 10 +-
sys/arch/sgimips/hpc/pckbc_hpc.c | 6 +-
sys/arch/sgimips/hpc/wdsc.c | 13 +-
sys/arch/sgimips/include/bus_defs.h | 173 +---
sys/arch/sgimips/include/bus_funcs.h | 95 +--
sys/arch/sgimips/include/pci_machdep.h | 4 +-
sys/arch/sgimips/ioc/ioc.c | 10 +-
sys/arch/sgimips/ioc/oioc.c | 11 +-
sys/arch/sgimips/mace/com_mace.c | 6 +-
sys/arch/sgimips/mace/mace.c | 38 +-
sys/arch/sgimips/mace/mcclock_mace.c | 8 +-
sys/arch/sgimips/mace/pci_mace.c | 72 +-
sys/arch/sgimips/mace/pcireg_mace.h | 3 +-
sys/arch/sgimips/pci/pci_machdep.c | 7 +-
sys/arch/sgimips/sgimips/bus.c | 1420 +-------------------------------
sys/arch/sgimips/sgimips/console.c | 18 +-
30 files changed, 350 insertions(+), 1768 deletions(-)
diffs (truncated from 3094 to 300 lines):
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/conf/files.sgimips
--- a/sys/arch/sgimips/conf/files.sgimips Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/conf/files.sgimips Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sgimips,v 1.52 2014/07/20 10:22:55 alnsn Exp $
+# $NetBSD: files.sgimips,v 1.53 2015/02/18 16:47:58 macallan Exp $
maxpartitions 16
@@ -26,8 +26,7 @@
file arch/sgimips/sgimips/disksubr.c
file arch/sgimips/sgimips/machdep.c
-file dev/bus_dma/bus_dmamem_common.c
-
+file arch/mips/mips/bus_dma.c
file arch/mips/mips/mips3_clock.c mips3
file arch/mips/mips/mips3_clockintr.c mips3
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/crime.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crime.c,v 1.37 2014/05/17 20:44:08 mrg Exp $ */
+/* $NetBSD: crime.c,v 1.38 2015/02/18 16:47:58 macallan Exp $ */
/*
* Copyright (c) 2004 Christopher SEKIYA
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.37 2014/05/17 20:44:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.38 2015/02/18 16:47:58 macallan Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -108,9 +108,9 @@
uint32_t startctr, endctr, cps;
sc->sc_dev = self;
- crm_iot = SGIMIPS_BUS_SPACE_CRIME;
+ crm_iot = normal_memt;
- if (bus_space_map(crm_iot, ma->ma_addr, 0 /* XXX */,
+ if (bus_space_map(crm_iot, ma->ma_addr, 0x1000,
BUS_SPACE_MAP_LINEAR, &crm_ioh))
panic("%s: can't map I/O space", __func__);
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/crmfb.c
--- a/sys/arch/sgimips/dev/crmfb.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/crmfb.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.39 2015/01/20 12:13:04 macallan Exp $ */
+/* $NetBSD: crmfb.c,v 1.40 2015/02/18 16:47:58 macallan Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -32,14 +32,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.39 2015/01/20 12:13:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.40 2015/02/18 16:47:58 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
-#define _SGIMIPS_BUS_DMA_PRIVATE
#include <machine/autoconf.h>
#include <sys/bus.h>
#include <machine/machtype.h>
@@ -262,7 +261,7 @@
ma = (struct mainbus_attach_args *)opaque;
- sc->sc_iot = SGIMIPS_BUS_SPACE_CRIME;
+ sc->sc_iot = normal_memt;
sc->sc_dmat = &sgimips_default_bus_dma_tag;
sc->sc_wsmode = WSDISPLAYIO_MODE_EMUL;
@@ -571,7 +570,7 @@
if (offset >= 0 && offset < (0x100000 * sc->sc_tiles_x)) {
pa = bus_dmamem_mmap(sc->sc_dmat, sc->sc_dma.segs,
sc->sc_dma.nsegs, offset, prot,
- BUS_DMA_WAITOK | BUS_DMA_COHERENT);
+ BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_PREFETCHABLE);
return pa;
}
#endif
@@ -588,8 +587,8 @@
if ((offset >= 0x15010000) && (offset < 0x15030000))
return bus_dmamem_mmap(sc->sc_dmat, sc->sc_dma.segs,
sc->sc_dma.nsegs,
- offset + (0x100000 * sc->sc_tiles_x) - 0x15010000,
- prot, BUS_DMA_WAITOK | BUS_DMA_COHERENT);
+ offset + (0x100000 * sc->sc_tiles_x) - 0x15010000, prot,
+ BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_PREFETCHABLE);
return -1;
}
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/ctl.c
--- a/sys/arch/sgimips/dev/ctl.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/ctl.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctl.c,v 1.3 2011/07/01 18:53:46 dyoung Exp $ */
+/* $NetBSD: ctl.c,v 1.4 2015/02/18 16:47:58 macallan Exp $ */
/*
* Copyright (c) 2009 Stephen M. Rumble
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ctl.c,v 1.3 2011/07/01 18:53:46 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ctl.c,v 1.4 2015/02/18 16:47:58 macallan Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -98,8 +98,8 @@
sc->sc_dev = self;
csc = sc;
- sc->iot = SGIMIPS_BUS_SPACE_NORMAL;
- if (bus_space_map(sc->iot, ma->ma_addr, 0,
+ sc->iot = normal_memt;
+ if (bus_space_map(sc->iot, ma->ma_addr, 0x10000 /* XXX */,
BUS_SPACE_MAP_LINEAR, &sc->ioh))
panic("ctl_attach: could not allocate memory\n");
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/dpclock.c
--- a/sys/arch/sgimips/dev/dpclock.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/dpclock.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dpclock.c,v 1.5 2014/11/20 16:34:26 christos Exp $ */
+/* $NetBSD: dpclock.c,v 1.6 2015/02/18 16:47:58 macallan Exp $ */
/*
* Copyright (c) 2001 Erik Reid
@@ -55,6 +55,7 @@
/* RTC registers */
bus_space_tag_t sc_rtct;
bus_space_handle_t sc_rtch;
+ int sc_offset;
};
static int dpclock_match(device_t, cfdata_t, void *);
@@ -87,6 +88,20 @@
}
static void
+writereg(struct dpclock_softc *sc, uint32_t reg, uint8_t val)
+{
+ bus_space_write_1(sc->sc_rtct, sc->sc_rtch,
+ (reg << 2) + sc->sc_offset, val);
+}
+
+static uint8_t
+readreg(struct dpclock_softc *sc, uint32_t reg)
+{
+ return bus_space_read_1(sc->sc_rtct, sc->sc_rtch,
+ (reg << 2) + sc->sc_offset);
+}
+
+static void
dpclock_attach(device_t parent, device_t self, void *aux)
{
struct dpclock_softc *sc = device_private(self);
@@ -95,14 +110,15 @@
printf("\n");
+ sc->sc_rtct = normal_memt;
/*
* All machines have one byte register per word. IP6/IP10 use
* the MSB, others the LSB.
*/
if (mach_type == MACH_SGI_IP12 || mach_type == MACH_SGI_IP20)
- sc->sc_rtct = SGIMIPS_BUS_SPACE_HPC;
+ sc->sc_offset = 3;
else
- sc->sc_rtct = SGIMIPS_BUS_SPACE_IP6_DPCLOCK;
+ sc->sc_offset = 0;
if ((err = bus_space_map(sc->sc_rtct, ma->ma_addr, 0x1ffff,
BUS_SPACE_MAP_LINEAR, &sc->sc_rtch)) != 0) {
@@ -131,14 +147,14 @@
u_int8_t regs[32];
s = splhigh();
- i = bus_space_read_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL);
+ i = readreg(sc, DP8573A_TIMESAVE_CTL);
j = i | DP8573A_TIMESAVE_CTL_EN;
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL, j);
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL, i);
+ writereg(sc, DP8573A_TIMESAVE_CTL, j);
+ writereg(sc, DP8573A_TIMESAVE_CTL, i);
splx(s);
for (i = 0; i < 32; i++)
- regs[i] = bus_space_read_1(sc->sc_rtct, sc->sc_rtch, i);
+ regs[i] = readreg(sc, i);
dt.dt_sec = bcdtobin(regs[DP8573A_SAVE_SEC]);
dt.dt_min = bcdtobin(regs[DP8573A_SAVE_MIN]);
@@ -194,14 +210,14 @@
clock_secs_to_ymdhms((time_t)(tv->tv_sec + (tv->tv_usec > 500000)),&dt);
s = splhigh();
- i = bus_space_read_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL);
+ i = readreg(sc, DP8573A_TIMESAVE_CTL);
j = i | DP8573A_TIMESAVE_CTL_EN;
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL, j);
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_TIMESAVE_CTL, i);
+ writereg(sc, DP8573A_TIMESAVE_CTL, j);
+ writereg(sc, DP8573A_TIMESAVE_CTL, i);
splx(s);
for (i = 0; i < 32; i++)
- regs[i] = bus_space_read_1(sc->sc_rtct, sc->sc_rtch, i);
+ regs[i] = readreg(sc, i);
regs[DP8573A_SUBSECOND] = 0;
regs[DP8573A_SECOND] = bintobcd(dt.dt_sec);
@@ -213,15 +229,14 @@
regs[DP8573A_YEAR] = bintobcd(TO_IRIX_YEAR(dt.dt_year));
s = splhigh();
- i = bus_space_read_1(sc->sc_rtct, sc->sc_rtch, DP8573A_RT_MODE);
+ i = readreg(sc, DP8573A_RT_MODE);
j = i & ~DP8573A_RT_MODE_CLKSS;
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_RT_MODE, j);
+ writereg(sc, DP8573A_RT_MODE, j);
for (i = 0; i < 10; i++)
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_COUNTERS +i,
- regs[DP8573A_COUNTERS + i]);
+ writereg(sc, DP8573A_COUNTERS +i, regs[DP8573A_COUNTERS + i]);
- bus_space_write_1(sc->sc_rtct, sc->sc_rtch, DP8573A_RT_MODE, i);
+ writereg(sc, DP8573A_RT_MODE, i);
splx(s);
return (0);
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/dsclock.c
--- a/sys/arch/sgimips/dev/dsclock.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/dsclock.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dsclock.c,v 1.6 2014/11/20 16:34:26 christos Exp $ */
+/* $NetBSD: dsclock.c,v 1.7 2015/02/18 16:47:58 macallan Exp $ */
/*
* Copyright (c) 2001 Rafal K. Boni
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dsclock.c,v 1.6 2014/11/20 16:34:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dsclock.c,v 1.7 2015/02/18 16:47:58 macallan Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -72,9 +72,9 @@
dsclock_match, dsclock_attach, NULL, NULL);
#define ds1286_write(sc, reg, datum) \
- bus_space_write_1((sc)->sc_rtct, (sc)->sc_rtch, (reg), (datum))
+ bus_space_write_1((sc)->sc_rtct, (sc)->sc_rtch, (reg << 2) + 3, (datum))
#define ds1286_read(sc, reg) \
- bus_space_read_1((sc)->sc_rtct, (sc)->sc_rtch, (reg))
+ bus_space_read_1((sc)->sc_rtct, (sc)->sc_rtch, (reg << 2) + 3)
static int
dsclock_match(device_t parent, cfdata_t cf, void *aux)
@@ -96,7 +96,7 @@
aprint_normal("\n");
- sc->sc_rtct = SGIMIPS_BUS_SPACE_HPC;
+ sc->sc_rtct = normal_memt;
if ((err = bus_space_map(sc->sc_rtct, ma->ma_addr, 0x1ffff,
BUS_SPACE_MAP_LINEAR, &sc->sc_rtch)) != 0) {
aprint_error_dev(self,
diff -r c3307b588930 -r 88279e6cbbf8 sys/arch/sgimips/dev/imc.c
--- a/sys/arch/sgimips/dev/imc.c Wed Feb 18 15:05:43 2015 +0000
+++ b/sys/arch/sgimips/dev/imc.c Wed Feb 18 16:47:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.33 2012/10/27 17:18:09 chs Exp $ */
+/* $NetBSD: imc.c,v 1.34 2015/02/18 16:47:58 macallan Exp $ */
/*
* Copyright (c) 2001 Rafal K. Boni
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.33 2012/10/27 17:18:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.34 2015/02/18 16:47:58 macallan Exp $");
Home |
Main Index |
Thread Index |
Old Index