host-drivers/base-driver/vca/plx87xx/plx_hw.c
static int
plx_program_rid_lut(struct plx_device *xdev, struct pci_dev *pdev)
{
	struct pci_dev *root_port;
	u8 root_complex_bus_num;
	u32 rid_lut;
	u32 virtual_rid_offset, link_rid_offset;

	if (xdev->port_id == 0) {
		// NT0
		virtual_rid_offset = PLX_NT0_RID_LUT_VIRTUAL_OFFSET;
		link_rid_offset = PLX_NT0_RID_LUT_LINK_OFFSET;
	} else {
		// NT1
		virtual_rid_offset = PLX_NT1_RID_LUT_VIRTUAL_OFFSET;
		link_rid_offset = PLX_NT1_RID_LUT_LINK_OFFSET;
	}

	root_port = plx_find_root_port(pdev);
	if (!root_port) {
		dev_err(&pdev->dev, "can't find root port\n");
		return -ENXIO;
	}
	root_complex_bus_num = plx_find_root_complex_bus_num(pdev);
	rid_lut = plx_rid_lut(
		root_port->bus->number,
		PCI_SLOT(root_port->devfn),
		root_complex_bus_num,
		0);
	if (xdev->link_side) {
		plx_mmio_write(&xdev->mmio, rid_lut, link_rid_offset);
	} else {
		plx_mmio_write(&xdev->mmio, rid_lut, virtual_rid_offset);
	}
	return 0;
}
/*
 * plx_program_rid_lut - program RID LUT
 *
 * @xdev: pointer to plx_device instance
 * @pdev: The PCIe device
 *
 * RETURNS: 0 on success and errno on failure
 */
program RID LUT
@xdev: pointer to plx_device instance
@pdev: The PCIe device

0 on success and errno on failure
program RID LUT @xdev : pointer to plx_device instance @pdev : The PCIe device 0 on success and errno on failure
static int
plx_program_rid_lut(struct plx_device *xdev, struct pci_dev *pdev)
{
	struct pci_dev *root_port;
	u8 root_complex_bus_num;
	u32 rid_lut;
	u32 virtual_rid_offset, link_rid_offset;
	if (xdev->port_id == 0) {
		virtual_rid_offset = PLX_NT0_RID_LUT_VIRTUAL_OFFSET;
		link_rid_offset = PLX_NT0_RID_LUT_LINK_OFFSET;
	} else {
		virtual_rid_offset = PLX_NT1_RID_LUT_VIRTUAL_OFFSET;
		link_rid_offset = PLX_NT1_RID_LUT_LINK_OFFSET;
	}
	root_port = plx_find_root_port(pdev);
	if (!root_port) {
		dev_err(&pdev->dev, "can't find root port\n");
		return -ENXIO;
	}
	root_complex_bus_num = plx_find_root_complex_bus_num(pdev);
	rid_lut = plx_rid_lut(
		root_port->bus->number,
		PCI_SLOT(root_port->devfn),
		root_complex_bus_num,
		0);
	if (xdev->link_side) {
		plx_mmio_write(&xdev->mmio, rid_lut, link_rid_offset);
	} else {
		plx_mmio_write(&xdev->mmio, rid_lut, virtual_rid_offset);
	}
	return 0;
}
static int plx_program_rid_lut ( struct plx_device * xdev , struct pci_dev * pdev ) { struct pci_dev * root_port ; u8 root_complex_bus_num ; u32 rid_lut ; u32 virtual_rid_offset , link_rid_offset ; if ( xdev -> port_id == 0 ) { virtual_rid_offset = PLX_NT0_RID_LUT_VIRTUAL_OFFSET ; link_rid_offset = PLX_NT0_RID_LUT_LINK_OFFSET ; } else { virtual_rid_offset = PLX_NT1_RID_LUT_VIRTUAL_OFFSET ; link_rid_offset = PLX_NT1_RID_LUT_LINK_OFFSET ; } root_port = plx_find_root_port ( pdev ) ; if ( ! root_port ) { dev_err ( & pdev -> dev , " \n " ) ; return - ENXIO ; } root_complex_bus_num = plx_find_root_complex_bus_num ( pdev ) ; rid_lut = plx_rid_lut ( root_port -> bus -> number , PCI_SLOT ( root_port -> devfn ) , root_complex_bus_num , 0 ) ; if ( xdev -> link_side ) { plx_mmio_write ( & xdev -> mmio , rid_lut , link_rid_offset ) ; } else { plx_mmio_write ( & xdev -> mmio , rid_lut , virtual_rid_offset ) ; } return 0 ; }
plx_program_rid_lut - program RID LUT
 @xdev: pointer to plx_device instance
 @pdev: The PCIe device
plx_program_rid_lut - program RID LUT @xdev : pointer to plx_device instance @pdev : The PCIe device
// NT0 // NT1