hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/m68k/kernel/setup_mm.c
....@@ -10,6 +10,7 @@
1010 */
1111
1212 #include <linux/kernel.h>
13
+#include <linux/cpu.h>
1314 #include <linux/mm.h>
1415 #include <linux/sched.h>
1516 #include <linux/delay.h>
....@@ -20,11 +21,11 @@
2021 #include <linux/errno.h>
2122 #include <linux/string.h>
2223 #include <linux/init.h>
23
-#include <linux/bootmem.h>
2424 #include <linux/memblock.h>
2525 #include <linux/proc_fs.h>
2626 #include <linux/seq_file.h>
2727 #include <linux/module.h>
28
+#include <linux/nvram.h>
2829 #include <linux/initrd.h>
2930
3031 #include <asm/bootinfo.h>
....@@ -38,13 +39,14 @@
3839 #ifdef CONFIG_AMIGA
3940 #include <asm/amigahw.h>
4041 #endif
41
-#ifdef CONFIG_ATARI
4242 #include <asm/atarihw.h>
43
+#ifdef CONFIG_ATARI
4344 #include <asm/atari_stram.h>
4445 #endif
4546 #ifdef CONFIG_SUN3X
4647 #include <asm/dvma.h>
4748 #endif
49
+#include <asm/macintosh.h>
4850 #include <asm/natfeat.h>
4951
5052 #if !FPSTATESIZE || !NR_IRQS
....@@ -272,10 +274,6 @@
272274 memcpy(boot_command_line, *cmdline_p, CL_SIZE);
273275
274276 parse_early_param();
275
-
276
-#ifdef CONFIG_DUMMY_CONSOLE
277
- conswitchp = &dummy_con;
278
-#endif
279277
280278 switch (m68k_machtype) {
281279 #ifdef CONFIG_AMIGA
....@@ -526,7 +524,7 @@
526524 module_init(proc_hardware_init);
527525 #endif
528526
529
-void check_bugs(void)
527
+void __init arch_cpu_finalize_init(void)
530528 {
531529 #if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU)
532530 if (m68k_fputype == 0) {
....@@ -548,3 +546,81 @@
548546
549547 __setup("adb_sync", adb_probe_sync_enable);
550548 #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 */