| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: arm32_machdep.c,v 1.111 2016/07/15 05:59:46 skrll Exp $ */ | | 1 | /* $NetBSD: arm32_machdep.c,v 1.112 2016/07/16 01:49:42 mrg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994-1998 Mark Brinicombe. | | 4 | * Copyright (c) 1994-1998 Mark Brinicombe. |
5 | * Copyright (c) 1994 Brini. | | 5 | * Copyright (c) 1994 Brini. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software written for Brini by Mark Brinicombe | | 8 | * This code is derived from software written for Brini by Mark Brinicombe |
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. |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
36 | * SUCH DAMAGE. | | 36 | * SUCH DAMAGE. |
37 | * | | 37 | * |
38 | * Machine dependent functions for kernel setup | | 38 | * Machine dependent functions for kernel setup |
39 | * | | 39 | * |
40 | * Created : 17/09/94 | | 40 | * Created : 17/09/94 |
41 | * Updated : 18/04/01 updated for new wscons | | 41 | * Updated : 18/04/01 updated for new wscons |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/cdefs.h> | | 44 | #include <sys/cdefs.h> |
45 | __KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.111 2016/07/15 05:59:46 skrll Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.112 2016/07/16 01:49:42 mrg Exp $"); |
46 | | | 46 | |
47 | #include "opt_modular.h" | | 47 | #include "opt_modular.h" |
48 | #include "opt_md.h" | | 48 | #include "opt_md.h" |
49 | #include "opt_pmap_debug.h" | | 49 | #include "opt_pmap_debug.h" |
50 | #include "opt_multiprocessor.h" | | 50 | #include "opt_multiprocessor.h" |
51 | | | 51 | |
52 | #include <sys/param.h> | | 52 | #include <sys/param.h> |
53 | #include <sys/systm.h> | | 53 | #include <sys/systm.h> |
54 | #include <sys/reboot.h> | | 54 | #include <sys/reboot.h> |
55 | #include <sys/proc.h> | | 55 | #include <sys/proc.h> |
56 | #include <sys/kauth.h> | | 56 | #include <sys/kauth.h> |
57 | #include <sys/kernel.h> | | 57 | #include <sys/kernel.h> |
58 | #include <sys/mbuf.h> | | 58 | #include <sys/mbuf.h> |
| @@ -740,17 +740,23 @@ mm_md_direct_mapped_phys(paddr_t pa, vad | | | @@ -740,17 +740,23 @@ mm_md_direct_mapped_phys(paddr_t pa, vad |
740 | { | | 740 | { |
741 | bool rv; | | 741 | bool rv; |
742 | vaddr_t va = pmap_direct_mapped_phys(pa, &rv, 0); | | 742 | vaddr_t va = pmap_direct_mapped_phys(pa, &rv, 0); |
743 | if (rv) { | | 743 | if (rv) { |
744 | *vap = va; | | 744 | *vap = va; |
745 | } | | 745 | } |
746 | return rv; | | 746 | return rv; |
747 | } | | 747 | } |
748 | #endif | | 748 | #endif |
749 | | | 749 | |
750 | bool | | 750 | bool |
751 | mm_md_page_color(paddr_t pa, int *colorp) | | 751 | mm_md_page_color(paddr_t pa, int *colorp) |
752 | { | | 752 | { |
| | | 753 | #if (ARM_MMU_V6 + ARM_MMU_V7) != 0 |
753 | *colorp = atop(pa & arm_cache_prefer_mask); | | 754 | *colorp = atop(pa & arm_cache_prefer_mask); |
754 | | | 755 | |
755 | return arm_cache_prefer_mask ? false : true; | | 756 | return arm_cache_prefer_mask ? false : true; |
| | | 757 | #else |
| | | 758 | *colorp = 0; |
| | | 759 | |
| | | 760 | return true; |
| | | 761 | #endif |
756 | } | | 762 | } |