x86 suspend/resume: suspend pics and pseudo-pics in reverse order
- change 'pics' from STAILQ to TAILQ - ensure that Local APIC is always first in 'pics' Reviewed by: jhb Tested by: Sergey V. Dyatko <sergey.dyatko@gmail.com>, KAHO Toshikazu <kaho@elam.kais.kyoto-u.ac.jp> MFC after: 12 days
This commit is contained in:
parent
8e238c660c
commit
09a43450b8
@ -94,7 +94,7 @@ struct pic {
|
|||||||
int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
|
int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
|
||||||
enum intr_polarity);
|
enum intr_polarity);
|
||||||
int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
|
int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
|
||||||
STAILQ_ENTRY(pic) pics;
|
TAILQ_ENTRY(pic) pics;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Flags for pic_disable_source() */
|
/* Flags for pic_disable_source() */
|
||||||
|
@ -94,7 +94,7 @@ struct pic {
|
|||||||
int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
|
int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
|
||||||
enum intr_polarity);
|
enum intr_polarity);
|
||||||
int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
|
int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
|
||||||
STAILQ_ENTRY(pic) pics;
|
TAILQ_ENTRY(pic) pics;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Flags for pic_disable_source() */
|
/* Flags for pic_disable_source() */
|
||||||
|
@ -78,7 +78,7 @@ static int intrcnt_index;
|
|||||||
static struct intsrc *interrupt_sources[NUM_IO_INTS];
|
static struct intsrc *interrupt_sources[NUM_IO_INTS];
|
||||||
static struct mtx intr_table_lock;
|
static struct mtx intr_table_lock;
|
||||||
static struct mtx intrcnt_lock;
|
static struct mtx intrcnt_lock;
|
||||||
static STAILQ_HEAD(, pic) pics;
|
static TAILQ_HEAD(pics_head, pic) pics;
|
||||||
|
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
static int assign_cpu;
|
static int assign_cpu;
|
||||||
@ -102,7 +102,7 @@ intr_pic_registered(struct pic *pic)
|
|||||||
{
|
{
|
||||||
struct pic *p;
|
struct pic *p;
|
||||||
|
|
||||||
STAILQ_FOREACH(p, &pics, pics) {
|
TAILQ_FOREACH(p, &pics, pics) {
|
||||||
if (p == pic)
|
if (p == pic)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ intr_register_pic(struct pic *pic)
|
|||||||
if (intr_pic_registered(pic))
|
if (intr_pic_registered(pic))
|
||||||
error = EBUSY;
|
error = EBUSY;
|
||||||
else {
|
else {
|
||||||
STAILQ_INSERT_TAIL(&pics, pic, pics);
|
TAILQ_INSERT_TAIL(&pics, pic, pics);
|
||||||
error = 0;
|
error = 0;
|
||||||
}
|
}
|
||||||
mtx_unlock(&intr_table_lock);
|
mtx_unlock(&intr_table_lock);
|
||||||
@ -287,7 +287,7 @@ intr_resume(void)
|
|||||||
atpic_reset();
|
atpic_reset();
|
||||||
#endif
|
#endif
|
||||||
mtx_lock(&intr_table_lock);
|
mtx_lock(&intr_table_lock);
|
||||||
STAILQ_FOREACH(pic, &pics, pics) {
|
TAILQ_FOREACH(pic, &pics, pics) {
|
||||||
if (pic->pic_resume != NULL)
|
if (pic->pic_resume != NULL)
|
||||||
pic->pic_resume(pic);
|
pic->pic_resume(pic);
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ intr_suspend(void)
|
|||||||
struct pic *pic;
|
struct pic *pic;
|
||||||
|
|
||||||
mtx_lock(&intr_table_lock);
|
mtx_lock(&intr_table_lock);
|
||||||
STAILQ_FOREACH(pic, &pics, pics) {
|
TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) {
|
||||||
if (pic->pic_suspend != NULL)
|
if (pic->pic_suspend != NULL)
|
||||||
pic->pic_suspend(pic);
|
pic->pic_suspend(pic);
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ intr_init(void *dummy __unused)
|
|||||||
|
|
||||||
intrcnt_setname("???", 0);
|
intrcnt_setname("???", 0);
|
||||||
intrcnt_index = 1;
|
intrcnt_index = 1;
|
||||||
STAILQ_INIT(&pics);
|
TAILQ_INIT(&pics);
|
||||||
mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF);
|
mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF);
|
||||||
mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN);
|
mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN);
|
||||||
}
|
}
|
||||||
|
@ -1360,11 +1360,19 @@ apic_setup_io(void *dummy __unused)
|
|||||||
|
|
||||||
if (best_enum == NULL)
|
if (best_enum == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local APIC must be registered before other PICs and pseudo PICs
|
||||||
|
* for proper suspend/resume order.
|
||||||
|
*/
|
||||||
|
#ifndef XEN
|
||||||
|
intr_register_pic(&lapic_pic);
|
||||||
|
#endif
|
||||||
|
|
||||||
retval = best_enum->apic_setup_io();
|
retval = best_enum->apic_setup_io();
|
||||||
if (retval != 0)
|
if (retval != 0)
|
||||||
printf("%s: Failed to setup I/O APICs: returned %d\n",
|
printf("%s: Failed to setup I/O APICs: returned %d\n",
|
||||||
best_enum->apic_name, retval);
|
best_enum->apic_name, retval);
|
||||||
|
|
||||||
#ifdef XEN
|
#ifdef XEN
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@ -1373,7 +1381,6 @@ apic_setup_io(void *dummy __unused)
|
|||||||
* properly program the LINT pins.
|
* properly program the LINT pins.
|
||||||
*/
|
*/
|
||||||
lapic_setup(1);
|
lapic_setup(1);
|
||||||
intr_register_pic(&lapic_pic);
|
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
lapic_dump("BSP");
|
lapic_dump("BSP");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user