Commit 34f5a2a8 authored by David Mosberger's avatar David Mosberger

ia64: Fix ACPI/IOSAPIC breakage introduced by big ACPI update.

parent e7254614
...@@ -42,7 +42,7 @@ struct fake_pci_dev { ...@@ -42,7 +42,7 @@ struct fake_pci_dev {
static struct fake_pci_dev *fake_pci_head, **fake_pci_tail = &fake_pci_head; static struct fake_pci_dev *fake_pci_head, **fake_pci_tail = &fake_pci_head;
static struct pci_ops orig_pci_ops; static struct pci_ops *orig_pci_ops;
static inline struct fake_pci_dev * static inline struct fake_pci_dev *
fake_pci_find_slot(unsigned char bus, unsigned int devfn) fake_pci_find_slot(unsigned char bus, unsigned int devfn)
...@@ -77,7 +77,7 @@ static int hp_cfg_read##sz (struct pci_dev *dev, int where, u##bits *value) \ ...@@ -77,7 +77,7 @@ static int hp_cfg_read##sz (struct pci_dev *dev, int where, u##bits *value) \
{ \ { \
struct fake_pci_dev *fake_dev; \ struct fake_pci_dev *fake_dev; \
if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \ if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \
return orig_pci_ops.name(dev, where, value); \ return orig_pci_ops->name(dev, where, value); \
\ \
switch (where) { \ switch (where) { \
case PCI_COMMAND: \ case PCI_COMMAND: \
...@@ -105,7 +105,7 @@ static int hp_cfg_write##sz (struct pci_dev *dev, int where, u##bits value) \ ...@@ -105,7 +105,7 @@ static int hp_cfg_write##sz (struct pci_dev *dev, int where, u##bits value) \
{ \ { \
struct fake_pci_dev *fake_dev; \ struct fake_pci_dev *fake_dev; \
if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \ if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \
return orig_pci_ops.name(dev, where, value); \ return orig_pci_ops->name(dev, where, value); \
\ \
switch (where) { \ switch (where) { \
case PCI_BASE_ADDRESS_0: \ case PCI_BASE_ADDRESS_0: \
...@@ -295,7 +295,7 @@ hpzx1_lba_probe(acpi_handle obj, u32 depth, void *context, void **ret) ...@@ -295,7 +295,7 @@ hpzx1_lba_probe(acpi_handle obj, u32 depth, void *context, void **ret)
if (status != AE_OK) if (status != AE_OK)
return status; return status;
status = acpi_cf_evaluate_method(obj, METHOD_NAME__BBN, &busnum); status = acpi_evaluate_integer(obj, METHOD_NAME__BBN, NULL, &busnum);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(KERN_ERR PFX "evaluate _BBN fail=0x%x\n", status); printk(KERN_ERR PFX "evaluate _BBN fail=0x%x\n", status);
busnum = 0; // no _BBN; stick it on bus 0 busnum = 0; // no _BBN; stick it on bus 0
...@@ -313,7 +313,7 @@ hpzx1_lba_probe(acpi_handle obj, u32 depth, void *context, void **ret) ...@@ -313,7 +313,7 @@ hpzx1_lba_probe(acpi_handle obj, u32 depth, void *context, void **ret)
static void static void
hpzx1_acpi_dev_init(void) hpzx1_acpi_dev_init(void)
{ {
extern struct pci_ops pci_conf; extern struct pci_ops *pci_root_ops;
/* /*
* Make fake PCI devices for the following hardware in the * Make fake PCI devices for the following hardware in the
...@@ -383,8 +383,8 @@ hpzx1_acpi_dev_init(void) ...@@ -383,8 +383,8 @@ hpzx1_acpi_dev_init(void)
/* /*
* Replace PCI ops, but only if we made fake devices. * Replace PCI ops, but only if we made fake devices.
*/ */
orig_pci_ops = pci_conf; orig_pci_ops = pci_root_ops;
pci_conf = hp_pci_conf; pci_root_ops = &hp_pci_conf;
} }
extern void sba_init(void); extern void sba_init(void);
......
...@@ -56,18 +56,43 @@ asm (".weak iosapic_version"); ...@@ -56,18 +56,43 @@ asm (".weak iosapic_version");
void (*pm_idle) (void); void (*pm_idle) (void);
void (*pm_power_off) (void); void (*pm_power_off) (void);
/*
* TBD: Should go away once we have an ACPI parser.
*/
const char * const char *
acpi_get_sysname (void) acpi_get_sysname (void)
{ {
#ifdef CONFIG_IA64_GENERIC #ifdef CONFIG_IA64_GENERIC
return "hpsim"; unsigned long rsdp_phys = 0;
struct acpi20_table_rsdp *rsdp;
struct acpi_table_xsdt *xsdt;
struct acpi_table_header *hdr;
if ((0 != acpi_find_rsdp(&rsdp_phys)) || !rsdp_phys) {
printk("ACPI 2.0 RSDP not found, default to \"dig\"\n");
return "dig";
}
rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
printk("ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
return "dig";
}
xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
hdr = &xsdt->header;
if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
printk("ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
return "dig";
}
if (!strcmp(hdr->oem_id, "HP")) {
return "hpzx1";
}
return "dig";
#else #else
# if defined (CONFIG_IA64_HP_SIM) # if defined (CONFIG_IA64_HP_SIM)
return "hpsim"; return "hpsim";
# elif defined (CONFIG_IA64_HP_ZX1)
return "hpzx1";
# elif defined (CONFIG_IA64_SGI_SN1) # elif defined (CONFIG_IA64_SGI_SN1)
return "sn1"; return "sn1";
# elif defined (CONFIG_IA64_SGI_SN2) # elif defined (CONFIG_IA64_SGI_SN2)
...@@ -80,6 +105,69 @@ acpi_get_sysname (void) ...@@ -80,6 +105,69 @@ acpi_get_sysname (void)
#endif #endif
} }
#ifdef CONFIG_ACPI
/**
* acpi_get_crs - Return the current resource settings for a device
* obj: A handle for this device
* buf: A buffer to be populated by this call.
*
* Pass a valid handle, typically obtained by walking the namespace and a
* pointer to an allocated buffer, and this function will fill in the buffer
* with a list of acpi_resource structures.
*/
acpi_status
acpi_get_crs (acpi_handle obj, acpi_buffer *buf)
{
acpi_status result;
buf->length = 0;
buf->pointer = NULL;
result = acpi_get_current_resources(obj, buf);
if (result != AE_BUFFER_OVERFLOW)
return result;
buf->pointer = kmalloc(buf->length, GFP_KERNEL);
if (!buf->pointer)
return -ENOMEM;
result = acpi_get_current_resources(obj, buf);
return result;
}
acpi_resource *
acpi_get_crs_next (acpi_buffer *buf, int *offset)
{
acpi_resource *res;
if (*offset >= buf->length)
return NULL;
res = buf->pointer + *offset;
*offset += res->length;
return res;
}
acpi_resource_data *
acpi_get_crs_type (acpi_buffer *buf, int *offset, int type)
{
for (;;) {
acpi_resource *res = acpi_get_crs_next(buf, offset);
if (!res)
return NULL;
if (res->id == type)
return &res->data;
}
}
void
acpi_dispose_crs (acpi_buffer *buf)
{
kfree(buf->pointer);
}
#endif /* CONFIG_ACPI */
#ifdef CONFIG_ACPI_BOOT #ifdef CONFIG_ACPI_BOOT
#define ACPI_MAX_PLATFORM_IRQS 256 #define ACPI_MAX_PLATFORM_IRQS 256
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* iosapic_set_affinity(), initializations for * iosapic_set_affinity(), initializations for
* /proc/irq/#/smp_affinity * /proc/irq/#/smp_affinity
* 02/04/02 P. Diefenbaugh Cleaned up ACPI PCI IRQ routing. * 02/04/02 P. Diefenbaugh Cleaned up ACPI PCI IRQ routing.
* 02/04/18 J.I. Lee bug fix in iosapic_init_pci_irq
*/ */
/* /*
* Here is what the interrupt logic between a PCI device and the CPU looks like: * Here is what the interrupt logic between a PCI device and the CPU looks like:
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
#undef DEBUG_IRQ_ROUTING #undef DEBUG_IRQ_ROUTING
#undef OVERRIDE_DEBUG #undef OVERRIDE_DEBUG
static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED; static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED;
...@@ -676,6 +677,11 @@ iosapic_init_pci_irq (void) ...@@ -676,6 +677,11 @@ iosapic_init_pci_irq (void)
pci_irq.route[i].bus, pci_irq.route[i].pci_id>>16, pci_irq.route[i].pin, pci_irq.route[i].bus, pci_irq.route[i].pci_id>>16, pci_irq.route[i].pin,
iosapic_irq[vector].base_irq + iosapic_irq[vector].pin, vector); iosapic_irq[vector].base_irq + iosapic_irq[vector].pin, vector);
#endif #endif
/*
* Forget not to program the IOSAPIC RTE per ACPI _PRT
*/
set_rte(vector, (ia64_get_lid() >> 16) & 0xffff);
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define __acpi_map_table(phys_addr, size) __va(phys_addr) #define __acpi_map_table(phys_addr, size) __va(phys_addr)
const char *acpi_get_sysname (void);
int acpi_boot_init (char *cdline); int acpi_boot_init (char *cdline);
int acpi_find_rsdp (unsigned long *phys_addr); int acpi_find_rsdp (unsigned long *phys_addr);
int acpi_request_vector (u32 int_type); int acpi_request_vector (u32 int_type);
......
...@@ -71,7 +71,7 @@ do { \ ...@@ -71,7 +71,7 @@ do { \
#ifdef CONFIG_IA64_GENERIC #ifdef CONFIG_IA64_GENERIC
# include <asm/machvec.h> # include <asm/machvec.h>
# define virt_to_page(kaddr) (mem_map + platform_map_nr(kaddr)) # define virt_to_page(kaddr) (mem_map + platform_map_nr(kaddr))
# define page_to_phys(page) XXX fix me # define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
#elif defined (CONFIG_IA64_SGI_SN1) #elif defined (CONFIG_IA64_SGI_SN1)
# ifndef CONFIG_DISCONTIGMEM # ifndef CONFIG_DISCONTIGMEM
# define virt_to_page(kaddr) (mem_map + MAP_NR_DENSE(kaddr)) # define virt_to_page(kaddr) (mem_map + MAP_NR_DENSE(kaddr))
......
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