Skip to content

Commit

Permalink
x86: refactor ->setup_portio_remap() subarch methods
Browse files Browse the repository at this point in the history
Only NUMAQ has a real ->setup_portio_remap() method, the other
subarchitectures define it but keep it empty.

So mark the vector as NULL, extend the generic code to handle
NULL -setup_portio_remap() entries and remove all the empty
handlers.

Also move the NUMAQ method from the header file into the
 apic driver .c file.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jan 28, 2009
1 parent 8058714 commit d83093b
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 30 deletions.
2 changes: 1 addition & 1 deletion arch/x86/include/asm/bigsmp/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static inline physid_mask_t bigsmp_ioapic_phys_id_map(physid_mask_t phys_map)
return physids_promote(0xFFL);
}

static inline void setup_portio_remap(void)
static inline void bigsmp_setup_portio_remap(void)
{
}

Expand Down
4 changes: 0 additions & 4 deletions arch/x86/include/asm/es7000/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ static inline physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
}


static inline void setup_portio_remap(void)
{
}

extern unsigned int boot_cpu_physical_apicid;
static inline int check_phys_apicid_present(int cpu_physical_apicid)
{
Expand Down
4 changes: 0 additions & 4 deletions arch/x86/include/asm/mach-default/mach_apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
return physid_mask_of_physid(phys_apicid);
}

static inline void setup_portio_remap(void)
{
}

static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
{
return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
Expand Down
1 change: 0 additions & 1 deletion arch/x86/include/asm/mach-generic/mach_apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <asm/genapic.h>

#define setup_portio_remap (apic->setup_portio_remap)
#define check_phys_apicid_present (apic->check_phys_apicid_present)
#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
Expand Down
13 changes: 0 additions & 13 deletions arch/x86/include/asm/numaq/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@ static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid)

extern void *xquad_portio;

static inline void setup_portio_remap(void)
{
int num_quads = num_online_nodes();

if (num_quads <= 1)
return;

printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
(u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
}

static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
{
return (1);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/summit/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static inline physid_mask_t summit_apicid_to_cpu_present(int apicid)
return physid_mask_of_physid(0);
}

static inline void setup_portio_remap(void)
static inline void summit_setup_portio_remap(void)
{
}

Expand Down
3 changes: 2 additions & 1 deletion arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)

map_cpu_to_logical_apicid();

setup_portio_remap();
if (apic->setup_portio_remap)
apic->setup_portio_remap();

smpboot_setup_io_apic();
/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mach-generic/bigsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct genapic apic_bigsmp = {
.cpu_to_logical_apicid = bigsmp_cpu_to_logical_apicid,
.cpu_present_to_apicid = bigsmp_cpu_present_to_apicid,
.apicid_to_cpu_present = bigsmp_apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap,
.setup_portio_remap = NULL,
.check_phys_apicid_present = check_phys_apicid_present,
.enable_apic_mode = enable_apic_mode,
.phys_pkg_id = phys_pkg_id,
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mach-generic/default.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct genapic apic_default = {
.cpu_to_logical_apicid = default_cpu_to_logical_apicid,
.cpu_present_to_apicid = default_cpu_present_to_apicid,
.apicid_to_cpu_present = default_apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap,
.setup_portio_remap = NULL,
.check_phys_apicid_present = check_phys_apicid_present,
.enable_apic_mode = enable_apic_mode,
.phys_pkg_id = phys_pkg_id,
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mach-generic/es7000.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ struct genapic apic_es7000 = {
.cpu_to_logical_apicid = es7000_cpu_to_logical_apicid,
.cpu_present_to_apicid = es7000_cpu_present_to_apicid,
.apicid_to_cpu_present = es7000_apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap,
.setup_portio_remap = NULL,
.check_phys_apicid_present = check_phys_apicid_present,
.enable_apic_mode = enable_apic_mode,
.phys_pkg_id = phys_pkg_id,
Expand Down
15 changes: 14 additions & 1 deletion arch/x86/mach-generic/numaq.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask)
*retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
}

static void numaq_setup_portio_remap(void)
{
int num_quads = num_online_nodes();

if (num_quads <= 1)
return;

printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
(u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
}

struct genapic apic_numaq = {

.name = "NUMAQ",
Expand Down Expand Up @@ -71,7 +84,7 @@ struct genapic apic_numaq = {
.cpu_to_logical_apicid = numaq_cpu_to_logical_apicid,
.cpu_present_to_apicid = numaq_cpu_present_to_apicid,
.apicid_to_cpu_present = numaq_apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap,
.setup_portio_remap = numaq_setup_portio_remap,
.check_phys_apicid_present = check_phys_apicid_present,
.enable_apic_mode = enable_apic_mode,
.phys_pkg_id = phys_pkg_id,
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mach-generic/summit.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct genapic apic_summit = {
.cpu_to_logical_apicid = summit_cpu_to_logical_apicid,
.cpu_present_to_apicid = summit_cpu_present_to_apicid,
.apicid_to_cpu_present = summit_apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap,
.setup_portio_remap = NULL,
.check_phys_apicid_present = check_phys_apicid_present,
.enable_apic_mode = enable_apic_mode,
.phys_pkg_id = phys_pkg_id,
Expand Down

0 comments on commit d83093b

Please sign in to comment.