Mon Jun 6 17:13:06 2011 UTC ()
CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
use bool when appropriate
some constification


(matt)
diff -r1.12 -r1.13 src/sys/arch/evbmips/malta/dev/gt.c
diff -r1.11 -r1.12 src/sys/arch/evbmips/malta/dev/mainbus.c
diff -r1.9 -r1.10 src/sys/arch/evbmips/malta/pci/pchb.c
diff -r1.7 -r1.8 src/sys/arch/evbppc/explora/dev/elb.c
diff -r1.10 -r1.11 src/sys/arch/evbppc/walnut/pci/pchb.c
diff -r1.9 -r1.10 src/sys/arch/hpcmips/tx/txioman.c
diff -r1.7 -r1.8 src/sys/arch/mips/alchemy/dev/auaudio.c
diff -r1.16 -r1.17 src/sys/arch/mipsco/obio/obio.c

cvs diff -r1.12 -r1.13 src/sys/arch/evbmips/malta/dev/gt.c (expand / switch to unified diff)

--- src/sys/arch/evbmips/malta/dev/gt.c 2011/05/17 17:34:49 1.12
+++ src/sys/arch/evbmips/malta/dev/gt.c 2011/06/06 17:13:05 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $ */ 1/* $NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 matt Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Wasabi Systems, Inc. 4 * Copyright 2002 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe and Simon Burge for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe 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
@@ -26,92 +26,90 @@ @@ -26,92 +26,90 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 matt Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/device.h> 43#include <sys/device.h>
44 44
45#include <dev/pci/pcivar.h> 45#include <dev/pci/pcivar.h>
46 46
47#include <evbmips/malta/maltareg.h> 47#include <evbmips/malta/maltareg.h>
48#include <evbmips/malta/maltavar.h> 48#include <evbmips/malta/maltavar.h>
49 49
50#include <evbmips/malta/dev/gtreg.h> 50#include <evbmips/malta/dev/gtreg.h>
51#include <evbmips/malta/dev/gtvar.h> 51#include <evbmips/malta/dev/gtvar.h>
52 52
53#include "pci.h" 53#include "pci.h"
54 54
55/* 55/*
56 * Galileo systems (so far) are always single-processor, so this is sufficient. 56 * Galileo systems (so far) are always single-processor, so this is sufficient.
57 */ 57 */
58#define PCI_CONF_LOCK(s) (s) = splhigh() 58#define PCI_CONF_LOCK(s) (s) = splhigh()
59#define PCI_CONF_UNLOCK(s) splx((s)) 59#define PCI_CONF_UNLOCK(s) splx((s))
60 60
61static void gt_attach_hook(struct device *, struct device *, 61static void gt_attach_hook(device_t, device_t, struct pcibus_attach_args *);
62 struct pcibus_attach_args *); 
63static int gt_bus_maxdevs(void *, int); 62static int gt_bus_maxdevs(void *, int);
64static pcitag_t gt_make_tag(void *, int, int, int); 63static pcitag_t gt_make_tag(void *, int, int, int);
65static void gt_decompose_tag(void *, pcitag_t, int *, int *, int *); 64static void gt_decompose_tag(void *, pcitag_t, int *, int *, int *);
66static pcireg_t gt_conf_read(void *, pcitag_t, int); 65static pcireg_t gt_conf_read(void *, pcitag_t, int);
67static void gt_conf_write(void *, pcitag_t, int, pcireg_t); 66static void gt_conf_write(void *, pcitag_t, int, pcireg_t);
68 67
69void 68void
70gt_pci_init(pci_chipset_tag_t pc, struct gt_config *mcp) 69gt_pci_init(pci_chipset_tag_t pc, struct gt_config *mcp)
71{ 70{
72 71
73 pc->pc_conf_v = mcp; 72 pc->pc_conf_v = mcp;
74 pc->pc_attach_hook = gt_attach_hook; 73 pc->pc_attach_hook = gt_attach_hook;
75 pc->pc_bus_maxdevs = gt_bus_maxdevs; 74 pc->pc_bus_maxdevs = gt_bus_maxdevs;
76 pc->pc_make_tag = gt_make_tag; 75 pc->pc_make_tag = gt_make_tag;
77 pc->pc_decompose_tag = gt_decompose_tag; 76 pc->pc_decompose_tag = gt_decompose_tag;
78 pc->pc_conf_read = gt_conf_read; 77 pc->pc_conf_read = gt_conf_read;
79 pc->pc_conf_write = gt_conf_write; 78 pc->pc_conf_write = gt_conf_write;
80} 79}
81 80
82static void 81static void
83gt_attach_hook(struct device *parent, struct device *self, 82gt_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
84 struct pcibus_attach_args *pba) 
85{ 83{
86 84
87 /* Nothing to do... */ 85 /* Nothing to do... */
88} 86}
89 87
90static int gt_match(struct device *, struct cfdata *, void *); 88static int gt_match(device_t, cfdata_t, void *);
91static void gt_attach(struct device *, struct device *, void *); 89static void gt_attach(device_t, device_t, void *);
92static int gt_print(void *aux, const char *pnp); 90static int gt_print(void *aux, const char *pnp);
93 91
94CFATTACH_DECL(gt, sizeof(struct device), 92CFATTACH_DECL_NEW(gt, 0,
95 gt_match, gt_attach, NULL, NULL); 93 gt_match, gt_attach, NULL, NULL);
96 94
97static int 95static int
98gt_match(struct device *parent, struct cfdata *match, void *aux) 96gt_match(device_t parent, cfdata_t match, void *aux)
99{ 97{
100 return 1; 98 return 1;
101} 99}
102 100
103static void 101static void
104gt_attach(struct device *parent, struct device *self, void *aux) 102gt_attach(device_t parent, device_t self, void *aux)
105{ 103{
106 struct malta_config *mcp = &malta_configuration; 104 struct malta_config *mcp = &malta_configuration;
107 struct pcibus_attach_args pba; 105 struct pcibus_attach_args pba;
108 106
109 printf("\n"); 107 printf("\n");
110 108
111#if NPCI > 0 109#if NPCI > 0
112 pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; 110 pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY;
113 pba.pba_bus = 0; 111 pba.pba_bus = 0;
114 pba.pba_bridgetag = NULL; 112 pba.pba_bridgetag = NULL;
115 pba.pba_iot = &mcp->mc_iot; 113 pba.pba_iot = &mcp->mc_iot;
116 pba.pba_memt = &mcp->mc_memt; 114 pba.pba_memt = &mcp->mc_memt;
117 pba.pba_dmat = &mcp->mc_pci_dmat; /* pci_bus_dma_tag */ 115 pba.pba_dmat = &mcp->mc_pci_dmat; /* pci_bus_dma_tag */

cvs diff -r1.11 -r1.12 src/sys/arch/evbmips/malta/dev/mainbus.c (expand / switch to unified diff)

--- src/sys/arch/evbmips/malta/dev/mainbus.c 2009/03/14 15:36:06 1.11
+++ src/sys/arch/evbmips/malta/dev/mainbus.c 2011/06/06 17:13:05 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $ */ 1/* $NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Wasabi Systems, Inc. 4 * Copyright 2002 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Simon Burge for Wasabi Systems, Inc. 7 * Written by 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
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $");
40 40
41#include "opt_pci.h" 41#include "opt_pci.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/device.h> 45#include <sys/device.h>
46#if defined(PCI_NETBSD_CONFIGURE) 46#if defined(PCI_NETBSD_CONFIGURE)
47#include <sys/extent.h> 47#include <sys/extent.h>
48#include <sys/malloc.h> 48#include <sys/malloc.h>
49#endif 49#endif
50 50
51#include <dev/pci/pcivar.h> 51#include <dev/pci/pcivar.h>
52#if defined(PCI_NETBSD_CONFIGURE) 52#if defined(PCI_NETBSD_CONFIGURE)
@@ -57,79 +57,78 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v  @@ -57,79 +57,78 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v
57#include <mips/cpuregs.h> 57#include <mips/cpuregs.h>
58 58
59#include <evbmips/malta/autoconf.h> 59#include <evbmips/malta/autoconf.h>
60#include <evbmips/malta/maltareg.h> 60#include <evbmips/malta/maltareg.h>
61#include <evbmips/malta/maltavar.h> 61#include <evbmips/malta/maltavar.h>
62 62
63#if defined(PCI_NETBSD_ENABLE_IDE) 63#if defined(PCI_NETBSD_ENABLE_IDE)
64#include <dev/pci/pciide_piix_reg.h> 64#include <dev/pci/pciide_piix_reg.h>
65#endif /* PCI_NETBSD_ENABLE_IDE */ 65#endif /* PCI_NETBSD_ENABLE_IDE */
66 66
67#include "locators.h" 67#include "locators.h"
68#include "pci.h" 68#include "pci.h"
69 69
70static int mainbus_match(struct device *, struct cfdata *, void *); 70static int mainbus_match(device_t, cfdata_t, void *);
71static void mainbus_attach(struct device *, struct device *, void *); 71static void mainbus_attach(device_t, device_t, void *);
72static int mainbus_submatch(struct device *, struct cfdata *, 72static int mainbus_submatch(device_t, cfdata_t, const int *, void *);
73 const int *, void *); 
74static int mainbus_print(void *, const char *); 73static int mainbus_print(void *, const char *);
75 74
76CFATTACH_DECL(mainbus, sizeof(struct device), 75CFATTACH_DECL_NEW(mainbus, 0,
77 mainbus_match, mainbus_attach, NULL, NULL); 76 mainbus_match, mainbus_attach, NULL, NULL);
78 77
79/* There can be only one. */ 78/* There can be only one. */
80int mainbus_found; 79bool mainbus_found;
81 80
82struct mainbusdev { 81struct mainbusdev {
83 const char *md_name; 82 const char *md_name;
84 bus_addr_t md_addr; 83 bus_addr_t md_addr;
85 int md_intr; 84 int md_intr;
86}; 85};
87 86
88struct mainbusdev mainbusdevs[] = { 87const struct mainbusdev mainbusdevs[] = {
89 { "cpu", -1, -1 }, 88 { "cpu", -1, -1 },
90 { "gt", MALTA_CORECTRL_BASE, -1 }, 89 { "gt", MALTA_CORECTRL_BASE, -1 },
91 { "com", MALTA_CBUSUART, MALTA_CBUSUART_INTR }, 90 { "com", MALTA_CBUSUART, MALTA_CBUSUART_INTR },
92 { "i2c", MALTA_I2C_BASE, -1 }, 91 { "i2c", MALTA_I2C_BASE, -1 },
93 { "gpio", MALTA_GPIO_BASE, -1 }, 92 { "gpio", MALTA_GPIO_BASE, -1 },
94 { NULL, 0, 0 }, 93 { NULL, 0, 0 },
95}; 94};
96 95
97static int 96static int
98mainbus_match(struct device *parent, struct cfdata *match, void *aux) 97mainbus_match(device_t parent, cfdata_t match, void *aux)
99{ 98{
100 99
101 if (mainbus_found) 100 if (mainbus_found)
102 return (0); 101 return (0);
103 102
104 return (1); 103 return (1);
105} 104}
106 105
107static void 106static void
108mainbus_attach(struct device *parent, struct device *self, void *aux) 107mainbus_attach(device_t parent, device_t self, void *aux)
109{ 108{
110 struct mainbus_attach_args ma; 109 struct mainbus_attach_args ma;
111 struct mainbusdev *md; 110 const struct mainbusdev *md;
112#if defined(PCI_NETBSD_CONFIGURE) 111#if defined(PCI_NETBSD_CONFIGURE)
113 struct extent *ioext, *memext; 112 struct extent *ioext, *memext;
114#endif 113#endif
115#if defined(PCI_NETBSD_ENABLE_IDE) 114#if defined(PCI_NETBSD_ENABLE_IDE)
116 struct malta_config *mcp = &malta_configuration; 115 struct malta_config *mcp = &malta_configuration;
117 pci_chipset_tag_t pc = &mcp->mc_pc; 116 pci_chipset_tag_t pc = &mcp->mc_pc;
118 pcitag_t idetag; 117 pcitag_t idetag;
119 pcireg_t idetim; 118 pcireg_t idetim;
120#endif 119#endif
121 120
122 mainbus_found = 1; 121 mainbus_found = true;
123 printf("\n"); 122 printf("\n");
124 123
125#if defined(PCI_NETBSD_CONFIGURE) 124#if defined(PCI_NETBSD_CONFIGURE)
126 ioext = extent_create("pciio", 0x00001000, 0x0000efff, 125 ioext = extent_create("pciio", 0x00001000, 0x0000efff,
127 M_DEVBUF, NULL, 0, EX_NOWAIT); 126 M_DEVBUF, NULL, 0, EX_NOWAIT);
128 memext = extent_create("pcimem", MALTA_PCIMEM1_BASE, 127 memext = extent_create("pcimem", MALTA_PCIMEM1_BASE,
129 MALTA_PCIMEM1_BASE + MALTA_PCIMEM1_SIZE, 128 MALTA_PCIMEM1_BASE + MALTA_PCIMEM1_SIZE,
130 M_DEVBUF, NULL, 0, EX_NOWAIT); 129 M_DEVBUF, NULL, 0, EX_NOWAIT);
131 130
132 pci_configure_bus(pc, ioext, memext, NULL, 0, mips_dcache_align); 131 pci_configure_bus(pc, ioext, memext, NULL, 0, mips_dcache_align);
133 extent_destroy(ioext); 132 extent_destroy(ioext);
134 extent_destroy(memext); 133 extent_destroy(memext);
135#endif /* PCI_NETBSD_CONFIGURE */ 134#endif /* PCI_NETBSD_CONFIGURE */
@@ -152,27 +151,27 @@ mainbus_attach(struct device *parent, st @@ -152,27 +151,27 @@ mainbus_attach(struct device *parent, st
152 idetag = pci_make_tag(pc, 0, 10, 1); 151 idetag = pci_make_tag(pc, 0, 10, 1);
153 pci_conf_write(pc, idetag, PIIX_IDETIM, idetim); 152 pci_conf_write(pc, idetag, PIIX_IDETIM, idetim);
154#endif 153#endif
155 for (md = mainbusdevs; md->md_name != NULL; md++) { 154 for (md = mainbusdevs; md->md_name != NULL; md++) {
156 ma.ma_name = md->md_name; 155 ma.ma_name = md->md_name;
157 ma.ma_addr = md->md_addr; 156 ma.ma_addr = md->md_addr;
158 ma.ma_intr = md->md_intr; 157 ma.ma_intr = md->md_intr;
159 (void) config_found_sm_loc(self, "mainbus", NULL, &ma, 158 (void) config_found_sm_loc(self, "mainbus", NULL, &ma,
160 mainbus_print, mainbus_submatch); 159 mainbus_print, mainbus_submatch);
161 } 160 }
162} 161}
163 162
164static int 163static int
165mainbus_submatch(struct device *parent, struct cfdata *cf, 164mainbus_submatch(device_t parent, cfdata_t cf,
166 const int *ldesc, void *aux) 165 const int *ldesc, void *aux)
167{ 166{
168 struct mainbus_attach_args *ma = aux; 167 struct mainbus_attach_args *ma = aux;
169 168
170 if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT && 169 if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT &&
171 cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr) 170 cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr)
172 return (0); 171 return (0);
173 172
174 return (config_match(parent, cf, aux)); 173 return (config_match(parent, cf, aux));
175} 174}
176 175
177static int 176static int
178mainbus_print(void *aux, const char *pnp) 177mainbus_print(void *aux, const char *pnp)

cvs diff -r1.9 -r1.10 src/sys/arch/evbmips/malta/pci/pchb.c (expand / switch to unified diff)

--- src/sys/arch/evbmips/malta/pci/pchb.c 2006/08/22 21:42:19 1.9
+++ src/sys/arch/evbmips/malta/pci/pchb.c 2011/06/06 17:13:05 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $ */ 1/* $NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Wasabi Systems, Inc. 4 * Copyright 2002 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Simon Burge for Wasabi Systems, Inc. 7 * Written by 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
@@ -26,73 +26,73 @@ @@ -26,73 +26,73 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44 44
45#include <dev/pci/pcivar.h> 45#include <dev/pci/pcivar.h>
46#include <dev/pci/pcidevs.h> 46#include <dev/pci/pcidevs.h>
47 47
48static int pchb_match(struct device *, struct cfdata *, void *); 48static int pchb_match(device_t, cfdata_t, void *);
49static void pchb_attach(struct device *, struct device *, void *); 49static void pchb_attach(device_t, device_t, void *);
50 50
51CFATTACH_DECL(pchb, sizeof(struct device), 51CFATTACH_DECL_NEW(pchb, 0,
52 pchb_match, pchb_attach, NULL, NULL); 52 pchb_match, pchb_attach, NULL, NULL);
53 53
54static int pcifound = 0; 54static bool pcifound;
55 55
56static int 56static int
57pchb_match(struct device *parent, struct cfdata *match, void *aux) 57pchb_match(device_t parent, cfdata_t match, void *aux)
58{ 58{
59 struct pci_attach_args *pa = aux; 59 struct pci_attach_args *pa = aux;
60 60
61 /* 61 /*
62 * Match all known PCI host chipsets. 62 * Match all known PCI host chipsets.
63 */ 63 */
64 if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE && 64 if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
65 PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) { 65 PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) {
66 switch (PCI_VENDOR(pa->pa_id)) { 66 switch (PCI_VENDOR(pa->pa_id)) {
67 case PCI_VENDOR_MARVELL: 67 case PCI_VENDOR_MARVELL:
68 switch (PCI_PRODUCT(pa->pa_id)) { 68 switch (PCI_PRODUCT(pa->pa_id)) {
69 case PCI_PRODUCT_MARVELL_GT64120: 69 case PCI_PRODUCT_MARVELL_GT64120:
70 return (!pcifound); 70 return (!pcifound);
71 } 71 }
72 break; 72 break;
73 } 73 }
74 } 74 }
75 return (0); 75 return (0);
76} 76}
77 77
78static void 78static void
79pchb_attach(struct device *parent, struct device *self, void *aux) 79pchb_attach(device_t parent, device_t self, void *aux)
80{ 80{
81 struct pci_attach_args *pa = aux; 81 struct pci_attach_args *pa = aux;
82 char devinfo[256]; 82 char devinfo[256];
83 83
84 printf("\n"); 84 printf("\n");
85 pcifound++; 85 pcifound = true;
86 86
87 /* 87 /*
88 * All we do is print out a description. Eventually, we 88 * All we do is print out a description. Eventually, we
89 * might want to add code that does something that's 89 * might want to add code that does something that's
90 * possibly chipset-specific. 90 * possibly chipset-specific.
91 */ 91 */
92 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL && 92 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL &&
93 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MARVELL_GT64120) { 93 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MARVELL_GT64120) {
94 /* Bah, same product ID... */ 94 /* Bah, same product ID... */
95 95
96 /* 96 /*
97 * XXX: Is the >= 0x10 test correct? The '120 doco 97 * XXX: Is the >= 0x10 test correct? The '120 doco
98 * lists rev == 0x02 and the '120A doco lists 98 * lists rev == 0x02 and the '120A doco lists

cvs diff -r1.7 -r1.8 src/sys/arch/evbppc/explora/dev/elb.c (expand / switch to unified diff)

--- src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 16:42:17 1.7
+++ src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 17:13:06 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $ */ 1/* $NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Juergen Hannken-Illjes. 8 * by Juergen Hannken-Illjes.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/conf.h> 36#include <sys/conf.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/extent.h> 39#include <sys/extent.h>
40 40
41#include <machine/explora.h> 41#include <machine/explora.h>
42#define _POWERPC_BUS_DMA_PRIVATE 42#define _POWERPC_BUS_DMA_PRIVATE
43#include <machine/bus.h> 43#include <machine/bus.h>
44 44
45#include <powerpc/ibm4xx/dcr403cgx.h> 45#include <powerpc/ibm4xx/dcr403cgx.h>
46 46
@@ -54,63 +54,64 @@ struct elb_dev { @@ -54,63 +54,64 @@ struct elb_dev {
54 bus_space_tag_t elb_bt; 54 bus_space_tag_t elb_bt;
55}; 55};
56 56
57static int elb_match(device_t, cfdata_t, void *); 57static int elb_match(device_t, cfdata_t, void *);
58static void elb_attach(device_t, device_t, void *); 58static void elb_attach(device_t, device_t, void *);
59static int elb_print(void *, const char *); 59static int elb_print(void *, const char *);
60 60
61static struct powerpc_bus_space elb_tag = { 61static struct powerpc_bus_space elb_tag = {
62 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE | 1, /* stride 1 */ 62 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE | 1, /* stride 1 */
63 0x00000000, 63 0x00000000,
64 BASE_PCKBC, 64 BASE_PCKBC,
65 BASE_PCKBC + 0x6ff 65 BASE_PCKBC + 0x6ff
66}; 66};
67static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] 
68 __attribute__((aligned(8))); 
69static int elb_tag_init_done; 
70 
71static struct powerpc_bus_space elb_fb_tag = { 67static struct powerpc_bus_space elb_fb_tag = {
72 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, 68 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE,
73 0x00000000, 69 0x00000000,
74 BASE_FB, 70 BASE_FB,
75 BASE_FB2 + SIZE_FB - 1 71 BASE_FB2 + SIZE_FB - 1
76}; 72};
 73
 74static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
 75 __attribute__((aligned(8)));
77static char elbfb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] 76static char elbfb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
78 __attribute__((aligned(8))); 77 __attribute__((aligned(8)));
79static int elbfb_tag_init_done; 78
 79static bool elb_tag_init_done;
 80static bool elbfb_tag_init_done;
80 81
81/* 82/*
82 * DMA struct, nothing special. 83 * DMA struct, nothing special.
83 */ 84 */
84static struct powerpc_bus_dma_tag elb_bus_dma_tag = { 85static struct powerpc_bus_dma_tag elb_bus_dma_tag = {
85 0, /* _bounce_thresh */ 86 0, /* _bounce_thresh */
86 _bus_dmamap_create,  87 _bus_dmamap_create,
87 _bus_dmamap_destroy, 88 _bus_dmamap_destroy,
88 _bus_dmamap_load, 89 _bus_dmamap_load,
89 _bus_dmamap_load_mbuf, 90 _bus_dmamap_load_mbuf,
90 _bus_dmamap_load_uio, 91 _bus_dmamap_load_uio,
91 _bus_dmamap_load_raw, 92 _bus_dmamap_load_raw,
92 _bus_dmamap_unload, 93 _bus_dmamap_unload,
93 _bus_dmamap_sync, 94 _bus_dmamap_sync,
94 _bus_dmamem_alloc, 95 _bus_dmamem_alloc,
95 _bus_dmamem_free, 96 _bus_dmamem_free,
96 _bus_dmamem_map, 97 _bus_dmamem_map,
97 _bus_dmamem_unmap, 98 _bus_dmamem_unmap,
98 _bus_dmamem_mmap, 99 _bus_dmamem_mmap,
99 _bus_dma_phys_to_bus_mem_generic, 100 _bus_dma_phys_to_bus_mem_generic,
100 _bus_dma_bus_mem_to_phys_generic, 101 _bus_dma_bus_mem_to_phys_generic,
101}; 102};
102 103
103static struct elb_dev elb_devs[] = { 104static const struct elb_dev elb_devs[] = {
104 { "cpu", 0, 0, -1, NULL }, 105 { "cpu", 0, 0, -1, NULL },
105 { "pckbc", BASE_PCKBC, BASE_PCKBC2, 31, &elb_tag }, 106 { "pckbc", BASE_PCKBC, BASE_PCKBC2, 31, &elb_tag },
106 { "com", BASE_COM, 0, 30, &elb_tag }, 107 { "com", BASE_COM, 0, 30, &elb_tag },
107 { "lpt", BASE_LPT, 0, -1, &elb_tag }, 108 { "lpt", BASE_LPT, 0, -1, &elb_tag },
108 { "fb", BASE_FB, BASE_FB2, -1, &elb_fb_tag }, 109 { "fb", BASE_FB, BASE_FB2, -1, &elb_fb_tag },
109 { "le", BASE_LE, 0, 28, &elb_fb_tag }, 110 { "le", BASE_LE, 0, 28, &elb_fb_tag },
110}; 111};
111 112
112CFATTACH_DECL_NEW(elb, 0, 113CFATTACH_DECL_NEW(elb, 0,
113 elb_match, elb_attach, NULL, NULL); 114 elb_match, elb_attach, NULL, NULL);
114 115
115/* 116/*
116 * Probe for the elb; always succeeds. 117 * Probe for the elb; always succeeds.
@@ -118,36 +119,37 @@ CFATTACH_DECL_NEW(elb, 0, @@ -118,36 +119,37 @@ CFATTACH_DECL_NEW(elb, 0,
118static int 119static int
119elb_match(device_t parent, cfdata_t cf, void *aux) 120elb_match(device_t parent, cfdata_t cf, void *aux)
120{ 121{
121 return (1); 122 return (1);
122} 123}
123 124
124/* 125/*
125 * Attach the Explora local bus. 126 * Attach the Explora local bus.
126 */ 127 */
127static void 128static void
128elb_attach(device_t parent, device_t self, void *aux) 129elb_attach(device_t parent, device_t self, void *aux)
129{ 130{
130 struct elb_attach_args eaa; 131 struct elb_attach_args eaa;
131 int i; 132 const struct elb_dev *elb;
 133 size_t i;
132 134
133 printf("\n"); 135 printf("\n");
134 for (i = 0; i < sizeof(elb_devs)/sizeof(elb_devs[0]); i++) { 136 for (i = 0, elb = elb_devs; i < __arraycount(elb_devs); i++, elb++) {
135 eaa.elb_name = elb_devs[i].elb_name; 137 eaa.elb_name = elb->elb_name;
136 eaa.elb_bt = elb_get_bus_space_tag(elb_devs[i].elb_addr); 138 eaa.elb_bt = elb_get_bus_space_tag(elb->elb_addr);
137 eaa.elb_dmat = &elb_bus_dma_tag; 139 eaa.elb_dmat = &elb_bus_dma_tag;
138 eaa.elb_base = elb_devs[i].elb_addr; 140 eaa.elb_base = elb->elb_addr;
139 eaa.elb_base2 = elb_devs[i].elb_addr2; 141 eaa.elb_base2 = elb->elb_addr2;
140 eaa.elb_irq = elb_devs[i].elb_irq; 142 eaa.elb_irq = elb->elb_irq;
141 143
142 (void) config_found(self, &eaa, elb_print); 144 (void) config_found(self, &eaa, elb_print);
143 } 145 }
144} 146}
145 147
146static int 148static int
147elb_print(void *aux, const char *pnp) 149elb_print(void *aux, const char *pnp)
148{ 150{
149 struct elb_attach_args *eaa = aux; 151 struct elb_attach_args *eaa = aux;
150 152
151 if (pnp) 153 if (pnp)
152 aprint_normal("%s at %s", eaa->elb_name, pnp); 154 aprint_normal("%s at %s", eaa->elb_name, pnp);
153 if (eaa->elb_irq != -1) 155 if (eaa->elb_irq != -1)
@@ -156,27 +158,27 @@ elb_print(void *aux, const char *pnp) @@ -156,27 +158,27 @@ elb_print(void *aux, const char *pnp)
156 return (UNCONF); 158 return (UNCONF);
157} 159}
158 160
159bus_space_tag_t 161bus_space_tag_t
160elb_get_bus_space_tag(bus_addr_t addr) 162elb_get_bus_space_tag(bus_addr_t addr)
161{ 163{
162 164
163 if ((addr & 0xff000000) == 0x74000000) { 165 if ((addr & 0xff000000) == 0x74000000) {
164 if (!elb_tag_init_done) { 166 if (!elb_tag_init_done) {
165 if (bus_space_init(&elb_tag, "elbtag", 167 if (bus_space_init(&elb_tag, "elbtag",
166 elb_ex_storage, sizeof(elb_ex_storage))) 168 elb_ex_storage, sizeof(elb_ex_storage)))
167 panic("elb_get_bus_space_tag: elb_tag"); 169 panic("elb_get_bus_space_tag: elb_tag");
168 170
169 elb_tag_init_done = 1; 171 elb_tag_init_done = true;
170 } 172 }
171 return (&elb_tag); 173 return (&elb_tag);
172 } else { 174 } else {
173 if (!elbfb_tag_init_done) { 175 if (!elbfb_tag_init_done) {
174 if (bus_space_init(&elb_fb_tag, "elbfbtag", 176 if (bus_space_init(&elb_fb_tag, "elbfbtag",
175 elbfb_ex_storage, sizeof(elbfb_ex_storage))) 177 elbfb_ex_storage, sizeof(elbfb_ex_storage)))
176 panic("elb_get_bus_space_tag: elb_fb_tag"); 178 panic("elb_get_bus_space_tag: elb_fb_tag");
177 179
178 elbfb_tag_init_done = 1; 180 elbfb_tag_init_done = true;
179 } 181 }
180 return (&elb_fb_tag); 182 return (&elb_fb_tag);
181 } 183 }
182} 184}

cvs diff -r1.10 -r1.11 src/sys/arch/evbppc/walnut/pci/Attic/pchb.c (expand / switch to unified diff)

--- src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 16:42:18 1.10
+++ src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 17:13:06 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $ */ 1/* $NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $");
33 33
34#include "pci.h" 34#include "pci.h"
35#include "opt_pci.h" 35#include "opt_pci.h"
36 36
37#include <sys/types.h> 37#include <sys/types.h>
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/extent.h> 41#include <sys/extent.h>
42#include <sys/malloc.h> 42#include <sys/malloc.h>
43 43
44#define _IBM4XX_BUS_DMA_PRIVATE 44#define _IBM4XX_BUS_DMA_PRIVATE
45#include <machine/walnut.h> 45#include <machine/walnut.h>
@@ -49,27 +49,27 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.1 @@ -49,27 +49,27 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.1
49 49
50#include <dev/pci/pcivar.h> 50#include <dev/pci/pcivar.h>
51#include <dev/pci/pcireg.h> 51#include <dev/pci/pcireg.h>
52#include <dev/pci/pcidevs.h> 52#include <dev/pci/pcidevs.h>
53#include <dev/pci/pciconf.h> 53#include <dev/pci/pciconf.h>
54 54
55static int pchbmatch(device_t, cfdata_t, void *); 55static int pchbmatch(device_t, cfdata_t, void *);
56static void pchbattach(device_t, device_t, void *); 56static void pchbattach(device_t, device_t, void *);
57static int pchbprint(void *, const char *); 57static int pchbprint(void *, const char *);
58 58
59CFATTACH_DECL_NEW(pchb, 0, 59CFATTACH_DECL_NEW(pchb, 0,
60 pchbmatch, pchbattach, NULL, NULL); 60 pchbmatch, pchbattach, NULL, NULL);
61 61
62static int pcifound = 0; 62static bool pcifound;
63 63
64/* IO window located @ e8000000 and maps to 0-0xffff */ 64/* IO window located @ e8000000 and maps to 0-0xffff */
65static struct powerpc_bus_space pchb_io_tag = { 65static struct powerpc_bus_space pchb_io_tag = {
66 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_IO_TYPE, 66 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_IO_TYPE,
67 MIN_PLB_PCI_IOADDR, /* offset */ 67 MIN_PLB_PCI_IOADDR, /* offset */
68 MIN_PCI_PCI_IOADDR, /* extent base */ 68 MIN_PCI_PCI_IOADDR, /* extent base */
69 MIN_PCI_PCI_IOADDR + 0xffff, /* extent limit */ 69 MIN_PCI_PCI_IOADDR + 0xffff, /* extent limit */
70}; 70};
71 71
72/* PCI memory window is directly mapped */ 72/* PCI memory window is directly mapped */
73static struct powerpc_bus_space pchb_mem_tag = { 73static struct powerpc_bus_space pchb_mem_tag = {
74 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, 74 _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE,
75 0x00000000, /* offset */ 75 0x00000000, /* offset */
@@ -129,27 +129,27 @@ pchbattach(device_t parent, device_t sel @@ -129,27 +129,27 @@ pchbattach(device_t parent, device_t sel
129#endif 129#endif
130#endif 130#endif
131 pci_chipset_tag_t pc = 0; 131 pci_chipset_tag_t pc = 0;
132 pcitag_t tag;  132 pcitag_t tag;
133 int class, id; 133 int class, id;
134 134
135 pci_machdep_init(); 135 pci_machdep_init();
136 tag = pci_make_tag(pc, 0, 0, 0); 136 tag = pci_make_tag(pc, 0, 0, 0);
137 137
138 class = pci_conf_read(pc, tag, PCI_CLASS_REG); 138 class = pci_conf_read(pc, tag, PCI_CLASS_REG);
139 id = pci_conf_read(pc, tag, PCI_ID_REG); 139 id = pci_conf_read(pc, tag, PCI_ID_REG);
140 140
141 printf("\n"); 141 printf("\n");
142 pcifound++; 142 pcifound = true;
143 /* 143 /*
144 * All we do is print out a description. Eventually, we 144 * All we do is print out a description. Eventually, we
145 * might want to add code that does something that's 145 * might want to add code that does something that's
146 * possibly chipset-specific. 146 * possibly chipset-specific.
147 */ 147 */
148 148
149 pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); 149 pci_devinfo(id, class, 0, devinfo, sizeof(devinfo));
150 printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, 150 printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
151 PCI_REVISION(class)); 151 PCI_REVISION(class));
152 152
153 pci_machdep_init(); /* Redundant... */ 153 pci_machdep_init(); /* Redundant... */
154 ibm4xx_setup_pci(); 154 ibm4xx_setup_pci();
155#ifdef PCI_CONFIGURE_VERBOSE 155#ifdef PCI_CONFIGURE_VERBOSE

cvs diff -r1.9 -r1.10 src/sys/arch/hpcmips/tx/txioman.c (expand / switch to unified diff)

--- src/sys/arch/hpcmips/tx/txioman.c 2008/04/28 20:23:22 1.9
+++ src/sys/arch/hpcmips/tx/txioman.c 2011/06/06 17:13:06 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $ */ 1/* $NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi. 8 * by UCHIYAMA Yasushi.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,62 +20,62 @@ @@ -20,62 +20,62 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 matt Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/device.h> 37#include <sys/device.h>
38 38
39#include <machine/bus.h> 39#include <machine/bus.h>
40#include <hpcmips/tx/tx39var.h> 40#include <hpcmips/tx/tx39var.h>
41 41
42#include <dev/hpc/hpciovar.h> 42#include <dev/hpc/hpciovar.h>
43 43
44int txioman_match(struct device *, struct cfdata *, void *); 44int txioman_match(device_t, cfdata_t, void *);
45void txioman_attach(struct device *, struct device *, void *); 45void txioman_attach(device_t, device_t, void *);
46void txioman_callback(struct device *); 46void txioman_callback(device_t);
47int txioman_print(void *, const char *); 47int txioman_print(void *, const char *);
48hpcio_chip_t tx_conf_reference_ioman(void *, int); 48hpcio_chip_t tx_conf_reference_ioman(void *, int);
49 49
50CFATTACH_DECL(txioman, sizeof(struct device), 50CFATTACH_DECL_NEW(txioman, 0,
51 txioman_match, txioman_attach, NULL, NULL); 51 txioman_match, txioman_attach, NULL, NULL);
52 52
53int 53int
54txioman_match(struct device *parent, struct cfdata *cf, void *aux) 54txioman_match(device_t parent, cfdata_t cf, void *aux)
55{ 55{
56 return (1); 56 return (1);
57} 57}
58 58
59void 59void
60txioman_attach(struct device *parent, struct device *self, void *aux) 60txioman_attach(device_t parent, device_t self, void *aux)
61{ 61{
62 printf("\n"); 62 printf("\n");
63 63
64 config_defer(self, txioman_callback); 64 config_defer(self, txioman_callback);
65} 65}
66 66
67void 67void
68txioman_callback(struct device *self) 68txioman_callback(device_t self)
69{ 69{
70 struct hpcio_attach_args haa; 70 struct hpcio_attach_args haa;
71 71
72 haa.haa_busname = HPCIO_BUSNAME; 72 haa.haa_busname = HPCIO_BUSNAME;
73 haa.haa_sc = tx_conf_get_tag(); 73 haa.haa_sc = tx_conf_get_tag();
74 haa.haa_getchip = tx_conf_reference_ioman; 74 haa.haa_getchip = tx_conf_reference_ioman;
75 haa.haa_iot = 0; /* not needed for TX */ 75 haa.haa_iot = 0; /* not needed for TX */
76 76
77 config_found(self, &haa, txioman_print); 77 config_found(self, &haa, txioman_print);
78} 78}
79 79
80int 80int
81txioman_print(void *aux, const char *pnp) 81txioman_print(void *aux, const char *pnp)

cvs diff -r1.7 -r1.8 src/sys/arch/mips/alchemy/dev/auaudio.c (expand / switch to unified diff)

--- src/sys/arch/mips/alchemy/dev/auaudio.c 2005/12/11 12:18:06 1.7
+++ src/sys/arch/mips/alchemy/dev/auaudio.c 2011/06/06 17:13:06 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $ */ 1/* $NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 matt Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Wasabi Systems, Inc. 4 * Copyright 2002 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Simon Burge for Wasabi Systems, Inc. 7 * Written by 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
@@ -26,46 +26,46 @@ @@ -26,46 +26,46 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 matt Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/device.h> 43#include <sys/device.h>
44 44
45#include <mips/alchemy/include/aureg.h> 45#include <mips/alchemy/include/aureg.h>
46#include <mips/alchemy/include/aubusvar.h> 46#include <mips/alchemy/include/aubusvar.h>
47 47
48static int auaudio_match(struct device *, struct cfdata *, void *); 48static int auaudio_match(device_t, cfdata_t, void *);
49static void auaudio_attach(struct device *, struct device *, void *); 49static void auaudio_attach(device_t, device_t, void *);
50 50
51CFATTACH_DECL(auaudio, sizeof (struct device), 51CFATTACH_DECL_NEW(auaudio, sizeof (struct device),
52 auaudio_match, auaudio_attach, NULL, NULL); 52 auaudio_match, auaudio_attach, NULL, NULL);
53 53
54int 54int
55auaudio_match(struct device *parent, struct cfdata *match, void *aux) 55auaudio_match(device_t parent, cfdata_t match, void *aux)
56{ 56{
57 struct aubus_attach_args *aa = aux; 57 struct aubus_attach_args *aa = aux;
58 58
59 return (0); /* XXX unimplemented! */ 59 return (0); /* XXX unimplemented! */
60 if (strcmp(aa->aa_name, match->cf_name) == 0) 60 if (strcmp(aa->aa_name, match->cf_name) == 0)
61 return (1); 61 return (1);
62 62
63 return (0); 63 return (0);
64} 64}
65 65
66void 66void
67auaudio_attach(struct device *parent, struct device *self, void *aux) 67auaudio_attach(device_t parent, device_t self, void *aux)
68{ 68{
69 69
70 printf(": Au1X00 audio\n"); /* \n in clockattach */ 70 printf(": Au1X00 audio\n"); /* \n in clockattach */
71} 71}

cvs diff -r1.16 -r1.17 src/sys/arch/mipsco/obio/obio.c (expand / switch to unified diff)

--- src/sys/arch/mipsco/obio/obio.c 2009/03/16 23:11:13 1.16
+++ src/sys/arch/mipsco/obio/obio.c 2011/06/06 17:13:06 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $ */ 1/* $NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Wayne Knowles 8 * by Wayne Knowles
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,88 +20,87 @@ @@ -20,88 +20,87 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 matt Exp $");
34 34
35#include "locators.h" 35#include "locators.h"
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/device.h> 39#include <sys/device.h>
40 40
41#include <machine/autoconf.h> 41#include <machine/autoconf.h>
42#include <machine/mainboard.h> 42#include <machine/mainboard.h>
43#include <machine/bus.h> 43#include <machine/bus.h>
44#include <machine/sysconf.h> 44#include <machine/sysconf.h>
45 45
46static int obio_match(struct device *, struct cfdata *, void *); 46static int obio_match(device_t, cfdata_t, void *);
47static void obio_attach(struct device *, struct device *, void *); 47static void obio_attach(device_t, device_t, void *);
48static int obio_search(struct device *, struct cfdata *, 48static int obio_search(device_t, cfdata_t, const int *, void *);
49 const int *, void *); 
50static int obio_print(void *, const char *); 49static int obio_print(void *, const char *);
51static void obio_intr_establish(bus_space_tag_t, int, int, int, 50static void obio_intr_establish(bus_space_tag_t, int, int, int,
52 int (*)(void *), void *); 51 int (*)(void *), void *);
53 52
54CFATTACH_DECL(obio, sizeof(struct device), 53CFATTACH_DECL_NEW(obio, 0,
55 obio_match, obio_attach, NULL, NULL); 54 obio_match, obio_attach, NULL, NULL);
56 55
57extern struct cfdriver obio_cd; 56extern struct cfdriver obio_cd;
58 57
59struct mipsco_bus_space obio_bustag; 58struct mipsco_bus_space obio_bustag;
60struct mipsco_bus_dma_tag obio_dmatag; 59struct mipsco_bus_dma_tag obio_dmatag;
61  60
62static int 61static int
63obio_match(struct device *parent, struct cfdata *cf, void *aux) 62obio_match(device_t parent, cfdata_t cf, void *aux)
64{ 63{
65 struct confargs *ca = aux; 64 struct confargs *ca = aux;
66 65
67 if (strcmp(ca->ca_name, obio_cd.cd_name) != 0) 66 if (strcmp(ca->ca_name, obio_cd.cd_name) != 0)
68 return 0; 67 return 0;
69 68
70 return 1; 69 return 1;
71} 70}
72 71
73static void 72static void
74obio_attach(struct device *parent, struct device *self, void *aux) 73obio_attach(device_t parent, device_t self, void *aux)
75{ 74{
76 struct confargs *ca = aux; 75 struct confargs *ca = aux;
77 76
78 /* PIZAZZ (Mips 3000 Magnum) Address Map */ 77 /* PIZAZZ (Mips 3000 Magnum) Address Map */
79 mipsco_bus_space_init(&obio_bustag, "obio",  78 mipsco_bus_space_init(&obio_bustag, "obio",
80 0x18000000, 0xb8000000, 79 0x18000000, 0xb8000000,
81 0xb8000000, 0x08000000); 80 0xb8000000, 0x08000000);
82 81
83 _bus_dma_tag_init(&obio_dmatag); 82 _bus_dma_tag_init(&obio_dmatag);
84 obio_bustag.bs_intr_establish = obio_intr_establish; /* XXX */ 83 obio_bustag.bs_intr_establish = obio_intr_establish; /* XXX */
85 84
86 ca->ca_bustag = &obio_bustag; 85 ca->ca_bustag = &obio_bustag;
87 ca->ca_dmatag = &obio_dmatag; 86 ca->ca_dmatag = &obio_dmatag;
88 87
89 printf("\n"); 88 printf("\n");
90 config_search_ia(obio_search, self, "obio", ca); 89 config_search_ia(obio_search, self, "obio", ca);
91} 90}
92 91
93static int 92static int
94obio_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) 93obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
95{ 94{
96 struct confargs *ca = aux; 95 struct confargs *ca = aux;
97 96
98 ca->ca_addr = cf->cf_addr; 97 ca->ca_addr = cf->cf_addr;
99 ca->ca_name = cf->cf_name; 98 ca->ca_name = cf->cf_name;
100 99
101 if (config_match(parent, cf, ca) != 0) 100 if (config_match(parent, cf, ca) != 0)
102 config_attach(parent, cf, ca, obio_print); 101 config_attach(parent, cf, ca, obio_print);
103 102
104 return 0; 103 return 0;
105} 104}
106 105
107/* 106/*
@@ -113,17 +112,18 @@ obio_print(void *args, const char *name) @@ -113,17 +112,18 @@ obio_print(void *args, const char *name)
113{ 112{
114 struct confargs *ca = args; 113 struct confargs *ca = args;
115 114
116 if (name) 115 if (name)
117 return(QUIET); 116 return(QUIET);
118 117
119 if (ca->ca_addr != -1) 118 if (ca->ca_addr != -1)
120 aprint_normal(" addr 0x%x", ca->ca_addr); 119 aprint_normal(" addr 0x%x", ca->ca_addr);
121 120
122 return(UNCONF); 121 return(UNCONF);
123} 122}
124 123
125void 124void
126obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags, int (*func)(void *), void *arg) 125obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags,
 126 int (*func)(void *), void *arg)
127{ 127{
128 (*platform.intr_establish)(level, func, arg); 128 (*platform.intr_establish)(level, func, arg);
129} 129}