Add IBM405GPr "External Bus" driver.diff -r1.11 -r1.12 src/sys/arch/powerpc/conf/files.ibm4xx
(uebayasi)
--- src/sys/arch/powerpc/conf/files.ibm4xx 2010/03/18 13:58:38 1.11
+++ src/sys/arch/powerpc/conf/files.ibm4xx 2010/11/06 16:30:15 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.ibm4xx,v 1.11 2010/03/18 13:58:38 kiyohara Exp $ | 1 | # $NetBSD: files.ibm4xx,v 1.12 2010/11/06 16:30:15 uebayasi Exp $ | |
2 | # | 2 | # | |
3 | # IBM 4xx specific configuration info | 3 | # IBM 4xx specific configuration info | |
4 | 4 | |||
5 | include "arch/powerpc/fpu/files.fpu" | 5 | include "arch/powerpc/fpu/files.fpu" | |
6 | 6 | |||
7 | defflag opt_uic.h MULTIUIC | 7 | defflag opt_uic.h MULTIUIC | |
8 | file arch/powerpc/ibm4xx/intr.c | 8 | file arch/powerpc/ibm4xx/intr.c | |
9 | 9 | |||
10 | # Board Properties | 10 | # Board Properties | |
11 | file arch/powerpc/ibm4xx/board_prop.c | 11 | file arch/powerpc/ibm4xx/board_prop.c | |
12 | 12 | |||
13 | # Processor Local Bus | 13 | # Processor Local Bus | |
14 | device plb { [irq = -1] } | 14 | device plb { [irq = -1] } | |
@@ -59,13 +59,18 @@ include "dev/i2o/files.i2o" | @@ -59,13 +59,18 @@ include "dev/i2o/files.i2o" | |||
59 | include "dev/pci/files.pci" | 59 | include "dev/pci/files.pci" | |
60 | 60 | |||
61 | # On-chip PCI bridge | 61 | # On-chip PCI bridge | |
62 | device pchb : pcibus | 62 | device pchb : pcibus | |
63 | attach pchb at plb | 63 | attach pchb at plb | |
64 | file arch/powerpc/ibm4xx/pci/pchb.c pchb | 64 | file arch/powerpc/ibm4xx/pci/pchb.c pchb | |
65 | file arch/powerpc/ibm4xx/pci/pci_machdep.c pci | 65 | file arch/powerpc/ibm4xx/pci/pci_machdep.c pci | |
66 | file arch/powerpc/ibm4xx/dev/ibm405gp.c pchb | pci | 66 | file arch/powerpc/ibm4xx/dev/ibm405gp.c pchb | pci | |
67 | 67 | |||
68 | # On-chip IIC controller | 68 | # On-chip IIC controller | |
69 | device gpiic: i2cbus, i2c_bitbang | 69 | device gpiic: i2cbus, i2c_bitbang | |
70 | attach gpiic at opb | 70 | attach gpiic at opb | |
71 | file arch/powerpc/ibm4xx/dev/gpiic_opb.c gpiic | 71 | file arch/powerpc/ibm4xx/dev/gpiic_opb.c gpiic | |
72 | ||||
73 | # External bus | |||
74 | #device exb {[addr = -1]} | |||
75 | #attach exb at plb | |||
76 | #file arch/powerpc/ibm4xx/dev/exb.c exb |
/* $Id: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software developed for The NetBSD Foundation
* by Masao Uebayashi.
*
* 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/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $");
#include "locators.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/bus.h>
#include <powerpc/ibm4xx/dcr4xx.h>
#include <powerpc/ibm4xx/dev/exbvar.h>
struct exb_softc {
};
extern const struct exb_conf exb_confs[];
static int exb_match(device_t, struct cfdata *, void *);
static void exb_attach(device_t, struct device *, void *);
static int exb_print(void *, const char *);
CFATTACH_DECL_NEW(exb, sizeof(struct exb_softc), exb_match, exb_attach,
NULL, NULL);
static struct powerpc_bus_space exb_bus_space_tag =
{ _BUS_SPACE_BIG_ENDIAN | _BUS_SPACE_MEM_TYPE, 0 };
static int
exb_match(device_t parent, struct cfdata *cf, void *aux)
{
return 1;
}
static void
exb_attach(device_t parent, device_t self, void *aux)
{
const struct exb_conf *ec = exb_confs;
uint32_t ebc0_bNcr;
bus_addr_t base, size;
int locs[EXBCF_NLOCS];
printf("\n");
/* mtdcr needs a constant */
switch (device_unit(self)) {
case 0: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B0CR); break;
case 1: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B1CR); break;
case 2: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B2CR); break;
case 3: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B3CR); break;
case 4: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B4CR); break;
case 5: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B5CR); break;
case 6: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B6CR); break;
case 7: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B7CR); break;
}
ebc0_bNcr = mfdcr(DCR_EBC0_CFGDATA);
base = ebc0_bNcr & 0xfff00000;
size = 0x00100000 << ((ebc0_bNcr & 0x000e0000) >> 17);
exb_bus_space_tag.pbs_base = base;
exb_bus_space_tag.pbs_limit = base + size - 1;
while (ec->ec_name) {
struct exb_conf ec1;
locs[EXBCF_ADDR] = ec->ec_addr;
ec1 = *ec;
ec1.ec_bust = exb_get_bus_space_tag();
config_found_sm_loc(self, "exb", locs, &ec1, exb_print,
config_stdsubmatch);
ec++;
}
}
static int
exb_print(void *aux, const char *bus)
{
struct exb_conf *ec = aux;
if (bus)
return QUIET;
if (ec->ec_addr)
printf(" addr %"PRIxBUSADDR, ec->ec_addr);
return UNCONF;
}
bus_space_tag_t
exb_get_bus_space_tag(void)
{
static char ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
__attribute__((aligned(8)));
static int exb_bus_space_tag_inited;
if (exb_bus_space_tag_inited == 0) {
if (bus_space_init(&exb_bus_space_tag, "exbtag",
ex_storage, sizeof(ex_storage)))
panic("exb_attach: Failed to initialise exb_bus_space_tag");
exb_bus_space_tag_inited = 1;
}
return &exb_bus_space_tag;
}
/* $Id: exbvar.h,v 1.2 2010/11/06 16:30:15 uebayasi Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software developed for The NetBSD Foundation
* by Masao Uebayashi.
*
* 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.
*/
#ifndef _POWERPC_IBM4XX_DEV_EXBVAR_H_
#define _POWERPC_IBM4XX_DEV_EXBVAR_H_
struct exb_conf {
const char *ec_name;
bus_addr_t ec_addr;
bus_size_t ec_size;
bus_space_tag_t ec_bust;
};
bus_space_tag_t exb_get_bus_space_tag(void);
#endif /* _POWERPC_IBM4XX_DEV_EXBVAR_H_ */
--- src/sys/arch/powerpc/ibm4xx/dev/plb.c 2010/03/18 13:47:04 1.15
+++ src/sys/arch/powerpc/ibm4xx/dev/plb.c 2010/11/06 16:30:15 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: plb.c,v 1.15 2010/03/18 13:47:04 kiyohara Exp $ */ | 1 | /* $NetBSD: plb.c,v 1.16 2010/11/06 16:30:15 uebayasi Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2001 Wasabi Systems, Inc. | 4 | * Copyright 2001 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. | 7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -56,27 +56,27 @@ | @@ -56,27 +56,27 @@ | |||
56 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 56 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
57 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 57 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
58 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 58 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
59 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 59 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
60 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 60 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
62 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 62 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
63 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 63 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
64 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 64 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
65 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 65 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | #include <sys/cdefs.h> | 68 | #include <sys/cdefs.h> | |
69 | __KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.15 2010/03/18 13:47:04 kiyohara Exp $"); | 69 | __KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.16 2010/11/06 16:30:15 uebayasi Exp $"); | |
70 | 70 | |||
71 | #include "locators.h" | 71 | #include "locators.h" | |
72 | #include "emac.h" | 72 | #include "emac.h" | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/systm.h> | 75 | #include <sys/systm.h> | |
76 | #include <sys/device.h> | 76 | #include <sys/device.h> | |
77 | #include <sys/extent.h> | 77 | #include <sys/extent.h> | |
78 | #include <sys/malloc.h> | 78 | #include <sys/malloc.h> | |
79 | 79 | |||
80 | #define _POWERPC_BUS_DMA_PRIVATE | 80 | #define _POWERPC_BUS_DMA_PRIVATE | |
81 | #include <machine/bus.h> | 81 | #include <machine/bus.h> | |
82 | 82 | |||
@@ -90,26 +90,27 @@ __KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.15 | @@ -90,26 +90,27 @@ __KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.15 | |||
90 | */ | 90 | */ | |
91 | const struct plb_dev plb_devs [] = { | 91 | const struct plb_dev plb_devs [] = { | |
92 | /* IBM 405GP */ | 92 | /* IBM 405GP */ | |
93 | { IBM405GP, "cpu", }, | 93 | { IBM405GP, "cpu", }, | |
94 | { IBM405GP, "ecc", }, | 94 | { IBM405GP, "ecc", }, | |
95 | { IBM405GP, "opb", }, | 95 | { IBM405GP, "opb", }, | |
96 | { IBM405GP, "pchb", }, | 96 | { IBM405GP, "pchb", }, | |
97 | 97 | |||
98 | /* IBM 405GPr */ | 98 | /* IBM 405GPr */ | |
99 | { IBM405GPR, "cpu", }, | 99 | { IBM405GPR, "cpu", }, | |
100 | { IBM405GPR, "ecc", }, | 100 | { IBM405GPR, "ecc", }, | |
101 | { IBM405GPR, "opb", }, | 101 | { IBM405GPR, "opb", }, | |
102 | { IBM405GPR, "pchb", }, | 102 | { IBM405GPR, "pchb", }, | |
103 | { IBM405GPR, "exb", }, | |||
103 | 104 | |||
104 | /* AMCC 405EX / EXR */ | 105 | /* AMCC 405EX / EXR */ | |
105 | { AMCC405EX, "cpu", }, | 106 | { AMCC405EX, "cpu", }, | |
106 | { AMCC405EX, "ecc", }, | 107 | { AMCC405EX, "ecc", }, | |
107 | { AMCC405EX, "opb", }, | 108 | { AMCC405EX, "opb", }, | |
108 | { AMCC405EX, "pchb", }, | 109 | { AMCC405EX, "pchb", }, | |
109 | 110 | |||
110 | { 0, NULL } | 111 | { 0, NULL } | |
111 | }; | 112 | }; | |
112 | 113 | |||
113 | static int plb_match(struct device *, struct cfdata *, void *); | 114 | static int plb_match(struct device *, struct cfdata *, void *); | |
114 | static void plb_attach(struct device *, struct device *, void *); | 115 | static void plb_attach(struct device *, struct device *, void *); | |
115 | static int plb_print(void *, const char *); | 116 | static int plb_print(void *, const char *); |