summaryrefslogtreecommitdiffstats
path: root/sys/pc98/pc98/machdep.c
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2010-10-24 03:20:54 +0000
committernyan <nyan@FreeBSD.org>2010-10-24 03:20:54 +0000
commitac495e24872de53b8cd3cc5ff72eed984b73901b (patch)
tree60558781770e5834978587302ae10f434c1ff305 /sys/pc98/pc98/machdep.c
parent0491d02744d4f9119e0d7496d649be15f96fb22e (diff)
downloadFreeBSD-src-ac495e24872de53b8cd3cc5ff72eed984b73901b.zip
FreeBSD-src-ac495e24872de53b8cd3cc5ff72eed984b73901b.tar.gz
MFi386: the part of revision 213226.
Rewrite the i386 memory probe: - Move the base memory setup into a new basemem_setup() routine. MFC after: 1 week
Diffstat (limited to 'sys/pc98/pc98/machdep.c')
-rw-r--r--sys/pc98/pc98/machdep.c99
1 files changed, 55 insertions, 44 deletions
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index c7c4c96..32328c5 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -1776,52 +1776,13 @@ sdtossd(sd, ssd)
ssd->ssd_gran = sd->sd_gran;
}
-/*
- * Populate the (physmap) array with base/bound pairs describing the
- * available physical memory in the system, then test this memory and
- * build the phys_avail array describing the actually-available memory.
- *
- * If we cannot accurately determine the physical memory map, then use
- * value from the 0xE801 call, and failing that, the RTC.
- *
- * Total memory size may be set by the kernel environment variable
- * hw.physmem or the compile-time define MAXMEM.
- *
- * XXX first should be vm_paddr_t.
- */
static void
-getmemsize(int first)
+basemem_setup(void)
{
- int i, off, physmap_idx, pa_indx, da_indx;
- int pg_n;
- u_long physmem_tunable;
- u_int extmem;
- u_int under16;
- vm_paddr_t pa, physmap[PHYSMAP_SIZE];
+ vm_paddr_t pa;
pt_entry_t *pte;
- quad_t dcons_addr, dcons_size;
-
- bzero(physmap, sizeof(physmap));
-
- /* XXX - some of EPSON machines can't use PG_N */
- pg_n = PG_N;
- if (pc98_machine_type & M_EPSON_PC98) {
- switch (epson_machine_id) {
-#ifdef WB_CACHE
- default:
-#endif
- case EPSON_PC486_HX:
- case EPSON_PC486_HG:
- case EPSON_PC486_HA:
- pg_n = 0;
- break;
- }
- }
+ int i;
- /*
- * Perform "base memory" related probes & setup
- */
- under16 = pc98_getmemsize(&basemem, &extmem);
if (basemem > 640) {
printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
basemem);
@@ -1853,12 +1814,62 @@ getmemsize(int first)
pmap_kenter(KERNBASE + pa, pa);
/*
- * if basemem != 640, map pages r/w into vm86 page table so
- * that the bios can scribble on it.
+ * Map pages between basemem and ISA_HOLE_START, if any, r/w into
+ * the vm86 page table so that vm86 can scribble on them using
+ * the vm86 map too. XXX: why 2 ways for this and only 1 way for
+ * page 0, at least as initialized here?
*/
pte = (pt_entry_t *)vm86paddr;
for (i = basemem / 4; i < 160; i++)
pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U;
+}
+
+/*
+ * Populate the (physmap) array with base/bound pairs describing the
+ * available physical memory in the system, then test this memory and
+ * build the phys_avail array describing the actually-available memory.
+ *
+ * If we cannot accurately determine the physical memory map, then use
+ * value from the 0xE801 call, and failing that, the RTC.
+ *
+ * Total memory size may be set by the kernel environment variable
+ * hw.physmem or the compile-time define MAXMEM.
+ *
+ * XXX first should be vm_paddr_t.
+ */
+static void
+getmemsize(int first)
+{
+ int off, physmap_idx, pa_indx, da_indx;
+ u_long physmem_tunable;
+ vm_paddr_t physmap[PHYSMAP_SIZE];
+ pt_entry_t *pte;
+ quad_t dcons_addr, dcons_size;
+ int i;
+ int pg_n;
+ u_int extmem;
+ u_int under16;
+ vm_paddr_t pa;
+
+ bzero(physmap, sizeof(physmap));
+
+ /* XXX - some of EPSON machines can't use PG_N */
+ pg_n = PG_N;
+ if (pc98_machine_type & M_EPSON_PC98) {
+ switch (epson_machine_id) {
+#ifdef WB_CACHE
+ default:
+#endif
+ case EPSON_PC486_HX:
+ case EPSON_PC486_HG:
+ case EPSON_PC486_HA:
+ pg_n = 0;
+ break;
+ }
+ }
+
+ under16 = pc98_getmemsize(&basemem, &extmem);
+ basemem_setup();
physmap[0] = 0;
physmap[1] = basemem * 1024;
OpenPOWER on IntegriCloud