From: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
To: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>, <krzysztof.kozlowski@linaro.org>
Cc: <bhelgaas@google.com>, <michals@xilinx.com>, <robh+dt@kernel.org>,
<lorenzo.pieralisi@arm.com>, <bharat.kumar.gogada@amd.com>,
"Thippeswamy Havalige" <thippeswamy.havalige@amd.com>
Subject: [PATCH 04/13] microblaze/PCI: Remove unused PCI legacy IO's access on a bus
Date: Tue, 25 Oct 2022 12:22:05 +0530 [thread overview]
Message-ID: <20221025065214.4663-5-thippeswamy.havalige@amd.com> (raw)
In-Reply-To: <20221025065214.4663-1-thippeswamy.havalige@amd.com>
Remove PCI legacy read,write and mmap access IO's
on a bus
Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
---
arch/microblaze/include/asm/pci.h | 10 ---
arch/microblaze/pci/pci-common.c | 140 --------------------------------------
2 files changed, 150 deletions(-)
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index d905280..34337e2 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -48,16 +48,6 @@
#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
#define arch_can_pci_mmap_io() 1
-extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
- size_t count);
-extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
- size_t count);
-extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
- struct vm_area_struct *vma,
- enum pci_mmap_state mmap_state);
-
-#define HAVE_PCI_LEGACY 1
-
extern void pcibios_resource_survey(void);
struct file;
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 6ccaf33..ef4a9fc 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -146,146 +146,6 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
return 0;
}
-/* This provides legacy IO read access on a bus */
-int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size)
-{
- unsigned long offset;
- struct pci_controller *hose = pci_bus_to_host(bus);
- struct resource *rp = &hose->io_resource;
- void __iomem *addr;
-
- /* Check if port can be supported by that bus. We only check
- * the ranges of the PHB though, not the bus itself as the rules
- * for forwarding legacy cycles down bridges are not our problem
- * here. So if the host bridge supports it, we do it.
- */
- offset = (unsigned long)hose->io_base_virt - _IO_BASE;
- offset += port;
-
- if (!(rp->flags & IORESOURCE_IO))
- return -ENXIO;
- if (offset < rp->start || (offset + size) > rp->end)
- return -ENXIO;
- addr = hose->io_base_virt + port;
-
- switch (size) {
- case 1:
- *((u8 *)val) = in_8(addr);
- return 1;
- case 2:
- if (port & 1)
- return -EINVAL;
- *((u16 *)val) = in_le16(addr);
- return 2;
- case 4:
- if (port & 3)
- return -EINVAL;
- *((u32 *)val) = in_le32(addr);
- return 4;
- }
- return -EINVAL;
-}
-
-/* This provides legacy IO write access on a bus */
-int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, size_t size)
-{
- unsigned long offset;
- struct pci_controller *hose = pci_bus_to_host(bus);
- struct resource *rp = &hose->io_resource;
- void __iomem *addr;
-
- /* Check if port can be supported by that bus. We only check
- * the ranges of the PHB though, not the bus itself as the rules
- * for forwarding legacy cycles down bridges are not our problem
- * here. So if the host bridge supports it, we do it.
- */
- offset = (unsigned long)hose->io_base_virt - _IO_BASE;
- offset += port;
-
- if (!(rp->flags & IORESOURCE_IO))
- return -ENXIO;
- if (offset < rp->start || (offset + size) > rp->end)
- return -ENXIO;
- addr = hose->io_base_virt + port;
-
- /* WARNING: The generic code is idiotic. It gets passed a pointer
- * to what can be a 1, 2 or 4 byte quantity and always reads that
- * as a u32, which means that we have to correct the location of
- * the data read within those 32 bits for size 1 and 2
- */
- switch (size) {
- case 1:
- out_8(addr, val >> 24);
- return 1;
- case 2:
- if (port & 1)
- return -EINVAL;
- out_le16(addr, val >> 16);
- return 2;
- case 4:
- if (port & 3)
- return -EINVAL;
- out_le32(addr, val);
- return 4;
- }
- return -EINVAL;
-}
-
-/* This provides legacy IO or memory mmap access on a bus */
-int pci_mmap_legacy_page_range(struct pci_bus *bus,
- struct vm_area_struct *vma,
- enum pci_mmap_state mmap_state)
-{
- struct pci_controller *hose = pci_bus_to_host(bus);
- resource_size_t offset =
- ((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT;
- resource_size_t size = vma->vm_end - vma->vm_start;
- struct resource *rp;
-
- pr_debug("pci_mmap_legacy_page_range(%04x:%02x, %s @%llx..%llx)\n",
- pci_domain_nr(bus), bus->number,
- mmap_state == pci_mmap_mem ? "MEM" : "IO",
- (unsigned long long)offset,
- (unsigned long long)(offset + size - 1));
-
- if (mmap_state == pci_mmap_mem) {
- /* Hack alert !
- *
- * Because X is lame and can fail starting if it gets an error
- * trying to mmap legacy_mem (instead of just moving on without
- * legacy memory access) we fake it here by giving it anonymous
- * memory, effectively behaving just like /dev/zero
- */
- if ((offset + size) > hose->isa_mem_size) {
- pr_debug("Process %s (pid:%d) mapped non-existing PCI",
- current->comm, current->pid);
- pr_debug("legacy memory for 0%04x:%02x\n",
- pci_domain_nr(bus), bus->number);
- if (vma->vm_flags & VM_SHARED)
- return shmem_zero_setup(vma);
- return 0;
- }
- offset += hose->isa_mem_phys;
- } else {
- unsigned long io_offset = (unsigned long)hose->io_base_virt -
- _IO_BASE;
- unsigned long roffset = offset + io_offset;
- rp = &hose->io_resource;
- if (!(rp->flags & IORESOURCE_IO))
- return -ENXIO;
- if (roffset < rp->start || (roffset + size) > rp->end)
- return -ENXIO;
- offset += hose->io_base_phys;
- }
- pr_debug(" -> mapping phys %llx\n", (unsigned long long)offset);
-
- vma->vm_pgoff = offset >> PAGE_SHIFT;
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
-}
-
void pci_resource_to_user(const struct pci_dev *dev, int bar,
const struct resource *rsrc,
resource_size_t *start, resource_size_t *end)
--
1.8.3.1
next prev parent reply other threads:[~2022-10-25 6:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 6:52 [PATCH 00/13] Remove unused microblaze PCIe bus architecture Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 01/13] microblaze/PCI: Remove unused early_read_config_byte() et al declarations Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 02/13] microblaze/PCI: Remove Null PCI config access unused functions Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 03/13] microblaze/PCI: Remove unused PCI bus scan if configured as a host Thippeswamy Havalige
2022-10-25 6:52 ` Thippeswamy Havalige [this message]
2022-10-25 6:52 ` [PATCH 05/13] microblaze/PCI: Remove unused device tree parsing for a host bridge resources Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 06/13] microblaze/PCI: Remove unused allocation & free of PCI host bridge structure Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 07/13] microblaze/PCI: Remove unused PCI BIOS resource allocation Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 08/13] microblaze/PCI: Remove unused PCI Indirect ops Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 09/13] microblaze/PCI: Remove unused pci_address_to_pio() conversion of CPU address to I/O port Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 10/13] microblaze/PCI: Remove unused sys_pciconfig_iobase() and et al declaration Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 11/13] microblaze/PCI: Remove unused pci_iobar_pfn() and et al declarations Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 12/13] microblaze/PCI: Remove support for Xilinx PCI host bridge Thippeswamy Havalige
2022-10-25 6:52 ` [PATCH 13/13] microblaze/PCI: Moving PCI iounmap and dependent code Thippeswamy Havalige
2022-10-25 7:31 ` [PATCH 00/13] Remove unused microblaze PCIe bus architecture Michal Simek
2022-10-25 8:26 ` Havalige, Thippeswamy
2022-10-25 9:22 ` Michal Simek
2022-10-25 14:07 ` Havalige, Thippeswamy
2022-10-27 9:46 ` Lorenzo Pieralisi
2022-11-04 8:56 ` Havalige, Thippeswamy
2022-11-25 10:39 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221025065214.4663-5-thippeswamy.havalige@amd.com \
--to=thippeswamy.havalige@amd.com \
--cc=bharat.kumar.gogada@amd.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=michals@xilinx.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®