direct-io.hg

changeset 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 c64a59ff9880
children b476c756ad4f
files xen/arch/x86/dmi_scan.c xen/arch/x86/genapic/es7000.h xen/arch/x86/genapic/es7000plat.c xen/arch/x86/mpparse.c xen/include/asm-x86/mach-es7000/mach_mpparse.h xen/include/asm-x86/mach-generic/mach_apic.h xen/include/asm-x86/system.h
line diff
     1.1 --- a/xen/arch/x86/dmi_scan.c	Mon Jul 09 19:28:54 2007 +0100
     1.2 +++ b/xen/arch/x86/dmi_scan.c	Tue Jul 10 10:07:00 2007 +0100
     1.3 @@ -15,8 +15,6 @@
     1.4  #define memcpy_fromio    memcpy
     1.5  #define alloc_bootmem(l) xmalloc_bytes(l)
     1.6  
     1.7 -int es7000_plat = 0;
     1.8 -
     1.9  struct dmi_header
    1.10  {
    1.11  	u8	type;
     2.1 --- a/xen/arch/x86/genapic/es7000.h	Mon Jul 09 19:28:54 2007 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,120 +0,0 @@
     2.4 -/*
     2.5 - * Written by: Garry Forsgren, Unisys Corporation
     2.6 - *             Natalie Protasevich, Unisys Corporation
     2.7 - * This file contains the code to configure and interface 
     2.8 - * with Unisys ES7000 series hardware system manager.
     2.9 - *
    2.10 - * Copyright (c) 2003 Unisys Corporation.  All Rights Reserved.
    2.11 - *
    2.12 - * This program is free software; you can redistribute it and/or modify it
    2.13 - * under the terms of version 2 of the GNU General Public License as
    2.14 - * published by the Free Software Foundation.
    2.15 - *
    2.16 - * This program is distributed in the hope that it would be useful, but
    2.17 - * WITHOUT ANY WARRANTY; without even the implied warranty of
    2.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    2.19 - *
    2.20 - * You should have received a copy of the GNU General Public License along
    2.21 - * with this program; if not, write the Free Software Foundation, Inc., 59
    2.22 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
    2.23 - *
    2.24 - * Contact information: Unisys Corporation, Township Line & Union Meeting 
    2.25 - * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
    2.26 - *
    2.27 - * http://www.unisys.com
    2.28 - */
    2.29 -
    2.30 -/*
    2.31 - * ES7000 chipsets
    2.32 - */
    2.33 -
    2.34 -#define NON_UNISYS		0
    2.35 -#define ES7000_CLASSIC		1
    2.36 -#define ES7000_ZORRO		2
    2.37 -
    2.38 -
    2.39 -#define	MIP_REG			1
    2.40 -#define	MIP_PSAI_REG		4
    2.41 -
    2.42 -#define	MIP_BUSY		1
    2.43 -#define	MIP_SPIN		0xf0000
    2.44 -#define	MIP_VALID		0x0100000000000000ULL
    2.45 -#define	MIP_PORT(VALUE)	((VALUE >> 32) & 0xffff)
    2.46 -
    2.47 -#define	MIP_RD_LO(VALUE)	(VALUE & 0xffffffff)   
    2.48 -
    2.49 -struct mip_reg_info {
    2.50 -	unsigned long long mip_info;
    2.51 -	unsigned long long delivery_info;
    2.52 -	unsigned long long host_reg;
    2.53 -	unsigned long long mip_reg;
    2.54 -};
    2.55 -
    2.56 -struct part_info {
    2.57 -	unsigned char type;   
    2.58 -	unsigned char length;
    2.59 -	unsigned char part_id;
    2.60 -	unsigned char apic_mode;
    2.61 -	unsigned long snum;    
    2.62 -	char ptype[16];
    2.63 -	char sname[64];
    2.64 -	char pname[64];
    2.65 -};
    2.66 -
    2.67 -struct psai {
    2.68 -	unsigned long long entry_type;
    2.69 -	unsigned long long addr;
    2.70 -	unsigned long long bep_addr;
    2.71 -};
    2.72 -
    2.73 -struct es7000_mem_info {
    2.74 -	unsigned char type;   
    2.75 -	unsigned char length;
    2.76 -	unsigned char resv[6];
    2.77 -	unsigned long long  start;
    2.78 -	unsigned long long  size;
    2.79 -};
    2.80 -
    2.81 -struct es7000_oem_table {
    2.82 -	unsigned long long hdr;
    2.83 -	struct mip_reg_info mip;
    2.84 -	struct part_info pif;
    2.85 -	struct es7000_mem_info shm;
    2.86 -	struct psai psai;
    2.87 -};
    2.88 -
    2.89 -struct acpi_table_sdt {
    2.90 -	unsigned long pa;
    2.91 -	unsigned long count;
    2.92 -	struct {
    2.93 -		unsigned long pa;
    2.94 -		enum acpi_table_id id;
    2.95 -		unsigned long size;
    2.96 -	}	entry[50];
    2.97 -};
    2.98 -
    2.99 -struct oem_table {
   2.100 -	struct acpi_table_header Header;
   2.101 -	u32 OEMTableAddr;
   2.102 -	u32 OEMTableSize;
   2.103 -};
   2.104 -
   2.105 -struct mip_reg {
   2.106 -	unsigned long long off_0;
   2.107 -	unsigned long long off_8;
   2.108 -	unsigned long long off_10;
   2.109 -	unsigned long long off_18;
   2.110 -	unsigned long long off_20;
   2.111 -	unsigned long long off_28;
   2.112 -	unsigned long long off_30;
   2.113 -	unsigned long long off_38;
   2.114 -};
   2.115 -
   2.116 -#define	MIP_SW_APIC		0x1020b
   2.117 -#define	MIP_FUNC(VALUE) 	(VALUE & 0xff)
   2.118 -
   2.119 -extern int parse_unisys_oem (char *oemptr);
   2.120 -extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
   2.121 -extern void setup_unisys(void);
   2.122 -extern int es7000_start_cpu(int cpu, unsigned long eip);
   2.123 -extern void es7000_sw_apic(void);
     3.1 --- a/xen/arch/x86/genapic/es7000plat.c	Mon Jul 09 19:28:54 2007 +0100
     3.2 +++ b/xen/arch/x86/genapic/es7000plat.c	Tue Jul 10 10:07:00 2007 +0100
     3.3 @@ -1,6 +1,7 @@
     3.4  /*
     3.5   * Written by: Garry Forsgren, Unisys Corporation
     3.6   *             Natalie Protasevich, Unisys Corporation
     3.7 + * Modified by: Raj Subrahmanian <raj.subrahmanian@unisys.com> Unisys Corp.
     3.8   * This file contains the code to configure and interface
     3.9   * with Unisys ES7000 series hardware system manager.
    3.10   *
    3.11 @@ -36,77 +37,33 @@
    3.12  #include <asm/io.h>
    3.13  #include <asm/smp.h>
    3.14  #include <asm/apicdef.h>
    3.15 -#include "es7000.h"
    3.16 -
    3.17 -/*
    3.18 - * ES7000 Globals
    3.19 - */
    3.20 -
    3.21 -volatile unsigned long	*psai = NULL;
    3.22 -struct mip_reg		*mip_reg;
    3.23 -struct mip_reg		*host_reg;
    3.24 -int 			mip_port;
    3.25 -unsigned long		mip_addr, host_addr;
    3.26 -
    3.27 -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI)
    3.28 -
    3.29 -/*
    3.30 - * GSI override for ES7000 platforms.
    3.31 - */
    3.32 -
    3.33 -static unsigned int base;
    3.34 -
    3.35 -static int
    3.36 -es7000_rename_gsi(int ioapic, int gsi)
    3.37 -{
    3.38 -	if (es7000_plat == ES7000_ZORRO)
    3.39 -		return gsi;
    3.40  
    3.41 -	if (!base) {
    3.42 -		int i;
    3.43 -		for (i = 0; i < nr_ioapics; i++)
    3.44 -			base += nr_ioapic_registers[i];
    3.45 -	}
    3.46 -
    3.47 -	if (!ioapic && (gsi < 16)) 
    3.48 -		gsi += base;
    3.49 -	return gsi;
    3.50 -}
    3.51 -
    3.52 -#endif	/* (CONFIG_X86_IO_APIC) && (CONFIG_ACPI) */
    3.53 +#define	MIP_REG			1
    3.54 +#define	MIP_PSAI_REG		4
    3.55  
    3.56 -void __init
    3.57 -setup_unisys(void)
    3.58 -{
    3.59 -	/*
    3.60 -	 * Determine the generation of the ES7000 currently running.
    3.61 -	 *
    3.62 -	 * es7000_plat = 1 if the machine is a 5xx ES7000 box
    3.63 -	 * es7000_plat = 2 if the machine is a x86_64 ES7000 box
    3.64 -	 *
    3.65 -	 */
    3.66 -	if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
    3.67 -		es7000_plat = ES7000_ZORRO;
    3.68 -	else
    3.69 -		es7000_plat = ES7000_CLASSIC;
    3.70 -	ioapic_renumber_irq = es7000_rename_gsi;
    3.71 -}
    3.72 +struct acpi_table_sdt {
    3.73 +	unsigned long pa;
    3.74 +	unsigned long count;
    3.75 +	struct {
    3.76 +		unsigned long pa;
    3.77 +		enum acpi_table_id id;
    3.78 +		unsigned long size;
    3.79 +	}	entry[50];
    3.80 +};
    3.81  
    3.82 -/*
    3.83 - * Parse the OEM Table
    3.84 - */
    3.85 +struct oem_table {
    3.86 +	struct acpi_table_header Header;
    3.87 +	u32 OEMTableAddr;
    3.88 +	u32 OEMTableSize;
    3.89 +};
    3.90  
    3.91  int __init
    3.92 -parse_unisys_oem (char *oemptr)
    3.93 +parse_unisys_oem(char *oemptr)
    3.94  {
    3.95  	int                     i;
    3.96  	int 			success = 0;
    3.97  	unsigned char           type, size;
    3.98 -	unsigned long           val;
    3.99  	char                    *tp = NULL;
   3.100 -	struct psai             *psaip = NULL;
   3.101 -	struct mip_reg_info 	*mi;
   3.102 -	struct mip_reg		*host, *mip;
   3.103  
   3.104  	tp = oemptr;
   3.105  
   3.106 @@ -118,43 +75,16 @@ parse_unisys_oem (char *oemptr)
   3.107  		tp -= 2;
   3.108  		switch (type) {
   3.109  		case MIP_REG:
   3.110 -			mi = (struct mip_reg_info *)tp;
   3.111 -			val = MIP_RD_LO(mi->host_reg);
   3.112 -			host_addr = val;
   3.113 -			host = (struct mip_reg *)val;
   3.114 -			host_reg = __va(host);
   3.115 -			val = MIP_RD_LO(mi->mip_reg);
   3.116 -			mip_port = MIP_PORT(mi->mip_info);
   3.117 -			mip_addr = val;
   3.118 -			mip = (struct mip_reg *)val;
   3.119 -			mip_reg = __va(mip);
   3.120 -			Dprintk("es7000_mipcfg: host_reg = 0x%lx \n",
   3.121 -				(unsigned long)host_reg);
   3.122 -			Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n",
   3.123 -				(unsigned long)mip_reg);
   3.124 +		case MIP_PSAI_REG:
   3.125  			success++;
   3.126  			break;
   3.127 -		case MIP_PSAI_REG:
   3.128 -			psaip = (struct psai *)tp;
   3.129 -			if (tp != NULL) {
   3.130 -				if (psaip->addr)
   3.131 -					psai = __va(psaip->addr);
   3.132 -				else
   3.133 -					psai = NULL;
   3.134 -				success++;
   3.135 -			}
   3.136 -			break;
   3.137  		default:
   3.138  			break;
   3.139  		}
   3.140  		tp += size;
   3.141  	}
   3.142  
   3.143 -	if (success < 2) {
   3.144 -		es7000_plat = NON_UNISYS;
   3.145 -	} else
   3.146 -		setup_unisys();
   3.147 -	return es7000_plat;
   3.148 +	return (success >= 2);
   3.149  }
   3.150  
   3.151  int __init
   3.152 @@ -209,107 +139,3 @@ find_unisys_acpi_oem_table(unsigned long
   3.153  	}
   3.154  	return -1;
   3.155  }
   3.156 -
   3.157 -static void
   3.158 -es7000_spin(int n)
   3.159 -{
   3.160 -	int i = 0;
   3.161 -
   3.162 -	while (i++ < n)
   3.163 -		rep_nop();
   3.164 -}
   3.165 -
   3.166 -static int __init
   3.167 -es7000_mip_write(struct mip_reg *mip_reg)
   3.168 -{
   3.169 -	int			status = 0;
   3.170 -	int			spin;
   3.171 -
   3.172 -	spin = MIP_SPIN;
   3.173 -	while (((unsigned long long)host_reg->off_38 &
   3.174 -		(unsigned long long)MIP_VALID) != 0) {
   3.175 -			if (--spin <= 0) {
   3.176 -				printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
   3.177 -				return -1;
   3.178 -			}
   3.179 -		es7000_spin(MIP_SPIN);
   3.180 -	}
   3.181 -
   3.182 -	memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
   3.183 -	outb(1, mip_port);
   3.184 -
   3.185 -	spin = MIP_SPIN;
   3.186 -
   3.187 -	while (((unsigned long long)mip_reg->off_38 &
   3.188 -		(unsigned long long)MIP_VALID) == 0) {
   3.189 -		if (--spin <= 0) {
   3.190 -			printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
   3.191 -			return -1;
   3.192 -		}
   3.193 -		es7000_spin(MIP_SPIN);
   3.194 -	}
   3.195 -
   3.196 -	status = ((unsigned long long)mip_reg->off_0 &
   3.197 -		(unsigned long long)0xffff0000000000ULL) >> 48;
   3.198 -	mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
   3.199 -		(unsigned long long)~MIP_VALID);
   3.200 -	return status;
   3.201 -}
   3.202 -
   3.203 -int
   3.204 -es7000_start_cpu(int cpu, unsigned long eip)
   3.205 -{
   3.206 -	unsigned long vect = 0, psaival = 0;
   3.207 -
   3.208 -	if (psai == NULL)
   3.209 -		return -1;
   3.210 -
   3.211 -	vect = ((unsigned long)__pa(eip)/0x1000) << 16;
   3.212 -	psaival = (0x1000000 | vect | cpu);
   3.213 -
   3.214 -	while (*psai & 0x1000000)
   3.215 -                ;
   3.216 -
   3.217 -	*psai = psaival;
   3.218 -
   3.219 -	return 0;
   3.220 -
   3.221 -}
   3.222 -
   3.223 -int
   3.224 -es7000_stop_cpu(int cpu)
   3.225 -{
   3.226 -	int startup;
   3.227 -
   3.228 -	if (psai == NULL)
   3.229 -		return -1;
   3.230 -
   3.231 -	startup= (0x1000000 | cpu);
   3.232 -
   3.233 -	while ((*psai & 0xff00ffff) != startup)
   3.234 -		;
   3.235 -
   3.236 -	startup = (*psai & 0xff0000) >> 16;
   3.237 -	*psai &= 0xffffff;
   3.238 -
   3.239 -	return 0;
   3.240 -
   3.241 -}
   3.242 -
   3.243 -void __init
   3.244 -es7000_sw_apic()
   3.245 -{
   3.246 -	if (es7000_plat && (es7000_plat != ES7000_ZORRO)) {
   3.247 -		int mip_status;
   3.248 -		struct mip_reg es7000_mip_reg;
   3.249 -
   3.250 -		printk("ES7000: Enabling APIC mode.\n");
   3.251 -		memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
   3.252 -        	es7000_mip_reg.off_0 = MIP_SW_APIC;
   3.253 -        	es7000_mip_reg.off_38 = (MIP_VALID);
   3.254 -        	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
   3.255 -              		printk("es7000_sw_apic: command failed, status = %x\n",
   3.256 -				mip_status);
   3.257 -		return;
   3.258 -	}
   3.259 -}
     4.1 --- a/xen/arch/x86/mpparse.c	Mon Jul 09 19:28:54 2007 +0100
     4.2 +++ b/xen/arch/x86/mpparse.c	Tue Jul 10 10:07:00 2007 +0100
     4.3 @@ -1001,12 +1001,6 @@ void __init mp_config_acpi_legacy_irqs (
     4.4  	mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
     4.5  	Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
     4.6  
     4.7 -	/*
     4.8 -	 * Older generations of ES7000 have no legacy identity mappings
     4.9 -	 */
    4.10 -	if (es7000_plat == 1)
    4.11 -		return;
    4.12 -
    4.13  	/* 
    4.14  	 * Locate the IOAPIC that manages the ISA IRQs (0-15). 
    4.15  	 */
     5.1 --- a/xen/include/asm-x86/mach-es7000/mach_mpparse.h	Mon Jul 09 19:28:54 2007 +0100
     5.2 +++ b/xen/include/asm-x86/mach-es7000/mach_mpparse.h	Tue Jul 10 10:07:00 2007 +0100
     5.3 @@ -3,9 +3,8 @@
     5.4  
     5.5  #include <xen/acpi.h>
     5.6  
     5.7 -extern int parse_unisys_oem (char *oemptr);
     5.8 +extern int parse_unisys_oem(char *oemptr);
     5.9  extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
    5.10 -extern void setup_unisys(void);
    5.11  
    5.12  static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
    5.13  		char *productid)
    5.14 @@ -36,10 +35,8 @@ static inline int acpi_madt_oem_check(ch
    5.15  	if (!find_unisys_acpi_oem_table(&oem_addr)) {
    5.16  		if (es7000_check_dsdt())
    5.17  			return parse_unisys_oem((char *)oem_addr);
    5.18 -		else {
    5.19 -			setup_unisys();
    5.20 +		else
    5.21  			return 1;
    5.22 -		}
    5.23  	}
    5.24  	return 0;
    5.25  }
     6.1 --- a/xen/include/asm-x86/mach-generic/mach_apic.h	Mon Jul 09 19:28:54 2007 +0100
     6.2 +++ b/xen/include/asm-x86/mach-generic/mach_apic.h	Tue Jul 10 10:07:00 2007 +0100
     6.3 @@ -15,11 +15,10 @@
     6.4  #define clustered_apic_check (genapic->clustered_apic_check) 
     6.5  #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
     6.6  
     6.7 -extern void es7000_sw_apic(void);
     6.8  static inline void enable_apic_mode(void)
     6.9  {
    6.10 -	es7000_sw_apic();
    6.11 -	return;
    6.12 +	/* Not needed for modern ES7000 which boot in Virtual Wire mode. */
    6.13 +	/*es7000_sw_apic();*/
    6.14  }
    6.15  
    6.16  #define apicid_to_node(apicid) ((int)apicid_to_node[(u8)apicid])
     7.1 --- a/xen/include/asm-x86/system.h	Mon Jul 09 19:28:54 2007 +0100
     7.2 +++ b/xen/include/asm-x86/system.h	Tue Jul 10 10:07:00 2007 +0100
     7.3 @@ -335,6 +335,4 @@ static inline int local_irq_is_enabled(v
     7.4  #define BROKEN_ACPI_Sx		0x0001
     7.5  #define BROKEN_INIT_AFTER_S1	0x0002
     7.6  
     7.7 -extern int es7000_plat;
     7.8 -
     7.9  #endif