summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c82
1 files changed, 13 insertions, 69 deletions
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index 29c22f24a4a..377bc6ddb7a 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.4 2006/01/10 19:21:14 martin Exp $ */
+/* $OpenBSD: machdep.c,v 1.5 2007/05/26 20:26:50 pedro Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -75,12 +75,6 @@
/*
* Patchable buffer cache parameters
*/
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-
#ifndef BUFCACHEPERCENT
#define BUFCACHEPERCENT 10
#endif /* BUFCACHEPERCENT */
@@ -290,29 +284,6 @@ TODO hpmc/toc/pfr
/* sets resvphysmem */
pmap_bootstrap(start);
- /* buffer cache parameters */
- if (bufpages == 0)
- bufpages = physmem / 100 *
- (physmem <= 0x1000? 5 : bufcachepercent);
-
- if (nbuf == 0)
- nbuf = bufpages < 16? 16 : bufpages;
-
- /* Restrict to at most 50% filled kvm */
- if (nbuf * MAXBSIZE >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / 2)
- nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- MAXBSIZE / 2;
-
- /* More buffer pages than fits into the buffers is senseless. */
- if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE)
- bufpages = nbuf * MAXBSIZE / PAGE_SIZE;
-
- if (!(buf = (struct buf *)pmap_steal_memory(round_page(nbuf *
- sizeof(struct buf)), NULL, NULL)))
- panic("cpu_startup: no space for bufs");
- bzero(buf, nbuf * sizeof(struct buf));
-
/* space has been reserved in pmap_bootstrap() */
msgbufp = (struct msgbuf *)((vaddr_t)ptoa(physmem) -
round_page(MSGBUFSIZE));
@@ -415,8 +386,6 @@ void
cpu_startup(void)
{
vaddr_t minaddr, maxaddr;
- vsize_t size;
- int i, base, residual;
/*
* psychodelic kingdom come
@@ -428,41 +397,18 @@ cpu_startup(void)
printf("real mem = %u (%u reserved for PROM, %u used by OpenBSD)\n",
ctob(physmem), ctob(resvmem), ctob(resvphysmem - resvmem));
-printf("here2\n");
- size = MAXBSIZE * nbuf;
- if (uvm_map(kernel_map, &minaddr, round_page(size),
- NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE,
- UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0)))
- panic("cpu_startup: cannot allocate VM for buffers");
- buffers = (caddr_t)minaddr;
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- for (i = 0; i < nbuf; i++) {
- vaddr_t curbuf;
- int cbpgs, pd;
-
-{ extern int pmapdebug; pd = pmapdebug; pmapdebug = 0; }
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
-
- for (cbpgs = base + (i < residual? 1 : 0); cbpgs--; ) {
- struct vm_page *pg;
-
- if ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL)
- panic("cpu_startup: not enough memory for "
- "buffer cache");
- pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
- UVM_PROT_RW);
- curbuf += PAGE_SIZE;
- }
-{ extern int pmapdebug; pmapdebug = pd; }
- }
+ /*
+ * Determine how many buffers to allocate.
+ * We allocate bufcachepercent% of memory for buffer space.
+ */
+ if (bufpages == 0)
+ bufpages = physmem * bufcachepercent / 100;
+
+ /* Restrict to at most 25% filled kvm */
+ if (bufpages >
+ (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
+ bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
+ PAGE_SIZE / 4;
printf("here3\n");
/*
@@ -481,8 +427,6 @@ printf("here4\n");
printf("here5\n");
printf("avail mem = %lu\n", ptoa(uvmexp.free));
- printf("using %u buffers containing %u bytes of memory\n",
- nbuf, (unsigned)bufpages * PAGE_SIZE);
/*
* Set up buffers, so they can be used to read disk labels.