Commit 4c60f4e2 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by David Mosberger

[PATCH] Here are a couple patches against 2.5.18-ia64-020530. The

first is some trivial cleanup in ia64/kernel/acpi.c (no need to
initialize automatics that are immediately assigned, don't
check for "0 == __va(x)", don't bail out of acpi_boot_init
on errors in MADT parsing (we might still be able to get
good stuff from SPCR, etc)).

The second applies on top of the first and cleans up legacy
keyboard detection by using the 8042 bit in the FADT boot
architecture flags.  I think it's a little cleaner than the current
"#ifdef CONFIG_IA64" approach in pc_keyb.c.
parent 3ae2bae1
...@@ -56,6 +56,8 @@ asm (".weak iosapic_version"); ...@@ -56,6 +56,8 @@ asm (".weak iosapic_version");
void (*pm_idle) (void); void (*pm_idle) (void);
void (*pm_power_off) (void); void (*pm_power_off) (void);
unsigned char acpi_kbd_controller_present = 1;
const char * const char *
acpi_get_sysname (void) acpi_get_sysname (void)
{ {
...@@ -206,7 +208,7 @@ struct acpi_table_madt * acpi_madt __initdata; ...@@ -206,7 +208,7 @@ struct acpi_table_madt * acpi_madt __initdata;
static int __init static int __init
acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header) acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header)
{ {
struct acpi_table_lapic_addr_ovr *lapic = NULL; struct acpi_table_lapic_addr_ovr *lapic;
lapic = (struct acpi_table_lapic_addr_ovr *) header; lapic = (struct acpi_table_lapic_addr_ovr *) header;
if (!lapic) if (!lapic)
...@@ -226,7 +228,7 @@ acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header) ...@@ -226,7 +228,7 @@ acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_lsapic (acpi_table_entry_header *header) acpi_parse_lsapic (acpi_table_entry_header *header)
{ {
struct acpi_table_lsapic *lsapic = NULL; struct acpi_table_lsapic *lsapic;
lsapic = (struct acpi_table_lsapic *) header; lsapic = (struct acpi_table_lsapic *) header;
if (!lsapic) if (!lsapic)
...@@ -262,7 +264,7 @@ acpi_parse_lsapic (acpi_table_entry_header *header) ...@@ -262,7 +264,7 @@ acpi_parse_lsapic (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_lapic_nmi (acpi_table_entry_header *header) acpi_parse_lapic_nmi (acpi_table_entry_header *header)
{ {
struct acpi_table_lapic_nmi *lacpi_nmi = NULL; struct acpi_table_lapic_nmi *lacpi_nmi;
lacpi_nmi = (struct acpi_table_lapic_nmi*) header; lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
if (!lacpi_nmi) if (!lacpi_nmi)
...@@ -279,7 +281,7 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header) ...@@ -279,7 +281,7 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header)
static int __init static int __init
acpi_find_iosapic (int global_vector, u32 *irq_base, char **iosapic_address) acpi_find_iosapic (int global_vector, u32 *irq_base, char **iosapic_address)
{ {
struct acpi_table_iosapic *iosapic = NULL; struct acpi_table_iosapic *iosapic;
int ver = 0; int ver = 0;
int max_pin = 0; int max_pin = 0;
char *p = 0; char *p = 0;
...@@ -338,7 +340,7 @@ acpi_parse_iosapic (acpi_table_entry_header *header) ...@@ -338,7 +340,7 @@ acpi_parse_iosapic (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_plat_int_src (acpi_table_entry_header *header) acpi_parse_plat_int_src (acpi_table_entry_header *header)
{ {
struct acpi_table_plat_int_src *plintsrc = NULL; struct acpi_table_plat_int_src *plintsrc;
int vector = 0; int vector = 0;
u32 irq_base = 0; u32 irq_base = 0;
char *iosapic_address = NULL; char *iosapic_address = NULL;
...@@ -381,7 +383,7 @@ acpi_parse_plat_int_src (acpi_table_entry_header *header) ...@@ -381,7 +383,7 @@ acpi_parse_plat_int_src (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_int_src_ovr (acpi_table_entry_header *header) acpi_parse_int_src_ovr (acpi_table_entry_header *header)
{ {
struct acpi_table_int_src_ovr *p = NULL; struct acpi_table_int_src_ovr *p;
p = (struct acpi_table_int_src_ovr *) header; p = (struct acpi_table_int_src_ovr *) header;
if (!p) if (!p)
...@@ -404,7 +406,7 @@ acpi_parse_int_src_ovr (acpi_table_entry_header *header) ...@@ -404,7 +406,7 @@ acpi_parse_int_src_ovr (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_nmi_src (acpi_table_entry_header *header) acpi_parse_nmi_src (acpi_table_entry_header *header)
{ {
struct acpi_table_nmi_src *nmi_src = NULL; struct acpi_table_nmi_src *nmi_src;
nmi_src = (struct acpi_table_nmi_src*) header; nmi_src = (struct acpi_table_nmi_src*) header;
if (!nmi_src) if (!nmi_src)
...@@ -425,10 +427,6 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size) ...@@ -425,10 +427,6 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
return -EINVAL; return -EINVAL;
acpi_madt = (struct acpi_table_madt *) __va(phys_addr); acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
if (!acpi_madt) {
printk(KERN_WARNING PREFIX "Unable to map MADT\n");
return -ENODEV;
}
/* Get base address of IPI Message Block */ /* Get base address of IPI Message Block */
...@@ -442,6 +440,28 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size) ...@@ -442,6 +440,28 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
} }
static int __init
acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
{
struct acpi_table_header *fadt_header;
fadt_descriptor_rev2 *fadt;
if (!phys_addr || !size)
return -EINVAL;
fadt_header = (struct acpi_table_header *) __va(phys_addr);
if (fadt_header->revision != 3)
return -ENODEV; /* Only deal with ACPI 2.0 FADT */
fadt = (fadt_descriptor_rev2 *) fadt_header;
if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
acpi_kbd_controller_present = 0;
return 0;
}
int __init int __init
acpi_find_rsdp (unsigned long *rsdp_phys) acpi_find_rsdp (unsigned long *rsdp_phys)
{ {
...@@ -467,8 +487,8 @@ acpi_find_rsdp (unsigned long *rsdp_phys) ...@@ -467,8 +487,8 @@ acpi_find_rsdp (unsigned long *rsdp_phys)
static int __init static int __init
acpi_parse_spcr (unsigned long phys_addr, unsigned long size) acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
{ {
acpi_ser_t *spcr = NULL; acpi_ser_t *spcr;
unsigned long global_int = 0; unsigned long global_int;
if (!phys_addr || !size) if (!phys_addr || !size)
return -EINVAL; return -EINVAL;
...@@ -486,11 +506,6 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size) ...@@ -486,11 +506,6 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
*/ */
spcr = (acpi_ser_t *) __va(phys_addr); spcr = (acpi_ser_t *) __va(phys_addr);
if (!spcr) {
printk(KERN_WARNING PREFIX "Unable to map SPCR\n");
return -ENODEV;
}
setup_serial_acpi(spcr); setup_serial_acpi(spcr);
if (spcr->length < sizeof(acpi_ser_t)) if (spcr->length < sizeof(acpi_ser_t))
...@@ -527,11 +542,11 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size) ...@@ -527,11 +542,11 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
int __init int __init
acpi_boot_init (char *cmdline) acpi_boot_init (char *cmdline)
{ {
int result = 0; int result;
/* Initialize the ACPI boot-time table parser */ /* Initialize the ACPI boot-time table parser */
result = acpi_table_init(cmdline); result = acpi_table_init(cmdline);
if (0 != result) if (result)
return result; return result;
/* /*
...@@ -542,57 +557,49 @@ acpi_boot_init (char *cmdline) ...@@ -542,57 +557,49 @@ acpi_boot_init (char *cmdline)
* information -- the successor to MPS tables. * information -- the successor to MPS tables.
*/ */
result = acpi_table_parse(ACPI_APIC, acpi_parse_madt); if (acpi_table_parse(ACPI_APIC, acpi_parse_madt) < 1) {
if (1 > result) printk(KERN_ERR PREFIX "Can't find MADT\n");
return result; goto skip_madt;
}
/* Local APIC */ /* Local APIC */
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr); if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
if (0 > result) { acpi_parse_lapic_addr_ovr) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
return result;
}
result = acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic); if (acpi_table_parse_madt(ACPI_MADT_LSAPIC,
if (1 > result) { acpi_parse_lsapic) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries!\n"); printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
return -ENODEV;
}
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi); if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
if (0 > result) { acpi_parse_lapic_nmi) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
return result;
}
/* I/O APIC */ /* I/O APIC */
result = acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic); if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC,
if (1 > result) { acpi_parse_iosapic) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no IOAPIC entries!\n"); printk(KERN_ERR PREFIX "Error parsing MADT - no IOAPIC entries\n");
return ((result == 0) ? -ENODEV : result);
}
/* System-Level Interrupt Routing */ /* System-Level Interrupt Routing */
result = acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src); if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC,
if (0 > result) { acpi_parse_plat_int_src) < 0)
printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n"); printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
return result;
}
result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr); if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
if (0 > result) { acpi_parse_int_src_ovr) < 0)
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
return result;
}
result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src); if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
if (0 > result) { acpi_parse_nmi_src) < 0)
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
return result; skip_madt:
}
/* FADT says whether a legacy keyboard controller is present. */
if (acpi_table_parse(ACPI_FACP, acpi_parse_fadt) < 1)
printk(KERN_ERR PREFIX "Can't find FADT\n");
#ifdef CONFIG_SERIAL_ACPI #ifdef CONFIG_SERIAL_ACPI
/* /*
...@@ -602,7 +609,7 @@ acpi_boot_init (char *cmdline) ...@@ -602,7 +609,7 @@ acpi_boot_init (char *cmdline)
* serial ports, EC, SMBus, etc. * serial ports, EC, SMBus, etc.
*/ */
acpi_table_parse(ACPI_SPCR, acpi_parse_spcr); acpi_table_parse(ACPI_SPCR, acpi_parse_spcr);
#endif /*CONFIG_SERIAL_ACPI*/ #endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (available_cpus == 0) { if (available_cpus == 0) {
...@@ -625,9 +632,9 @@ acpi_boot_init (char *cmdline) ...@@ -625,9 +632,9 @@ acpi_boot_init (char *cmdline)
int __init int __init
acpi_get_prt (struct pci_vector_struct **vectors, int *count) acpi_get_prt (struct pci_vector_struct **vectors, int *count)
{ {
struct pci_vector_struct *vector = NULL; struct pci_vector_struct *vector;
struct list_head *node = NULL; struct list_head *node;
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry;
int i = 0; int i = 0;
if (!vectors || !count) if (!vectors || !count)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define KEYBOARD_IRQ isa_irq_to_vector(1) #define KEYBOARD_IRQ isa_irq_to_vector(1)
#define DISABLE_KBD_DURING_INTERRUPTS 0 #define DISABLE_KBD_DURING_INTERRUPTS 0
extern unsigned char acpi_kbd_controller_present;
extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_getkeycode(unsigned int scancode);
extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_pretranslate(unsigned char scancode, char raw_mode);
...@@ -26,6 +27,7 @@ extern void pckbd_leds(unsigned char leds); ...@@ -26,6 +27,7 @@ extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void); extern void pckbd_init_hw(void);
extern unsigned char pckbd_sysrq_xlate[128]; extern unsigned char pckbd_sysrq_xlate[128];
#define kbd_controller_present() acpi_kbd_controller_present
#define kbd_setkeycode pckbd_setkeycode #define kbd_setkeycode pckbd_setkeycode
#define kbd_getkeycode pckbd_getkeycode #define kbd_getkeycode pckbd_getkeycode
#define kbd_pretranslate pckbd_pretranslate #define kbd_pretranslate pckbd_pretranslate
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment