]> git.neil.brown.name Git - history.git/commitdiff
ia64: Fix misc. merge errors and typos.
authorDavid Mosberger <davidm@tiger.hpl.hp.com>
Fri, 3 May 2002 04:52:26 +0000 (21:52 -0700)
committerDavid Mosberger <davidm@wailua.hpl.hp.com>
Fri, 3 May 2002 04:52:26 +0000 (21:52 -0700)
arch/ia64/hp/common/Makefile
arch/ia64/hp/sim/simserial.c
arch/ia64/hp/zx1/hpzx1_misc.c
arch/ia64/kernel/iosapic.c
include/asm-ia64/efi.h

index 678bbf3d09b88471138c1ddf2d52c4da1b85135b..58b60abd89b3af3b8e0a92504faeac5f9d802788 100644 (file)
@@ -12,17 +12,3 @@ export-objs := sba_iommu.o
 obj-y := sba_iommu.o
 
 include $(TOPDIR)/Rules.make
-#
-# ia64/platform/hp/common/Makefile
-#
-# Copyright (C) 2002 Hewlett Packard
-# Copyright (C) Alex Williamson (alex_williamson@hp.com)
-#
-
-O_TARGET := common.o
-
-export-objs := sba_iommu.o
-
-obj-y := sba_iommu.o
-
-include $(TOPDIR)/Rules.make
index d7573b683278d77cb0ab2750a2d96f7776c495c5..fdad06630b2a2d028f5f2da8db5b1ad80e8fa630 100644 (file)
@@ -7,9 +7,9 @@
  * case means sys_sim.c console (goes via the simulator). The code hereafter
  * is completely leveraged from the serial.c driver.
  *
- * Copyright (C) 1999-2000 Hewlett-Packard Co
- * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com>
- * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
+ * Copyright (C) 1999-2000, 2002 Hewlett-Packard Co
+ *     Stephane Eranian <eranian@hpl.hp.com>
+ *     David Mosberger-Tang <davidm@hpl.hp.com>
  *
  * 02/04/00 D. Mosberger       Merged in serial.c bug fixes in rs_close().
  * 02/25/00 D. Mosberger       Synced up with 2.3.99pre-5 version of serial.c.
@@ -24,7 +24,7 @@
 #include <linux/major.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #include <linux/console.h>
 #include <linux/module.h>
 #include <linux/serial.h>
index 2ffe99a69e8efee3d1c02f78178715a158dcba58..5dc34d51dbbefa3f74df2a6f5d2c312aab7807b6 100644 (file)
@@ -198,7 +198,6 @@ extern acpi_status acpi_get_crs(acpi_handle, acpi_buffer *);
 extern acpi_resource *acpi_get_crs_next(acpi_buffer *, int *);
 extern acpi_resource_data *acpi_get_crs_type(acpi_buffer *, int *, int);
 extern void acpi_dispose_crs(acpi_buffer *);
-extern acpi_status acpi_cf_evaluate_method(acpi_handle, UINT8 *, NATIVE_UINT *);
 
 static acpi_status
 hp_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
@@ -388,407 +387,7 @@ hpzx1_acpi_dev_init(void)
 }
 
 extern void sba_init(void);
-       
-void
-hpzx1_pci_fixup (int phase)
-{
-       if (phase == 0)
-               hpzx1_acpi_dev_init();
-       iosapic_pci_fixup(phase);
-        if (phase == 1)
-               sba_init();
-}
-/*
- * Misc. support for HP zx1 chipset support
- *
- * Copyright (C) 2002 Hewlett-Packard Co
- * Copyright (C) 2002 Alex Williamson <alex_williamson@hp.com>
- * Copyright (C) 2002 Bjorn Helgaas <bjorn_helgaas@hp.com>
- */
-
-
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/acpi.h>
-#include <asm/iosapic.h>
-#include <asm/efi.h>
-
-#include "../drivers/acpi/include/platform/acgcc.h"
-#include "../drivers/acpi/include/actypes.h"
-#include "../drivers/acpi/include/acexcep.h"
-#include "../drivers/acpi/include/acpixf.h"
-#include "../drivers/acpi/include/actbl.h"
-#include "../drivers/acpi/include/acconfig.h"
-#include "../drivers/acpi/include/acmacros.h"
-#include "../drivers/acpi/include/aclocal.h"
-#include "../drivers/acpi/include/acobject.h"
-#include "../drivers/acpi/include/acstruct.h"
-#include "../drivers/acpi/include/acnamesp.h"
-#include "../drivers/acpi/include/acutils.h"
-
-#define PFX "hpzx1: "
-
-struct fake_pci_dev {
-       struct fake_pci_dev *next;
-       unsigned char bus;
-       unsigned int devfn;
-       int sizing;             // in middle of BAR sizing operation?
-       unsigned long csr_base;
-       unsigned int csr_size;
-       unsigned long mapped_csrs;      // ioremapped
-};
-
-static struct fake_pci_dev *fake_pci_head, **fake_pci_tail = &fake_pci_head;
-
-static struct pci_ops orig_pci_ops;
-
-static inline struct fake_pci_dev *
-fake_pci_find_slot(unsigned char bus, unsigned int devfn)
-{
-       struct fake_pci_dev *dev;
-
-       for (dev = fake_pci_head; dev; dev = dev->next)
-               if (dev->bus == bus && dev->devfn == devfn)
-                       return dev;
-       return NULL;
-}
-
-static struct fake_pci_dev *
-alloc_fake_pci_dev(void)
-{
-        struct fake_pci_dev *dev;
-
-        dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-       if (!dev)
-               return NULL;
-
-       memset(dev, 0, sizeof(*dev));
-
-        *fake_pci_tail = dev;
-        fake_pci_tail = &dev->next;
-
-        return dev;
-}
-
-#define HP_CFG_RD(sz, bits, name) \
-static int hp_cfg_read##sz (struct pci_dev *dev, int where, u##bits *value) \
-{ \
-       struct fake_pci_dev *fake_dev; \
-       if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \
-               return orig_pci_ops.name(dev, where, value); \
-       \
-       switch (where) { \
-       case PCI_COMMAND: \
-               *value = read##sz(fake_dev->mapped_csrs + where); \
-               *value |= PCI_COMMAND_MEMORY; /* SBA omits this */ \
-               break; \
-       case PCI_BASE_ADDRESS_0: \
-               if (fake_dev->sizing) \
-                       *value = ~(fake_dev->csr_size - 1); \
-               else \
-                       *value = (fake_dev->csr_base & \
-                                   PCI_BASE_ADDRESS_MEM_MASK) | \
-                               PCI_BASE_ADDRESS_SPACE_MEMORY; \
-               fake_dev->sizing = 0; \
-               break; \
-       default: \
-               *value = read##sz(fake_dev->mapped_csrs + where); \
-               break; \
-       } \
-       return PCIBIOS_SUCCESSFUL; \
-}
 
-#define HP_CFG_WR(sz, bits, name) \
-static int hp_cfg_write##sz (struct pci_dev *dev, int where, u##bits value) \
-{ \
-       struct fake_pci_dev *fake_dev; \
-       if (!(fake_dev = fake_pci_find_slot(dev->bus->number, dev->devfn))) \
-               return orig_pci_ops.name(dev, where, value); \
-       \
-       switch (where) { \
-       case PCI_BASE_ADDRESS_0: \
-               if (value == ~0) \
-                       fake_dev->sizing = 1; \
-               break; \
-       default: \
-               write##sz(value, fake_dev->mapped_csrs + where); \
-               break; \
-       } \
-       return PCIBIOS_SUCCESSFUL; \
-}
-
-HP_CFG_RD(b,  8, read_byte)
-HP_CFG_RD(w, 16, read_word)
-HP_CFG_RD(l, 32, read_dword)
-HP_CFG_WR(b,  8, write_byte)
-HP_CFG_WR(w, 16, write_word)
-HP_CFG_WR(l, 32, write_dword)
-
-static struct pci_ops hp_pci_conf = {
-       hp_cfg_readb,
-       hp_cfg_readw,
-       hp_cfg_readl,
-       hp_cfg_writeb,
-       hp_cfg_writew,
-       hp_cfg_writel,
-};
-
-/*
- * Assume we'll never have a physical slot higher than 0x10, so we can
- * use slots above that for "fake" PCI devices to represent things
- * that only show up in the ACPI namespace.
- */
-#define HP_MAX_SLOT    0x10
-
-static struct fake_pci_dev *
-hpzx1_fake_pci_dev(unsigned long addr, unsigned int bus, unsigned int size)
-{
-       struct fake_pci_dev *dev;
-       int slot;
-
-       // Note: lspci thinks 0x1f is invalid
-       for (slot = 0x1e; slot > HP_MAX_SLOT; slot--) {
-               if (!fake_pci_find_slot(bus, PCI_DEVFN(slot, 0)))
-                       break;
-       }
-       if (slot == HP_MAX_SLOT) {
-               printk(KERN_ERR PFX
-                       "no slot space for device (0x%p) on bus 0x%02x\n",
-                       (void *) addr, bus);
-               return NULL;
-       }
-
-       dev = alloc_fake_pci_dev();
-       if (!dev) {
-               printk(KERN_ERR PFX
-                       "no memory for device (0x%p) on bus 0x%02x\n",
-                       (void *) addr, bus);
-               return NULL;
-       }
-
-       dev->bus = bus;
-       dev->devfn = PCI_DEVFN(slot, 0);
-       dev->csr_base = addr;
-       dev->csr_size = size;
-
-       /*
-        * Drivers should ioremap what they need, but we have to do
-        * it here, too, so PCI config accesses work.
-        */
-       dev->mapped_csrs = (unsigned long) ioremap(dev->csr_base, dev->csr_size);
-
-       return dev;
-}
-
-typedef struct {
-       u8      guid_id;
-       u8      guid[16];
-       u8      csr_base[8];
-       u8      csr_length[8];
-} acpi_hp_vendor_long;
-
-#define HP_CCSR_LENGTH 0x21
-#define HP_CCSR_TYPE 0x2
-#define HP_CCSR_GUID \
-    ((efi_guid_t) { 0x69e9adf9, 0x924f, 0xab5f, { 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad }})
-
-extern acpi_status acpi_get_crs(acpi_handle, acpi_buffer *);
-extern acpi_resource *acpi_get_crs_next(acpi_buffer *, int *);
-extern acpi_resource_data *acpi_get_crs_type(acpi_buffer *, int *, int);
-extern void acpi_dispose_crs(acpi_buffer *);
-extern acpi_status acpi_cf_evaluate_method(acpi_handle, UINT8 *, NATIVE_UINT *);
-
-static acpi_status
-hp_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
-{
-       int i, offset = 0;
-       acpi_status status;
-       acpi_buffer buf;
-       acpi_resource_vendor *res;
-       acpi_hp_vendor_long *hp_res;
-       efi_guid_t vendor_guid;
-
-       *csr_base = 0;
-       *csr_length = 0;
-
-       status = acpi_get_crs(obj, &buf);
-       if (status != AE_OK) {
-               printk(KERN_ERR PFX "Unable to get _CRS data on object\n");
-               return status;
-       }
-
-       res = (acpi_resource_vendor *)acpi_get_crs_type(&buf, &offset, ACPI_RSTYPE_VENDOR);
-       if (!res) {
-               printk(KERN_ERR PFX "Failed to find config space for device\n");
-               acpi_dispose_crs(&buf);
-               return AE_NOT_FOUND;
-       }
-
-       hp_res = (acpi_hp_vendor_long *)(res->reserved);
-
-       if (res->length != HP_CCSR_LENGTH || hp_res->guid_id != HP_CCSR_TYPE) {
-               printk(KERN_ERR PFX "Unknown Vendor data\n");
-               acpi_dispose_crs(&buf);
-               return AE_TYPE; /* Revisit error? */
-       }
-
-       memcpy(&vendor_guid, hp_res->guid, sizeof(efi_guid_t));
-       if (efi_guidcmp(vendor_guid, HP_CCSR_GUID) != 0) {
-               printk(KERN_ERR PFX "Vendor GUID does not match\n");
-               acpi_dispose_crs(&buf);
-               return AE_TYPE; /* Revisit error? */
-       }
-
-       for (i = 0 ; i < 8 ; i++) {
-               *csr_base |= ((u64)(hp_res->csr_base[i]) << (i * 8));
-               *csr_length |= ((u64)(hp_res->csr_length[i]) << (i * 8));
-       }
-
-       acpi_dispose_crs(&buf);
-
-       return AE_OK;
-}
-
-static acpi_status
-hpzx1_sba_probe(acpi_handle obj, u32 depth, void *context, void **ret)
-{
-       u64 csr_base = 0, csr_length = 0;
-       char *name = context;
-       struct fake_pci_dev *dev;
-       acpi_status status;
-
-       status = hp_csr_space(obj, &csr_base, &csr_length);
-
-       if (status != AE_OK)
-               return status;
-
-       /*
-        * Only SBA shows up in ACPI namespace, so its CSR space
-        * includes both SBA and IOC.  Make SBA and IOC show up
-        * separately in PCI space.
-        */
-       if ((dev = hpzx1_fake_pci_dev(csr_base, 0, 0x1000)))
-               printk(KERN_INFO PFX "%s SBA at 0x%lx; pci dev %02x:%02x.%d\n",
-                       name, csr_base, dev->bus,
-                       PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-       if ((dev = hpzx1_fake_pci_dev(csr_base + 0x1000, 0, 0x1000)))
-               printk(KERN_INFO PFX "%s IOC at 0x%lx; pci dev %02x:%02x.%d\n",
-                       name, csr_base + 0x1000, dev->bus,
-                       PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-
-       return AE_OK;
-}
-
-static acpi_status
-hpzx1_lba_probe(acpi_handle obj, u32 depth, void *context, void **ret)
-{
-       acpi_status status;
-       u64 csr_base = 0, csr_length = 0;
-       char *name = context;
-       NATIVE_UINT busnum = 0;
-       struct fake_pci_dev *dev;
-
-       status = hp_csr_space(obj, &csr_base, &csr_length);
-
-       if (status != AE_OK)
-               return status;
-
-       status = acpi_cf_evaluate_method(obj, METHOD_NAME__BBN, &busnum);
-       if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PFX "evaluate _BBN fail=0x%x\n", status);
-               busnum = 0;     // no _BBN; stick it on bus 0
-       }
-
-       if ((dev = hpzx1_fake_pci_dev(csr_base, busnum, csr_length)))
-               printk(KERN_INFO PFX "%s LBA at 0x%lx, _BBN 0x%02x; "
-                       "pci dev %02x:%02x.%d\n",
-                       name, csr_base, busnum, dev->bus,
-                       PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-
-       return AE_OK;
-}
-
-static void
-hpzx1_acpi_dev_init(void)
-{
-       extern struct pci_ops pci_conf;
-
-       /*
-        * Make fake PCI devices for the following hardware in the
-        * ACPI namespace.  This makes it more convenient for drivers
-        * because they can claim these devices based on PCI
-        * information, rather than needing to know about ACPI.  The
-        * 64-bit "HPA" space for this hardware is available as BAR
-        * 0/1.
-        *
-        * HWP0001: Single IOC SBA w/o IOC in namespace
-        * HWP0002: LBA device
-        * HWP0003: AGP LBA device
-        */
-       acpi_get_devices("HWP0001", hpzx1_sba_probe, "HWP0001", NULL);
-#ifdef CONFIG_IA64_HP_PROTO
-       if (fake_pci_tail != &fake_pci_head) {
-#endif
-       acpi_get_devices("HWP0002", hpzx1_lba_probe, "HWP0002", NULL);
-       acpi_get_devices("HWP0003", hpzx1_lba_probe, "HWP0003", NULL);
-
-#ifdef CONFIG_IA64_HP_PROTO
-       }
-
-#define ZX1_FUNC_ID_VALUE    (PCI_DEVICE_ID_HP_ZX1_SBA << 16) | PCI_VENDOR_ID_HP
-       /*
-        * Early protos don't have bridges in the ACPI namespace, so
-        * if we didn't find anything, add the things we know are
-        * there.
-        */
-       if (fake_pci_tail == &fake_pci_head) {
-               u64 hpa, csr_base;
-               struct fake_pci_dev *dev;
-
-               csr_base = 0xfed00000UL;
-               hpa = (u64) ioremap(csr_base, 0x1000);
-               if (__raw_readl(hpa) == ZX1_FUNC_ID_VALUE) {
-                       if ((dev = hpzx1_fake_pci_dev(csr_base, 0, 0x1000)))
-                               printk(KERN_INFO PFX "HWP0001 SBA at 0x%lx; "
-                                       "pci dev %02x:%02x.%d\n", csr_base,
-                                       dev->bus, PCI_SLOT(dev->devfn),
-                                       PCI_FUNC(dev->devfn));
-                       if ((dev = hpzx1_fake_pci_dev(csr_base + 0x1000, 0,
-                                       0x1000)))
-                               printk(KERN_INFO PFX "HWP0001 IOC at 0x%lx; "
-                                       "pci dev %02x:%02x.%d\n",
-                                       csr_base + 0x1000,
-                                       dev->bus, PCI_SLOT(dev->devfn),
-                                       PCI_FUNC(dev->devfn));
-
-                       csr_base = 0xfed24000UL;
-                       iounmap(hpa);
-                       hpa = (u64) ioremap(csr_base, 0x1000);
-                       if ((dev = hpzx1_fake_pci_dev(csr_base, 0x40, 0x1000)))
-                               printk(KERN_INFO PFX "HWP0003 AGP LBA at "
-                                       "0x%lx; pci dev %02x:%02x.%d\n",
-                                       csr_base,
-                                       dev->bus, PCI_SLOT(dev->devfn),
-                                       PCI_FUNC(dev->devfn));
-               }
-               iounmap(hpa);
-       }
-#endif
-
-       if (fake_pci_tail == &fake_pci_head)
-               return;
-
-       /*
-        * Replace PCI ops, but only if we made fake devices.
-        */
-       orig_pci_ops = pci_conf;
-       pci_conf = hp_pci_conf;
-}
-
-extern void sba_init(void);
-       
 void
 hpzx1_pci_fixup (int phase)
 {
index 65694310972622f2c0d415fa68f556736880cec0..42b29c3e37b36c49dcbe0882608641dc60c1abcd 100644 (file)
@@ -24,6 +24,7 @@
  *                              /proc/irq/#/smp_affinity
  * 02/04/02    P. Diefenbaugh  Cleaned up ACPI PCI IRQ routing.
  * 02/04/18    J.I. Lee        bug fix in iosapic_init_pci_irq
+ * 02/04/30    J.I. Lee        bug fix in find_iosapic to fix ACPI PCI IRQ to IOSAPIC mapping error
  */
 /*
  * Here is what the interrupt logic between a PCI device and the CPU looks like:
@@ -112,7 +113,7 @@ find_iosapic (unsigned int irq)
        int i;
 
        for (i = 0; i < num_iosapic; i++) {
-               if ((irq - iosapic_lists[i].base_irq) < iosapic_lists[i].max_pin)
+               if ((unsigned) (irq - iosapic_lists[i].base_irq) <= iosapic_lists[i].max_pin)
                        return i;
        }
 
@@ -138,7 +139,7 @@ iosapic_irq_to_vector (int irq)
  * Map PCI pin to the corresponding IA-64 interrupt vector.  If no such mapping exists,
  * return -1.
  */
-static int
+int
 pci_pin_to_vector (int bus, int slot, int pci_pin)
 {
        struct pci_vector_struct *r;
index b679cec86170c7f7fc2e2e12a43f3190684bad30..be93c080640a68c5119b5a38882ccd3fcc1d46c6 100644 (file)
@@ -7,9 +7,9 @@
  *
  * Copyright (C) 1999 VA Linux Systems
  * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999 Hewlett-Packard Co.
- * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com>
+ * Copyright (C) 1999, 2002 Hewlett-Packard Co.
+ *     David Mosberger-Tang <davidm@hpl.hp.com>
+ *     Stephane Eranian <eranian@hpl.hp.com>
  */
 #include <linux/init.h>
 #include <linux/string.h>
@@ -258,8 +258,9 @@ extern void efi_map_pal_code (void);
 extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
 extern void efi_gettimeofday (struct timeval *tv);
 extern void efi_enter_virtual_mode (void);     /* switch EFI to virtual mode, if possible */
-extern u64  efi_get_iobase (void);
-extern u32  efi_mem_type (u64 phys_addr);
+extern u64 efi_get_iobase (void);
+extern u32 efi_mem_type (unsigned long phys_addr);
+extern u64 efi_mem_attributes (unsigned long phys_addr);
 
 /*
  * Variable Attributes