diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-02-17 08:57:16 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 11:52:46 -0500 |
| commit | 2c4ce18c95d632c9227ebcc6d45da11a9ef1ec70 (patch) | |
| tree | 4b9cf2267ea06a3090e4e6502da12623197034a6 | |
| parent | 2f205bc47f615b7bd0c7aba817d67ce25760eaf1 (diff) | |
x86, es7000: clean up
No code changed:
arch/x86/kernel/es7000_32.o:
text data bss dec hex filename
2813 192 44 3049 be9 es7000_32.o.before
2813 192 44 3049 be9 es7000_32.o.after
md5:
a593d98a882bf534622c70d9568497ac es7000_32.o.before.asm
a593d98a882bf534622c70d9568497ac es7000_32.o.after.asm
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | arch/x86/kernel/es7000_32.c | 241 |
1 files changed, 113 insertions, 128 deletions
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c index 3dc48831eb95..c7cc9776ccae 100644 --- a/arch/x86/kernel/es7000_32.c +++ b/arch/x86/kernel/es7000_32.c | |||
| @@ -24,90 +24,96 @@ | |||
| 24 | * http://www.unisys.com | 24 | * http://www.unisys.com |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <linux/module.h> | 27 | #include <linux/notifier.h> |
| 28 | #include <linux/types.h> | 28 | #include <linux/spinlock.h> |
| 29 | #include <linux/cpumask.h> | ||
| 30 | #include <linux/threads.h> | ||
| 29 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
| 30 | #include <linux/smp.h> | 32 | #include <linux/module.h> |
| 33 | #include <linux/reboot.h> | ||
| 31 | #include <linux/string.h> | 34 | #include <linux/string.h> |
| 32 | #include <linux/spinlock.h> | 35 | #include <linux/types.h> |
| 33 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
| 34 | #include <linux/notifier.h> | ||
| 35 | #include <linux/reboot.h> | ||
| 36 | #include <linux/init.h> | ||
| 37 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
| 38 | #include <asm/io.h> | 38 | #include <linux/init.h> |
| 39 | #include <asm/nmi.h> | 39 | #include <linux/smp.h> |
| 40 | #include <asm/smp.h> | 40 | |
| 41 | #include <asm/atomic.h> | ||
| 42 | #include <asm/apicdef.h> | 41 | #include <asm/apicdef.h> |
| 43 | #include <asm/apic.h> | 42 | #include <asm/atomic.h> |
| 43 | #include <asm/fixmap.h> | ||
| 44 | #include <asm/mpspec.h> | ||
| 44 | #include <asm/setup.h> | 45 | #include <asm/setup.h> |
| 46 | #include <asm/apic.h> | ||
| 47 | #include <asm/ipi.h> | ||
| 48 | #include <asm/nmi.h> | ||
| 49 | #include <asm/smp.h> | ||
| 50 | #include <asm/io.h> | ||
| 45 | 51 | ||
| 46 | /* | 52 | /* |
| 47 | * ES7000 chipsets | 53 | * ES7000 chipsets |
| 48 | */ | 54 | */ |
| 49 | 55 | ||
| 50 | #define NON_UNISYS 0 | 56 | #define NON_UNISYS 0 |
| 51 | #define ES7000_CLASSIC 1 | 57 | #define ES7000_CLASSIC 1 |
| 52 | #define ES7000_ZORRO 2 | 58 | #define ES7000_ZORRO 2 |
| 53 | 59 | ||
| 60 | #define MIP_REG 1 | ||
| 61 | #define MIP_PSAI_REG 4 | ||
| 54 | 62 | ||
| 55 | #define MIP_REG 1 | 63 | #define MIP_BUSY 1 |
| 56 | #define MIP_PSAI_REG 4 | 64 | #define MIP_SPIN 0xf0000 |
| 65 | #define MIP_VALID 0x0100000000000000ULL | ||
| 57 | 66 | ||
| 58 | #define MIP_BUSY 1 | 67 | #define MIP_PORT(val) ((val >> 32) & 0xffff) |
| 59 | #define MIP_SPIN 0xf0000 | ||
| 60 | #define MIP_VALID 0x0100000000000000ULL | ||
| 61 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | ||
| 62 | 68 | ||
| 63 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | 69 | #define MIP_RD_LO(val) (val & 0xffffffff) |
| 64 | 70 | ||
| 65 | struct mip_reg_info { | 71 | struct mip_reg_info { |
| 66 | unsigned long long mip_info; | 72 | unsigned long long mip_info; |
| 67 | unsigned long long delivery_info; | 73 | unsigned long long delivery_info; |
| 68 | unsigned long long host_reg; | 74 | unsigned long long host_reg; |
| 69 | unsigned long long mip_reg; | 75 | unsigned long long mip_reg; |
| 70 | }; | 76 | }; |
| 71 | 77 | ||
| 72 | struct part_info { | 78 | struct part_info { |
| 73 | unsigned char type; | 79 | unsigned char type; |
| 74 | unsigned char length; | 80 | unsigned char length; |
| 75 | unsigned char part_id; | 81 | unsigned char part_id; |
| 76 | unsigned char apic_mode; | 82 | unsigned char apic_mode; |
| 77 | unsigned long snum; | 83 | unsigned long snum; |
| 78 | char ptype[16]; | 84 | char ptype[16]; |
| 79 | char sname[64]; | 85 | char sname[64]; |
| 80 | char pname[64]; | 86 | char pname[64]; |
| 81 | }; | 87 | }; |
| 82 | 88 | ||
| 83 | struct psai { | 89 | struct psai { |
| 84 | unsigned long long entry_type; | 90 | unsigned long long entry_type; |
| 85 | unsigned long long addr; | 91 | unsigned long long addr; |
| 86 | unsigned long long bep_addr; | 92 | unsigned long long bep_addr; |
| 87 | }; | 93 | }; |
| 88 | 94 | ||
| 89 | struct es7000_mem_info { | 95 | struct es7000_mem_info { |
| 90 | unsigned char type; | 96 | unsigned char type; |
| 91 | unsigned char length; | 97 | unsigned char length; |
| 92 | unsigned char resv[6]; | 98 | unsigned char resv[6]; |
| 93 | unsigned long long start; | 99 | unsigned long long start; |
| 94 | unsigned long long size; | 100 | unsigned long long size; |
| 95 | }; | 101 | }; |
| 96 | 102 | ||
| 97 | struct es7000_oem_table { | 103 | struct es7000_oem_table { |
| 98 | unsigned long long hdr; | 104 | unsigned long long hdr; |
| 99 | struct mip_reg_info mip; | 105 | struct mip_reg_info mip; |
| 100 | struct part_info pif; | 106 | struct part_info pif; |
| 101 | struct es7000_mem_info shm; | 107 | struct es7000_mem_info shm; |
| 102 | struct psai psai; | 108 | struct psai psai; |
| 103 | }; | 109 | }; |
| 104 | 110 | ||
| 105 | #ifdef CONFIG_ACPI | 111 | #ifdef CONFIG_ACPI |
| 106 | 112 | ||
| 107 | struct oem_table { | 113 | struct oem_table { |
| 108 | struct acpi_table_header Header; | 114 | struct acpi_table_header Header; |
| 109 | u32 OEMTableAddr; | 115 | u32 OEMTableAddr; |
| 110 | u32 OEMTableSize; | 116 | u32 OEMTableSize; |
| 111 | }; | 117 | }; |
| 112 | 118 | ||
| 113 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | 119 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); |
| @@ -115,36 +121,50 @@ extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | |||
| 115 | #endif | 121 | #endif |
| 116 | 122 | ||
| 117 | struct mip_reg { | 123 | struct mip_reg { |
| 118 | unsigned long long off_0; | 124 | unsigned long long off_0x00; |
| 119 | unsigned long long off_8; | 125 | unsigned long long off_0x08; |
| 120 | unsigned long long off_10; | 126 | unsigned long long off_0x10; |
| 121 | unsigned long long off_18; | 127 | unsigned long long off_0x18; |
| 122 | unsigned long long off_20; | 128 | unsigned long long off_0x20; |
| 123 | unsigned long long off_28; | 129 | unsigned long long off_0x28; |
| 124 | unsigned long long off_30; | 130 | unsigned long long off_0x30; |
| 125 | unsigned long long off_38; | 131 | unsigned long long off_0x38; |
| 126 | }; | 132 | }; |
| 127 | 133 | ||
| 128 | #define MIP_SW_APIC 0x1020b | 134 | #define MIP_SW_APIC 0x1020b |
| 129 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | 135 | #define MIP_FUNC(VALUE) (VALUE & 0xff) |
| 136 | |||
| 137 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
| 138 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
| 139 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
| 140 | |||
| 141 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
| 142 | |||
| 143 | extern void es7000_enable_apic_mode(void); | ||
| 144 | extern int parse_unisys_oem (char *oemptr); | ||
| 145 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
| 146 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
| 147 | extern void setup_unisys(void); | ||
| 148 | |||
| 149 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
| 130 | 150 | ||
| 131 | /* | 151 | /* |
| 132 | * ES7000 Globals | 152 | * ES7000 Globals |
| 133 | */ | 153 | */ |
| 134 | 154 | ||
| 135 | static volatile unsigned long *psai = NULL; | 155 | static volatile unsigned long *psai = NULL; |
| 136 | static struct mip_reg *mip_reg; | 156 | static struct mip_reg *mip_reg; |
| 137 | static struct mip_reg *host_reg; | 157 | static struct mip_reg *host_reg; |
| 138 | static int mip_port; | 158 | static int mip_port; |
| 139 | static unsigned long mip_addr, host_addr; | 159 | static unsigned long mip_addr, host_addr; |
| 140 | 160 | ||
| 141 | int es7000_plat; | 161 | int es7000_plat; |
| 142 | 162 | ||
| 143 | /* | 163 | /* |
| 144 | * GSI override for ES7000 platforms. | 164 | * GSI override for ES7000 platforms. |
| 145 | */ | 165 | */ |
| 146 | 166 | ||
| 147 | static unsigned int base; | 167 | static unsigned int base; |
| 148 | 168 | ||
| 149 | static int | 169 | static int |
| 150 | es7000_rename_gsi(int ioapic, int gsi) | 170 | es7000_rename_gsi(int ioapic, int gsi) |
| @@ -160,6 +180,7 @@ es7000_rename_gsi(int ioapic, int gsi) | |||
| 160 | 180 | ||
| 161 | if (!ioapic && (gsi < 16)) | 181 | if (!ioapic && (gsi < 16)) |
| 162 | gsi += base; | 182 | gsi += base; |
| 183 | |||
| 163 | return gsi; | 184 | return gsi; |
| 164 | } | 185 | } |
| 165 | 186 | ||
| @@ -196,8 +217,7 @@ static int __init es7000_update_genapic(void) | |||
| 196 | return 0; | 217 | return 0; |
| 197 | } | 218 | } |
| 198 | 219 | ||
| 199 | void __init | 220 | void __init setup_unisys(void) |
| 200 | setup_unisys(void) | ||
| 201 | { | 221 | { |
| 202 | /* | 222 | /* |
| 203 | * Determine the generation of the ES7000 currently running. | 223 | * Determine the generation of the ES7000 currently running. |
| @@ -219,8 +239,7 @@ setup_unisys(void) | |||
| 219 | * Parse the OEM Table | 239 | * Parse the OEM Table |
| 220 | */ | 240 | */ |
| 221 | 241 | ||
| 222 | int __init | 242 | int __init parse_unisys_oem (char *oemptr) |
| 223 | parse_unisys_oem (char *oemptr) | ||
| 224 | { | 243 | { |
| 225 | int i; | 244 | int i; |
| 226 | int success = 0; | 245 | int success = 0; |
| @@ -277,12 +296,15 @@ parse_unisys_oem (char *oemptr) | |||
| 277 | es7000_plat = NON_UNISYS; | 296 | es7000_plat = NON_UNISYS; |
| 278 | } else | 297 | } else |
| 279 | setup_unisys(); | 298 | setup_unisys(); |
| 299 | |||
| 280 | return es7000_plat; | 300 | return es7000_plat; |
| 281 | } | 301 | } |
| 282 | 302 | ||
| 283 | #ifdef CONFIG_ACPI | 303 | #ifdef CONFIG_ACPI |
| 284 | static unsigned long oem_addrX; | 304 | |
| 285 | static unsigned long oem_size; | 305 | static unsigned long oem_addrX; |
| 306 | static unsigned long oem_size; | ||
| 307 | |||
| 286 | int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) | 308 | int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) |
| 287 | { | 309 | { |
| 288 | struct acpi_table_header *header = NULL; | 310 | struct acpi_table_header *header = NULL; |
| @@ -315,8 +337,7 @@ void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr) | |||
| 315 | } | 337 | } |
| 316 | #endif | 338 | #endif |
| 317 | 339 | ||
| 318 | static void | 340 | static void es7000_spin(int n) |
| 319 | es7000_spin(int n) | ||
| 320 | { | 341 | { |
| 321 | int i = 0; | 342 | int i = 0; |
| 322 | 343 | ||
| @@ -327,16 +348,15 @@ es7000_spin(int n) | |||
| 327 | static int __init | 348 | static int __init |
| 328 | es7000_mip_write(struct mip_reg *mip_reg) | 349 | es7000_mip_write(struct mip_reg *mip_reg) |
| 329 | { | 350 | { |
| 330 | int status = 0; | 351 | int status = 0; |
| 331 | int spin; | 352 | int spin; |
| 332 | 353 | ||
| 333 | spin = MIP_SPIN; | 354 | spin = MIP_SPIN; |
| 334 | while (((unsigned long long)host_reg->off_38 & | 355 | while ((host_reg->off_0x38 & MIP_VALID) != 0) { |
| 335 | (unsigned long long)MIP_VALID) != 0) { | 356 | if (--spin <= 0) { |
| 336 | if (--spin <= 0) { | 357 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); |
| 337 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); | 358 | return -1; |
| 338 | return -1; | 359 | } |
| 339 | } | ||
| 340 | es7000_spin(MIP_SPIN); | 360 | es7000_spin(MIP_SPIN); |
| 341 | } | 361 | } |
| 342 | 362 | ||
| @@ -345,8 +365,7 @@ es7000_mip_write(struct mip_reg *mip_reg) | |||
| 345 | 365 | ||
| 346 | spin = MIP_SPIN; | 366 | spin = MIP_SPIN; |
| 347 | 367 | ||
| 348 | while (((unsigned long long)mip_reg->off_38 & | 368 | while ((mip_reg->off_0x38 & MIP_VALID) == 0) { |
| 349 | (unsigned long long)MIP_VALID) == 0) { | ||
| 350 | if (--spin <= 0) { | 369 | if (--spin <= 0) { |
| 351 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); | 370 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); |
| 352 | return -1; | 371 | return -1; |
| @@ -354,10 +373,9 @@ es7000_mip_write(struct mip_reg *mip_reg) | |||
| 354 | es7000_spin(MIP_SPIN); | 373 | es7000_spin(MIP_SPIN); |
| 355 | } | 374 | } |
| 356 | 375 | ||
| 357 | status = ((unsigned long long)mip_reg->off_0 & | 376 | status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48; |
| 358 | (unsigned long long)0xffff0000000000ULL) >> 48; | 377 | mip_reg->off_0x38 &= ~MIP_VALID; |
| 359 | mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 & | 378 | |
| 360 | (unsigned long long)~MIP_VALID); | ||
| 361 | return status; | 379 | return status; |
| 362 | } | 380 | } |
| 363 | 381 | ||
| @@ -371,8 +389,8 @@ void __init es7000_enable_apic_mode(void) | |||
| 371 | 389 | ||
| 372 | printk("ES7000: Enabling APIC mode.\n"); | 390 | printk("ES7000: Enabling APIC mode.\n"); |
| 373 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | 391 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); |
| 374 | es7000_mip_reg.off_0 = MIP_SW_APIC; | 392 | es7000_mip_reg.off_0x00 = MIP_SW_APIC; |
| 375 | es7000_mip_reg.off_38 = MIP_VALID; | 393 | es7000_mip_reg.off_0x38 = MIP_VALID; |
| 376 | 394 | ||
| 377 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { | 395 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { |
| 378 | printk("es7000_enable_apic_mode: command failed, status = %x\n", | 396 | printk("es7000_enable_apic_mode: command failed, status = %x\n", |
| @@ -380,39 +398,6 @@ void __init es7000_enable_apic_mode(void) | |||
| 380 | } | 398 | } |
| 381 | } | 399 | } |
| 382 | 400 | ||
| 383 | /* | ||
| 384 | * APIC driver for the Unisys ES7000 chipset. | ||
| 385 | */ | ||
| 386 | #include <linux/threads.h> | ||
| 387 | #include <linux/cpumask.h> | ||
| 388 | #include <asm/mpspec.h> | ||
| 389 | #include <asm/fixmap.h> | ||
| 390 | #include <asm/apicdef.h> | ||
| 391 | #include <linux/kernel.h> | ||
| 392 | #include <linux/string.h> | ||
| 393 | #include <linux/init.h> | ||
| 394 | #include <linux/acpi.h> | ||
| 395 | #include <linux/smp.h> | ||
| 396 | #include <asm/ipi.h> | ||
| 397 | |||
| 398 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
| 399 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
| 400 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
| 401 | |||
| 402 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
| 403 | |||
| 404 | extern void es7000_enable_apic_mode(void); | ||
| 405 | extern int apic_version [MAX_APICS]; | ||
| 406 | extern unsigned int boot_cpu_physical_apicid; | ||
| 407 | |||
| 408 | extern int parse_unisys_oem (char *oemptr); | ||
| 409 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
| 410 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
| 411 | extern void setup_unisys(void); | ||
| 412 | |||
| 413 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
| 414 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
| 415 | |||
| 416 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) | 401 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) |
| 417 | { | 402 | { |
| 418 | /* Careful. Some cpus do not strictly honor the set of cpus | 403 | /* Careful. Some cpus do not strictly honor the set of cpus |
| @@ -495,9 +480,9 @@ static unsigned long es7000_check_apicid_present(int bit) | |||
| 495 | 480 | ||
| 496 | static unsigned long calculate_ldr(int cpu) | 481 | static unsigned long calculate_ldr(int cpu) |
| 497 | { | 482 | { |
| 498 | unsigned long id = xapic_phys_to_log_apicid(cpu); | 483 | unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu); |
| 499 | 484 | ||
| 500 | return (SET_APIC_LOGICAL_ID(id)); | 485 | return SET_APIC_LOGICAL_ID(id); |
| 501 | } | 486 | } |
| 502 | 487 | ||
| 503 | /* | 488 | /* |
| @@ -547,7 +532,7 @@ static int es7000_cpu_present_to_apicid(int mps_cpu) | |||
| 547 | if (!mps_cpu) | 532 | if (!mps_cpu) |
| 548 | return boot_cpu_physical_apicid; | 533 | return boot_cpu_physical_apicid; |
| 549 | else if (mps_cpu < nr_cpu_ids) | 534 | else if (mps_cpu < nr_cpu_ids) |
| 550 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | 535 | return per_cpu(x86_bios_cpu_apicid, mps_cpu); |
| 551 | else | 536 | else |
| 552 | return BAD_APICID; | 537 | return BAD_APICID; |
| 553 | } | 538 | } |
| @@ -584,7 +569,7 @@ static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map) | |||
| 584 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | 569 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) |
| 585 | { | 570 | { |
| 586 | boot_cpu_physical_apicid = read_apic_id(); | 571 | boot_cpu_physical_apicid = read_apic_id(); |
| 587 | return (1); | 572 | return 1; |
| 588 | } | 573 | } |
| 589 | 574 | ||
| 590 | static unsigned int | 575 | static unsigned int |
