obio.c (182901) | obio.c (202036) |
---|---|
1/* $NetBSD: obio.c,v 1.11 2003/07/15 00:25:05 lukem Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 29 unchanged lines hidden (view full) --- 38/* 39 * On-board device autoconfiguration support for Broadcom Sentry5 40 * based boards. 41 * XXX This is totally bogus and is just enough to get the console hopefully 42 * running on the sentry5. 43 */ 44 45#include <sys/cdefs.h> | 1/* $NetBSD: obio.c,v 1.11 2003/07/15 00:25:05 lukem Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 29 unchanged lines hidden (view full) --- 38/* 39 * On-board device autoconfiguration support for Broadcom Sentry5 40 * based boards. 41 * XXX This is totally bogus and is just enough to get the console hopefully 42 * running on the sentry5. 43 */ 44 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/sys/mips/sentry5/obio.c 182901 2008-09-10 03:49:08Z gonzo $"); | 46__FBSDID("$FreeBSD: head/sys/mips/sentry5/obio.c 202036 2010-01-10 20:09:30Z imp $"); |
47 48#include <sys/param.h> 49#include <sys/systm.h> 50#include <sys/bus.h> 51#include <sys/kernel.h> 52#include <sys/module.h> 53#include <sys/rman.h> 54#include <sys/malloc.h> --- 12 unchanged lines hidden (view full) --- 67 * be only one such device, so we use this static flag 68 * to prevent false positives on every realPCI device probe. 69 */ 70static int have_one = 0; 71 72int 73obio_probe(device_t dev) 74{ | 47 48#include <sys/param.h> 49#include <sys/systm.h> 50#include <sys/bus.h> 51#include <sys/kernel.h> 52#include <sys/module.h> 53#include <sys/rman.h> 54#include <sys/malloc.h> --- 12 unchanged lines hidden (view full) --- 67 * be only one such device, so we use this static flag 68 * to prevent false positives on every realPCI device probe. 69 */ 70static int have_one = 0; 71 72int 73obio_probe(device_t dev) 74{ |
75 if(!have_one) 76 { | 75 if (!have_one) { |
77 have_one = 1; 78 return 0; 79 } | 76 have_one = 1; 77 return 0; 78 } |
80 else 81 return (ENXIO); | 79 return (ENXIO); |
82} 83 84int 85obio_attach(device_t dev) 86{ 87 struct obio_softc *sc = device_get_softc(dev); 88 89 sc->oba_st = MIPS_BUS_SPACE_IO; --- 24 unchanged lines hidden (view full) --- 114} 115 116static struct resource * 117obio_alloc_resource(device_t bus, device_t child, int type, int *rid, 118 u_long start, u_long end, u_long count, u_int flags) 119{ 120 struct resource *rv; 121 struct rman *rm; | 80} 81 82int 83obio_attach(device_t dev) 84{ 85 struct obio_softc *sc = device_get_softc(dev); 86 87 sc->oba_st = MIPS_BUS_SPACE_IO; --- 24 unchanged lines hidden (view full) --- 112} 113 114static struct resource * 115obio_alloc_resource(device_t bus, device_t child, int type, int *rid, 116 u_long start, u_long end, u_long count, u_int flags) 117{ 118 struct resource *rv; 119 struct rman *rm; |
122 bus_space_tag_t bt = 0; | |
123 bus_space_handle_t bh = 0; 124 struct obio_softc *sc = device_get_softc(bus); 125 126 switch (type) { 127 case SYS_RES_IRQ: 128 rm = &sc->oba_irq_rman; 129 break; 130 case SYS_RES_MEMORY: 131 return (NULL); 132 case SYS_RES_IOPORT: 133 rm = &sc->oba_rman; | 120 bus_space_handle_t bh = 0; 121 struct obio_softc *sc = device_get_softc(bus); 122 123 switch (type) { 124 case SYS_RES_IRQ: 125 rm = &sc->oba_irq_rman; 126 break; 127 case SYS_RES_MEMORY: 128 return (NULL); 129 case SYS_RES_IOPORT: 130 rm = &sc->oba_rman; |
134 bt = sc->oba_st; | |
135 bh = sc->oba_addr; 136 start = bh; 137 break; 138 default: 139 return (NULL); 140 } 141 142 143 rv = rman_reserve_resource(rm, start, end, count, flags, child); 144 if (rv == NULL) 145 return (NULL); 146 if (type == SYS_RES_IRQ) 147 return (rv); 148 rman_set_rid(rv, *rid); | 131 bh = sc->oba_addr; 132 start = bh; 133 break; 134 default: 135 return (NULL); 136 } 137 138 139 rv = rman_reserve_resource(rm, start, end, count, flags, child); 140 if (rv == NULL) 141 return (NULL); 142 if (type == SYS_RES_IRQ) 143 return (rv); 144 rman_set_rid(rv, *rid); |
149 rman_set_bustag(rv, bt); | 145 rman_set_bustag(rv, mips_bus_space_generic); |
150 rman_set_bushandle(rv, bh); 151 152 if (0) { 153 if (bus_activate_resource(child, type, *rid, rv)) { 154 rman_release_resource(rv); 155 return (NULL); 156 } 157 } --- 30 unchanged lines hidden --- | 146 rman_set_bushandle(rv, bh); 147 148 if (0) { 149 if (bus_activate_resource(child, type, *rid, rv)) { 150 rman_release_resource(rv); 151 return (NULL); 152 } 153 } --- 30 unchanged lines hidden --- |