mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
* Fix the memory probing code so that it sees all memory clusters, not
just the first one. * Don't reserve extra memory for the prom console unless the platform actually uses it. * Fix some historical confusion and a minor bug in the message buffer initialisation. Submitted by: gallatin for the prom console part Approved by: jkh
This commit is contained in:
parent
ccf52fc678
commit
db1d02f417
3 changed files with 43 additions and 53 deletions
|
|
@ -859,57 +859,55 @@ alpha_init(pfn, ptb, bim, bip, biv)
|
|||
* XXX memory after the kernel in the first system segment,
|
||||
* XXX to avoid clobbering prom mapping, data, etc.
|
||||
*/
|
||||
if (!pmap_uses_prom_console() || physmem == 0) {
|
||||
physmem += memc->mddt_pg_cnt;
|
||||
pfn0 = memc->mddt_pfn;
|
||||
pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt;
|
||||
if (pfn0 <= kernendpfn && kernstartpfn <= pfn1) {
|
||||
/*
|
||||
* Must compute the location of the kernel
|
||||
* within the segment.
|
||||
*/
|
||||
physmem += memc->mddt_pg_cnt;
|
||||
pfn0 = memc->mddt_pfn;
|
||||
pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt;
|
||||
if (pfn0 <= kernendpfn && kernstartpfn <= pfn1) {
|
||||
/*
|
||||
* Must compute the location of the kernel
|
||||
* within the segment.
|
||||
*/
|
||||
#ifdef DEBUG_CLUSTER
|
||||
printf("Cluster %d contains kernel\n", i);
|
||||
printf("Cluster %d contains kernel\n", i);
|
||||
#endif
|
||||
if (!pmap_uses_prom_console()) {
|
||||
if (pfn0 < kernstartpfn) {
|
||||
/*
|
||||
* There is a chunk before the kernel.
|
||||
*/
|
||||
if (!pmap_uses_prom_console()) {
|
||||
if (pfn0 < kernstartpfn) {
|
||||
/*
|
||||
* There is a chunk before the kernel.
|
||||
*/
|
||||
#ifdef DEBUG_CLUSTER
|
||||
printf("Loading chunk before kernel: "
|
||||
"0x%lx / 0x%lx\n", pfn0, kernstartpfn);
|
||||
printf("Loading chunk before kernel: "
|
||||
"0x%lx / 0x%lx\n", pfn0, kernstartpfn);
|
||||
#endif
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(pfn0);
|
||||
phys_avail[phys_avail_cnt+1] = alpha_ptob(kernstartpfn);
|
||||
phys_avail_cnt += 2;
|
||||
}
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(pfn0);
|
||||
phys_avail[phys_avail_cnt+1] = alpha_ptob(kernstartpfn);
|
||||
phys_avail_cnt += 2;
|
||||
}
|
||||
if (kernendpfn < pfn1) {
|
||||
}
|
||||
if (kernendpfn < pfn1) {
|
||||
/*
|
||||
* There is a chunk after the kernel.
|
||||
*/
|
||||
#ifdef DEBUG_CLUSTER
|
||||
printf("Loading chunk after kernel: "
|
||||
"0x%lx / 0x%lx\n", kernendpfn, pfn1);
|
||||
printf("Loading chunk after kernel: "
|
||||
"0x%lx / 0x%lx\n", kernendpfn, pfn1);
|
||||
#endif
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(kernendpfn);
|
||||
phys_avail[phys_avail_cnt+1] = alpha_ptob(pfn1);
|
||||
phys_avail_cnt += 2;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Just load this cluster as one chunk.
|
||||
*/
|
||||
#ifdef DEBUG_CLUSTER
|
||||
printf("Loading cluster %d: 0x%lx / 0x%lx\n", i,
|
||||
pfn0, pfn1);
|
||||
#endif
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(pfn0);
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(kernendpfn);
|
||||
phys_avail[phys_avail_cnt+1] = alpha_ptob(pfn1);
|
||||
phys_avail_cnt += 2;
|
||||
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Just load this cluster as one chunk.
|
||||
*/
|
||||
#ifdef DEBUG_CLUSTER
|
||||
printf("Loading cluster %d: 0x%lx / 0x%lx\n", i,
|
||||
pfn0, pfn1);
|
||||
#endif
|
||||
phys_avail[phys_avail_cnt] = alpha_ptob(pfn0);
|
||||
phys_avail[phys_avail_cnt+1] = alpha_ptob(pfn1);
|
||||
phys_avail_cnt += 2;
|
||||
|
||||
}
|
||||
}
|
||||
phys_avail[phys_avail_cnt] = 0;
|
||||
|
|
@ -956,16 +954,16 @@ alpha_init(pfn, ptb, bim, bip, biv)
|
|||
phys_avail[i+1] -= sz;
|
||||
msgbufp = (struct msgbuf*) ALPHA_PHYS_TO_K0SEG(phys_avail[i+1]);
|
||||
|
||||
msgbufinit(msgbufp, MSGBUF_SIZE);
|
||||
msgbufinit(msgbufp, sz);
|
||||
|
||||
/* Remove the last segment if it now has no pages. */
|
||||
if (phys_avail[i] == phys_avail[i+1])
|
||||
phys_avail[i] = 0;
|
||||
|
||||
/* warn if the message buffer had to be shrunk */
|
||||
if (sz != round_page(MSGBUFSIZE))
|
||||
if (sz != round_page(MSGBUF_SIZE))
|
||||
printf("WARNING: %ld bytes not available for msgbuf in last cluster (%ld used)\n",
|
||||
round_page(MSGBUFSIZE), sz);
|
||||
round_page(MSGBUF_SIZE), sz);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@
|
|||
#include <sys/user.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/rpb.h>
|
||||
|
||||
#ifndef PMAP_SHPGPERPROC
|
||||
#define PMAP_SHPGPERPROC 200
|
||||
|
|
@ -606,19 +607,14 @@ pmap_bootstrap(vm_offset_t ptaddr, u_int maxasn)
|
|||
int
|
||||
pmap_uses_prom_console()
|
||||
{
|
||||
#if 0
|
||||
extern int cputype;
|
||||
int cputype;
|
||||
|
||||
#if defined(NEW_SCC_DRIVER)
|
||||
return (cputype == ST_DEC_21000);
|
||||
#else
|
||||
cputype = hwrpb->rpb_type;
|
||||
return (cputype == ST_DEC_21000
|
||||
|| cputype == ST_DEC_3000_300
|
||||
|| cputype == ST_DEC_3000_500);
|
||||
#endif /* NEW_SCC_DRIVER */
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -114,10 +114,6 @@
|
|||
#define UPAGES 2 /* pages of u-area */
|
||||
#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
|
||||
|
||||
#ifndef MSGBUFSIZE
|
||||
#define MSGBUFSIZE PAGE_SIZE /* default message buffer size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
|
|
|
|||
Loading…
Reference in a new issue