2 * Written by: Garry Forsgren, Unisys Corporation
3 * Natalie Protasevich, Unisys Corporation
4 * This file contains the code to configure and interface
5 * with Unisys ES7000 series hardware system manager.
7 * Copyright (c) 2003 Unisys Corporation. All Rights Reserved.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it would be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 * Contact information: Unisys Corporation, Township Line & Union Meeting
22 * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
24 * http://www.unisys.com
27 #include <linux/module.h>
28 #include <linux/types.h>
29 #include <linux/kernel.h>
30 #include <linux/smp.h>
31 #include <linux/string.h>
32 #include <linux/spinlock.h>
33 #include <linux/errno.h>
34 #include <linux/notifier.h>
35 #include <linux/reboot.h>
36 #include <linux/init.h>
37 #include <linux/acpi.h>
41 #include <asm/apicdef.h>
43 #include <mach_mpparse.h>
49 static volatile unsigned long *psai = NULL;
50 static struct mip_reg *mip_reg;
51 static struct mip_reg *host_reg;
53 static unsigned long mip_addr, host_addr;
58 * GSI override for ES7000 platforms.
61 static unsigned int base;
64 es7000_rename_gsi(int ioapic, int gsi)
66 if (es7000_plat == ES7000_ZORRO)
71 for (i = 0; i < nr_ioapics; i++)
72 base += nr_ioapic_registers[i];
75 if (!ioapic && (gsi < 16))
84 * Determine the generation of the ES7000 currently running.
86 * es7000_plat = 1 if the machine is a 5xx ES7000 box
87 * es7000_plat = 2 if the machine is a x86_64 ES7000 box
90 if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
91 es7000_plat = ES7000_ZORRO;
93 es7000_plat = ES7000_CLASSIC;
94 ioapic_renumber_irq = es7000_rename_gsi;
102 parse_unisys_oem (char *oemptr)
106 unsigned char type, size;
109 struct psai *psaip = NULL;
110 struct mip_reg_info *mi;
111 struct mip_reg *host, *mip;
117 for (i=0; i <= 6; i++) {
123 mi = (struct mip_reg_info *)tp;
124 val = MIP_RD_LO(mi->host_reg);
126 host = (struct mip_reg *)val;
127 host_reg = __va(host);
128 val = MIP_RD_LO(mi->mip_reg);
129 mip_port = MIP_PORT(mi->mip_info);
131 mip = (struct mip_reg *)val;
133 Dprintk("es7000_mipcfg: host_reg = 0x%lx \n",
134 (unsigned long)host_reg);
135 Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n",
136 (unsigned long)mip_reg);
140 psaip = (struct psai *)tp;
143 psai = __va(psaip->addr);
156 es7000_plat = NON_UNISYS;
164 find_unisys_acpi_oem_table(unsigned long *oem_addr)
166 struct acpi_table_header *header = NULL;
168 while (ACPI_SUCCESS(acpi_get_table("OEM1", i++, &header))) {
169 if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) {
170 struct oem_table *t = (struct oem_table *)header;
171 *oem_addr = (unsigned long)__acpi_map_table(t->OEMTableAddr,
190 es7000_mip_write(struct mip_reg *mip_reg)
196 while (((unsigned long long)host_reg->off_38 &
197 (unsigned long long)MIP_VALID) != 0) {
199 printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
202 es7000_spin(MIP_SPIN);
205 memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
210 while (((unsigned long long)mip_reg->off_38 &
211 (unsigned long long)MIP_VALID) == 0) {
213 printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
216 es7000_spin(MIP_SPIN);
219 status = ((unsigned long long)mip_reg->off_0 &
220 (unsigned long long)0xffff0000000000ULL) >> 48;
221 mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
222 (unsigned long long)~MIP_VALID);
227 es7000_start_cpu(int cpu, unsigned long eip)
229 unsigned long vect = 0, psaival = 0;
234 vect = ((unsigned long)__pa(eip)/0x1000) << 16;
235 psaival = (0x1000000 | vect | cpu);
237 while (*psai & 0x1000000)
251 struct mip_reg es7000_mip_reg;
253 printk("ES7000: Enabling APIC mode.\n");
254 memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
255 es7000_mip_reg.off_0 = MIP_SW_APIC;
256 es7000_mip_reg.off_38 = (MIP_VALID);
257 while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
258 printk("es7000_sw_apic: command failed, status = %x\n",