1 /* $NetBSD: atari_init.c,v 1.130 2026/11/13 23:48:34 thorpej Exp $ */ 2 3 /* 4 * Copyright (c) 1995 Leo Weppelman 5 * Copyright (c) 1994 Michael L. Hitch 6 * Copyright (c) 1993 Markus Wild 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Markus Wild. 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #include <sys/cdefs.h> 36 __KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.130 2026/11/13 23:48:34 thorpej Exp $"); 37 38 #include "opt_ddb.h" 39 #include "opt_mbtype.h" 40 #include "opt_m060sp.h" 41 #include "opt_m68k_arch.h" 42 #include "opt_st_pool_size.h" 43 44 #include <sys/param.h> 45 #include <sys/systm.h> 46 #include <sys/ioctl.h> 47 #include <sys/select.h> 48 #include <sys/tty.h> 49 #include <sys/buf.h> 50 #include <sys/msgbuf.h> 51 #include <sys/mbuf.h> 52 #include <sys/protosw.h> 53 #include <sys/domain.h> 54 #include <sys/reboot.h> 55 #include <sys/exec.h> 56 #include <sys/exec_aout.h> 57 #include <sys/bus.h> 58 59 #include <uvm/uvm_extern.h> 60 61 #include <machine/vmparam.h> 62 #include <machine/pmap.h> 63 #include <machine/cpu.h> 64 #include <machine/iomap.h> 65 #include <machine/mfp.h> 66 #include <machine/scu.h> 67 #include <machine/acia.h> 68 #include <machine/intr.h> 69 #include <machine/vectors.h> 70 71 #include <m68k/cpu.h> 72 #include <m68k/cacheops.h> 73 #include <m68k/pcr.h> 74 75 #include <atari/atari/stalloc.h> 76 #include <atari/dev/clockvar.h> 77 #include <atari/dev/ym2149reg.h> 78 79 #include "pci.h" 80 81 /* Temporary cross-file declarations for the NEW_PMAP transition. */ 82 void cpu_init_kcorehdr(paddr_t, paddr_t); 83 84 void *start_c(int, u_int, u_int, u_int, char *); 85 static void atari_hwinit(void); 86 static void initcpu(void); 87 static void set_machtype(void); 88 89 #if defined(_MILANHW_) 90 static u_int milan_probe_bank_1(paddr_t paddr); 91 static u_int milan_probe_bank(paddr_t paddr); 92 93 #define NBANK 2 94 #define NSLOT 4 95 96 #define MB(n) ((n) * 1024 * 1024) 97 #define MB_END(n) (MB(n) - 1) 98 #define MAGIC_4M (4 - 1) 99 #define MAGIC_4M_INV ((uint8_t)~MAGIC_4M) 100 #define MAGIC_8M (8 - 1) 101 #define MAGIC_16M (16 - 1) 102 #define MAGIC_32M (32 - 1) 103 #define MAGIC_64M (64 - 1) 104 #endif 105 106 struct memseg boot_segs[NMEM_SEGS]; 107 struct memseg usable_segs[NMEM_SEGS]; 108 109 extern u_int lowram; 110 int machineid, mmutype, cputype; 111 112 extern char *esym; 113 114 /* 115 * This is the virtual address of physical page 0. Used by 'do_boot()'. 116 */ 117 vaddr_t page_zero; 118 119 /* 120 * Simple support for allocation in ST-ram. 121 * Currently 16 bit ST-ram is required to allocate DMA buffers for SCSI and 122 * FDC transfers, and video memory for the XFree68 based Xservers. 123 * The physical address is also returned because the video init needs it to 124 * setup the controller at the time the vm-system is not yet operational so 125 * 'kvtop()' cannot be used. 126 */ 127 #define ST_POOL_SIZE_MIN 24 /* for DMA bounce buffers */ 128 #ifndef ST_POOL_SIZE 129 #define ST_POOL_SIZE 56 /* Xserver requires 320KB (40 pages) */ 130 #endif 131 132 psize_t st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable */ 133 vaddr_t st_pool_virt; 134 paddr_t st_pool_phys; 135 136 /* 137 * Thresholds to restrict size of reserved ST memory to make sure 138 * the kernel at least boot even on lower memory machines. 139 * Nowadays we could assume most users have 4MB ST-RAM and 16MB TT-RAM. 140 */ 141 #define STRAM_MINTHRESH (2 * 1024 * 1024) 142 #define TTRAM_MINTHRESH (4 * 1024 * 1024) 143 144 /* I/O address space variables */ 145 vaddr_t stio_addr; /* Where the st io-area is mapped */ 146 vaddr_t pci_conf_addr; /* KVA base of PCI config space */ 147 vaddr_t pci_io_addr; /* KVA base of PCI io-space */ 148 vaddr_t pci_mem_addr; /* KVA base of PCI mem-space */ 149 vaddr_t pci_mem_uncached; /* KVA base of an uncached PCI mem-page */ 150 151 /* 152 * Are we relocating the kernel to TT-Ram if possible? It is faster, but 153 * it is also reported not to work on all TT's. So the default is NO. 154 */ 155 #ifndef RELOC_KERNEL 156 #define RELOC_KERNEL 0 157 #endif 158 int reloc_kernel = RELOC_KERNEL; /* Patchable */ 159 160 /* 161 * this is the C-level entry function, it's called from locore.s. 162 * Preconditions: 163 * Interrupts are disabled 164 * PA == VA, we don't have to relocate addresses before enabling 165 * the MMU 166 * Exec is no longer available (because we're loaded all over 167 * low memory, no ExecBase is available anymore) 168 * 169 * It's purpose is: 170 * Do the things that are done in locore.s in the hp300 version, 171 * this includes allocation of kernel maps and enabling the MMU. 172 * 173 * Some of the code in here is `stolen' from Amiga MACH, and was 174 * written by Bryan Ford and Niklas Hallqvist. 175 * 176 * Very crude 68040 support by Michael L. Hitch. 177 */ 178 179 void * __attribute__((no_instrument_function)) 180 start_c(int id, u_int ttphystart, u_int ttphysize, u_int stphysize, 181 char *esym_addr) 182 /* id: Machine id */ 183 /* ttphystart, ttphysize: Start address and size of TT-ram */ 184 /* stphysize: Size of ST-ram */ 185 /* esym_addr: Address of kernel '_esym' symbol */ 186 { 187 extern char end[]; 188 paddr_t pstart; /* Next available physical address */ 189 u_int i; 190 vaddr_t end_loaded; 191 paddr_t kbase; 192 #if defined(_MILANHW_) 193 /* 194 * The Milan Lies about the presence of TT-RAM. If you insert 195 * 16MB it is split in 14MB ST starting at address 0 and 2MB TT RAM, 196 * starting at address 16MB as the BIOS remapping memory using MMU. 197 * 198 * Milan actually has four SIMM slots and each slot has two banks, 199 * so it could have up to 8 memory segment regions. 200 */ 201 const paddr_t simm_base[NBANK][NSLOT] = { 202 /* slot 0-3, bank 0 */ 203 { 0x00000000, 0x04000000, 0x08000000, 0x0c000000 }, 204 /* slot 0-3, bank 1 */ 205 { 0x10000000, 0x14000000, 0x18000000, 0x1c000000 } 206 }; 207 int slot, bank, seg; 208 u_int mb; 209 210 /* On Milan, all RAMs are fast 32 bit so no need to reloc kernel */ 211 reloc_kernel = 0; 212 213 /* probe memory region in all SIMM slots and banks */ 214 seg = 0; 215 ttphysize = 0; 216 for (bank = 0; bank < 2; bank++) { 217 for (slot = 0; slot < 4; slot++) { 218 if (bank == 0 && slot == 0) { 219 /* 220 * The first bank has at least 16MB because 221 * the Milan's ROM bootloader requires it 222 * to allocate ST RAM. 223 */ 224 mb = milan_probe_bank_1(simm_base[bank][slot]); 225 boot_segs[0].start = 0; 226 boot_segs[0].end = MB(mb); 227 stphysize = MB(mb); 228 seg++; 229 } else { 230 /* 231 * The rest banks could be empty or 232 * have 4, 8, 16, 32, or 64MB. 233 */ 234 mb = milan_probe_bank(simm_base[bank][slot]); 235 if (mb > 0) { 236 boot_segs[seg].start = 237 simm_base[bank][slot]; 238 boot_segs[seg].end = 239 simm_base[bank][slot] + MB(mb); 240 ttphysize += MB(mb); 241 seg++; 242 } 243 } 244 } 245 } 246 #else /* _MILANHW_ */ 247 boot_segs[0].start = 0; 248 boot_segs[0].end = stphysize; 249 boot_segs[1].start = ttphystart; 250 boot_segs[1].end = ttphystart + ttphysize; 251 boot_segs[2].start = boot_segs[2].end = 0; /* End of segments! */ 252 #endif 253 254 /* 255 * We do not know how much ST memory we really need until after 256 * configuration has finished, but typical users of ST memory 257 * are bounce buffers DMA against TT-RAM for SCSI and FDC, 258 * and video memory for the Xserver. 259 * If we have enough RAMs reserve ST memory including for the Xserver. 260 * Otherwise just allocate minimum one for SCSI and FDC. 261 * 262 * The round_page() call is meant to correct errors made by 263 * binpatching! 264 */ 265 if (st_pool_size > ST_POOL_SIZE_MIN * PAGE_SIZE && 266 (stphysize <= STRAM_MINTHRESH || ttphysize <= TTRAM_MINTHRESH)) { 267 st_pool_size = ST_POOL_SIZE_MIN * PAGE_SIZE; 268 } 269 st_pool_size = m68k_round_page(st_pool_size); 270 st_pool_phys = stphysize - st_pool_size; 271 stphysize = st_pool_phys; 272 273 physmem = btoc(stphysize) + btoc(ttphysize); 274 machineid = id; 275 esym = esym_addr; 276 277 /* 278 * the kernel ends at end() or esym. 279 */ 280 if (esym == NULL) 281 end_loaded = (vaddr_t)&end; 282 else 283 end_loaded = (vaddr_t)esym; 284 285 /* 286 * If we have enough fast-memory to put the kernel in and the 287 * RELOC_KERNEL option is set, do it! 288 */ 289 if ((reloc_kernel != 0) && (ttphysize >= end_loaded)) 290 kbase = ttphystart; 291 else 292 kbase = 0; 293 294 /* 295 * Determine the type of machine we are running on. This needs 296 * to be done early (and before initcpu())! 297 */ 298 set_machtype(); 299 300 /* 301 * Initialize CPU specific stuff 302 */ 303 initcpu(); 304 305 pstart = pmap_bootstrap1(end_loaded, kbase); 306 307 lowram = 0 >> PGSHIFT; /* XXX */ 308 309 /* 310 * Fill in usable segments. The page indexes will be initialized 311 * later when all reservations are made. 312 */ 313 usable_segs[0].start = 0; 314 usable_segs[0].end = stphysize; 315 usable_segs[0].free_list = VM_FREELIST_STRAM; 316 #if defined(_MILANHW_) 317 for (i = 1; i < seg; i++) { 318 usable_segs[i].start = boot_segs[i].start; 319 usable_segs[i].end = boot_segs[i].end; 320 usable_segs[i].free_list = VM_FREELIST_TTRAM; 321 } 322 for (; i < NMEM_SEGS; i++) { 323 usable_segs[i].start = usable_segs[i].end = 0; 324 } 325 #else 326 usable_segs[1].start = ttphystart; 327 usable_segs[1].end = ttphystart + ttphysize; 328 usable_segs[1].free_list = VM_FREELIST_TTRAM; 329 usable_segs[2].start = usable_segs[2].end = 0; /* End of segments! */ 330 #endif 331 332 if (kbase) { 333 /* 334 * First page of ST-ram is unusable, reserve the space 335 * for the kernel in the TT-ram segment. 336 * Note: Because physical page-zero is partially mapped to ROM 337 * by hardware, it is unusable. 338 */ 339 usable_segs[0].start = PAGE_SIZE; 340 usable_segs[1].start += pstart; 341 } else 342 usable_segs[0].start += pstart; 343 344 /* 345 * As all segment sizes are now valid, calculate page indexes and 346 * available physical memory. 347 */ 348 usable_segs[0].first_page = 0; 349 for (i = 1; i < NMEM_SEGS && usable_segs[i].start; i++) { 350 usable_segs[i].first_page = usable_segs[i-1].first_page; 351 usable_segs[i].first_page += 352 (usable_segs[i-1].end - usable_segs[i-1].start) / PAGE_SIZE; 353 } 354 for (i = 0, physmem = 0; i < NMEM_SEGS && usable_segs[i].start; i++) 355 physmem += usable_segs[i].end - usable_segs[i].start; 356 physmem >>= PGSHIFT; 357 358 /* 359 * get the pmap module in sync with reality. 360 */ 361 pmap_bootstrap(); 362 363 #if defined(M68030) 364 /* 365 * Prepare the SRP prototype before relocating the kernel. 366 * The relocated copy must contain the root table address 367 * when the MMU is enabled. 368 */ 369 protorp[1] = Sysseg_pa; 370 #endif 371 372 cpu_init_kcorehdr(kbase, Sysseg_pa); 373 374 /* 375 * copy over the kernel (and all now initialized variables) 376 * to fastram. DONT use bcopy(), this beast is much larger 377 * than 128k ! 378 */ 379 if (kbase) { 380 register paddr_t *lp, *le, *fp; 381 382 lp = (paddr_t *)0; 383 le = (paddr_t *)pstart; 384 fp = (paddr_t *)kbase; 385 while (lp < le) 386 *fp++ = *lp++; 387 } 388 #if defined(M68040) || defined(M68060) 389 if (mmutype == MMU_68040) { 390 /* 391 * movel Sysseg_pa,a0; 392 * movec a0,SRP; 393 * pflusha; 394 * movel #$0xc000,d0; 395 * movec d0,TC 396 */ 397 if (cputype == CPU_68060) { 398 /* XXX: Need the branch cache be cleared? */ 399 __asm volatile (".word 0x4e7a,0x0002;" 400 "orl #0x400000,%%d0;" 401 ".word 0x4e7b,0x0002" : : : "d0"); 402 } 403 __asm volatile ("movel %0,%%a0;" 404 ".word 0x4e7b,0x8807" : : "a" (Sysseg_pa) : "a0"); 405 __asm volatile (".word 0xf518" : : ); 406 __asm volatile ("movel #0xc000,%%d0;" 407 ".word 0x4e7b,0x0003" : : : "d0" ); 408 } else 409 #endif 410 { 411 #if defined(M68030) 412 __asm volatile ("pmove %0@,%%srp" 413 : 414 : "a" (&protorp[0]), "m" (protorp[0]), "m" (protorp[1])); 415 /* 416 * setup and load TC register. 417 * enable_cpr, enable_srp, pagesize=8k, 418 * A = 8 bits, B = 11 bits 419 */ 420 u_int tc = MMU51_TCR_BITS; 421 __asm volatile ("pflusha" : : ); 422 __asm volatile ("pmove %0@,%%tc" : : "a" (&tc), "m" (tc)); 423 #endif /* M68030 */ 424 } 425 426 /* 427 * Initialize the "u-area" pages etc. 428 */ 429 void *ksp = pmap_bootstrap2(); 430 431 /* 432 * Get the hardware into a defined state 433 */ 434 atari_hwinit(); 435 436 /* 437 * Initialize stmem allocator 438 */ 439 init_stmem(); 440 441 /* 442 * Initialize the iomem arena for bus_space(9) to manage address 443 * spaces and allocate the physical RAM from the extent map. 444 */ 445 atari_bus_space_arena_init(0x0, 0xffffffff); 446 for (i = 0; i < NMEM_SEGS && boot_segs[i].end != 0; i++) { 447 if (atari_bus_space_alloc_physmem(boot_segs[i].start, 448 boot_segs[i].end)) { 449 /* XXX: Ahum, should not happen ;-) */ 450 printf("Warning: Cannot allocate boot memory from" 451 " extent map!?\n"); 452 } 453 } 454 455 /* 456 * Initialize interrupt mapping. 457 */ 458 intr_init(); 459 460 return ksp; 461 } 462 463 #if defined(_MILANHW_) 464 /* 465 * Probe and return available memory size in MB at specified address. 466 * The first slot SIMM have at least 16MB, so check if it has 32 or 64 MB. 467 * 468 * Note it seems Milan does not generate bus errors on accesses against 469 * address regions where memory doesn't exist, but it returns memory images 470 * of lower address of the bank. 471 */ 472 static u_int 473 milan_probe_bank_1(paddr_t start_paddr) 474 { 475 volatile uint8_t *base; 476 u_int mb; 477 uint8_t save_16, save_32, save_64; 478 479 /* Assume that this bank has at least 16MB */ 480 mb = 16; 481 482 base = (uint8_t *)start_paddr; 483 484 /* save and write a MAGIC at the end of 16MB region */ 485 save_16 = base[MB_END(16)]; 486 base[MB_END(16)] = MAGIC_16M; 487 488 /* check bus error at the end of 32MB region */ 489 if (badbaddr(base + MB_END(32))) { 490 /* bus error; assume no memory there */ 491 goto out16; 492 } 493 494 /* check if the 32MB region is not image of the prior 16MB region */ 495 save_32 = base[MB_END(32)]; 496 base[MB_END(32)] = MAGIC_32M; 497 if (base[MB_END(32)] != MAGIC_32M || base[MB_END(16)] != MAGIC_16M) { 498 /* no memory or image at the 32MB region */ 499 goto out16; 500 } 501 /* we have at least 32MB */ 502 mb = 32; 503 504 /* check bus error at the end of 64MB region */ 505 if (badbaddr(base + MB_END(64))) { 506 /* bus error; assume no memory there */ 507 goto out32; 508 } 509 510 /* check if the 64MB region is not image of the prior 32MB region */ 511 save_64 = base[MB_END(64)]; 512 base[MB_END(64)] = MAGIC_64M; 513 if (base[MB_END(64)] != MAGIC_64M || base[MB_END(32)] != MAGIC_32M) { 514 /* no memory or image at the 64MB region */ 515 goto out32; 516 } 517 /* we have 64MB */ 518 mb = 64; 519 base[MB_END(64)] = save_64; 520 out32: 521 base[MB_END(32)] = save_32; 522 out16: 523 base[MB_END(16)] = save_16; 524 525 return mb; 526 } 527 528 /* 529 * Probe and return available memory size in MB at specified address. 530 * The rest slot could be empty so check all possible size. 531 */ 532 static u_int 533 milan_probe_bank(paddr_t start_paddr) 534 { 535 volatile uint8_t *base; 536 u_int mb; 537 uint8_t save_4, save_8, save_16; 538 539 /* The rest banks might have no memory */ 540 mb = 0; 541 542 base = (uint8_t *)start_paddr; 543 544 /* check bus error at the end of 4MB region */ 545 if (badbaddr(base + MB_END(4))) { 546 /* bus error; assume no memory there */ 547 goto out; 548 } 549 550 /* check if the 4MB region has memory */ 551 save_4 = base[MB_END(4)]; 552 base[MB_END(4)] = MAGIC_4M_INV; 553 if (base[MB_END(4)] != MAGIC_4M_INV) { 554 /* no memory */ 555 goto out; 556 } 557 base[MB_END(4)] = MAGIC_4M; 558 if (base[MB_END(4)] != MAGIC_4M) { 559 /* no memory */ 560 goto out; 561 } 562 /* we have at least 4MB */ 563 mb = 4; 564 565 /* check bus error at the end of 8MB region */ 566 if (badbaddr(base + MB_END(8))) { 567 /* bus error; assume no memory there */ 568 goto out4; 569 } 570 571 /* check if the 8MB region is not image of the prior 4MB region */ 572 save_8 = base[MB_END(8)]; 573 base[MB_END(8)] = MAGIC_8M; 574 if (base[MB_END(8)] != MAGIC_8M || base[MB_END(4)] != MAGIC_4M) { 575 /* no memory or image at the 8MB region */ 576 goto out4; 577 } 578 /* we have at least 8MB */ 579 mb = 8; 580 581 /* check bus error at the end of 16MB region */ 582 if (badbaddr(base + MB_END(16))) { 583 /* bus error; assume no memory there */ 584 goto out8; 585 } 586 587 /* check if the 16MB region is not image of the prior 8MB region */ 588 save_16 = base[MB_END(16)]; 589 base[MB_END(16)] = MAGIC_16M; 590 if (base[MB_END(16)] != MAGIC_16M || base[MB_END(8)] != MAGIC_8M) { 591 /* no memory or image at the 32MB region */ 592 goto out8; 593 } 594 /* we have at least 16MB, so check more region as the first bank */ 595 mb = milan_probe_bank_1(start_paddr); 596 597 base[MB_END(16)] = save_16; 598 out8: 599 base[MB_END(8)] = save_8; 600 out4: 601 base[MB_END(4)] = save_4; 602 out: 603 604 return mb; 605 } 606 #endif /* _MILANHW_ */ 607 608 /* 609 * Try to figure out on what type of machine we are running 610 * Note: This module runs *before* the io-mapping is setup! 611 */ 612 static void 613 set_machtype(void) 614 { 615 616 #ifdef _MILANHW_ 617 machineid |= ATARI_MILAN; 618 619 #else 620 stio_addr = 0xff8000; /* XXX: For TT & Falcon only */ 621 if (badbaddr(&MFP2->mf_gpip)) { 622 /* 623 * Watch out! We can also have a Hades with < 16Mb 624 * RAM here... 625 */ 626 if (!badbaddr(&MFP->mf_gpip)) { 627 machineid |= ATARI_FALCON; 628 return; 629 } 630 } 631 if (!badbaddr((void *)(PCI_CONFB_PHYS + PCI_CONFM_PHYS))) 632 machineid |= ATARI_HADES; 633 else 634 machineid |= ATARI_TT; 635 #endif /* _MILANHW_ */ 636 } 637 638 static void 639 atari_hwinit(void) 640 { 641 642 #if defined(_ATARIHW_) 643 /* 644 * Initialize the sound chip 645 */ 646 ym2149_init(); 647 648 /* 649 * Make sure that the midi acia will not generate an interrupt 650 * unless something attaches to it. We cannot do this for the 651 * keyboard acia because this breaks the '-d' option of the 652 * booter... 653 */ 654 MDI->ac_cs = 0; 655 #endif /* defined(_ATARIHW_) */ 656 657 /* 658 * Initialize both MFP chips (if both present!) to generate 659 * auto-vectored interrupts with EOI. The active-edge registers are 660 * set up. The interrupt enable registers are set to disable all 661 * interrupts. 662 */ 663 MFP->mf_iera = MFP->mf_ierb = 0; 664 MFP->mf_imra = MFP->mf_imrb = 0; 665 MFP->mf_aer = MFP->mf_ddr = 0; 666 MFP->mf_vr = 0x40; 667 668 #if defined(_ATARIHW_) 669 if (machineid & (ATARI_TT|ATARI_HADES)) { 670 MFP2->mf_iera = MFP2->mf_ierb = 0; 671 MFP2->mf_imra = MFP2->mf_imrb = 0; 672 MFP2->mf_aer = 0x80; 673 MFP2->mf_vr = 0x50; 674 } 675 676 if (machineid & ATARI_TT) { 677 /* 678 * Initialize the SCU, to enable interrupts on the SCC (ipl5), 679 * MFP (ipl6) and softints (ipl1). 680 */ 681 SCU->sys_mask = SCU_SYS_SOFT; 682 SCU->vme_mask = SCU_MFP | SCU_SCC; 683 #ifdef DDB 684 /* 685 * This allows people with the correct hardware modification 686 * to drop into the debugger from an NMI. 687 */ 688 SCU->sys_mask |= SCU_IRQ7; 689 #endif 690 } 691 #endif /* defined(_ATARIHW_) */ 692 693 /* 694 * Initialize a timer for delay(9). 695 */ 696 init_delay(); 697 698 #if NPCI > 0 699 if (machineid & (ATARI_HADES|ATARI_MILAN)) { 700 /* 701 * Configure PCI-bus 702 */ 703 init_pci_bus(); 704 } 705 #endif 706 707 } 708 709 #if defined(M68060) 710 int m68060_pcr_init = PCR_ESS; /* make this patchable */ 711 #endif 712 713 static void 714 initcpu(void) 715 { 716 #if defined(M68060) 717 if (cputype == CPU_68060) { 718 __asm volatile ("movl %0,%%d0; .word 0x4e7b,0x0808" : : 719 "d"(m68060_pcr_init):"d0" ); 720 } 721 #endif 722 /* Initialize the vector table. */ 723 vec_init(); 724 } 725