| .. | .. |
|---|
| 10 | 10 | */ |
|---|
| 11 | 11 | |
|---|
| 12 | 12 | #include <linux/kernel.h> |
|---|
| 13 | +#include <linux/cpu.h> |
|---|
| 13 | 14 | #include <linux/mm.h> |
|---|
| 14 | 15 | #include <linux/sched.h> |
|---|
| 15 | 16 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 20 | 21 | #include <linux/errno.h> |
|---|
| 21 | 22 | #include <linux/string.h> |
|---|
| 22 | 23 | #include <linux/init.h> |
|---|
| 23 | | -#include <linux/bootmem.h> |
|---|
| 24 | 24 | #include <linux/memblock.h> |
|---|
| 25 | 25 | #include <linux/proc_fs.h> |
|---|
| 26 | 26 | #include <linux/seq_file.h> |
|---|
| 27 | 27 | #include <linux/module.h> |
|---|
| 28 | +#include <linux/nvram.h> |
|---|
| 28 | 29 | #include <linux/initrd.h> |
|---|
| 29 | 30 | |
|---|
| 30 | 31 | #include <asm/bootinfo.h> |
|---|
| .. | .. |
|---|
| 38 | 39 | #ifdef CONFIG_AMIGA |
|---|
| 39 | 40 | #include <asm/amigahw.h> |
|---|
| 40 | 41 | #endif |
|---|
| 41 | | -#ifdef CONFIG_ATARI |
|---|
| 42 | 42 | #include <asm/atarihw.h> |
|---|
| 43 | +#ifdef CONFIG_ATARI |
|---|
| 43 | 44 | #include <asm/atari_stram.h> |
|---|
| 44 | 45 | #endif |
|---|
| 45 | 46 | #ifdef CONFIG_SUN3X |
|---|
| 46 | 47 | #include <asm/dvma.h> |
|---|
| 47 | 48 | #endif |
|---|
| 49 | +#include <asm/macintosh.h> |
|---|
| 48 | 50 | #include <asm/natfeat.h> |
|---|
| 49 | 51 | |
|---|
| 50 | 52 | #if !FPSTATESIZE || !NR_IRQS |
|---|
| .. | .. |
|---|
| 272 | 274 | memcpy(boot_command_line, *cmdline_p, CL_SIZE); |
|---|
| 273 | 275 | |
|---|
| 274 | 276 | parse_early_param(); |
|---|
| 275 | | - |
|---|
| 276 | | -#ifdef CONFIG_DUMMY_CONSOLE |
|---|
| 277 | | - conswitchp = &dummy_con; |
|---|
| 278 | | -#endif |
|---|
| 279 | 277 | |
|---|
| 280 | 278 | switch (m68k_machtype) { |
|---|
| 281 | 279 | #ifdef CONFIG_AMIGA |
|---|
| .. | .. |
|---|
| 526 | 524 | module_init(proc_hardware_init); |
|---|
| 527 | 525 | #endif |
|---|
| 528 | 526 | |
|---|
| 529 | | -void check_bugs(void) |
|---|
| 527 | +void __init arch_cpu_finalize_init(void) |
|---|
| 530 | 528 | { |
|---|
| 531 | 529 | #if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU) |
|---|
| 532 | 530 | if (m68k_fputype == 0) { |
|---|
| .. | .. |
|---|
| 548 | 546 | |
|---|
| 549 | 547 | __setup("adb_sync", adb_probe_sync_enable); |
|---|
| 550 | 548 | #endif /* CONFIG_ADB */ |
|---|
| 549 | + |
|---|
| 550 | +#if IS_ENABLED(CONFIG_NVRAM) |
|---|
| 551 | +#ifdef CONFIG_MAC |
|---|
| 552 | +static unsigned char m68k_nvram_read_byte(int addr) |
|---|
| 553 | +{ |
|---|
| 554 | + if (MACH_IS_MAC) |
|---|
| 555 | + return mac_pram_read_byte(addr); |
|---|
| 556 | + return 0xff; |
|---|
| 557 | +} |
|---|
| 558 | + |
|---|
| 559 | +static void m68k_nvram_write_byte(unsigned char val, int addr) |
|---|
| 560 | +{ |
|---|
| 561 | + if (MACH_IS_MAC) |
|---|
| 562 | + mac_pram_write_byte(val, addr); |
|---|
| 563 | +} |
|---|
| 564 | +#endif /* CONFIG_MAC */ |
|---|
| 565 | + |
|---|
| 566 | +#ifdef CONFIG_ATARI |
|---|
| 567 | +static ssize_t m68k_nvram_read(char *buf, size_t count, loff_t *ppos) |
|---|
| 568 | +{ |
|---|
| 569 | + if (MACH_IS_ATARI) |
|---|
| 570 | + return atari_nvram_read(buf, count, ppos); |
|---|
| 571 | + else if (MACH_IS_MAC) |
|---|
| 572 | + return nvram_read_bytes(buf, count, ppos); |
|---|
| 573 | + return -EINVAL; |
|---|
| 574 | +} |
|---|
| 575 | + |
|---|
| 576 | +static ssize_t m68k_nvram_write(char *buf, size_t count, loff_t *ppos) |
|---|
| 577 | +{ |
|---|
| 578 | + if (MACH_IS_ATARI) |
|---|
| 579 | + return atari_nvram_write(buf, count, ppos); |
|---|
| 580 | + else if (MACH_IS_MAC) |
|---|
| 581 | + return nvram_write_bytes(buf, count, ppos); |
|---|
| 582 | + return -EINVAL; |
|---|
| 583 | +} |
|---|
| 584 | + |
|---|
| 585 | +static long m68k_nvram_set_checksum(void) |
|---|
| 586 | +{ |
|---|
| 587 | + if (MACH_IS_ATARI) |
|---|
| 588 | + return atari_nvram_set_checksum(); |
|---|
| 589 | + return -EINVAL; |
|---|
| 590 | +} |
|---|
| 591 | + |
|---|
| 592 | +static long m68k_nvram_initialize(void) |
|---|
| 593 | +{ |
|---|
| 594 | + if (MACH_IS_ATARI) |
|---|
| 595 | + return atari_nvram_initialize(); |
|---|
| 596 | + return -EINVAL; |
|---|
| 597 | +} |
|---|
| 598 | +#endif /* CONFIG_ATARI */ |
|---|
| 599 | + |
|---|
| 600 | +static ssize_t m68k_nvram_get_size(void) |
|---|
| 601 | +{ |
|---|
| 602 | + if (MACH_IS_ATARI) |
|---|
| 603 | + return atari_nvram_get_size(); |
|---|
| 604 | + else if (MACH_IS_MAC) |
|---|
| 605 | + return mac_pram_get_size(); |
|---|
| 606 | + return -ENODEV; |
|---|
| 607 | +} |
|---|
| 608 | + |
|---|
| 609 | +/* Atari device drivers call .read (to get checksum validation) whereas |
|---|
| 610 | + * Mac and PowerMac device drivers just use .read_byte. |
|---|
| 611 | + */ |
|---|
| 612 | +const struct nvram_ops arch_nvram_ops = { |
|---|
| 613 | +#ifdef CONFIG_MAC |
|---|
| 614 | + .read_byte = m68k_nvram_read_byte, |
|---|
| 615 | + .write_byte = m68k_nvram_write_byte, |
|---|
| 616 | +#endif |
|---|
| 617 | +#ifdef CONFIG_ATARI |
|---|
| 618 | + .read = m68k_nvram_read, |
|---|
| 619 | + .write = m68k_nvram_write, |
|---|
| 620 | + .set_checksum = m68k_nvram_set_checksum, |
|---|
| 621 | + .initialize = m68k_nvram_initialize, |
|---|
| 622 | +#endif |
|---|
| 623 | + .get_size = m68k_nvram_get_size, |
|---|
| 624 | +}; |
|---|
| 625 | +EXPORT_SYMBOL(arch_nvram_ops); |
|---|
| 626 | +#endif /* CONFIG_NVRAM */ |
|---|