FreeBSD/sys/mips/nlm/xlp_pci.c
/*
 * Enable byte swap in hardware when compiled big-endian.
 * Programs a link's PCIe SWAP regions from the link's IO and MEM address
 * ranges.
 */
Enable byte swap in hardware when compiled big-endian.
Programs a link's PCIe SWAP regions from the link's IO and MEM address
ranges.
Enable byte swap in hardware when compiled big - endian . Programs a link ' s PCIe SWAP regions from the link ' s IO and MEM address ranges .
static void
xlp_pcib_hardware_swap_enable(int node, int link)
{
#if BYTE_ORDER == BIG_ENDIAN
	uint64_t bbase, linkpcibase;
	uint32_t bar;
	int pcieoffset;
	pcieoffset = XLP_IO_PCIE_OFFSET(node, link);
	if (!nlm_dev_exists(pcieoffset))
		return;
	bbase = nlm_get_bridge_regbase(node);
	linkpcibase = nlm_pcicfg_base(pcieoffset);
	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEMEM_BASE0 + link);
	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_MEM_BASE, bar);
	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEMEM_LIMIT0 + link);
	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_MEM_LIM, bar | 0xFFF);
	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEIO_BASE0 + link);
	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_IO_BASE, bar);
	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEIO_LIMIT0 + link);
	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_IO_LIM, bar | 0xFFF);
#endif
}
static void xlp_pcib_hardware_swap_enable ( int node , int link ) { #if BYTE_ORDER == BIG_ENDIAN uint64_t bbase , linkpcibase ; uint32_t bar ; int pcieoffset ; pcieoffset = XLP_IO_PCIE_OFFSET ( node , link ) ; if ( ! nlm_dev_exists ( pcieoffset ) ) return ; bbase = nlm_get_bridge_regbase ( node ) ; linkpcibase = nlm_pcicfg_base ( pcieoffset ) ; bar = nlm_read_bridge_reg ( bbase , BRIDGE_PCIEMEM_BASE0 + link ) ; nlm_write_pci_reg ( linkpcibase , PCIE_BYTE_SWAP_MEM_BASE , bar ) ; bar = nlm_read_bridge_reg ( bbase , BRIDGE_PCIEMEM_LIMIT0 + link ) ; nlm_write_pci_reg ( linkpcibase , PCIE_BYTE_SWAP_MEM_LIM , bar | 0xFFF ) ; bar = nlm_read_bridge_reg ( bbase , BRIDGE_PCIEIO_BASE0 + link ) ; nlm_write_pci_reg ( linkpcibase , PCIE_BYTE_SWAP_IO_BASE , bar ) ; bar = nlm_read_bridge_reg ( bbase , BRIDGE_PCIEIO_LIMIT0 + link ) ; nlm_write_pci_reg ( linkpcibase , PCIE_BYTE_SWAP_IO_LIM , bar | 0xFFF ) ; #endif }
Enable byte swap in hardware when compiled big-endian.
Enable byte swap in hardware when compiled big - endian .