Source-Changes-HG archive

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

[src/trunk]: src Add basic PCI support for amiga port.



details:   https://anonhg.NetBSD.org/src/rev/b90a44dc29d9
branches:  trunk
changeset: 767957:b90a44dc29d9
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Thu Aug 04 17:48:50 2011 +0000

description:
Add basic PCI support for amiga port.
Add missing bus_space(9) methods needed for MI PCI.
Add p5pb(4) - Phase5 PCI bridge driver (and the man page).
Add quirks table to zbus(4) - needed for p5pb.
Change approved by phx.

diffstat:

 share/man/man4/man4.amiga/Makefile            |    6 +-
 share/man/man4/man4.amiga/p5pb.4              |   80 +++++++
 sys/arch/amiga/amiga/amiga_bus_simple_1word.c |  197 +++++++++++++++++-
 sys/arch/amiga/amiga/autoconf.c               |   60 +++++-
 sys/arch/amiga/amiga/bus.c                    |   66 ++++++
 sys/arch/amiga/amiga/simple_busfuncs.c        |  208 +++++++++++++++++-
 sys/arch/amiga/conf/DRACO                     |    6 +-
 sys/arch/amiga/conf/GENERIC                   |   12 +-
 sys/arch/amiga/conf/GENERIC.in                |   10 +-
 sys/arch/amiga/conf/INSTALL                   |   12 +-
 sys/arch/amiga/conf/files.amiga               |   18 +-
 sys/arch/amiga/dev/zbus.c                     |   47 +++-
 sys/arch/amiga/include/bus.h                  |   77 ++++--
 sys/arch/amiga/include/pci_machdep.h          |  112 ++++++++++
 sys/arch/amiga/pci/p5pb.c                     |  281 ++++++++++++++++++++++++++
 sys/arch/amiga/pci/p5pbreg.h                  |   71 ++++++
 16 files changed, 1192 insertions(+), 71 deletions(-)

diffs (truncated from 1585 to 300 lines):

diff -r eb24230510a4 -r b90a44dc29d9 share/man/man4/man4.amiga/Makefile
--- a/share/man/man4/man4.amiga/Makefile        Thu Aug 04 15:40:20 2011 +0000
+++ b/share/man/man4/man4.amiga/Makefile        Thu Aug 04 17:48:50 2011 +0000
@@ -1,11 +1,11 @@
 #      from: @(#)Makefile      8.2 (Berkeley) 2/16/94
-#      $NetBSD: Makefile,v 1.17 2011/01/14 10:25:14 phx Exp $
+#      $NetBSD: Makefile,v 1.18 2011/08/04 17:48:50 rkujawa Exp $
 
 MAN=   afsc.4 ahsc.4 amidisplaycc.4 atzsc.4 autoconf.4 console.4 bah.4 \
        bppcsc.4 ed.4 es.4 fdc.4 grf.4 \
        grfcl.4 grfcv.4 grfcv3d.4 grfet.4 grfrh.4 grfrt.4 grful.4 \
-       gtsc.4 intro.4 ite.4 mem.4 mfcs.4 mgnsc.4 qn.4 ser.4 \
-       wesc.4 zssc.4
+       gtsc.4 intro.4 ite.4 mem.4 mfcs.4 mgnsc.4 p5pb.4 \ 
+       qn.4 ser.4 wesc.4 zssc.4
 MLINKS=        mem.4 kmem.4
 MANSUBDIR=/amiga
 
diff -r eb24230510a4 -r b90a44dc29d9 share/man/man4/man4.amiga/p5pb.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/man4.amiga/p5pb.4  Thu Aug 04 17:48:50 2011 +0000
@@ -0,0 +1,80 @@
+.\" $NetBSD: p5pb.4,v 1.1 2011/08/04 17:48:50 rkujawa Exp $
+.\"
+.\" Copyright (c) 2011 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.
+.\"
+.Dd July 26, 2011
+.Dt P5PB 4 amiga
+.Os
+.Sh NAME
+.Nm p5pb
+.Nd Phase5 PCI bridge driver
+.Sh SYNOPSIS
+.Cd "p5pb0 at zbus0"
+.Cd "pci* at p5pb?"
+.Cd "genfb* at pci?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the PCI bus present on BlizzardVisionPPC and 
+CyberVisionPPC graphics cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following hardware:
+.Bl -tag -width "BLIZZARDVISIONPPC" -offset indent
+.It Em BLIZZARDVISIONPPC
+Phase5 BlizzardVisionPPC graphics card.
+.El
+.Bl -tag -width "BLIZZARDVISIONPPC" -offset indent
+.It Em CYBERVISIONPPC
+Phase5 CyberVisionPPC graphics card.
+.El
+.Sh SEE ALSO
+.Xr pm2fb 4 ,
+.Xr genfb 4 ,
+.Xr pci 4
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Radoslaw Kujawa Aq radoslaw.kujawa%gmail.com@localhost .
+.Sh BUGS
+Current version of this driver depends on PCI bus setup and enumeration 
+done by the firmware. 
+.Pp
+The driver will not attach at all, if there is no AutoConfig entry 
+for CVPPC/BVPPC card (Zorro product ID 110). Some firmware revisions
+are known not to create this entry.
+.Pp
+It is not (yet) possible to use the CVPPC/BVPPC as a console.
diff -r eb24230510a4 -r b90a44dc29d9 sys/arch/amiga/amiga/amiga_bus_simple_1word.c
--- a/sys/arch/amiga/amiga/amiga_bus_simple_1word.c     Thu Aug 04 15:40:20 2011 +0000
+++ b/sys/arch/amiga/amiga/amiga_bus_simple_1word.c     Thu Aug 04 17:48:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amiga_bus_simple_1word.c,v 1.3 2008/04/28 20:23:12 martin Exp $ */
+/* $NetBSD: amiga_bus_simple_1word.c,v 1.4 2011/08/04 17:48:50 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -28,11 +28,202 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <machine/cpu.h>
+#include <machine/pte.h>
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_1word.c,v 1.3 2008/04/28 20:23:12 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_1word.c,v 1.4 2011/08/04 17:48:50 rkujawa Exp $");
 
-#define AMIGA_SIMPLE_BUS_STRIDE 1              /* 1 byte per word */
+#define AMIGA_SIMPLE_BUS_STRIDE 1              /* 1 byte per byte */
 #define AMIGA_SIMPLE_BUS_WORD_METHODS
+#define AMIGA_SIMPLE_BUS_LONGWORD_METHODS
 
 #include "simple_busfuncs.c"
+
+bsr(oabs(bsr4_swap_), u_int32_t);
+bsw(oabs(bsw4_swap_), u_int32_t);
+
+bsrm(oabs(bsrm2_swap_), u_int16_t);
+bswm(oabs(bswm2_swap_), u_int16_t);
+
+int oabs(bsm_absolute_)(bus_space_tag_t, bus_addr_t, bus_size_t, int,
+                       bus_space_handle_t *);
+
+/* ARGSUSED */
+int
+oabs(bsm_absolute_)(tag, address, size, flags, handlep)
+       bus_space_tag_t tag;
+       bus_addr_t address;
+       bus_size_t size;
+       int flags;
+       bus_space_handle_t *handlep;
+{
+       uint32_t pa = kvtop((void*) tag->base);
+       *handlep = tag->base + (address - pa) * AMIGA_SIMPLE_BUS_STRIDE;
+       return 0;
+}
+
+/* ARGSUSED */
+u_int32_t
+oabs(bsr4_swap_)(handle, offset)
+       bus_space_handle_t handle;
+       bus_size_t offset;
+{
+       volatile u_int32_t *p;
+       u_int32_t x;
+
+       p = (volatile u_int32_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+       x = *p;
+       amiga_bus_reorder_protect();
+       return bswap32(x);
+}
+
+/* ARGSUSED */
+void
+oabs(bsw4_swap_)(handle, offset, value)
+       bus_space_handle_t handle;
+       bus_size_t offset;
+       unsigned value;
+{
+       volatile u_int32_t *p;
+
+       p = (volatile u_int32_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+       *p = bswap32( (u_int32_t)value );
+       amiga_bus_reorder_protect();
+}
+
+/* ARGSUSED */
+void
+oabs(bsrm2_swap_)(bus_space_handle_t handle, bus_size_t offset,
+                       u_int16_t *pointer, bus_size_t count)
+{
+       volatile u_int16_t *p;
+
+       p = (volatile u_int16_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+
+       while (count > 0) {
+               *pointer++ = bswap16(*p);
+               amiga_bus_reorder_protect();
+               --count;
+       }
+}
+
+/* ARGSUSED */
+void
+oabs(bswm2_swap_)(bus_space_handle_t handle, bus_size_t offset,
+                       const u_int16_t *pointer, bus_size_t count)
+{
+        volatile u_int16_t *p;
+
+        p = (volatile u_int16_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+
+        while (count > 0) {
+                *p = bswap16(*pointer);
+                amiga_bus_reorder_protect();
+                ++pointer;
+                --count;
+        }
+}
+
+const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs = {
+
+       oabs(bsm_absolute_),
+       oabs(bsms_),
+       oabs(bsu_),
+       0,
+       0,
+
+       oabs(bsr1_),
+       oabs(bsw1_),
+       oabs(bsrm1_),
+       oabs(bswm1_),
+       oabs(bsrr1_),
+       oabs(bswr1_),
+       oabs(bssr1_),
+       oabs(bscr1_),
+
+       oabs(bsr2_),            /* XXX swap? */
+       oabs(bsw2_),            /* XXX swap? */
+       oabs(bsr2_),
+       oabs(bsw2_),
+       oabs(bsrm2_swap_),
+       oabs(bswm2_swap_),
+       oabs(bsrm2_),
+       oabs(bswm2_),
+       oabs(bsrr2_),           /* XXX swap? */
+       oabs(bswr2_),           /* XXX swap? */
+       oabs(bsrr2_),
+       oabs(bswr2_),
+       oabs(bssr2_),           /* XXX swap? */
+       oabs(bscr2_),           /* XXX swap? */
+
+       oabs(bsr4_swap_),
+       oabs(bsw4_swap_),
+       oabs(bsr4_),
+       oabs(bsw4_),
+       oabs(bsrm4_),           /* XXX swap? */
+       oabs(bswm4_),           /* XXX swap? */
+       oabs(bsrm4_),
+       oabs(bswm4_),
+       oabs(bsrr4_),           /* XXX swap? */
+       oabs(bswr4_),           /* XXX swap? */
+       oabs(bsrr4_),
+       oabs(bswr4_),
+       oabs(bssr4_),           /* XXX swap? */
+       oabs(bscr4_)            /* XXX swap? */
+
+};
+
+const struct amiga_bus_space_methods amiga_bus_stride_1swap = {
+
+       oabs(bsm_),
+       oabs(bsms_),
+       oabs(bsu_),
+       0,
+       0,
+
+       oabs(bsr1_),
+       oabs(bsw1_),
+       oabs(bsrm1_),
+       oabs(bswm1_),
+       oabs(bsrr1_),
+       oabs(bswr1_),
+       oabs(bssr1_),
+       oabs(bscr1_),
+
+       oabs(bsr2_),            /* XXX swap? */
+       oabs(bsw2_),            /* XXX swap? */
+       oabs(bsr2_),
+       oabs(bsw2_),
+       oabs(bsrm2_swap_),
+       oabs(bswm2_swap_),
+       oabs(bsrm2_),
+       oabs(bswm2_),
+       oabs(bsrr2_),           /* XXX swap? */
+       oabs(bswr2_),           /* XXX swap? */
+       oabs(bsrr2_),
+       oabs(bswr2_),
+       oabs(bssr2_),           /* XXX swap? */
+       oabs(bscr2_),           /* XXX swap? */
+
+       oabs(bsr4_swap_),



Home | Main Index | Thread Index | Old Index