From 81fe5bba88a3fbe34ee6c5d18e327c6aaacd588c Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Wed, 26 Dec 2018 20:46:27 +0100 Subject: parisc: Hide built-in serial aux port of Tosca GSP card Similar to commit bcf3f1752a62 ("parisc: Hide Diva-built-in serial aux and graphics card") it's better to hide the built-in serial AUX port at bootup. When not hiding the port, the Linux serial driver will try to manage this port and fails on a A500 server like this: serial 0000:00:05.0: enabling device (0000 -> 0003) serial 0000:00:05.0: enabling SERR and PARITY (0003 -> 0143) 0000:00:05.0: ttyS3 at MMIO 0xfffffffff8005000 (irq = 71, base_baud = 115200) is a 16550A serial 0000:00:05.0: Couldn't register serial port 0, irq 71, type 2, error -28 Signed-off-by: Helge Deller --- drivers/parisc/lba_pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers') diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 69bd98421eb1..d376201bc6a0 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -1743,3 +1743,15 @@ static void quirk_diva_aux_disable(struct pci_dev *dev) } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX, quirk_diva_aux_disable); + +static void quirk_tosca_aux_disable(struct pci_dev *dev) +{ + if (dev->subsystem_vendor != PCI_VENDOR_ID_HP || + dev->subsystem_device != 0x104a) + return; + + dev_info(&dev->dev, "Hiding Tosca secondary built-in AUX serial device"); + dev->device = 0; +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA, + quirk_tosca_aux_disable); -- cgit v1.2.3 From 9b8eeab019762fa43c5ffa6e2f8e1039f8e99157 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:04 +0100 Subject: parisc: move internal implementation details out of Move everything that is not required for the public facing DMA API out of and into a new drivers/parisc/iommu.h header. Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- arch/parisc/include/asm/dma-mapping.h | 44 ------------------------------ drivers/parisc/ccio-dma.c | 2 ++ drivers/parisc/dino.c | 1 + drivers/parisc/eisa.c | 2 ++ drivers/parisc/hppb.c | 2 ++ drivers/parisc/iommu.h | 51 +++++++++++++++++++++++++++++++++++ drivers/parisc/lba_pci.c | 2 ++ drivers/parisc/sba_iommu.c | 2 ++ 8 files changed, 62 insertions(+), 44 deletions(-) create mode 100644 drivers/parisc/iommu.h (limited to 'drivers') diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h index f1bf5e297f1c..d5bd94247371 100644 --- a/arch/parisc/include/asm/dma-mapping.h +++ b/arch/parisc/include/asm/dma-mapping.h @@ -26,48 +26,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return hppa_dma_ops; } -static inline void * -parisc_walk_tree(struct device *dev) -{ - struct device *otherdev; - if(likely(dev->platform_data != NULL)) - return dev->platform_data; - /* OK, just traverse the bus to find it */ - for(otherdev = dev->parent; otherdev; - otherdev = otherdev->parent) { - if(otherdev->platform_data) { - dev->platform_data = otherdev->platform_data; - break; - } - } - return dev->platform_data; -} - -#define GET_IOC(dev) ({ \ - void *__pdata = parisc_walk_tree(dev); \ - __pdata ? HBA_DATA(__pdata)->iommu : NULL; \ -}) - -#ifdef CONFIG_IOMMU_CCIO -struct parisc_device; -struct ioc; -void * ccio_get_iommu(const struct parisc_device *dev); -int ccio_request_resource(const struct parisc_device *dev, - struct resource *res); -int ccio_allocate_resource(const struct parisc_device *dev, - struct resource *res, unsigned long size, - unsigned long min, unsigned long max, unsigned long align); -#else /* !CONFIG_IOMMU_CCIO */ -#define ccio_get_iommu(dev) NULL -#define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res) -#define ccio_allocate_resource(dev, res, size, min, max, align) \ - allocate_resource(&iomem_resource, res, size, min, max, \ - align, NULL, NULL) -#endif /* !CONFIG_IOMMU_CCIO */ - -#ifdef CONFIG_IOMMU_SBA -struct parisc_device; -void * sba_get_iommu(struct parisc_device *dev); -#endif - #endif diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 8d2fc84119c6..b17e81cf77d5 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -55,6 +55,8 @@ #include /* for register_module() */ #include +#include "iommu.h" + /* ** Choose "ccio" since that's what HP-UX calls it. ** Make it easier for folks to migrate from one to the other :^) diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index dfeea458a789..6f348c75687c 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -59,6 +59,7 @@ #include #include "gsc.h" +#include "iommu.h" #undef DINO_DEBUG diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 9ff434f354bd..5657a1d3eb2b 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -45,6 +45,8 @@ #include #include +#include "iommu.h" + #if 0 #define EISA_DBG(msg, arg...) printk(KERN_DEBUG "eisa: " msg, ## arg) #else diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c index ebc7b617e5d0..3b3481c0d81d 100644 --- a/drivers/parisc/hppb.c +++ b/drivers/parisc/hppb.c @@ -23,6 +23,8 @@ #include #include +#include "iommu.h" + struct hppb_card { unsigned long hpa; struct resource mmio_region; diff --git a/drivers/parisc/iommu.h b/drivers/parisc/iommu.h new file mode 100644 index 000000000000..5a38b635e963 --- /dev/null +++ b/drivers/parisc/iommu.h @@ -0,0 +1,51 @@ +#ifndef _IOMMU_H +#define _IOMMU_H 1 + +#include + +struct parisc_device; +struct ioc; + +static inline void *parisc_walk_tree(struct device *dev) +{ + struct device *otherdev; + + if (likely(dev->platform_data)) + return dev->platform_data; + + /* OK, just traverse the bus to find it */ + for (otherdev = dev->parent; + otherdev; + otherdev = otherdev->parent) { + if (otherdev->platform_data) { + dev->platform_data = otherdev->platform_data; + break; + } + } + + return dev->platform_data; +} + +#define GET_IOC(dev) ({ \ + void *__pdata = parisc_walk_tree(dev); \ + __pdata ? HBA_DATA(__pdata)->iommu : NULL; \ +}) + +#ifdef CONFIG_IOMMU_CCIO +void *ccio_get_iommu(const struct parisc_device *dev); +int ccio_request_resource(const struct parisc_device *dev, + struct resource *res); +int ccio_allocate_resource(const struct parisc_device *dev, + struct resource *res, unsigned long size, + unsigned long min, unsigned long max, unsigned long align); +#else /* !CONFIG_IOMMU_CCIO */ +#define ccio_get_iommu(dev) NULL +#define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res) +#define ccio_allocate_resource(dev, res, size, min, max, align) \ + allocate_resource(&iomem_resource, res, size, min, max, \ + align, NULL, NULL) +#endif /* !CONFIG_IOMMU_CCIO */ + +void *sba_get_iommu(struct parisc_device *dev); + +#endif /* _IOMMU_H */ diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index d376201bc6a0..dcea15588833 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -49,6 +49,8 @@ #include #include /* read/write stuff */ +#include "iommu.h" + #undef DEBUG_LBA /* general stuff */ #undef DEBUG_LBA_PORT /* debug I/O Port access */ #undef DEBUG_LBA_CFG /* debug Config Space Access (ie PCI Bus walk) */ diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 42172eb32235..afaf8e6aefe6 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -49,6 +49,8 @@ #include /* for is_pdc_pat() */ #include +#include "iommu.h" + #define MODULE_NAME "SBA" /* -- cgit v1.2.3 From 25c9dbe8bb105d6eea3e3117344181970a6b9366 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:05 +0100 Subject: parisc: turn GET_IOC into an inline function This makes the function both more readable and more typesafe. Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- drivers/parisc/iommu.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/iommu.h b/drivers/parisc/iommu.h index 5a38b635e963..d6fd3ab899ac 100644 --- a/drivers/parisc/iommu.h +++ b/drivers/parisc/iommu.h @@ -26,10 +26,14 @@ static inline void *parisc_walk_tree(struct device *dev) return dev->platform_data; } -#define GET_IOC(dev) ({ \ - void *__pdata = parisc_walk_tree(dev); \ - __pdata ? HBA_DATA(__pdata)->iommu : NULL; \ -}) +static inline struct ioc *GET_IOC(struct device *dev) +{ + struct pci_hba_data *pdata = parisc_walk_tree(dev); + + if (!pdata) + return NULL; + return pdata->iommu; +} #ifdef CONFIG_IOMMU_CCIO void *ccio_get_iommu(const struct parisc_device *dev); -- cgit v1.2.3 From cb0f7ab4a41f966ed20810f9578355fe973f262e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:07 +0100 Subject: parisc: properly type the return value of parisc_walk_tree Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- drivers/parisc/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/parisc/iommu.h b/drivers/parisc/iommu.h index d6fd3ab899ac..240059cd8185 100644 --- a/drivers/parisc/iommu.h +++ b/drivers/parisc/iommu.h @@ -6,7 +6,7 @@ struct parisc_device; struct ioc; -static inline void *parisc_walk_tree(struct device *dev) +static inline struct pci_hba_data *parisc_walk_tree(struct device *dev) { struct device *otherdev; -- cgit v1.2.3 From e2fcabe0ebe0b343b9de53ed0a7a7f2f86eb9863 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:08 +0100 Subject: parisc/dino: use container_of in DINO_DEV Use the type safe container_of macros instead of a blind cast in DINO_DEV, and turn the macro into an inline function. Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- drivers/parisc/dino.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 6f348c75687c..846b59d15999 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -154,12 +154,10 @@ struct dino_device #endif }; -/* Looks nice and keeps the compiler happy */ -#define DINO_DEV(d) ({ \ - void *__pdata = d; \ - BUG_ON(!__pdata); \ - (struct dino_device *)__pdata; }) - +static inline struct dino_device *DINO_DEV(struct pci_hba_data *hba) +{ + return container_of(hba, struct dino_device, hba); +} /* * Dino Configuration Space Accessor Functions -- cgit v1.2.3 From 5007526700a0e13b15ef02c7495786f882d0cc0b Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:09 +0100 Subject: parisc/lba_pci: use container_of in LBA_DEV Use the type safe container_of macros instead of a blind cast in LBA_DEV, and turn the macro into an inline function. Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- drivers/parisc/lba_pci.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index dcea15588833..3c4a2e7f8010 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -111,12 +111,10 @@ static u32 lba_t32; #define LBA_SKIP_PROBE(d) ((d)->flags & LBA_FLAG_SKIP_PROBE) - -/* Looks nice and keeps the compiler happy */ -#define LBA_DEV(d) ({ \ - void *__pdata = d; \ - BUG_ON(!__pdata); \ - (struct lba_device *)__pdata; }) +static inline struct lba_device *LBA_DEV(struct pci_hba_data *hba) +{ + return container_of(hba, struct lba_device, hba); +} /* ** Only allow 8 subsidiary busses per LBA -- cgit v1.2.3 From 3654f012115db37d31e3628b26b116dc650922ac Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 29 Jan 2019 19:13:10 +0100 Subject: parisc: remove the HBA_DATA macro No need to hide a cast in a macro, especially as all users have cleaner ways to archive the result than blind casting. Signed-off-by: Christoph Hellwig Signed-off-by: Helge Deller --- arch/parisc/include/asm/pci.h | 2 -- drivers/parisc/ccio-dma.c | 9 ++++++--- drivers/parisc/lba_pci.c | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h index 00f763688401..f14465b84de4 100644 --- a/arch/parisc/include/asm/pci.h +++ b/arch/parisc/include/asm/pci.h @@ -66,8 +66,6 @@ struct pci_hba_data { char gmmio_name[HBA_NAME_SIZE]; }; -#define HBA_DATA(d) ((struct pci_hba_data *) (d)) - /* ** We support 2^16 I/O ports per HBA. These are set up in the form ** 0xbbxxxx, where bb is the bus number and xxxx is the I/O port diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index b17e81cf77d5..097b0d43d13c 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -1519,6 +1519,7 @@ static int __init ccio_probe(struct parisc_device *dev) { int i; struct ioc *ioc, **ioc_p = &ioc_list; + struct pci_hba_data *hba; ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL); if (ioc == NULL) { @@ -1545,11 +1546,13 @@ static int __init ccio_probe(struct parisc_device *dev) ccio_ioc_init(ioc); ccio_init_resources(ioc); hppa_dma_ops = &ccio_ops; - dev->dev.platform_data = kzalloc(sizeof(struct pci_hba_data), GFP_KERNEL); + hba = kzalloc(sizeof(*hba), GFP_KERNEL); /* if this fails, no I/O cards will work, so may as well bug */ - BUG_ON(dev->dev.platform_data == NULL); - HBA_DATA(dev->dev.platform_data)->iommu = ioc; + BUG_ON(hba == NULL); + + hba->iommu = ioc; + dev->dev.platform_data = hba; #ifdef CONFIG_PROC_FS if (ioc_count == 0) { diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 3c4a2e7f8010..d4701589bc8c 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -1275,7 +1275,7 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) r->flags = IORESOURCE_MEM; /* mmio_mask also clears Enable bit */ r->start &= mmio_mask; - r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start); + r->start = PCI_HOST_ADDR(&lba_dev->hba, r->start); rsize = ~ READ_REG32(lba_dev->hba.base_addr + LBA_LMMIO_MASK); /* @@ -1321,7 +1321,7 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) r->flags = IORESOURCE_MEM; /* mmio_mask also clears Enable bit */ r->start &= mmio_mask; - r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start); + r->start = PCI_HOST_ADDR(&lba_dev->hba, r->start); rsize = READ_REG32(lba_dev->hba.base_addr + LBA_ELMMIO_MASK); r->end = r->start + ~rsize; } @@ -1562,7 +1562,7 @@ lba_driver_probe(struct parisc_device *dev) /* ------------ Second : initialize common stuff ---------- */ pci_bios = &lba_bios_ops; - pcibios_register_hba(HBA_DATA(lba_dev)); + pcibios_register_hba(&lba_dev->hba); spin_lock_init(&lba_dev->lba_lock); if (lba_hw_init(lba_dev)) -- cgit v1.2.3 From 97d7e2e3fd8a080866701ebf2f40c04c257ff216 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Thu, 31 Jan 2019 08:22:22 +0100 Subject: parisc: Use F_EXTEND() macro in iosapic code and reduce include file list. Signed-off-by: Helge Deller --- drivers/parisc/iosapic.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 144c77dfe4b1..1be571c20062 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -126,21 +126,10 @@ ** o disable IRdT - call disable_irq(vector[line]->processor_irq) */ - -/* FIXME: determine which include files are really needed */ -#include -#include -#include #include -#include -#include -#include -#include /* get in-line asm for swab */ #include #include -#include -#include /* read/write functions */ #ifdef CONFIG_SUPERIO #include #endif @@ -168,12 +157,8 @@ #define DBG_IRT(x...) #endif -#ifdef CONFIG_64BIT -#define COMPARE_IRTE_ADDR(irte, hpa) ((irte)->dest_iosapic_addr == (hpa)) -#else #define COMPARE_IRTE_ADDR(irte, hpa) \ - ((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL)) -#endif + ((irte)->dest_iosapic_addr == F_EXTEND(hpa)) #define IOSAPIC_REG_SELECT 0x00 #define IOSAPIC_REG_WINDOW 0x10 -- cgit v1.2.3