Commit fa6ec6f7 authored by David Mosberger's avatar David Mosberger

ia64: Fix zx1-platform support.

parent 3c82eb67
......@@ -738,6 +738,9 @@ sba_map_single(struct pci_dev *dev, void *addr, size_t size, int direction)
unsigned long phys_addr = virt_to_phys(addr);
#endif
if (!sba_list)
panic("sba_map_single: no SBA found!\n");
ioc = GET_IOC(dev);
ASSERT(ioc);
......@@ -826,6 +829,9 @@ void sba_unmap_single(struct pci_dev *dev, dma_addr_t iova, size_t size,
unsigned long flags;
dma_addr_t offset;
if (!sba_list)
panic("sba_map_single: no SBA found!\n");
ioc = GET_IOC(dev);
ASSERT(ioc);
......@@ -1092,6 +1098,9 @@ int sba_map_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents,
DBG_RUN_SG("%s() START %d entries, 0x%p,0x%x\n", __FUNCTION__, nents,
sba_sg_address(sglist), sba_sg_len(sglist));
if (!sba_list)
panic("sba_map_single: no SBA found!\n");
ioc = GET_IOC(dev);
ASSERT(ioc);
......@@ -1181,6 +1190,9 @@ void sba_unmap_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents,
DBG_RUN_SG("%s() START %d entries, 0x%p,0x%x\n",
__FUNCTION__, nents, sba_sg_address(sglist), sba_sg_len(sglist));
if (!sba_list)
panic("sba_map_single: no SBA found!\n");
ioc = GET_IOC(dev);
ASSERT(ioc);
......@@ -1478,20 +1490,19 @@ sba_common_init(struct sba_device *sba_dev)
#ifdef CONFIG_PROC_FS
static int sba_proc_info(char *buf, char **start, off_t offset, int len)
{
struct sba_device *sba_dev = sba_list;
struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */
int total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */
struct sba_device *sba_dev;
struct ioc *ioc;
int total_pages;
unsigned long i = 0, avg = 0, min, max;
sprintf(buf, "%s rev %d.%d\n",
"Hewlett Packard zx1 SBA",
((sba_dev->hw_rev >> 4) & 0xF),
(sba_dev->hw_rev & 0xF)
);
sprintf(buf, "%sIO PDIR size : %d bytes (%d entries)\n",
buf,
(int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */
total_pages);
for (sba_dev = sba_list; sba_dev; sba_dev = sba_dev->next) {
ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */
total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */
sprintf(buf, "%s rev %d.%d\n", "Hewlett Packard zx1 SBA",
((sba_dev->hw_rev >> 4) & 0xF), (sba_dev->hw_rev & 0xF));
sprintf(buf, "%sIO PDIR size : %d bytes (%d entries)\n", buf,
(int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */ total_pages);
sprintf(buf, "%sIO PDIR entries : %ld free %ld used (%d%%)\n", buf,
total_pages - ioc->used_pages, ioc->used_pages,
......@@ -1537,7 +1548,7 @@ static int sba_proc_info(char *buf, char **start, off_t offset, int len)
sprintf(buf, "%spci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
buf, ioc->usg_calls, ioc->usg_pages,
(int) ((ioc->usg_pages * 1000)/ioc->usg_calls));
}
return strlen(buf);
}
......@@ -1545,9 +1556,13 @@ static int
sba_resource_map(char *buf, char **start, off_t offset, int len)
{
struct ioc *ioc = sba_list->ioc; /* FIXME: Multi-IOC support! */
unsigned int *res_ptr = (unsigned int *)ioc->res_map;
unsigned int *res_ptr;
int i;
if (!ioc)
return 0;
res_ptr = (unsigned int *)ioc->res_map;
buf[0] = '\0';
for(i = 0; i < (ioc->res_size / sizeof(unsigned int)); ++i, ++res_ptr) {
if ((i & 7) == 0)
......@@ -1587,13 +1602,11 @@ void __init sba_init(void)
}
func_id = READ_REG(hpa + SBA_FUNC_ID);
if (func_id != ZX1_FUNC_ID_VALUE)
return;
if (func_id == ZX1_FUNC_ID_VALUE) {
strcpy(sba_rev, "zx1");
func_offset = zx1_func_offsets;
} else {
return;
}
/* Read HW Rev First */
hw_rev = READ_REG(hpa + SBA_FCLASS) & 0xFFUL;
......
......@@ -25,21 +25,24 @@ extern acpi_status acpi_evaluate_integer (acpi_handle, acpi_string, acpi_object_
static int hpzx1_devices;
struct fake_pci_dev {
struct fake_pci_dev *next;
struct pci_dev *pci_dev;
unsigned long csr_base;
unsigned long csr_size;
unsigned long mapped_csrs; // ioremapped
int sizing; // in middle of BAR sizing operation?
};
} *fake_pci_dev_list;
static struct pci_ops *orig_pci_ops;
struct fake_pci_dev *
lookup_fake_dev (struct pci_bus *bus, unsigned int devfn)
{
struct pci_dev *dev;
list_for_each_entry(dev, &bus->devices, bus_list)
if (dev->devfn == devfn)
return (struct fake_pci_dev *) dev->sysdata;
struct fake_pci_dev *fake_dev;
for (fake_dev = fake_pci_dev_list; fake_dev; fake_dev = fake_dev->next)
if (fake_dev->pci_dev->bus == bus && fake_dev->pci_dev->devfn == devfn)
return fake_dev;
return NULL;
}
......@@ -156,6 +159,10 @@ hpzx1_fake_pci_dev(char *name, unsigned int busnum, unsigned long addr, unsigned
bus->ops = &hp_pci_conf; // replace pci ops for this bus
fake->pci_dev = dev;
fake->next = fake_pci_dev_list;
fake_pci_dev_list = fake;
memset(dev, 0, sizeof(*dev));
dev->bus = bus;
dev->sysdata = fake;
......
......@@ -149,7 +149,7 @@ do { \
"(p6) ssm psr.i;" \
"(p7) rsm psr.i;;" \
"(p6) srlz.d" \
: "=&r" (old_psr) : "r"((psr) & IA64_PSR_I) \
: "=r" (old_psr) : "r"((psr) & IA64_PSR_I) \
: "p6", "p7", "memory"); \
if ((old_psr & IA64_PSR_I) && !(psr & IA64_PSR_I)) { \
__asm__ ("mov %0=ip" : "=r"(ip)); \
......
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