29 #define pr_fmt(fmt) "summit: %s: " fmt, __func__
44 #include <asm/fixmap.h>
47 #include <linux/kernel.h>
48 #include <linux/string.h>
52 static unsigned summit_get_apic_id(
unsigned long x)
54 return (x >> 24) & 0xFF;
59 default_send_IPI_mask_sequence_logical(mask, vector);
62 static void summit_send_IPI_allbutself(
int vector)
64 default_send_IPI_mask_allbutself_logical(cpu_online_mask, vector);
67 static void summit_send_IPI_all(
int vector)
69 summit_send_IPI_mask(cpu_online_mask, vector);
76 #ifdef CONFIG_X86_SUMMIT_NUMA
77 static void setup_summit(
void);
79 static inline void setup_summit(
void) {}
82 static int summit_mps_oem_check(
struct mpc_table *mpc,
char *oem,
85 if (!
strncmp(oem,
"IBM ENSW", 8) &&
86 (!
strncmp(productid,
"VIGIL SMP", 9)
87 || !
strncmp(productid,
"EXA", 3)
88 || !
strncmp(productid,
"RUTHLESS SMP", 12))){
98 static int summit_acpi_madt_oem_check(
char *
oem_id,
char *oem_table_id)
100 if (!
strncmp(oem_id,
"IBM", 3) &&
101 (!
strncmp(oem_table_id,
"SERVIGIL", 8)
102 || !
strncmp(oem_table_id,
"EXA", 3))){
172 static inline int is_WPEG(
struct rio_detail *rio){
177 #define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
179 static const struct cpumask *summit_target_cpus(
void)
194 static unsigned long summit_check_apicid_present(
int bit)
199 static int summit_early_logical_apicid(
int cpu)
209 for (count = 0, i = nr_cpu_ids; --i >= 0; ) {
218 return my_cluster | (1
UL <<
count);
221 static void summit_init_apic_ldr(
void)
224 unsigned long id =
early_per_cpu(x86_cpu_to_logical_apicid, cpu);
233 static int summit_apic_id_registered(
void)
238 static void summit_setup_apic_routing(
void)
240 pr_info(
"Enabling APIC mode: Summit. Using %d I/O APICs\n",
244 static int summit_cpu_present_to_apicid(
int mps_cpu)
246 if (mps_cpu < nr_cpu_ids)
247 return (
int)
per_cpu(x86_bios_cpu_apicid, mps_cpu);
255 physids_promote(0x0FL, retmap);
260 physid_set_mask_of_physid(0, retmap);
263 static int summit_check_phys_apicid_present(
int physical_apicid)
271 unsigned int round = 0;
278 int new_apicid =
early_per_cpu(x86_cpu_to_logical_apicid, cpu);
281 pr_err(
"Not a valid mask!\n");
284 apicid |= new_apicid;
294 summit_cpu_mask_to_apicid_and(
const struct cpumask *inmask,
295 const struct cpumask *andmask,
296 unsigned int *apicid)
304 cpumask_and(cpumask, inmask, andmask);
305 summit_cpu_mask_to_apicid(cpumask, apicid);
307 free_cpumask_var(cpumask);
319 static int summit_phys_pkg_id(
int cpuid_apic,
int index_msb)
324 static int probe_summit(
void)
330 #ifdef CONFIG_X86_SUMMIT_NUMA
335 #ifndef CONFIG_X86_NUMAQ
339 static int setup_pci_node_map_for_wpeg(
int wpeg_num,
int last_bus)
341 int twister = 0,
node = 0;
342 int i,
bus, num_buses;
351 pr_err(
"Couldn't find owner Cyclone for Winnipeg!\n");
356 if (scal_devs[i]->
node_id == twister) {
362 pr_err(
"Couldn't find owner Twister for Cyclone!\n");
366 switch (rio_devs[wpeg_num]->
type) {
392 pr_info(
"Unsupported Winnipeg type!\n");
396 for (bus = last_bus; bus < last_bus + num_buses; bus++)
397 mp_bus_id_to_node[bus] =
node;
401 static int build_detail_arrays(
void)
404 int i, scal_detail_size, rio_detail_size;
407 pr_warn(
"MAX_NUMNODES too low! Defined as %d, but system has %d nodes\n",
412 switch (rio_table_hdr->
version) {
414 pr_warn(
"Invalid Rio Grande Table Version: %d\n",
418 scal_detail_size = 11;
419 rio_detail_size = 13;
422 scal_detail_size = 12;
423 rio_detail_size = 15;
427 ptr = (
unsigned long)rio_table_hdr + 3;
428 for (i = 0; i < rio_table_hdr->
num_scal_dev; i++, ptr += scal_detail_size)
431 for (i = 0; i < rio_table_hdr->
num_rio_dev; i++, ptr += rio_detail_size)
437 void setup_summit(
void)
441 int i, next_wpeg, next_bus = 0;
444 ptr = get_bios_ebda();
447 rio_table_hdr =
NULL;
451 if (*((
unsigned short *)(ptr + offset + 2)) == 0x4752) {
453 rio_table_hdr = (
struct rio_table_hdr *)(ptr + offset + 4);
457 offset = *((
unsigned short *)(ptr + offset));
459 if (!rio_table_hdr) {
460 pr_err(
"Unable to locate Rio Grande Table in EBDA - bailing!\n");
464 if (!build_detail_arrays())
471 if (is_WPEG(rio_devs[i]) && rio_devs[i]->
WP_index == next_wpeg) {
473 next_bus = setup_pci_node_map_for_wpeg(i, next_bus);
485 }
while (next_wpeg != 0);
489 static struct apic apic_summit = {
492 .probe = probe_summit,
493 .acpi_madt_oem_check = summit_acpi_madt_oem_check,
494 .apic_id_valid = default_apic_id_valid,
495 .apic_id_registered = summit_apic_id_registered,
501 .target_cpus = summit_target_cpus,
504 .check_apicid_used = summit_check_apicid_used,
505 .check_apicid_present = summit_check_apicid_present,
507 .vector_allocation_domain = flat_vector_allocation_domain,
508 .init_apic_ldr = summit_init_apic_ldr,
510 .ioapic_phys_id_map = summit_ioapic_phys_id_map,
511 .setup_apic_routing = summit_setup_apic_routing,
512 .multi_timer_check =
NULL,
513 .cpu_present_to_apicid = summit_cpu_present_to_apicid,
514 .apicid_to_cpu_present = summit_apicid_to_cpu_present,
515 .setup_portio_remap =
NULL,
516 .check_phys_apicid_present = summit_check_phys_apicid_present,
517 .enable_apic_mode =
NULL,
518 .phys_pkg_id = summit_phys_pkg_id,
519 .mps_oem_check = summit_mps_oem_check,
521 .get_apic_id = summit_get_apic_id,
523 .apic_id_mask = 0xFF << 24,
525 .cpu_mask_to_apicid_and = summit_cpu_mask_to_apicid_and,
527 .send_IPI_mask = summit_send_IPI_mask,
528 .send_IPI_mask_allbutself =
NULL,
529 .send_IPI_allbutself = summit_send_IPI_allbutself,
530 .send_IPI_all = summit_send_IPI_all,
531 .send_IPI_self = default_send_IPI_self,
536 .wait_for_init_deassert = default_wait_for_init_deassert,
538 .smp_callin_clear_local_apic =
NULL,
539 .inquire_remote_apic = default_inquire_remote_apic,
541 .read = native_apic_mem_read,
542 .write = native_apic_mem_write,
543 .eoi_write = native_apic_mem_write,
549 .x86_32_early_logical_apicid = summit_early_logical_apicid,