diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2001-02-16 16:02:55 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2001-02-16 16:02:55 +0000 |
commit | aaf077f32059a3491fc80147d3893454b901c91c (patch) | |
tree | 0a8e1b478e412894a016ada6da533f9a83e68d3c /sys/arch/alpha/pci | |
parent | ecd82efc92808a3b9161e0fb0fb90d746ce8a310 (diff) |
Finish merging lca to become closer to current netbsd.
Diffstat (limited to 'sys/arch/alpha/pci')
-rw-r--r-- | sys/arch/alpha/pci/lca.c | 101 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca_bus_io.c | 7 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca_bus_mem.c | 7 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca_dma.c | 4 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca_pci.c | 13 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lcareg.h | 66 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lcavar.h | 4 |
7 files changed, 147 insertions, 55 deletions
diff --git a/sys/arch/alpha/pci/lca.c b/sys/arch/alpha/pci/lca.c index 3ff240cb90c..cc483a56559 100644 --- a/sys/arch/alpha/pci/lca.c +++ b/sys/arch/alpha/pci/lca.c @@ -1,6 +1,42 @@ -/* $OpenBSD: lca.c,v 1.9 2001/02/16 05:17:31 jason Exp $ */ +/* $OpenBSD: lca.c,v 1.10 2001/02/16 16:02:52 jason Exp $ */ /* $NetBSD: lca.c,v 1.14 1996/12/05 01:39:35 cgd Exp $ */ +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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. + */ + /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. @@ -33,6 +69,7 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/device.h> + #include <vm/vm.h> #include <machine/autoconf.h> @@ -48,6 +85,12 @@ #ifdef DEC_AXPPCI_33 #include <alpha/pci/pci_axppci_33.h> #endif +#ifdef DEC_ALPHABOOK1 +#include <alpha/pci/pci_alphabook1.h> +#endif +#ifdef DEC_EB66 +#include <alpha/pci/pci_eb66.h> +#endif int lcamatch __P((struct device *, void *, void *)); void lcaattach __P((struct device *, struct device *, void *)); @@ -62,6 +105,11 @@ struct cfdriver lca_cd = { int lcaprint __P((void *, const char *pnp)); +#if 0 +int lca_bus_get_window __P((int, int, + struct alpha_bus_space_translation *)); +#endif + /* There can be only one. */ int lcafound; struct lca_config lca_configuration; @@ -105,6 +153,15 @@ lca_init(lcp, mallocsafe) /* don't do these twice since they set up extents */ lcp->lc_iot = lca_bus_io_init(lcp); lcp->lc_memt = lca_bus_mem_init(lcp); + +#if 0 + /* + * We have 1 I/O window and 3 MEM windows. + */ + alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 1; + alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 3; + alpha_bus_get_window = lca_bus_get_window; +#endif } lcp->lc_mallocsafe = mallocsafe; @@ -164,12 +221,22 @@ lcaattach(parent, self, aux) lca_dma_init(lcp); - switch (hwrpb->rpb_type) { + switch (cputype) { #ifdef DEC_AXPPCI_33 case ST_DEC_AXPPCI_33: pci_axppci_33_pickintr(lcp); break; #endif +#ifdef DEC_ALPHABOOK1 + case ST_ALPHABOOK1: + pci_alphabook1_pickintr(lcp); + break; +#endif +#ifdef DEC_EB66 + case ST_EB66: + pci_eb66_pickintr(lcp); + break; +#endif default: panic("lcaattach: shouldn't be here, really..."); @@ -178,8 +245,8 @@ lcaattach(parent, self, aux) pba.pba_busname = "pci"; pba.pba_iot = lcp->lc_iot; pba.pba_memt = lcp->lc_memt; - pba.pba_dmat = alphabus_dma_get_tag(&lcp->lc_dmat_direct, - ALPHA_BUS_PCI); + pba.pba_dmat = + alphabus_dma_get_tag(&lcp->lc_dmat_direct, ALPHA_BUS_PCI); pba.pba_pc = &lcp->lc_pc; pba.pba_bus = 0; #ifdef notyet @@ -202,3 +269,29 @@ lcaprint(aux, pnp) printf(" bus %d", pba->pba_bus); return (UNCONF); } + +#if 0 +int +lca_bus_get_window(type, window, abst) + int type, window; + struct alpha_bus_space_translation *abst; +{ + struct lca_config *lcp = &lca_configuration; + bus_space_tag_t st; + + switch (type) { + case ALPHA_BUS_TYPE_PCI_IO: + st = &lcp->lc_iot; + break; + + case ALPHA_BUS_TYPE_PCI_MEM: + st = &lcp->lc_memt; + break; + + default: + panic("lca_bus_get_window"); + } + + return (alpha_bus_space_get_window(st, window, abst)); +} +#endif diff --git a/sys/arch/alpha/pci/lca_bus_io.c b/sys/arch/alpha/pci/lca_bus_io.c index 3d01c9c3c1d..72b99866771 100644 --- a/sys/arch/alpha/pci/lca_bus_io.c +++ b/sys/arch/alpha/pci/lca_bus_io.c @@ -1,5 +1,5 @@ -/* $OpenBSD: lca_bus_io.c,v 1.3 2001/02/06 19:26:39 art Exp $ */ -/* $NetBSD: lca_bus_io.c,v 1.1 1996/11/25 03:42:14 cgd Exp $ */ +/* $OpenBSD: lca_bus_io.c,v 1.4 2001/02/16 16:02:53 jason Exp $ */ +/* $NetBSD: lca_bus_io.c,v 1.8 1997/09/02 13:19:31 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -33,6 +33,7 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/device.h> + #include <vm/vm.h> #include <machine/bus.h> @@ -51,4 +52,4 @@ #define CHIP_IO_W1_SYS_START(v) LCA_PCI_SIO #define CHIP_IO_W1_SYS_END(v) (LCA_PCI_SIO + ((0x00ffffffUL + 1) << 5) - 1) -#include "pci_swiz_bus_io_chipdep.c" +#include <alpha/pci/pci_swiz_bus_io_chipdep.c> diff --git a/sys/arch/alpha/pci/lca_bus_mem.c b/sys/arch/alpha/pci/lca_bus_mem.c index 6bf0e859c40..e7b62800bb7 100644 --- a/sys/arch/alpha/pci/lca_bus_mem.c +++ b/sys/arch/alpha/pci/lca_bus_mem.c @@ -1,5 +1,5 @@ -/* $OpenBSD: lca_bus_mem.c,v 1.3 2001/02/06 19:26:39 art Exp $ */ -/* $NetBSD: lca_bus_mem.c,v 1.1 1996/11/25 03:42:15 cgd Exp $ */ +/* $OpenBSD: lca_bus_mem.c,v 1.4 2001/02/16 16:02:53 jason Exp $ */ +/* $NetBSD: lca_bus_mem.c,v 1.8 1997/09/02 13:19:32 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -33,6 +33,7 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/device.h> + #include <vm/vm.h> #include <machine/bus.h> @@ -71,4 +72,4 @@ #define CHIP_S_MEM_W2_SYS_END(v) \ (LCA_PCI_SPARSE + (0x08000000UL << 5) - 1) -#include "pci_swiz_bus_mem_chipdep.c" +#include <alpha/pci/pci_swiz_bus_mem_chipdep.c> diff --git a/sys/arch/alpha/pci/lca_dma.c b/sys/arch/alpha/pci/lca_dma.c index 080204f2dbd..f6be756b2ba 100644 --- a/sys/arch/alpha/pci/lca_dma.c +++ b/sys/arch/alpha/pci/lca_dma.c @@ -1,5 +1,5 @@ -/* $OpenBSD: lca_dma.c,v 1.1 2001/02/16 05:17:31 jason Exp $ */ -/* $NetBSD: lca_dma.c,v 1.13 2000/06/29 08:58:47 mrg Exp $ */ +/* $OpenBSD: lca_dma.c,v 1.2 2001/02/16 16:02:53 jason Exp $ */ +/* $NetBSD: lca_dma.c,v 1.13 2000/06/29 08:58:47 mrg Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. diff --git a/sys/arch/alpha/pci/lca_pci.c b/sys/arch/alpha/pci/lca_pci.c index e166c228a01..15575305774 100644 --- a/sys/arch/alpha/pci/lca_pci.c +++ b/sys/arch/alpha/pci/lca_pci.c @@ -1,5 +1,5 @@ -/* $OpenBSD: lca_pci.c,v 1.5 1997/01/24 19:57:44 niklas Exp $ */ -/* $NetBSD: lca_pci.c,v 1.7 1996/11/13 21:13:28 cgd Exp $ */ +/* $OpenBSD: lca_pci.c,v 1.6 2001/02/16 16:02:54 jason Exp $ */ +/* $NetBSD: lca_pci.c,v 1.13 1997/09/02 13:19:35 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -32,6 +32,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> + #include <vm/vm.h> #include <machine/autoconf.h> /* badaddr proto */ @@ -118,12 +119,10 @@ lca_conf_read(cpv, tag, offset) pcireg_t *datap, data; int s, secondary, device, ba; -#ifdef DIAGNOSTIC s = 0; /* XXX gcc -Wuninitialized */ -#endif /* secondary if bus # != 0 */ - pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0); + alpha_pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0); if (secondary) { s = splhigh(); alpha_mb(); @@ -174,12 +173,10 @@ lca_conf_write(cpv, tag, offset, data) pcireg_t *datap; int s, secondary, device; -#ifdef DIAGNOSTIC s = 0; /* XXX gcc -Wuninitialized */ -#endif /* secondary if bus # != 0 */ - pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0); + alpha_pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0); if (secondary) { s = splhigh(); alpha_mb(); diff --git a/sys/arch/alpha/pci/lcareg.h b/sys/arch/alpha/pci/lcareg.h index ef74361a430..c391631fbcf 100644 --- a/sys/arch/alpha/pci/lcareg.h +++ b/sys/arch/alpha/pci/lcareg.h @@ -1,11 +1,11 @@ -/* $OpenBSD: lcareg.h,v 1.6 2001/02/16 05:17:32 jason Exp $ */ -/* $NetBSD: lcareg.h,v 1.4 1996/11/23 06:41:00 cgd Exp $ */ +/* $OpenBSD: lcareg.h,v 1.7 2001/02/16 16:02:54 jason Exp $ */ +/* $NetBSD: lcareg.h,v 1.7 1997/06/06 23:54:31 thorpej Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. * - * Author: Jeffrey Hsu + * Authors: Jeffrey Hsu, Jason R. Thorpe * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright @@ -32,8 +32,8 @@ * 21066 chip registers */ -#define REGVAL(r) (*(int32_t *)ALPHA_PHYS_TO_K0SEG(r)) -#define REGVAL64(r) (*(int64_t *)ALPHA_PHYS_TO_K0SEG(r)) +#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) +#define REGVAL64(r) (*(volatile int64_t *)ALPHA_PHYS_TO_K0SEG(r)) /* * Base addresses @@ -51,21 +51,21 @@ #define LCA_IOC_CONF (LCA_IOC_BASE + 0x020) /* Configuration Cycle Type */ #define LCA_IOC_STAT0 (LCA_IOC_BASE + 0x040) /* Status 0 */ -#define IOC_STAT0_CMD 0x000000000000000fUL /* PCI command mask */ -#define IOC_STAT0_ERR 0x0000000000000010UL /* IOC error indicator R/W1C */ -#define IOC_STAT0_LOST 0x0000000000000020UL /* IOC lose error info R/W1C */ -#define IOC_STAT0_THIT 0x0000000000000040UL /* test hit */ -#define IOC_STAT0_TREF 0x0000000000000080UL /* test reference */ -#define IOC_STAT0_CODE 0x0000000000000700UL /* code mask */ -#define IOC_STAT0_CODESHIFT 8 -#define IOC_STAT0_P_NBR 0x00000000ffffe000UL /* page number mask */ +#define IOC_STAT0_CMD 0x000000000000000fUL /* PCI command mask */ +#define IOC_STAT0_ERR 0x0000000000000010UL /* IOC error indicator R/W1C */ +#define IOC_STAT0_LOST 0x0000000000000020UL /* IOC lose error info R/W1C */ +#define IOC_STAT0_THIT 0x0000000000000040UL /* test hit */ +#define IOC_STAT0_TREF 0x0000000000000080UL /* test reference */ +#define IOC_STAT0_CODE 0x0000000000000700UL /* code mask */ +#define IOC_STAT0_CODESHIFT 8 +#define IOC_STAT0_P_NBR 0x00000000ffffe000UL /* page number mask */ #define LCA_IOC_STAT1 (LCA_IOC_BASE + 0x060) /* Status 1 */ -#define IOC_STAT1_ADDR 0x00000000ffffffffUL /* PCI address mask */ +#define IOC_STAT1_ADDR 0x00000000ffffffffUL /* PCI address mask */ -#define LCA_IOC_TBIA (LCA_IOC_BASE + 0x080) /* TLB Invalidate All */ -#define LCA_IOC_TB_ENA (LCA_IOC_BASE + 0x0a0) /* TLB Enable */ -#define IOC_TB_ENA_TEN 0x0000000000000080UL +#define LCA_IOC_TBIA (LCA_IOC_BASE + 0x080) /* TLB Invalidate All */ +#define LCA_IOC_TB_ENA (LCA_IOC_BASE + 0x0a0) /* TLB Enable */ +#define IOC_TB_ENA_TEN 0x0000000000000080UL #define LCA_IOC_W_BASE0 (LCA_IOC_BASE + 0x100) /* Window Base */ #define LCA_IOC_W_MASK0 (LCA_IOC_BASE + 0x140) /* Window Mask */ @@ -75,22 +75,22 @@ #define LCA_IOC_W_MASK1 (LCA_IOC_BASE + 0x160) /* Window Mask */ #define LCA_IOC_W_T_BASE1 (LCA_IOC_BASE + 0x1a0) /* Translated Base */ -#define IOC_W_BASE_W_BASE 0x00000000fff00000UL /* Window base value */ -#define IOC_W_BASE_SG 0x0000000100000000UL /* Window uses SGMAPs */ -#define IOC_W_BASE_WEN 0x0000000200000000UL /* Window enable */ +#define IOC_W_BASE_W_BASE 0x00000000fff00000UL /* Window base value */ +#define IOC_W_BASE_SG 0x0000000100000000UL /* Window uses SGMAPs */ +#define IOC_W_BASE_WEN 0x0000000200000000UL /* Window enable */ -#define IOC_W_MASK_1M 0x0000000000000000UL /* 1MB window */ -#define IOC_W_MASK_2M 0x0000000000100000UL /* 2MB window */ -#define IOC_W_MASK_4M 0x0000000000300000UL /* 4MB window */ -#define IOC_W_MASK_8M 0x0000000000700000UL /* 8MB window */ -#define IOC_W_MASK_16M 0x0000000000f00000UL /* 16MB window */ -#define IOC_W_MASK_32M 0x0000000001f00000UL /* 32MB window */ -#define IOC_W_MASK_64M 0x0000000003f00000UL /* 64MB window */ -#define IOC_W_MASK_128M 0x0000000007f00000UL /* 128M window */ -#define IOC_W_MASK_256M 0x000000000ff00000UL /* 256M window */ -#define IOC_W_MASK_512M 0x000000001ff00000UL /* 512M window */ -#define IOC_W_MASK_1G 0x000000003ff00000UL /* 1GB window */ -#define IOC_W_MASK_2G 0x000000007ff00000UL /* 2GB window */ -#define IOC_W_MASK_4G 0x00000000fff00000UL /* 4GB window */ +#define IOC_W_MASK_1M 0x0000000000000000UL /* 1MB window */ +#define IOC_W_MASK_2M 0x0000000000100000UL /* 2MB window */ +#define IOC_W_MASK_4M 0x0000000000300000UL /* 4MB window */ +#define IOC_W_MASK_8M 0x0000000000700000UL /* 8MB window */ +#define IOC_W_MASK_16M 0x0000000000f00000UL /* 16MB window */ +#define IOC_W_MASK_32M 0x0000000001f00000UL /* 32MB window */ +#define IOC_W_MASK_64M 0x0000000003f00000UL /* 64MB window */ +#define IOC_W_MASK_128M 0x0000000007f00000UL /* 128M window */ +#define IOC_W_MASK_256M 0x000000000ff00000UL /* 256M window */ +#define IOC_W_MASK_512M 0x000000001ff00000UL /* 512M window */ +#define IOC_W_MASK_1G 0x000000003ff00000UL /* 1GB window */ +#define IOC_W_MASK_2G 0x000000007ff00000UL /* 2GB window */ +#define IOC_W_MASK_4G 0x00000000fff00000UL /* 4GB window */ #define IOC_W_T_BASE 0x00000000fffffc00UL /* page table base */ diff --git a/sys/arch/alpha/pci/lcavar.h b/sys/arch/alpha/pci/lcavar.h index 6b40ff3234f..b6a146c2b2e 100644 --- a/sys/arch/alpha/pci/lcavar.h +++ b/sys/arch/alpha/pci/lcavar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: lcavar.h,v 1.7 2001/02/16 05:17:32 jason Exp $ */ -/* $NetBSD: lcavar.h,v 1.5 1996/11/25 03:49:38 cgd Exp $ */ +/* $OpenBSD: lcavar.h,v 1.8 2001/02/16 16:02:54 jason Exp $ */ +/* $NetBSD: lcavar.h,v 1.7 1997/06/06 23:54:32 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. |