Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

apic: Centralize IMCR present setting

  • Loading branch information...
commit 9d758cc4150a497db6dc00e13c1d6bf8175bb567 1 parent 4abdfb4
Sepherosa Ziehau authored
View
30 sys/platform/pc32/apic/ioapic_abi.c
@@ -480,8 +480,6 @@ static void ioapic_stabilize(void);
static void ioapic_initmap(void);
static void ioapic_intr_config(int, enum intr_trigger, enum intr_polarity);
-static int ioapic_imcr_present;
-
struct machintr_abi MachIntrABI_IOAPIC = {
MACHINTR_IOAPIC,
.intrdis = IOAPIC_INTRDIS,
@@ -500,35 +498,13 @@ struct machintr_abi MachIntrABI_IOAPIC = {
static int
ioapic_setvar(int varid, const void *buf)
{
- int error = 0;
-
- switch (varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- ioapic_imcr_present = *(const int *)buf;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
static int
ioapic_getvar(int varid, void *buf)
{
- int error = 0;
-
- switch (varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- *(int *)buf = ioapic_imcr_present;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
/*
@@ -554,7 +530,7 @@ ioapic_finalize(void)
* from the BSP. The 8259 may still be connected to LINT0 on
* the BSP's LAPIC.
*/
- if (ioapic_imcr_present) {
+ if (imcr_present) {
outb(0x22, 0x70); /* select IMCR */
outb(0x23, 0x01); /* disconnect 8259 */
}
View
18 sys/platform/pc32/i386/mp_machdep.c
@@ -346,7 +346,6 @@ static void mptable_fix(void);
#endif
static int mptable_map(struct mptable_pos *);
static void mptable_unmap(struct mptable_pos *);
-static void mptable_imcr(struct mptable_pos *);
static void mptable_bus_info_alloc(const mpcth_t,
struct mptable_bus_info *);
static void mptable_bus_info_free(struct mptable_bus_info *);
@@ -371,6 +370,8 @@ static cpumask_t smp_startup_mask = 1; /* which cpus have been started */
cpumask_t smp_active_mask = 1; /* which cpus are ready for IPIs etc? */
SYSCTL_INT(_machdep, OID_AUTO, smp_active, CTLFLAG_RD, &smp_active_mask, 0, "");
+int imcr_present;
+
static vm_paddr_t mptable_fps_phyaddr;
static int mptable_use_default;
static TAILQ_HEAD(mptable_pci_int_list, mptable_pci_int) mptable_pci_int_list =
@@ -418,6 +419,8 @@ mptable_probe(void)
kprintf("MPTABLE: use default configuration\n");
mptable_use_default = 1;
}
+ if (mpt.mp_fps->mpfb2 & 0x80)
+ imcr_present = 1;
mptable_unmap(&mpt);
}
@@ -652,11 +655,6 @@ mp_enable(u_int boot_addr)
if (apic_io_enable)
ioapic_config();
- if (mptable_fps_phyaddr) {
- mptable_map(&mpt);
- mptable_imcr(&mpt);
- mptable_unmap(&mpt);
- }
if (apic_io_enable && ioapic_use_old) {
if (!mptable_fps_phyaddr)
@@ -3037,14 +3035,6 @@ mptable_lapic_pass2_callback(void *xarg, const void *pos, int type)
}
static void
-mptable_imcr(struct mptable_pos *mpt)
-{
- /* record whether PIC or virtual-wire mode */
- machintr_setvar_simple(MACHINTR_VAR_IMCR_PRESENT,
- mpt->mp_fps->mpfb2 & 0x80);
-}
-
-static void
mptable_lapic_default(void)
{
int ap_apicid, bsp_apicid;
View
32 sys/platform/pc32/icu/icu_abi.c
@@ -119,43 +119,19 @@ struct machintr_abi MachIntrABI_ICU = {
.intr_config = icu_intr_config
};
-static int icu_imcr_present;
-
/*
* WARNING! SMP builds can use the ICU now so this code must be MP safe.
*/
static int
icu_setvar(int varid, const void *buf)
{
- int error = 0;
-
- switch (varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- icu_imcr_present = *(const int *)buf;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
static int
icu_getvar(int varid, void *buf)
{
- int error = 0;
-
- switch (varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- *(int *)buf = icu_imcr_present;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
/*
@@ -199,8 +175,6 @@ icu_finalize(void)
* MachIntrABI switching will happen in
* MachIntrABI_IOAPIC.finalize()
*/
- MachIntrABI_IOAPIC.setvar(MACHINTR_VAR_IMCR_PRESENT,
- &icu_imcr_present);
MachIntrABI_IOAPIC.finalize();
return;
}
@@ -214,7 +188,7 @@ icu_finalize(void)
* wire mode so we can use other interrupt sources within the LAPIC
* in addition to the 8259.
*/
- if (icu_imcr_present) {
+ if (imcr_present) {
u_long ef;
crit_enter();
View
1  sys/platform/pc32/include/smp.h
@@ -56,6 +56,7 @@ u_int ioapic_read (volatile void *, int);
void ioapic_write (volatile void *, int, u_int);
/* global data in mp_machdep.c */
+extern int imcr_present;
extern int mp_naps;
extern int mp_napics;
extern vm_offset_t io_apic_address[];
View
30 sys/platform/pc64/apic/ioapic_abi.c
@@ -480,8 +480,6 @@ static void ioapic_stabilize(void);
static void ioapic_initmap(void);
static void ioapic_intr_config(int, enum intr_trigger, enum intr_polarity);
-static int ioapic_imcr_present;
-
struct machintr_abi MachIntrABI_IOAPIC = {
MACHINTR_IOAPIC,
.intrdis = IOAPIC_INTRDIS,
@@ -500,35 +498,13 @@ struct machintr_abi MachIntrABI_IOAPIC = {
static int
ioapic_setvar(int varid, const void *buf)
{
- int error = 0;
-
- switch(varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- ioapic_imcr_present = *(const int *)buf;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
static int
ioapic_getvar(int varid, void *buf)
{
- int error = 0;
-
- switch(varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- *(int *)buf = ioapic_imcr_present;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
/*
@@ -554,7 +530,7 @@ ioapic_finalize(void)
* from the BSP. The 8259 may still be connected to LINT0 on
* the BSP's LAPIC.
*/
- if (ioapic_imcr_present) {
+ if (imcr_present) {
outb(0x22, 0x70); /* select IMCR */
outb(0x23, 0x01); /* disconnect 8259 */
}
View
32 sys/platform/pc64/icu/icu_abi.c
@@ -119,43 +119,19 @@ struct machintr_abi MachIntrABI_ICU = {
.intr_config = icu_intr_config
};
-static int icu_imcr_present;
-
/*
* WARNING! SMP builds can use the ICU now so this code must be MP safe.
*/
static int
icu_setvar(int varid, const void *buf)
{
- int error = 0;
-
- switch(varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- icu_imcr_present = *(const int *)buf;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
static int
icu_getvar(int varid, void *buf)
{
- int error = 0;
-
- switch(varid) {
- case MACHINTR_VAR_IMCR_PRESENT:
- *(int *)buf = icu_imcr_present;
- break;
-
- default:
- error = ENOENT;
- break;
- }
- return error;
+ return ENOENT;
}
/*
@@ -199,8 +175,6 @@ icu_finalize(void)
* MachIntrABI switching will happen in
* MachIntrABI_IOAPIC.finalize()
*/
- MachIntrABI_IOAPIC.setvar(MACHINTR_VAR_IMCR_PRESENT,
- &icu_imcr_present);
MachIntrABI_IOAPIC.finalize();
return;
}
@@ -214,7 +188,7 @@ icu_finalize(void)
* wire mode so we can use other interrupt sources within the LAPIC
* in addition to the 8259.
*/
- if (icu_imcr_present) {
+ if (imcr_present) {
register_t ef;
crit_enter();
View
1  sys/platform/pc64/include/smp.h
@@ -65,6 +65,7 @@ u_int ioapic_read (volatile void *, int);
void ioapic_write (volatile void *, int, u_int);
/* global data in mp_machdep.c */
+extern int imcr_present;
extern int apic_io_enable;
extern int ioapic_use_old;
extern int mp_naps;
View
18 sys/platform/pc64/x86_64/mp_machdep.c
@@ -332,7 +332,6 @@ static void mptable_fix(void);
#endif
static int mptable_map(struct mptable_pos *);
static void mptable_unmap(struct mptable_pos *);
-static void mptable_imcr(struct mptable_pos *);
static void mptable_bus_info_alloc(const mpcth_t,
struct mptable_bus_info *);
static void mptable_bus_info_free(struct mptable_bus_info *);
@@ -360,6 +359,8 @@ cpumask_t smp_active_mask = 1; /* which cpus are ready for IPIs etc? */
SYSCTL_INT(_machdep, OID_AUTO, smp_active, CTLFLAG_RD, &smp_active_mask, 0, "");
static u_int bootMP_size;
+int imcr_present;
+
static vm_paddr_t mptable_fps_phyaddr;
static int mptable_use_default;
static TAILQ_HEAD(mptable_pci_int_list, mptable_pci_int) mptable_pci_int_list =
@@ -410,6 +411,8 @@ mptable_probe(void)
kprintf("MPTABLE: use default configuration\n");
mptable_use_default = 1;
}
+ if (mpt.mp_fps->mpfb2 & 0x80)
+ imcr_present = 1;
mptable_unmap(&mpt);
}
@@ -673,11 +676,6 @@ mp_enable(u_int boot_addr)
if (apic_io_enable)
ioapic_config();
- if (mptable_fps_phyaddr) {
- mptable_map(&mpt);
- mptable_imcr(&mpt);
- mptable_unmap(&mpt);
- }
if (apic_io_enable && ioapic_use_old) {
if (!mptable_fps_phyaddr)
@@ -3031,14 +3029,6 @@ mptable_lapic_pass2_callback(void *xarg, const void *pos, int type)
}
static void
-mptable_imcr(struct mptable_pos *mpt)
-{
- /* record whether PIC or virtual-wire mode */
- machintr_setvar_simple(MACHINTR_VAR_IMCR_PRESENT,
- mpt->mp_fps->mpfb2 & 0x80);
-}
-
-static void
mptable_lapic_default(void)
{
int ap_apicid, bsp_apicid;
Please sign in to comment.
Something went wrong with that request. Please try again.