1 /* $NetBSD: pmap_bootstrap.c,v 1.37 1997/09/19 13:54:41 leo Exp $ */ 2 3 /* 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the Systems Programming Group of the University of Utah Computer 9 * Science Department. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgement: 21 * This product includes software developed by the University of 22 * California, Berkeley and its contributors. 23 * 4. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93 40 */ 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/reboot.h> 45 46 #include <vm/vm.h> 47 48 #include <machine/pte.h> 49 #include <mac68k/mac68k/clockreg.h> 50 #include <machine/vmparam.h> 51 #include <machine/cpu.h> 52 #include <machine/pmap.h> 53 #include <machine/autoconf.h> 54 55 #include <ufs/mfs/mfs_extern.h> 56 57 #include <mac68k/mac68k/macrom.h> 58 59 #define PA2VA(v, t) (t)((u_int)(v) - firstpa) 60 61 extern char *etext; 62 extern int Sysptsize; 63 extern char *extiobase, *proc0paddr; 64 extern st_entry_t *Sysseg; 65 extern pt_entry_t *Sysptmap, *Sysmap; 66 67 extern int maxmem, physmem; 68 extern int avail_remaining, avail_range, avail_end; 69 extern vm_offset_t avail_start, avail_next; 70 extern vm_offset_t virtual_avail, virtual_end; 71 extern vm_size_t mem_size; 72 extern int protection_codes[]; 73 74 extern vm_offset_t reserve_dumppages __P((vm_offset_t)); 75 76 /* 77 * These are used to map the RAM: 78 */ 79 int numranges; /* = 0 == don't use the ranges */ 80 u_long low[8]; 81 u_long high[8]; 82 extern int nbnumranges; 83 extern u_long nbphys[]; 84 extern u_long nblog[]; 85 extern signed long nblen[]; 86 #define VIDMAPSIZE btoc(m68k_round_page(vidlen)) 87 extern u_int32_t mac68k_vidlog; 88 extern u_int32_t mac68k_vidphys; 89 extern u_int32_t videoaddr; 90 extern u_int32_t videorowbytes; 91 extern u_int32_t videosize; 92 static int vidlen; 93 static u_int32_t newvideoaddr; 94 95 extern caddr_t ROMBase; 96 97 /* 98 * Special purpose kernel virtual addresses, used for mapping 99 * physical pages for a variety of temporary or permanent purposes: 100 * 101 * CADDR1, CADDR2: pmap zero/copy operations 102 * vmmap: /dev/mem, crash dumps, parity error checking 103 * msgbufaddr: kernel message buffer 104 */ 105 caddr_t CADDR1, CADDR2, vmmap; 106 extern caddr_t msgbufaddr; 107 108 /* 109 * Bootstrap the VM system. 110 * 111 * This is called with the MMU either on or off. If it's on, we assume 112 * that it's mapped with the same PA <=> LA mapping that we eventually 113 * want. The page sizes and the protections will be wrong, anyway. 114 * 115 * nextpa is the first address following the loaded kernel. On a IIsi 116 * on 12 May 1996, that was 0xf9000 beyond firstpa. 117 */ 118 void 119 pmap_bootstrap(nextpa, firstpa) 120 vm_offset_t nextpa; 121 register vm_offset_t firstpa; 122 { 123 vm_offset_t kstpa, kptpa, vidpa, iiopa, rompa; 124 vm_offset_t kptmpa, lkptpa, p0upa; 125 u_int nptpages, kstsize; 126 int i; 127 register st_entry_t protoste, *ste; 128 register pt_entry_t protopte, *pte, *epte; 129 130 vidlen = ((videosize >> 16) & 0xffff) * videorowbytes + PGOFSET; 131 132 /* 133 * Calculate important physical addresses: 134 * 135 * kstpa kernel segment table 1 page (!040) 136 * N pages (040) 137 * 138 * kptpa statically allocated 139 * kernel PT pages Sysptsize+ pages 140 * 141 * vidpa internal video space for some machines 142 * PT pages VIDMAPSIZE pages 143 * 144 * rompa ROM space 145 * PT pages ROMMAPSIZE pages 146 * 147 * iiopa internal IO space 148 * PT pages IIOMAPSIZE pages 149 * 150 * [ Sysptsize is the number of pages of PT, IIOMAPSIZE and 151 * NBMAPSIZE are the number of PTEs, hence we need to round 152 * the total to a page boundary with IO maps at the end. ] 153 * 154 * kptmpa kernel PT map 1 page 155 * 156 * lkptpa last kernel PT page 1 page 157 * 158 * p0upa proc 0 u-area UPAGES pages 159 * 160 */ 161 if (mmutype == MMU_68040) 162 kstsize = MAXKL2SIZE / (NPTEPG/SG4_LEV2SIZE); 163 else 164 kstsize = 1; 165 kstpa = nextpa; 166 nextpa += kstsize * NBPG; 167 kptpa = nextpa; 168 nptpages = Sysptsize + 169 (IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE + NPTEPG - 1) / NPTEPG; 170 nextpa += nptpages * NBPG; 171 vidpa = nextpa - VIDMAPSIZE * sizeof(pt_entry_t); 172 rompa = vidpa - ROMMAPSIZE * sizeof(pt_entry_t); 173 iiopa = rompa - IIOMAPSIZE * sizeof(pt_entry_t); 174 kptmpa = nextpa; 175 nextpa += NBPG; 176 lkptpa = nextpa; 177 nextpa += NBPG; 178 p0upa = nextpa; 179 nextpa += USPACE; 180 181 if (nextpa > high[0]) { 182 printf("Failure in NetBSD boot; nextpa=0x%lx, high[0]=0x%lx.\n", 183 nextpa, high[0]); 184 printf("You're hosed! Try booting with 32-bit addressing "); 185 printf("enabled in the memory control panel.\n"); 186 printf("Older machines may need Mode32 to get that option.\n"); 187 panic("Cannot work with the current memory mappings.\n"); 188 } 189 190 /* 191 * Initialize segment table and kernel page table map. 192 * 193 * On 68030s and earlier MMUs the two are identical except for 194 * the valid bits so both are initialized with essentially the 195 * same values. On the 68040, which has a mandatory 3-level 196 * structure, the segment table holds the level 1 table and part 197 * (or all) of the level 2 table and hence is considerably 198 * different. Here the first level consists of 128 descriptors 199 * (512 bytes) each mapping 32mb of address space. Each of these 200 * points to blocks of 128 second level descriptors (512 bytes) 201 * each mapping 256kb. Note that there may be additional "segment 202 * table" pages depending on how large MAXKL2SIZE is. 203 * 204 * XXX cramming two levels of mapping into the single "segment" 205 * table on the 68040 is intended as a temporary hack to get things 206 * working. The 224mb of address space that this allows will most 207 * likely be insufficient in the future (at least for the kernel). 208 */ 209 if (mmutype == MMU_68040) { 210 register int num; 211 212 /* 213 * First invalidate the entire "segment table" pages 214 * (levels 1 and 2 have the same "invalid" value). 215 */ 216 pte = PA2VA(kstpa, u_int *); 217 epte = &pte[kstsize * NPTEPG]; 218 while (pte < epte) 219 *pte++ = SG_NV; 220 /* 221 * Initialize level 2 descriptors (which immediately 222 * follow the level 1 table). We need: 223 * NPTEPG / SG4_LEV3SIZE 224 * level 2 descriptors to map each of the nptpages+1 225 * pages of PTEs. Note that we set the "used" bit 226 * now to save the HW the expense of doing it. 227 */ 228 num = (nptpages + 1) * (NPTEPG / SG4_LEV3SIZE); 229 pte = &(PA2VA(kstpa, u_int *))[SG4_LEV1SIZE]; 230 epte = &pte[num]; 231 protoste = kptpa | SG_U | SG_RW | SG_V; 232 while (pte < epte) { 233 *pte++ = protoste; 234 protoste += (SG4_LEV3SIZE * sizeof(st_entry_t)); 235 } 236 /* 237 * Initialize level 1 descriptors. We need: 238 * roundup(num, SG4_LEV2SIZE) / SG4_LEV2SIZE 239 * level 1 descriptors to map the `num' level 2's. 240 */ 241 pte = PA2VA(kstpa, u_int *); 242 epte = &pte[roundup(num, SG4_LEV2SIZE) / SG4_LEV2SIZE]; 243 protoste = (u_int)&pte[SG4_LEV1SIZE] | SG_U | SG_RW | SG_V; 244 while (pte < epte) { 245 *pte++ = protoste; 246 protoste += (SG4_LEV2SIZE * sizeof(st_entry_t)); 247 } 248 /* 249 * Initialize the final level 1 descriptor to map the last 250 * block of level 2 descriptors. 251 */ 252 ste = &(PA2VA(kstpa, u_int*))[SG4_LEV1SIZE-1]; 253 pte = &(PA2VA(kstpa, u_int*))[kstsize*NPTEPG - SG4_LEV2SIZE]; 254 *ste = (u_int)pte | SG_U | SG_RW | SG_V; 255 /* 256 * Now initialize the final portion of that block of 257 * descriptors to map the "last PT page". 258 */ 259 pte = &(PA2VA(kstpa, u_int*)) 260 [kstsize*NPTEPG - NPTEPG/SG4_LEV3SIZE]; 261 epte = &pte[NPTEPG/SG4_LEV3SIZE]; 262 protoste = lkptpa | SG_U | SG_RW | SG_V; 263 while (pte < epte) { 264 *pte++ = protoste; 265 protoste += (SG4_LEV3SIZE * sizeof(st_entry_t)); 266 } 267 /* 268 * Initialize Sysptmap 269 */ 270 pte = PA2VA(kptmpa, u_int *); 271 epte = &pte[nptpages+1]; 272 protopte = kptpa | PG_RW | PG_CI | PG_V; 273 while (pte < epte) { 274 *pte++ = protopte; 275 protopte += NBPG; 276 } 277 /* 278 * Invalidate all but the last remaining entries in both. 279 */ 280 epte = &(PA2VA(kptmpa, u_int *))[NPTEPG-1]; 281 while (pte < epte) { 282 *pte++ = PG_NV; 283 } 284 pte = &(PA2VA(kptmpa, u_int *))[NPTEPG-1]; 285 *pte = lkptpa | PG_RW | PG_CI | PG_V; 286 } else { 287 /* 288 * Map the page table pages in both the HW segment table 289 * and the software Sysptmap. Note that Sysptmap is also 290 * considered a PT page hence the +1. 291 */ 292 ste = PA2VA(kstpa, u_int*); 293 pte = PA2VA(kptmpa, u_int*); 294 epte = &pte[nptpages+1]; 295 protoste = kptpa | SG_RW | SG_V; 296 protopte = kptpa | PG_RW | PG_CI | PG_V; 297 while (pte < epte) { 298 *ste++ = protoste; 299 *pte++ = protopte; 300 protoste += NBPG; 301 protopte += NBPG; 302 } 303 /* 304 * Invalidate all but the last remaining entries in both. 305 */ 306 epte = &(PA2VA(kptmpa, u_int *))[NPTEPG-1]; 307 while (pte < epte) { 308 *ste++ = SG_NV; 309 *pte++ = PG_NV; 310 } 311 /* 312 * Initialize the last to point to point to the page 313 * table page allocated earlier. 314 */ 315 *ste = lkptpa | SG_RW | SG_V; 316 *pte = lkptpa | PG_RW | PG_CI | PG_V; 317 } 318 /* 319 * Invalidate all but the final entry in the last kernel PT page 320 * (u-area PTEs will be validated later). The final entry maps 321 * the last page of physical memory. 322 */ 323 pte = PA2VA(lkptpa, u_int *); 324 epte = &pte[NPTEPG-1]; 325 while (pte < epte) 326 *pte++ = PG_NV; 327 *pte = (0xFFFFF000) | PG_RW | PG_CI | PG_V; /* XXX */ 328 329 /* 330 * Initialize kernel page table. 331 * Start by invalidating the `nptpages' that we have allocated. 332 */ 333 pte = PA2VA(kptpa, u_int *); 334 epte = &pte[nptpages * NPTEPG]; 335 while (pte < epte) 336 *pte++ = PG_NV; 337 338 /* 339 * Validate PTEs for kernel text (RO) 340 */ 341 pte = &(PA2VA(kptpa, u_int *))[m68k_btop(KERNBASE)]; 342 epte = &pte[m68k_btop(m68k_trunc_page(&etext))]; 343 #if defined(KGDB) || defined(DDB) 344 protopte = firstpa | PG_RW | PG_V; /* XXX RW for now */ 345 #else 346 protopte = firstpa | PG_RO | PG_V; 347 #endif 348 while (pte < epte) { 349 *pte++ = protopte; 350 protopte += NBPG; 351 } 352 /* 353 * Validate PTEs for kernel data/bss, dynamic data allocated 354 * by us so far (nextpa - firstpa bytes), and pages for proc0 355 * u-area and page table allocated below (RW). 356 */ 357 epte = &(PA2VA(kptpa, u_int *))[m68k_btop(nextpa - firstpa)]; 358 protopte = (protopte & ~PG_PROT) | PG_RW; 359 /* 360 * Enable copy-back caching of data pages 361 */ 362 if (mmutype == MMU_68040) 363 protopte |= PG_CCB; 364 while (pte < epte) { 365 *pte++ = protopte; 366 protopte += NBPG; 367 } 368 /* 369 * Finally, validate the internal IO space PTEs (RW+CI). 370 * We do this here since the 320/350 MMU registers (also 371 * used, but to a lesser extent, on other models) are mapped 372 * in this range and it would be nice to be able to access 373 * them after the MMU is turned on. 374 */ 375 pte = PA2VA(iiopa, u_int *); 376 epte = PA2VA(rompa, u_int *); 377 protopte = IOBase | PG_RW | PG_CI | PG_V; 378 while (pte < epte) { 379 *pte++ = protopte; 380 protopte += NBPG; 381 } 382 383 pte = PA2VA(rompa, u_int *); 384 epte = PA2VA(vidpa, u_int *); 385 protopte = ((u_int) ROMBase) | PG_RO | PG_V; 386 while (pte < epte) { 387 *pte++ = protopte; 388 protopte += NBPG; 389 } 390 391 if (vidlen) { 392 pte = PA2VA(vidpa, u_int *); 393 epte = pte + VIDMAPSIZE; 394 protopte = (mac68k_vidphys & ~PGOFSET) | PG_RW | PG_V | PG_CI; 395 while (pte < epte) { 396 *pte++ = protopte; 397 protopte += NBPG; 398 } 399 } 400 401 /* 402 * Calculate important exported kernel virtual addresses 403 */ 404 /* 405 * Sysseg: base of kernel segment table 406 */ 407 Sysseg = PA2VA(kstpa, st_entry_t *); 408 /* 409 * Sysptmap: base of kernel page table map 410 */ 411 Sysptmap = PA2VA(kptmpa, pt_entry_t *); 412 /* 413 * Sysmap: kernel page table (as mapped through Sysptmap) 414 * Immediately follows `nptpages' of static kernel page table. 415 */ 416 Sysmap = (pt_entry_t *)m68k_ptob(nptpages * NPTEPG); 417 418 IOBase = (u_long)m68k_ptob(nptpages*NPTEPG - 419 (IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE)); 420 421 ROMBase = (char *)m68k_ptob(nptpages*NPTEPG - 422 (ROMMAPSIZE + VIDMAPSIZE)); 423 424 if (vidlen) { 425 newvideoaddr = (u_int32_t) 426 m68k_ptob(nptpages*NPTEPG - VIDMAPSIZE) 427 + (mac68k_vidphys & PGOFSET); 428 if (mac68k_vidlog) 429 mac68k_vidlog = newvideoaddr; 430 } 431 432 /* 433 * Setup u-area for process 0. 434 */ 435 /* 436 * Zero the u-area. 437 * NOTE: `pte' and `epte' aren't PTEs here. 438 */ 439 pte = PA2VA(p0upa, u_int *); 440 epte = (u_int *) (PA2VA(p0upa, u_int) + USPACE); 441 while (pte < epte) 442 *pte++ = 0; 443 /* 444 * Remember the u-area address so it can be loaded in the 445 * proc struct p_addr field later. 446 */ 447 proc0paddr = PA2VA(p0upa, char *); 448 449 /* 450 * VM data structures are now initialized, set up data for 451 * the pmap module. 452 */ 453 avail_next = avail_start = m68k_round_page(nextpa); 454 avail_remaining = 0; 455 avail_range = -1; 456 for (i = 0; i < numranges; i++) { 457 if (avail_next >= low[i] && avail_next < high[i]) { 458 avail_range = i; 459 avail_remaining = high[i] - avail_next; 460 } else if (avail_range != -1) { 461 avail_remaining += (high[i] - low[i]); 462 } 463 } 464 physmem = m68k_btop(avail_remaining + nextpa - firstpa); 465 avail_remaining -= m68k_round_page(MSGBUFSIZE); 466 high[numranges - 1] -= m68k_round_page(MSGBUFSIZE); 467 468 /* XXX -- this doesn't look correct to me. */ 469 while (high[numranges - 1] < low[numranges - 1]) { 470 numranges--; 471 high[numranges - 1] -= low[numranges] - high[numranges]; 472 } 473 474 avail_remaining = m68k_trunc_page(avail_remaining); 475 avail_end = avail_start + avail_remaining; 476 avail_remaining = m68k_btop(avail_remaining); 477 478 mem_size = m68k_ptob(physmem); 479 virtual_avail = VM_MIN_KERNEL_ADDRESS + (nextpa - firstpa); 480 virtual_end = VM_MAX_KERNEL_ADDRESS; 481 482 /* 483 * Initialize protection array. 484 * XXX don't use a switch statement, it might produce an 485 * absolute "jmp" table. 486 */ 487 { 488 register int *kp; 489 490 kp = (int *) &protection_codes; 491 kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; 492 kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; 493 kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; 494 kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; 495 kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; 496 kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; 497 kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; 498 kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; 499 } 500 501 /* 502 * Kernel page/segment table allocated in locore, 503 * just initialize pointers. 504 */ 505 { 506 struct pmap *kpm = (struct pmap *)&kernel_pmap_store; 507 508 kpm->pm_stab = Sysseg; 509 kpm->pm_ptab = Sysmap; 510 simple_lock_init(&kpm->pm_lock); 511 kpm->pm_count = 1; 512 kpm->pm_stpa = (st_entry_t *)kstpa; 513 /* 514 * For the 040 we also initialize the free level 2 515 * descriptor mask noting that we have used: 516 * 0: level 1 table 517 * 1 to `num': map page tables 518 * MAXKL2SIZE-1: maps last-page page table 519 */ 520 if (mmutype == MMU_68040) { 521 register int num; 522 523 kpm->pm_stfree = ~l2tobm(0); 524 num = roundup((nptpages + 1) * (NPTEPG / SG4_LEV3SIZE), 525 SG4_LEV2SIZE) / SG4_LEV2SIZE; 526 while (num) 527 kpm->pm_stfree &= ~l2tobm(num--); 528 kpm->pm_stfree &= ~l2tobm(MAXKL2SIZE-1); 529 for (num = MAXKL2SIZE; 530 num < sizeof(kpm->pm_stfree)*NBBY; 531 num++) 532 kpm->pm_stfree &= ~l2tobm(num); 533 } 534 } 535 536 /* 537 * Allocate some fixed, special purpose kernel virtual addresses 538 */ 539 { 540 vm_offset_t va = virtual_avail; 541 542 CADDR1 = (caddr_t)va; 543 va += NBPG; 544 CADDR2 = (caddr_t)va; 545 va += NBPG; 546 vmmap = (caddr_t)va; 547 va += NBPG; 548 msgbufaddr = (caddr_t)va; 549 va += m68k_round_page(MSGBUFSIZE); 550 virtual_avail = reserve_dumppages(va); 551 } 552 } 553 554 void 555 bootstrap_mac68k(tc) 556 int tc; 557 { 558 extern void zs_init __P((void)); 559 extern caddr_t esym; 560 vm_offset_t nextpa; 561 caddr_t oldROMBase; 562 563 if (mac68k_machine.do_graybars) 564 printf("Bootstrapping NetBSD/mac68k.\n"); 565 566 oldROMBase = ROMBase; 567 mac68k_vidphys = videoaddr; 568 569 if (((tc & 0x80000000) && (mmutype == MMU_68030)) || 570 ((tc & 0x8000) && (mmutype == MMU_68040))) { 571 if (mac68k_machine.do_graybars) 572 printf("Getting mapping from MMU.\n"); 573 (void) get_mapping(); 574 if (mac68k_machine.do_graybars) 575 printf("Done.\n"); 576 } else { 577 /* MMU not enabled. Fake up ranges. */ 578 nbnumranges = 0; 579 numranges = 1; 580 low[0] = 0; 581 high[0] = mac68k_machine.mach_memsize * (1024 * 1024); 582 if (mac68k_machine.do_graybars) 583 printf("Faked range to byte 0x%lx.\n", high[0]); 584 } 585 nextpa = load_addr + (((int)esym + NBPG - 1) & PG_FRAME); 586 587 #if MFS 588 if (boothowto & RB_MINIROOT) { 589 int v; 590 boothowto |= RB_DFLTROOT; 591 nextpa = m68k_round_page(nextpa); 592 if ((v = mfs_initminiroot((caddr_t) nextpa-load_addr)) == 0) { 593 printf("Error loading miniroot.\n"); 594 } 595 printf("Loaded %d byte miniroot.\n", v); 596 nextpa += v; 597 } 598 #endif 599 600 if (mac68k_machine.do_graybars) 601 printf("Bootstrapping the pmap system.\n"); 602 603 pmap_bootstrap(nextpa, load_addr); 604 605 if (mac68k_machine.do_graybars) 606 printf("Pmap bootstrapped.\n"); 607 608 if (!vidlen) 609 panic("Don't know how to relocate video!\n"); 610 611 if (mac68k_machine.do_graybars) 612 printf("Moving ROMBase from %p to %p.\n", 613 oldROMBase, ROMBase); 614 615 mrg_fixupROMBase(oldROMBase, ROMBase); 616 617 if (mac68k_machine.do_graybars) 618 printf("Video address 0x%lx -> 0x%lx.\n", 619 (unsigned long) videoaddr, 620 (unsigned long) newvideoaddr); 621 622 mac68k_set_io_offsets(IOBase); 623 624 /* 625 * If the serial ports are going (for console or 'echo'), then 626 * we need to make sure the IO change gets propagated properly. 627 * This resets the base addresses for the 8530 (serial) driver. 628 * 629 * WARNING!!! No printfs() (etc) BETWEEN zs_init() and the end 630 * of this function (where we start using the MMU, so the new 631 * address is correct. 632 */ 633 if ( (mac68k_machine.serial_boot_echo) 634 || (mac68k_machine.serial_console)) 635 zs_init(); 636 637 videoaddr = newvideoaddr; 638 } 639