Deleted Added
full compact
apb.c (200874) apb.c (206019)
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001, 2003 Thomas Moestl <tmm@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001, 2003 Thomas Moestl <tmm@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/sparc64/pci/apb.c 200874 2009-12-22 21:02:46Z marius $");
35__FBSDID("$FreeBSD: head/sys/sparc64/pci/apb.c 206019 2010-03-31 22:27:33Z marius $");
36
37/*
38 * Support for the Sun APB (Advanced PCI Bridge) PCI-PCI bridge.
39 * This bridge does not fully comply to the PCI bridge specification, and is
40 * therefore not supported by the generic driver.
41 * We can use some of the pcib methods anyway.
42 */
43

--- 174 unchanged lines hidden (view full) ---

218
219 /*
220 * If this is a "default" allocation against this rid, we can't work
221 * out where it's coming from (we should actually never see these) so
222 * we just have to punt.
223 */
224 if (start == 0 && end == ~0) {
225 device_printf(dev, "can't decode default resource id %d for "
36
37/*
38 * Support for the Sun APB (Advanced PCI Bridge) PCI-PCI bridge.
39 * This bridge does not fully comply to the PCI bridge specification, and is
40 * therefore not supported by the generic driver.
41 * We can use some of the pcib methods anyway.
42 */
43

--- 174 unchanged lines hidden (view full) ---

218
219 /*
220 * If this is a "default" allocation against this rid, we can't work
221 * out where it's coming from (we should actually never see these) so
222 * we just have to punt.
223 */
224 if (start == 0 && end == ~0) {
225 device_printf(dev, "can't decode default resource id %d for "
226 "%s%d, bypassing\n", *rid, device_get_name(child),
227 device_get_unit(child));
226 "%s, bypassing\n", *rid, device_get_nameunit(child));
228 goto passup;
229 }
230
231 /*
232 * Fail the allocation for this range if it's not supported.
233 * XXX we should probably just fix up the bridge decode and
234 * soldier on.
235 */
236 switch (type) {
237 case SYS_RES_IOPORT:
238 if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) {
227 goto passup;
228 }
229
230 /*
231 * Fail the allocation for this range if it's not supported.
232 * XXX we should probably just fix up the bridge decode and
233 * soldier on.
234 */
235 switch (type) {
236 case SYS_RES_IOPORT:
237 if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) {
239 device_printf(dev, "device %s%d requested unsupported "
240 "I/O range 0x%lx-0x%lx\n", device_get_name(child),
241 device_get_unit(child), start, end);
238 device_printf(dev, "device %s requested unsupported "
239 "I/O range 0x%lx-0x%lx\n",
240 device_get_nameunit(child), start, end);
242 return (NULL);
243 }
244 if (bootverbose)
245 device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
241 return (NULL);
242 }
243 if (bootverbose)
244 device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
246 "%s%d requested decoded I/O range 0x%lx-0x%lx\n",
247 device_get_name(child), device_get_unit(child),
248 start, end);
245 "%s requested decoded I/O range 0x%lx-0x%lx\n",
246 device_get_nameunit(child), start, end);
249 break;
250
251 case SYS_RES_MEMORY:
252 if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, end)) {
247 break;
248
249 case SYS_RES_MEMORY:
250 if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, end)) {
253 device_printf(dev, "device %s%d requested unsupported "
251 device_printf(dev, "device %s requested unsupported "
254 "memory range 0x%lx-0x%lx\n",
252 "memory range 0x%lx-0x%lx\n",
255 device_get_name(child), device_get_unit(child),
256 start, end);
253 device_get_nameunit(child), start, end);
257 return (NULL);
258 }
259 if (bootverbose)
260 device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
254 return (NULL);
255 }
256 if (bootverbose)
257 device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
261 "%s%d requested decoded memory range 0x%lx-0x%lx\n",
262 device_get_name(child), device_get_unit(child),
263 start, end);
258 "%s requested decoded memory range 0x%lx-0x%lx\n",
259 device_get_nameunit(child), start, end);
264 break;
265
266 default:
267 break;
268 }
269
270 passup:
271 /*
272 * Bridge is OK decoding this resource, so pass it up.
273 */
274 return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
275 count, flags));
276}
260 break;
261
262 default:
263 break;
264 }
265
266 passup:
267 /*
268 * Bridge is OK decoding this resource, so pass it up.
269 */
270 return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
271 count, flags));
272}