hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/m68k/kernel/setup_mm.c
....@@ -20,11 +20,11 @@
2020 #include <linux/errno.h>
2121 #include <linux/string.h>
2222 #include <linux/init.h>
23
-#include <linux/bootmem.h>
2423 #include <linux/memblock.h>
2524 #include <linux/proc_fs.h>
2625 #include <linux/seq_file.h>
2726 #include <linux/module.h>
27
+#include <linux/nvram.h>
2828 #include <linux/initrd.h>
2929
3030 #include <asm/bootinfo.h>
....@@ -38,13 +38,14 @@
3838 #ifdef CONFIG_AMIGA
3939 #include <asm/amigahw.h>
4040 #endif
41
-#ifdef CONFIG_ATARI
4241 #include <asm/atarihw.h>
42
+#ifdef CONFIG_ATARI
4343 #include <asm/atari_stram.h>
4444 #endif
4545 #ifdef CONFIG_SUN3X
4646 #include <asm/dvma.h>
4747 #endif
48
+#include <asm/macintosh.h>
4849 #include <asm/natfeat.h>
4950
5051 #if !FPSTATESIZE || !NR_IRQS
....@@ -272,10 +273,6 @@
272273 memcpy(boot_command_line, *cmdline_p, CL_SIZE);
273274
274275 parse_early_param();
275
-
276
-#ifdef CONFIG_DUMMY_CONSOLE
277
- conswitchp = &dummy_con;
278
-#endif
279276
280277 switch (m68k_machtype) {
281278 #ifdef CONFIG_AMIGA
....@@ -548,3 +545,81 @@
548545
549546 __setup("adb_sync", adb_probe_sync_enable);
550547 #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 */