arch/powerpc/platforms/pasemi/pci.c

Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pasemi/pci.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/platforms/pasemi/pci.c
Extension
.c
Size
6466 bytes
Lines
296
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!dn) {
			pr_crit("NEMO SB600 missing iob node\n");
			return;
		}

		err = of_address_to_resource(dn, 0, &res);
		of_node_put(dn);

		if (err) {
			pr_crit("NEMO SB600 missing resource\n");
			return;
		}

		pr_info("NEMO SB600 IOB base %08llx\n",res.start);

		iob_mapbase = ioremap(res.start + 0x100, 0x94);
	}

	if (iob_mapbase != NULL) {
		if (bus == SB600_BUS) {
			/*
			 * This is the SB600's bus, tell the PCI-e root port
			 * to allow non-zero devices to enumerate.
			 */
			out_le32(iob_mapbase + PXP_ERR_CFG_REG, in_le32(iob_mapbase + PXP_ERR_CFG_REG) | PXP_IGNORE_PCIE_ERRORS);
		} else {
			/*
			 * Only scan device 0 on other busses
			 */
			out_le32(iob_mapbase + PXP_ERR_CFG_REG, in_le32(iob_mapbase + PXP_ERR_CFG_REG) & ~PXP_IGNORE_PCIE_ERRORS);
		}
	}
}

#else

static void sb600_set_flag(int bus)
{
}
#endif

static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
			      int offset, int len, u32 *val)
{
	struct pci_controller *hose;
	void volatile __iomem *addr;

	hose = pci_bus_to_host(bus);
	if (!hose)
		return PCIBIOS_DEVICE_NOT_FOUND;

	if (!pa_pxp_offset_valid(bus->number, devfn, offset))
		return PCIBIOS_BAD_REGISTER_NUMBER;

	if (workaround_5945(bus, devfn, offset, len, val))
		return PCIBIOS_SUCCESSFUL;

	addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);

	sb600_set_flag(bus->number);

	/*
	 * Note: the caller has already checked that offset is
	 * suitably aligned and that len is 1, 2 or 4.
	 */
	switch (len) {
	case 1:
		*val = in_8(addr);
		break;
	case 2:
		*val = in_le16(addr);
		break;
	default:
		*val = in_le32(addr);
		break;
	}

	return PCIBIOS_SUCCESSFUL;
}

static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
			       int offset, int len, u32 val)
{
	struct pci_controller *hose;
	void volatile __iomem *addr;

	hose = pci_bus_to_host(bus);
	if (!hose)
		return PCIBIOS_DEVICE_NOT_FOUND;

Annotation

Implementation Notes