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