| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mainbus.c,v 1.56 2009/11/11 16:08:31 skrll Exp $ */ | | 1 | /* $NetBSD: mainbus.c,v 1.57 2009/12/02 13:45:13 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2001, 2002 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 Matthew Fredette. | | 8 | * by Matthew Fredette. |
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. |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
50 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, | | 50 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, |
51 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 51 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
52 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 52 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
53 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 53 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | 56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
57 | * THE POSSIBILITY OF SUCH DAMAGE. | | 57 | * THE POSSIBILITY OF SUCH DAMAGE. |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> | | 60 | #include <sys/cdefs.h> |
61 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.56 2009/11/11 16:08:31 skrll Exp $"); | | 61 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.57 2009/12/02 13:45:13 skrll Exp $"); |
62 | | | 62 | |
63 | #include "locators.h" | | 63 | #include "locators.h" |
64 | #include "power.h" | | 64 | #include "power.h" |
65 | | | 65 | |
66 | #include <sys/param.h> | | 66 | #include <sys/param.h> |
67 | #include <sys/systm.h> | | 67 | #include <sys/systm.h> |
68 | #include <sys/device.h> | | 68 | #include <sys/device.h> |
69 | #include <sys/reboot.h> | | 69 | #include <sys/reboot.h> |
70 | #include <sys/extent.h> | | 70 | #include <sys/extent.h> |
71 | #include <sys/mbuf.h> | | 71 | #include <sys/mbuf.h> |
72 | | | 72 | |
73 | #include <uvm/uvm_page.h> | | 73 | #include <uvm/uvm_page.h> |
74 | #include <uvm/uvm.h> | | 74 | #include <uvm/uvm.h> |
| @@ -386,27 +386,27 @@ mbus_alloc(void *v, bus_addr_t rstart, b | | | @@ -386,27 +386,27 @@ mbus_alloc(void *v, bus_addr_t rstart, b |
386 | panic("bus_space_alloc: bad region start/end"); | | 386 | panic("bus_space_alloc: bad region start/end"); |
387 | | | 387 | |
388 | /* | | 388 | /* |
389 | * Force the allocated region to be page-aligned. | | 389 | * Force the allocated region to be page-aligned. |
390 | */ | | 390 | */ |
391 | if (align < PAGE_SIZE) | | 391 | if (align < PAGE_SIZE) |
392 | align = PAGE_SIZE; | | 392 | align = PAGE_SIZE; |
393 | size = round_page(size); | | 393 | size = round_page(size); |
394 | | | 394 | |
395 | /* | | 395 | /* |
396 | * Allocate the region of I/O space. | | 396 | * Allocate the region of I/O space. |
397 | */ | | 397 | */ |
398 | error = extent_alloc_subregion1(hp700_io_extent, rstart, rend, size, | | 398 | error = extent_alloc_subregion1(hp700_io_extent, rstart, rend, size, |
399 | align, 0, boundary, EX_NOWAIT, &bpa); | | 399 | align, 0, boundary, EX_NOWAIT, &bpa); |
400 | if (error) | | 400 | if (error) |
401 | return (error); | | 401 | return (error); |
402 | | | 402 | |
403 | /* | | 403 | /* |
404 | * Map the region of I/O space. | | 404 | * Map the region of I/O space. |
405 | */ | | 405 | */ |
406 | error = mbus_add_mapping(bpa, size, flags, bshp); | | 406 | error = mbus_add_mapping(bpa, size, flags, bshp); |
407 | if (error) { | | 407 | if (error) { |
408 | if (extent_free(hp700_io_extent, bpa, size, EX_NOWAIT)) { | | 408 | if (extent_free(hp700_io_extent, bpa, size, EX_NOWAIT)) { |
409 | printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n", | | 409 | printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n", |
410 | bpa, size); | | 410 | bpa, size); |
411 | printf("bus_space_alloc: can't free region\n"); | | 411 | printf("bus_space_alloc: can't free region\n"); |
412 | } | | 412 | } |