| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $ */ | | 1 | /* $NetBSD: x86_machdep.c,v 1.93 2017/06/14 12:27:24 maxv Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, | | 4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, |
5 | * Copyright (c) 2005, 2008, 2009 The NetBSD Foundation, Inc. | | 5 | * Copyright (c) 2005, 2008, 2009 The NetBSD Foundation, Inc. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Julio M. Merino Vidal. | | 9 | * by Julio M. Merino Vidal. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.93 2017/06/14 12:27:24 maxv Exp $"); |
35 | | | 35 | |
36 | #include "opt_modular.h" | | 36 | #include "opt_modular.h" |
37 | #include "opt_physmem.h" | | 37 | #include "opt_physmem.h" |
38 | #include "opt_splash.h" | | 38 | #include "opt_splash.h" |
39 | | | 39 | |
40 | #include <sys/types.h> | | 40 | #include <sys/types.h> |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/kcore.h> | | 43 | #include <sys/kcore.h> |
44 | #include <sys/errno.h> | | 44 | #include <sys/errno.h> |
45 | #include <sys/kauth.h> | | 45 | #include <sys/kauth.h> |
46 | #include <sys/mutex.h> | | 46 | #include <sys/mutex.h> |
47 | #include <sys/cpu.h> | | 47 | #include <sys/cpu.h> |
| @@ -509,47 +509,37 @@ x86_select_freelist(uint64_t maxaddr) | | | @@ -509,47 +509,37 @@ x86_select_freelist(uint64_t maxaddr) |
509 | | | 509 | |
510 | panic("no freelist for maximum address %"PRIx64, maxaddr); | | 510 | panic("no freelist for maximum address %"PRIx64, maxaddr); |
511 | } | | 511 | } |
512 | | | 512 | |
513 | static int | | 513 | static int |
514 | x86_add_cluster(uint64_t seg_start, uint64_t seg_end, uint32_t type) | | 514 | x86_add_cluster(uint64_t seg_start, uint64_t seg_end, uint32_t type) |
515 | { | | 515 | { |
516 | extern struct extent *iomem_ex; | | 516 | extern struct extent *iomem_ex; |
517 | const uint64_t endext = MAXIOMEM + 1; | | 517 | const uint64_t endext = MAXIOMEM + 1; |
518 | uint64_t new_physmem = 0; | | 518 | uint64_t new_physmem = 0; |
519 | phys_ram_seg_t *cluster; | | 519 | phys_ram_seg_t *cluster; |
520 | int i; | | 520 | int i; |
521 | | | 521 | |
522 | #ifdef i386 | | 522 | if (seg_end > MAXPHYSMEM) { |
523 | #ifdef PAE | | | |
524 | #define TOPLIMIT 0x1000000000ULL /* 64GB */ | | | |
525 | #else | | | |
526 | #define TOPLIMIT 0x100000000ULL /* 4GB */ | | | |
527 | #endif | | | |
528 | #else | | | |
529 | #define TOPLIMIT 0x100000000000ULL /* 16TB */ | | | |
530 | #endif | | | |
531 | | | | |
532 | if (seg_end > TOPLIMIT) { | | | |
533 | aprint_verbose("WARNING: skipping large memory map entry: " | | 523 | aprint_verbose("WARNING: skipping large memory map entry: " |
534 | "0x%"PRIx64"/0x%"PRIx64"/0x%x\n", | | 524 | "0x%"PRIx64"/0x%"PRIx64"/0x%x\n", |
535 | seg_start, (seg_end - seg_start), type); | | 525 | seg_start, (seg_end - seg_start), type); |
536 | return 0; | | 526 | return 0; |
537 | } | | 527 | } |
538 | | | 528 | |
539 | /* | | 529 | /* |
540 | * XXX: Chop the last page off the size so that it can fit in avail_end. | | 530 | * XXX: Chop the last page off the size so that it can fit in avail_end. |
541 | */ | | 531 | */ |
542 | if (seg_end == TOPLIMIT) | | 532 | if (seg_end == MAXPHYSMEM) |
543 | seg_end -= PAGE_SIZE; | | 533 | seg_end -= PAGE_SIZE; |
544 | | | 534 | |
545 | if (seg_end <= seg_start) | | 535 | if (seg_end <= seg_start) |
546 | return 0; | | 536 | return 0; |
547 | | | 537 | |
548 | for (i = 0; i < mem_cluster_cnt; i++) { | | 538 | for (i = 0; i < mem_cluster_cnt; i++) { |
549 | cluster = &mem_clusters[i]; | | 539 | cluster = &mem_clusters[i]; |
550 | if ((cluster->start == round_page(seg_start)) && | | 540 | if ((cluster->start == round_page(seg_start)) && |
551 | (cluster->size == trunc_page(seg_end) - cluster->start)) { | | 541 | (cluster->size == trunc_page(seg_end) - cluster->start)) { |
552 | #ifdef DEBUG_MEMLOAD | | 542 | #ifdef DEBUG_MEMLOAD |
553 | printf("WARNING: skipping duplicate segment entry\n"); | | 543 | printf("WARNING: skipping duplicate segment entry\n"); |
554 | #endif | | 544 | #endif |
555 | return 0; | | 545 | return 0; |