direct-io.hg

view xen/arch/x86/genapic/es7000plat.c @ 15516:fa9fa5f98c91

Simplify Unisys ES7000 code in light of the fact we do not support
legacy boxes with very non-standard APIC setup.
From: Raj Subrahmanian <raj.subrahmanian@unisys.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Jul 10 10:07:00 2007 +0100 (2007-07-10)
parents 356588dda4bc
children
line source
1 /*
2 * Written by: Garry Forsgren, Unisys Corporation
3 * Natalie Protasevich, Unisys Corporation
4 * Modified by: Raj Subrahmanian <raj.subrahmanian@unisys.com> Unisys Corp.
5 * This file contains the code to configure and interface
6 * with Unisys ES7000 series hardware system manager.
7 *
8 * Copyright (c) 2003 Unisys Corporation. All Rights Reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it would be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write the Free Software Foundation, Inc., 59
20 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * Contact information: Unisys Corporation, Township Line & Union Meeting
23 * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
24 *
25 * http://www.unisys.com
26 */
28 #include <xen/config.h>
29 #include <xen/types.h>
30 #include <xen/kernel.h>
31 #include <xen/smp.h>
32 #include <xen/string.h>
33 #include <xen/spinlock.h>
34 #include <xen/errno.h>
35 #include <xen/init.h>
36 #include <xen/acpi.h>
37 #include <asm/io.h>
38 #include <asm/smp.h>
39 #include <asm/apicdef.h>
41 #define MIP_REG 1
42 #define MIP_PSAI_REG 4
44 struct acpi_table_sdt {
45 unsigned long pa;
46 unsigned long count;
47 struct {
48 unsigned long pa;
49 enum acpi_table_id id;
50 unsigned long size;
51 } entry[50];
52 };
54 struct oem_table {
55 struct acpi_table_header Header;
56 u32 OEMTableAddr;
57 u32 OEMTableSize;
58 };
60 int __init
61 parse_unisys_oem(char *oemptr)
62 {
63 int i;
64 int success = 0;
65 unsigned char type, size;
66 char *tp = NULL;
68 tp = oemptr;
70 tp += 8;
72 for (i=0; i <= 6; i++) {
73 type = *tp++;
74 size = *tp++;
75 tp -= 2;
76 switch (type) {
77 case MIP_REG:
78 case MIP_PSAI_REG:
79 success++;
80 break;
81 default:
82 break;
83 }
84 tp += size;
85 }
87 return (success >= 2);
88 }
90 int __init
91 find_unisys_acpi_oem_table(unsigned long *oem_addr)
92 {
93 struct acpi_table_rsdp *rsdp = NULL;
94 unsigned long rsdp_phys = 0;
95 struct acpi_table_header *header = NULL;
96 int i;
97 struct acpi_table_sdt sdt = { 0 }; /* initialise sdt.count */
99 rsdp_phys = acpi_find_rsdp();
100 rsdp = __va(rsdp_phys);
101 if (rsdp->rsdt_address) {
102 struct acpi_table_rsdt *mapped_rsdt = NULL;
103 sdt.pa = rsdp->rsdt_address;
105 header = (struct acpi_table_header *)
106 __acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
107 if (!header)
108 return -ENODEV;
110 sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
111 mapped_rsdt = (struct acpi_table_rsdt *)
112 __acpi_map_table(sdt.pa, header->length);
113 if (!mapped_rsdt)
114 return -ENODEV;
116 header = &mapped_rsdt->header;
118 for (i = 0; i < sdt.count; i++)
119 sdt.entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
120 };
121 for (i = 0; i < sdt.count; i++) {
123 header = (struct acpi_table_header *)
124 __acpi_map_table(sdt.entry[i].pa,
125 sizeof(struct acpi_table_header));
126 if (!header)
127 continue;
128 if (!strncmp((char *) &header->signature, "OEM1", 4)) {
129 if (!strncmp((char *) &header->oem_id, "UNISYS", 6)) {
130 void *addr;
131 struct oem_table *t;
132 acpi_table_print(header, sdt.entry[i].pa);
133 t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
134 addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
135 *oem_addr = (unsigned long) addr;
136 return 0;
137 }
138 }
139 }
140 return -1;
141 }