diff options
| -rw-r--r-- | arch/x86/kernel/es7000_32.c | 103 |
1 files changed, 33 insertions, 70 deletions
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c index d5c3894a9835..03acbe95d2b5 100644 --- a/arch/x86/kernel/es7000_32.c +++ b/arch/x86/kernel/es7000_32.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | * | 23 | * |
| 24 | * http://www.unisys.com | 24 | * http://www.unisys.com |
| 25 | */ | 25 | */ |
| 26 | |||
| 27 | #include <linux/notifier.h> | 26 | #include <linux/notifier.h> |
| 28 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 29 | #include <linux/cpumask.h> | 28 | #include <linux/cpumask.h> |
| @@ -63,11 +62,23 @@ | |||
| 63 | #define MIP_BUSY 1 | 62 | #define MIP_BUSY 1 |
| 64 | #define MIP_SPIN 0xf0000 | 63 | #define MIP_SPIN 0xf0000 |
| 65 | #define MIP_VALID 0x0100000000000000ULL | 64 | #define MIP_VALID 0x0100000000000000ULL |
| 65 | #define MIP_SW_APIC 0x1020b | ||
| 66 | 66 | ||
| 67 | #define MIP_PORT(val) ((val >> 32) & 0xffff) | 67 | #define MIP_PORT(val) ((val >> 32) & 0xffff) |
| 68 | 68 | ||
| 69 | #define MIP_RD_LO(val) (val & 0xffffffff) | 69 | #define MIP_RD_LO(val) (val & 0xffffffff) |
| 70 | 70 | ||
| 71 | struct mip_reg { | ||
| 72 | unsigned long long off_0x00; | ||
| 73 | unsigned long long off_0x08; | ||
| 74 | unsigned long long off_0x10; | ||
| 75 | unsigned long long off_0x18; | ||
| 76 | unsigned long long off_0x20; | ||
| 77 | unsigned long long off_0x28; | ||
| 78 | unsigned long long off_0x30; | ||
| 79 | unsigned long long off_0x38; | ||
| 80 | }; | ||
| 81 | |||
| 71 | struct mip_reg_info { | 82 | struct mip_reg_info { |
| 72 | unsigned long long mip_info; | 83 | unsigned long long mip_info; |
| 73 | unsigned long long delivery_info; | 84 | unsigned long long delivery_info; |
| @@ -75,69 +86,20 @@ struct mip_reg_info { | |||
| 75 | unsigned long long mip_reg; | 86 | unsigned long long mip_reg; |
| 76 | }; | 87 | }; |
| 77 | 88 | ||
| 78 | struct part_info { | ||
| 79 | unsigned char type; | ||
| 80 | unsigned char length; | ||
| 81 | unsigned char part_id; | ||
| 82 | unsigned char apic_mode; | ||
| 83 | unsigned long snum; | ||
| 84 | char ptype[16]; | ||
| 85 | char sname[64]; | ||
| 86 | char pname[64]; | ||
| 87 | }; | ||
| 88 | |||
| 89 | struct psai { | 89 | struct psai { |
| 90 | unsigned long long entry_type; | 90 | unsigned long long entry_type; |
| 91 | unsigned long long addr; | 91 | unsigned long long addr; |
| 92 | unsigned long long bep_addr; | 92 | unsigned long long bep_addr; |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | struct es7000_mem_info { | ||
| 96 | unsigned char type; | ||
| 97 | unsigned char length; | ||
| 98 | unsigned char resv[6]; | ||
| 99 | unsigned long long start; | ||
| 100 | unsigned long long size; | ||
| 101 | }; | ||
| 102 | |||
| 103 | struct es7000_oem_table { | ||
| 104 | unsigned long long hdr; | ||
| 105 | struct mip_reg_info mip; | ||
| 106 | struct part_info pif; | ||
| 107 | struct es7000_mem_info shm; | ||
| 108 | struct psai psai; | ||
| 109 | }; | ||
| 110 | |||
| 111 | #ifdef CONFIG_ACPI | 95 | #ifdef CONFIG_ACPI |
| 112 | 96 | struct es7000_oem_table { | |
| 113 | struct oem_table { | ||
| 114 | struct acpi_table_header Header; | 97 | struct acpi_table_header Header; |
| 115 | u32 OEMTableAddr; | 98 | u32 OEMTableAddr; |
| 116 | u32 OEMTableSize; | 99 | u32 OEMTableSize; |
| 117 | }; | 100 | }; |
| 118 | |||
| 119 | #endif | 101 | #endif |
| 120 | 102 | ||
| 121 | struct mip_reg { | ||
| 122 | unsigned long long off_0x00; | ||
| 123 | unsigned long long off_0x08; | ||
| 124 | unsigned long long off_0x10; | ||
| 125 | unsigned long long off_0x18; | ||
| 126 | unsigned long long off_0x20; | ||
| 127 | unsigned long long off_0x28; | ||
| 128 | unsigned long long off_0x30; | ||
| 129 | unsigned long long off_0x38; | ||
| 130 | }; | ||
| 131 | |||
| 132 | #define MIP_SW_APIC 0x1020b | ||
| 133 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | ||
| 134 | |||
| 135 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
| 136 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
| 137 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
| 138 | |||
| 139 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
| 140 | |||
| 141 | /* | 103 | /* |
| 142 | * ES7000 Globals | 104 | * ES7000 Globals |
| 143 | */ | 105 | */ |
| @@ -228,14 +190,14 @@ static void __init setup_unisys(void) | |||
| 228 | /* | 190 | /* |
| 229 | * Parse the OEM Table: | 191 | * Parse the OEM Table: |
| 230 | */ | 192 | */ |
| 231 | static int __init parse_unisys_oem (char *oemptr) | 193 | static int __init parse_unisys_oem(char *oemptr) |
| 232 | { | 194 | { |
| 233 | int i; | 195 | int i; |
| 234 | int success = 0; | 196 | int success = 0; |
| 235 | unsigned char type, size; | 197 | unsigned char type, size; |
| 236 | unsigned long val; | 198 | unsigned long val; |
| 237 | char *tp = NULL; | 199 | char *tp = NULL; |
| 238 | struct psai *psaip = NULL; | 200 | struct psai *psaip = NULL; |
| 239 | struct mip_reg_info *mi; | 201 | struct mip_reg_info *mi; |
| 240 | struct mip_reg *host, *mip; | 202 | struct mip_reg *host, *mip; |
| 241 | 203 | ||
| @@ -243,7 +205,7 @@ static int __init parse_unisys_oem (char *oemptr) | |||
| 243 | 205 | ||
| 244 | tp += 8; | 206 | tp += 8; |
| 245 | 207 | ||
| 246 | for (i=0; i <= 6; i++) { | 208 | for (i = 0; i <= 6; i++) { |
| 247 | type = *tp++; | 209 | type = *tp++; |
| 248 | size = *tp++; | 210 | size = *tp++; |
| 249 | tp -= 2; | 211 | tp -= 2; |
| @@ -302,7 +264,7 @@ static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) | |||
| 302 | 264 | ||
| 303 | while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) { | 265 | while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) { |
| 304 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { | 266 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { |
| 305 | struct oem_table *t = (struct oem_table *)header; | 267 | struct es7000_oem_table *t = (void *)header; |
| 306 | 268 | ||
| 307 | oem_addrX = t->OEMTableAddr; | 269 | oem_addrX = t->OEMTableAddr; |
| 308 | oem_size = t->OEMTableSize; | 270 | oem_size = t->OEMTableSize; |
| @@ -377,11 +339,11 @@ static void __init es7000_enable_apic_mode(void) | |||
| 377 | return; | 339 | return; |
| 378 | 340 | ||
| 379 | printk("ES7000: Enabling APIC mode.\n"); | 341 | printk("ES7000: Enabling APIC mode.\n"); |
| 380 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | 342 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); |
| 381 | es7000_mip_reg.off_0x00 = MIP_SW_APIC; | 343 | es7000_mip_reg.off_0x00 = MIP_SW_APIC; |
| 382 | es7000_mip_reg.off_0x38 = MIP_VALID; | 344 | es7000_mip_reg.off_0x38 = MIP_VALID; |
| 383 | 345 | ||
| 384 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { | 346 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { |
| 385 | printk("es7000_enable_apic_mode: command failed, status = %x\n", | 347 | printk("es7000_enable_apic_mode: command failed, status = %x\n", |
| 386 | mip_status); | 348 | mip_status); |
| 387 | } | 349 | } |
| @@ -444,7 +406,7 @@ static void es7000_send_IPI_all(int vector) | |||
| 444 | 406 | ||
| 445 | static int es7000_apic_id_registered(void) | 407 | static int es7000_apic_id_registered(void) |
| 446 | { | 408 | { |
| 447 | return 1; | 409 | return 1; |
| 448 | } | 410 | } |
| 449 | 411 | ||
| 450 | static const cpumask_t *target_cpus_cluster(void) | 412 | static const cpumask_t *target_cpus_cluster(void) |
| @@ -486,7 +448,7 @@ static void es7000_init_apic_ldr_cluster(void) | |||
| 486 | unsigned long val; | 448 | unsigned long val; |
| 487 | int cpu = smp_processor_id(); | 449 | int cpu = smp_processor_id(); |
| 488 | 450 | ||
| 489 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | 451 | apic_write(APIC_DFR, APIC_DFR_CLUSTER); |
| 490 | val = calculate_ldr(cpu); | 452 | val = calculate_ldr(cpu); |
| 491 | apic_write(APIC_LDR, val); | 453 | apic_write(APIC_LDR, val); |
| 492 | } | 454 | } |
| @@ -496,7 +458,7 @@ static void es7000_init_apic_ldr(void) | |||
| 496 | unsigned long val; | 458 | unsigned long val; |
| 497 | int cpu = smp_processor_id(); | 459 | int cpu = smp_processor_id(); |
| 498 | 460 | ||
| 499 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 461 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
| 500 | val = calculate_ldr(cpu); | 462 | val = calculate_ldr(cpu); |
| 501 | apic_write(APIC_LDR, val); | 463 | apic_write(APIC_LDR, val); |
| 502 | } | 464 | } |
| @@ -585,7 +547,7 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
| 585 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 547 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
| 586 | 548 | ||
| 587 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | 549 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
| 588 | printk ("%s: Not a valid mask!\n", __func__); | 550 | printk("%s: Not a valid mask!\n", __func__); |
| 589 | 551 | ||
| 590 | return 0xFF; | 552 | return 0xFF; |
| 591 | } | 553 | } |
| @@ -619,7 +581,7 @@ static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
| 619 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 581 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
| 620 | 582 | ||
| 621 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | 583 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
| 622 | printk ("%s: Not a valid mask!\n", __func__); | 584 | printk("%s: Not a valid mask!\n", __func__); |
| 623 | 585 | ||
| 624 | return es7000_cpu_to_logical_apicid(0); | 586 | return es7000_cpu_to_logical_apicid(0); |
| 625 | } | 587 | } |
| @@ -658,8 +620,9 @@ static int es7000_phys_pkg_id(int cpuid_apic, int index_msb) | |||
| 658 | void __init es7000_update_genapic_to_cluster(void) | 620 | void __init es7000_update_genapic_to_cluster(void) |
| 659 | { | 621 | { |
| 660 | apic->target_cpus = target_cpus_cluster; | 622 | apic->target_cpus = target_cpus_cluster; |
| 661 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; | 623 | apic->irq_delivery_mode = dest_LowestPrio; |
| 662 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; | 624 | /* logical delivery broadcast to all procs: */ |
| 625 | apic->irq_dest_mode = 1; | ||
| 663 | 626 | ||
| 664 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; | 627 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; |
| 665 | 628 | ||
