2 * linux/arch/alpha/kernel/sys_nautilus.c
4 * Copyright (C) 1995 David A Rusling
5 * Copyright (C) 1998 Richard Henderson
6 * Copyright (C) 1999 Alpha Processor, Inc.,
7 * (David Daniel, Stig Telfer, Soohoon Lee)
9 * Code supporting NAUTILUS systems.
12 * NAUTILUS has the following I/O features:
14 * a) Driven by AMD 751 aka IRONGATE (northbridge):
18 * b) Driven by ALI M1543C (southbridge)
21 * 1 dual drive capable FDD controller
23 * 1 ECP/EPP/SP parallel port
27 #include <linux/kernel.h>
28 #include <linux/types.h>
30 #include <linux/sched.h>
31 #include <linux/pci.h>
32 #include <linux/init.h>
33 #include <linux/reboot.h>
34 #include <linux/bootmem.h>
35 #include <linux/bitops.h>
37 #include <asm/ptrace.h>
38 #include <asm/system.h>
41 #include <asm/mmu_context.h>
44 #include <asm/pgtable.h>
45 #include <asm/core_irongate.h>
46 #include <asm/hwrpb.h>
47 #include <asm/tlbflush.h>
53 #include "machvec_impl.h"
57 nautilus_init_irq(void)
59 if (alpha_using_srm) {
60 alpha_mv.device_interrupt = srm_device_interrupt;
64 common_init_isa_dma();
68 nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
70 /* Preserve the IRQ set up by the console. */
73 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
78 nautilus_kill_arch(int mode)
80 struct pci_bus *bus = pci_isa_hose->bus;
85 case LINUX_REBOOT_CMD_RESTART:
86 if (! alpha_using_srm) {
88 pci_bus_read_config_byte(bus, 0x38, 0x43, &t8);
89 pci_bus_write_config_byte(bus, 0x38, 0x43, t8 | 0x80);
96 case LINUX_REBOOT_CMD_POWER_OFF:
98 off = 0x2000; /* SLP_TYPE = 0, SLP_EN = 1 */
99 pci_bus_read_config_dword(bus, 0x88, 0x10, &pmuport);
102 off = 0x3400; /* SLP_TYPE = 5, SLP_EN = 1 */
103 pci_bus_read_config_dword(bus, 0x88, 0xe0, &pmuport);
106 outw(0xffff, pmuport); /* Clear pending events. */
107 outw(off, pmuport + 4);
113 /* Perform analysis of a machine check that arrived from the system (NMI) */
116 naut_sys_machine_check(unsigned long vector, unsigned long la_ptr,
117 struct pt_regs *regs)
119 printk("PC %lx RA %lx\n", regs->pc, regs->r26);
120 irongate_pci_clr_err();
123 /* Machine checks can come from two sources - those on the CPU and those
124 in the system. They are analysed separately but all starts here. */
127 nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
131 /* Now for some analysis. Machine checks fall into two classes --
132 those picked up by the system, and those picked up by the CPU.
133 Add to that the two levels of severity - correctable or not. */
135 if (vector == SCB_Q_SYSMCHK
136 && ((IRONGATE0->dramms & 0x300) == 0x300)) {
137 unsigned long nmi_ctl;
146 /* Write again clears error bits. */
147 IRONGATE0->stat_cmd = IRONGATE0->stat_cmd & ~0x100;
151 /* Write again clears error bits. */
152 IRONGATE0->dramms = IRONGATE0->dramms;
162 if (vector == SCB_Q_SYSERR)
163 mchk_class = "Correctable";
164 else if (vector == SCB_Q_SYSMCHK)
165 mchk_class = "Fatal";
167 ev6_machine_check(vector, la_ptr);
171 printk(KERN_CRIT "NAUTILUS Machine check 0x%lx "
172 "[%s System Machine Check (NMI)]\n",
175 naut_sys_machine_check(vector, la_ptr, get_irq_regs());
177 /* Tell the PALcode to clear the machine check */
183 extern void free_reserved_mem(void *, void *);
185 static struct resource irongate_mem = {
186 .name = "Irongate PCI MEM",
187 .flags = IORESOURCE_MEM,
191 nautilus_init_pci(void)
193 struct pci_controller *hose = hose_head;
195 struct pci_dev *irongate;
196 unsigned long bus_align, bus_size, pci_mem;
197 unsigned long memtop = max_low_pfn << PAGE_SHIFT;
199 /* Scan our single hose. */
200 bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
203 irongate = pci_get_bus_and_slot(0, 0);
204 bus->self = irongate;
205 bus->resource[1] = &irongate_mem;
207 pci_bus_size_bridges(bus);
210 bus->resource[0]->start = 0;
211 bus->resource[0]->end = 0xffff;
213 /* Set up PCI memory range - limit is hardwired to 0xffffffff,
214 base must be at aligned to 16Mb. */
215 bus_align = bus->resource[1]->start;
216 bus_size = bus->resource[1]->end + 1 - bus_align;
217 if (bus_align < 0x1000000UL)
218 bus_align = 0x1000000UL;
220 pci_mem = (0x100000000UL - bus_size) & -bus_align;
222 bus->resource[1]->start = pci_mem;
223 bus->resource[1]->end = 0xffffffffUL;
224 if (request_resource(&iomem_resource, bus->resource[1]) < 0)
225 printk(KERN_ERR "Failed to request MEM on hose 0\n");
227 if (pci_mem < memtop)
229 if (memtop > alpha_mv.min_mem_address) {
230 free_reserved_mem(__va(alpha_mv.min_mem_address),
232 printk("nautilus_init_pci: %ldk freed\n",
233 (memtop - alpha_mv.min_mem_address) >> 10);
236 if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
237 IRONGATE0->pci_mem = pci_mem;
239 pci_bus_assign_resources(bus);
240 pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
247 struct alpha_machine_vector nautilus_mv __initmv = {
248 .vector_name = "Nautilus",
252 .machine_check = nautilus_machine_check,
253 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
254 .min_io_address = DEFAULT_IO_BASE,
255 .min_mem_address = IRONGATE_DEFAULT_MEM_BASE,
258 .device_interrupt = isa_device_interrupt,
260 .init_arch = irongate_init_arch,
261 .init_irq = nautilus_init_irq,
262 .init_rtc = common_init_rtc,
263 .init_pci = nautilus_init_pci,
264 .kill_arch = nautilus_kill_arch,
265 .pci_map_irq = nautilus_map_irq,
266 .pci_swizzle = common_swizzle,