Jelajahi Sumber

efDataStatistics alarmDataOperation.c 徐寅秋 commit at 2021-02-04

徐寅秋 4 tahun lalu
induk
melakukan
1a0d2e08f7
1 mengubah file dengan 69 tambahan dan 0 penghapusan
  1. 69 0
      efDataStatistics/databaseOperation/alarmDataOperation.c

+ 69 - 0
efDataStatistics/databaseOperation/alarmDataOperation.c

@@ -453,3 +453,72 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
 	 * Re-enable decode windows.
 	 */
 	writel(win_enable, PCI_BAR_ENABLE);
+
+	/*
+	 * Disable automatic update of address remapping when writing to BARs.
+	 */
+	orion5x_setbits(PCI_ADDR_DECODE_CTRL, 1);
+}
+
+static int __init pci_setup(struct pci_sys_data *sys)
+{
+	struct resource *res;
+
+	/*
+	 * Point PCI unit MBUS decode windows to DRAM space.
+	 */
+	orion5x_setup_pci_wins(&orion_mbus_dram_info);
+
+	/*
+	 * Master + Slave enable
+	 */
+	orion5x_pci_master_slave_enable();
+
+	/*
+	 * Force ordering
+	 */
+	orion5x_setbits(PCI_CMD, PCI_CMD_HOST_REORDER);
+
+	pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCI_IO_PHYS_BASE);
+
+	/*
+	 * Request resources
+	 */
+	res = kzalloc(sizeof(struct resource), GFP_KERNEL);
+	if (!res)
+		panic("pci_setup unable to alloc resources");
+
+	/*
+	 * IORESOURCE_MEM
+	 */
+	res->name = "PCI Memory Space";
+	res->flags = IORESOURCE_MEM;
+	res->start = ORION5X_PCI_MEM_PHYS_BASE;
+	res->end = res->start + ORION5X_PCI_MEM_SIZE - 1;
+	if (request_resource(&iomem_resource, res))
+		panic("Request PCI Memory resource failed\n");
+	pci_add_resource_offset(&sys->resources, res, sys->mem_offset);
+
+	return 1;
+}
+
+
+/*****************************************************************************
+ * General PCIe + PCI
+ ****************************************************************************/
+static void rc_pci_fixup(struct pci_dev *dev)
+{
+	/*
+	 * Prevent enumeration of root complex.
+	 */
+	if (dev->bus->parent == NULL && dev->devfn == 0) {
+		int i;
+
+		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
+			dev->resource[i].start = 0;
+			dev->resource[i].end   = 0;
+			dev->resource[i].flags = 0;
+		}
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);