summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2001-09-22 19:50:12 +0000
committerdfr <dfr@FreeBSD.org>2001-09-22 19:50:12 +0000
commit4c2efef4f7daf6355b55194fbdc8d29936ff3224 (patch)
tree35556a45b6e938cc4f4af63370dde8a2d049a653 /sys
parent934b85d282a060b7fe67b6ef0bee2e2d00305411 (diff)
downloadFreeBSD-src-4c2efef4f7daf6355b55194fbdc8d29936ff3224.zip
FreeBSD-src-4c2efef4f7daf6355b55194fbdc8d29936ff3224.tar.gz
* Turn off memory descriptor debugging - its served its purpose.
* Don't get confused when memory regions don't lie on page boundaries - remember our page size is typically larger than the firmware's page size. * Add a function ia64_running_in_simulator() which is intended to detect whether the kernel is running in SKI or on real hardware.
Diffstat (limited to 'sys')
-rw-r--r--sys/ia64/ia64/machdep.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 23fbfcc..c0a699a 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -392,8 +392,6 @@ identifycpu(void)
extern char kernel_text[], _end[];
-#define DEBUG_MD
-
void
ia64_init()
{
@@ -506,7 +504,6 @@ ia64_init()
* the memory descriptors.
*/
-#define DEBUG_MD
#ifdef DEBUG_MD
printf("Memory descriptor count: %d\n", mdcount);
#endif
@@ -514,29 +511,31 @@ ia64_init()
phys_avail_cnt = 0;
for (i = 0, mdp = md; i < mdcount; i++,
mdp = NextMemoryDescriptor(mdp, bootinfo.bi_memdesc_size)) {
- size_t size;
#ifdef DEBUG_MD
printf("MD %d: type %d pa 0x%lx cnt 0x%lx\n", i,
mdp->Type,
mdp->PhysicalStart,
mdp->NumberOfPages);
#endif
- size = mdp->NumberOfPages * 4096;
+ pfn0 = ia64_btop(round_page(mdp->PhysicalStart));
+ pfn1 = ia64_btop(trunc_page(mdp->PhysicalStart
+ + mdp->NumberOfPages * 4096));
+ if (pfn1 <= pfn0)
+ continue;
+
if (mdp->Type != EfiConventionalMemory) {
- resvmem += ia64_btop(size);
+ resvmem += (pfn1 - pfn0);
continue;
}
- totalphysmem += ia64_btop(size);
+ totalphysmem += (pfn1 - pfn0);
/*
* We have a memory descriptors available for system
* software use. We must determine if this cluster
* holds the kernel.
*/
- physmem += ia64_btop(size);
- pfn0 = ia64_btop(mdp->PhysicalStart);
- pfn1 = pfn0 + ia64_btop(size);
+ physmem += (pfn1 - pfn0);
if (pfn0 <= kernendpfn && kernstartpfn <= pfn1) {
/*
* Must compute the location of the kernel
@@ -706,6 +705,12 @@ ia64_init()
#endif
}
+int
+ia64_running_in_simulator()
+{
+ return bootinfo.bi_systab == 0;
+}
+
void
bzero(void *buf, size_t len)
{
OpenPOWER on IntegriCloud