2 * linux/arch/m68k/sun3/config.c
4 * Copyright (C) 1996,1997 Pekka Pietik{inen
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
11 #include <linux/types.h>
12 #include <linux/kernel.h>
14 #include <linux/seq_file.h>
15 #include <linux/tty.h>
16 #include <linux/console.h>
17 #include <linux/init.h>
18 #include <linux/bootmem.h>
20 #include <asm/oplib.h>
21 #include <asm/setup.h>
22 #include <asm/contregs.h>
24 #include <asm/pgtable.h>
25 #include <asm/pgalloc.h>
26 #include <asm/sun3-head.h>
27 #include <asm/sun3mmu.h>
29 #include <asm/machdep.h>
30 #include <asm/intersil.h>
32 #include <asm/segment.h>
33 #include <asm/sun3ints.h>
35 extern char _text
, _end
;
37 char sun3_reserved_pmeg
[SUN3_PMEGS_NUM
];
39 extern unsigned long sun3_gettimeoffset(void);
40 static void sun3_sched_init(irq_handler_t handler
);
41 extern void sun3_get_model (char* model
);
42 extern void idprom_init (void);
43 extern int sun3_hwclk(int set
, struct rtc_time
*t
);
45 volatile char* clock_va
;
46 extern volatile unsigned char* sun3_intreg
;
47 extern unsigned long availmem
;
48 unsigned long num_pages
;
50 static void sun3_get_hardware_list(struct seq_file
*m
)
52 seq_printf(m
, "PROM Revision:\t%s\n", romvec
->pv_monid
);
55 void __init
sun3_init(void)
57 unsigned char enable_register
;
60 m68k_machtype
= MACH_SUN3
;
61 m68k_cputype
= CPU_68020
;
62 m68k_fputype
= FPU_68881
; /* mc68881 actually */
63 m68k_mmutype
= MMU_SUN3
;
64 clock_va
= (char *) 0xfe06000; /* dark */
65 sun3_intreg
= (unsigned char *) 0xfe0a000; /* magic */
66 sun3_disable_interrupts();
68 prom_init((void *)LINUX_OPPROM_BEGVM
);
70 GET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
71 enable_register
|= 0x50; /* Enable FPU */
72 SET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
73 GET_CONTROL_BYTE(AC_SENABLE
,enable_register
);
75 /* This code looks suspicious, because it doesn't subtract
76 memory belonging to the kernel from the available space */
79 memset(sun3_reserved_pmeg
, 0, sizeof(sun3_reserved_pmeg
));
81 /* Reserve important PMEGS */
82 /* FIXME: These should be probed instead of hardcoded */
84 for (i
=0; i
<8; i
++) /* Kernel PMEGs */
85 sun3_reserved_pmeg
[i
] = 1;
87 sun3_reserved_pmeg
[247] = 1; /* ROM mapping */
88 sun3_reserved_pmeg
[248] = 1; /* AMD Ethernet */
89 sun3_reserved_pmeg
[251] = 1; /* VB area */
90 sun3_reserved_pmeg
[254] = 1; /* main I/O */
92 sun3_reserved_pmeg
[249] = 1;
93 sun3_reserved_pmeg
[252] = 1;
94 sun3_reserved_pmeg
[253] = 1;
98 /* Without this, Bad Things happen when something calls arch_reset. */
99 static void sun3_reboot (void)
101 prom_reboot ("vmlinux");
104 static void sun3_halt (void)
109 /* sun3 bootmem allocation */
111 static void __init
sun3_bootmem_alloc(unsigned long memory_start
,
112 unsigned long memory_end
)
114 unsigned long start_page
;
116 /* align start/end to page boundaries */
117 memory_start
= ((memory_start
+ (PAGE_SIZE
-1)) & PAGE_MASK
);
118 memory_end
= memory_end
& PAGE_MASK
;
120 start_page
= __pa(memory_start
) >> PAGE_SHIFT
;
121 num_pages
= __pa(memory_end
) >> PAGE_SHIFT
;
123 high_memory
= (void *)memory_end
;
124 availmem
= memory_start
;
127 availmem
+= init_bootmem_node(NODE_DATA(0), start_page
, 0, num_pages
);
128 availmem
= (availmem
+ (PAGE_SIZE
-1)) & PAGE_MASK
;
130 free_bootmem(__pa(availmem
), memory_end
- (availmem
));
134 void __init
config_sun3(void)
136 unsigned long memory_start
, memory_end
;
138 printk("ARCH: SUN3\n");
141 /* Subtract kernel memory from available memory */
143 mach_sched_init
= sun3_sched_init
;
144 mach_init_IRQ
= sun3_init_IRQ
;
145 mach_reset
= sun3_reboot
;
146 mach_gettimeoffset
= sun3_gettimeoffset
;
147 mach_get_model
= sun3_get_model
;
148 mach_hwclk
= sun3_hwclk
;
149 mach_halt
= sun3_halt
;
150 mach_get_hardware_list
= sun3_get_hardware_list
;
152 memory_start
= ((((int)&_end
) + 0x2000) & ~0x1fff);
153 // PROM seems to want the last couple of physical pages. --m
154 memory_end
= *(romvec
->pv_sun3mem
) + PAGE_OFFSET
- 2*PAGE_SIZE
;
157 m68k_memory
[0].size
=*(romvec
->pv_sun3mem
);
159 sun3_bootmem_alloc(memory_start
, memory_end
);
162 static void __init
sun3_sched_init(irq_handler_t timer_routine
)
164 sun3_disable_interrupts();
165 intersil_clock
->cmd_reg
=(INTERSIL_RUN
|INTERSIL_INT_DISABLE
|INTERSIL_24H_MODE
);
166 intersil_clock
->int_reg
=INTERSIL_HZ_100_MASK
;
169 intersil_clock
->cmd_reg
=(INTERSIL_RUN
|INTERSIL_INT_ENABLE
|INTERSIL_24H_MODE
);
170 sun3_enable_interrupts();