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