]> git.baikalelectronics.ru Git - uboot.git/commitdiff
pci: Add mask parameter to dm_pci_map_bar()
authorAndrew Scull <ascull@google.com>
Thu, 21 Apr 2022 16:11:13 +0000 (16:11 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 3 May 2022 22:33:29 +0000 (18:33 -0400)
Add a mask parameter to control the lookup of the PCI region from which
the mapping can be made.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
33 files changed:
arch/x86/cpu/baytrail/cpu.c
drivers/ata/ahci.c
drivers/ata/sata_sil.c
drivers/gpio/octeon_gpio.c
drivers/i2c/designware_i2c_pci.c
drivers/i2c/intel_i2c.c
drivers/i2c/octeon_i2c.c
drivers/mmc/octeontx_hsmmc.c
drivers/mmc/pci_mmc.c
drivers/mtd/nand/raw/octeontx_bch.c
drivers/mtd/nand/raw/octeontx_nand.c
drivers/net/bnxt/bnxt.c
drivers/net/e1000.c
drivers/net/fsl_enetc.c
drivers/net/fsl_enetc_mdio.c
drivers/net/mscc_eswitch/felix_switch.c
drivers/net/octeontx/bgx.c
drivers/net/octeontx/nic_main.c
drivers/net/octeontx/nicvf_main.c
drivers/net/octeontx/smi.c
drivers/net/octeontx2/cgx.c
drivers/net/octeontx2/rvu_af.c
drivers/net/octeontx2/rvu_pf.c
drivers/net/pch_gbe.c
drivers/nvme/nvme_pci.c
drivers/pci/pci-uclass.c
drivers/spi/octeon_spi.c
drivers/usb/host/ehci-pci.c
drivers/usb/host/ohci-pci.c
drivers/usb/host/xhci-pci.c
drivers/virtio/virtio_pci_legacy.c
include/pci.h
test/dm/pci.c

index 9b6ac5dd592ee118885a6fb2d0a44125a98cdd41..4fb6a485542fdd4ec9dbac0faaa195ba5b1147a2 100644 (file)
@@ -56,7 +56,7 @@ static int baytrail_uart_init(void *ctx, struct event *event)
        for (i = 0; i < 2; i++) {
                ret = dm_pci_bus_find_bdf(PCI_BDF(0, 0x1e, 3 + i), &dev);
                if (!ret) {
-                       base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+                       base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                              PCI_REGION_MEM);
                        hsuart_clock_set(base);
                }
index 3925807d55ed1cc6f2b016cb069304d6f00259b9..de6131f1d9b566cee9588da175e33cc478d8881a 100644 (file)
@@ -417,7 +417,7 @@ static int ahci_init_one(struct ahci_uc_priv *uc_priv, struct udevice *dev)
 
 #if !defined(CONFIG_DM_SCSI)
        uc_priv->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5, 0, 0,
-                                           PCI_REGION_MEM);
+                                           PCI_REGION_TYPE, PCI_REGION_MEM);
 
        /* Take from kernel:
         * JMicron-specific fixup:
@@ -1149,7 +1149,7 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
        u16 vendor, device;
 
        base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0,
-                                    PCI_REGION_MEM);
+                                    PCI_REGION_TYPE, PCI_REGION_MEM);
 
        /*
         * Note:
@@ -1163,7 +1163,8 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 
        if (vendor == PCI_VENDOR_ID_CAVIUM &&
            device == PCI_DEVICE_ID_CAVIUM_SATA)
-               base = (uintptr_t)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_0, 0, 0,
+               base = (uintptr_t)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_0,
+                                                0, 0, PCI_REGION_TYPE,
                                                 PCI_REGION_MEM);
        return ahci_probe_scsi(ahci_dev, base);
 }
index 8806e3fbbbc428912dc1757c88c44e37e9888e6e..706515457224b4ca3c8961c382c1059bf058ce62 100644 (file)
@@ -699,9 +699,11 @@ static int sil_pci_probe(struct udevice *dev)
 
        /* Read out all BARs */
        sata_info.iobase[0] = (ulong)dm_pci_map_bar(dev,
-                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
+                       PCI_REGION_MEM);
        sata_info.iobase[1] = (ulong)dm_pci_map_bar(dev,
-                       PCI_BASE_ADDRESS_2, 0, 0, PCI_REGION_MEM);
+                       PCI_BASE_ADDRESS_2, 0, 0, PCI_REGION_TYPE,
+                       PCI_REGION_MEM);
 
        /* mask out the unused bits */
        sata_info.iobase[0] &= 0xffffff80;
index e6a8e1a5212c569f341cc9005328bef9ba342fdf..2b2465b1bcd26edfb203153a8dd81113f209eeee 100644 (file)
@@ -183,7 +183,7 @@ static int octeon_gpio_probe(struct udevice *dev)
        priv->data = (const struct octeon_gpio_data *)dev_get_driver_data(dev);
 
        if (priv->data->probe == PROBE_PCI) {
-               priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+               priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                            PCI_REGION_MEM);
                uc_priv->gpio_count = readq(priv->base +
                                            priv->data->reg_offs + GPIO_CONST) &
index 51f1357d10e961b140862037fffe0f92d7717e85..1572c2c6bceec55c4b9a9d98a0bcbd02e0e14fbc 100644 (file)
@@ -59,7 +59,8 @@ static int designware_i2c_pci_of_to_plat(struct udevice *dev)
                priv->regs = (struct i2c_regs *)dm_pci_read_bar32(dev, 0);
        } else {
                priv->regs = (struct i2c_regs *)
-                       dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+                       dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+                                      PCI_REGION_TYPE, PCI_REGION_MEM);
        }
        if (!priv->regs)
                return -EINVAL;
index 7b5b62e3ebb78ebd5130b30d0a8f858f72e8224b..dc26fa8c5427318f78b20dbf0c10c8948f9ca1fd 100644 (file)
@@ -251,7 +251,7 @@ static int intel_i2c_probe(struct udevice *dev)
        ulong base;
 
        /* Save base address from PCI BAR */
-       priv->base = (ulong)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, 0, 0,
+       priv->base = (ulong)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, 0, 0, PCI_REGION_TYPE,
                                           PCI_REGION_IO);
        base = priv->base;
 
index 74fd5c3d2e8f264f18ce34d8675089a28da207d2..e54ef18e5155a254f71e66c03c8f93cf2c6a7e63 100644 (file)
@@ -792,7 +792,7 @@ static int octeon_i2c_probe(struct udevice *dev)
 
                debug("TWSI PCI device: %x\n", bdf);
 
-               twsi->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+               twsi->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                            PCI_REGION_MEM);
        } else {
                twsi->base = dev_remap_addr(dev);
index 0bf38945a1d5250d085836353bf20097b13caf87..6e9acf7310aa5f2ddbffc9265e94df6f4f40ca98 100644 (file)
@@ -3822,7 +3822,7 @@ static int octeontx_mmc_host_probe(struct udevice *dev)
 
        /* Octeon TX & TX2 use PCI based probing */
        if (device_is_compatible(dev, "cavium,thunder-8890-mmc")) {
-               host->base_addr = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+               host->base_addr = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                                 PCI_REGION_MEM);
                if (!host->base_addr) {
                        pr_err("%s: Error: MMC base address not found\n",
index 1bc2fbcfdfc477b863de9690a9de2b3f5fb0cdd7..cba2ea8cf3ae84115567785bbf97b48560ceea0a 100644 (file)
@@ -50,7 +50,7 @@ static int pci_mmc_probe(struct udevice *dev)
        desc = mmc_get_blk_desc(&plat->mmc);
        desc->removable = !(plat->cfg.host_caps & MMC_CAP_NONREMOVABLE);
 
-       host->ioaddr = (void *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       host->ioaddr = (void *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                              PCI_REGION_MEM);
        host->name = dev->name;
        host->cd_gpio = priv->cd_gpio;
index c1cc5fa187296d9b08756b560b4a77512aed0f22..c1d721cabfc6a228734a5637be9a6bc2367d5723 100644 (file)
@@ -176,7 +176,8 @@ static int octeontx_pci_bchpf_probe(struct udevice *dev)
        if (!bch)
                return -ENOMEM;
 
-       bch->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+       bch->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+                                      PCI_REGION_TYPE, PCI_REGION_MEM);
        bch->dev = dev;
 
        debug("%s: base address: %p\n", __func__, bch->reg_base);
@@ -361,7 +362,8 @@ static int octeontx_pci_bchvf_probe(struct udevice *dev)
        vf->dev = dev;
 
        /* Map PF's configuration registers */
-       vf->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+       vf->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+                                     PCI_REGION_TYPE, PCI_REGION_MEM);
        debug("%s: reg base: %p\n", __func__, vf->reg_base);
 
        err = octeontx_cmd_queue_initialize(dev, QID_BCH, QDEPTH - 1, 0,
index 3e84bb2fc062e27e6d8ba09b8a500dfb71037168..b338b204f3439928fa50740c0fc16e8f632c6707 100644 (file)
@@ -2098,7 +2098,7 @@ static int octeontx_pci_nand_probe(struct udevice *dev)
        tn->dev = dev;
        INIT_LIST_HEAD(&tn->chips);
 
-       tn->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+       tn->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM);
        if (!tn->base) {
                ret = -EINVAL;
                goto release;
index a24f965ec158d65e5b43f336b92ad4efcb00ae08..1c9a9962408a32dd9289bb7f7036a4522a475f14 100644 (file)
@@ -28,9 +28,12 @@ static void bnxt_bring_pci(struct bnxt *bp)
        dm_pci_read_config16(bp->pdev, PCI_SUBSYSTEM_ID, &bp->subsystem_device);
        dm_pci_read_config16(bp->pdev, PCI_COMMAND, &bp->cmd_reg);
        dm_pci_read_config8(bp->pdev, PCI_INTERRUPT_LINE, &bp->irq);
-       bp->bar0 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
-       bp->bar1 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_2, 0, 0, PCI_REGION_MEM);
-       bp->bar2 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_4, 0, 0, PCI_REGION_MEM);
+       bp->bar0 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_0, 0, 0,
+                                 PCI_REGION_TYPE, PCI_REGION_MEM);
+       bp->bar1 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_2, 0, 0,
+                                 PCI_REGION_TYPE, PCI_REGION_MEM);
+       bp->bar2 = dm_pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_4, 0, 0,
+                                 PCI_REGION_TYPE, PCI_REGION_MEM);
        cmd_reg = bp->cmd_reg | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
        cmd_reg |= PCI_COMMAND_INTX_DISABLE; /* disable intr */
        dm_pci_write_config16(bp->pdev, PCI_COMMAND, cmd_reg);
index f01c464e4804207380e2327e0e2f613865f569a7..5fe016ebaf7cc7449e306dec1a0eeb53a5b55f09 100644 (file)
@@ -5550,7 +5550,7 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum, pci_dev_t devno,
 #endif
 #ifdef CONFIG_DM_ETH
        hw->hw_addr = dm_pci_map_bar(devno,     PCI_BASE_ADDRESS_0, 0, 0,
-                                               PCI_REGION_MEM);
+                                               PCI_REGION_TYPE, PCI_REGION_MEM);
 #else
        hw->hw_addr = pci_map_bar(devno,        PCI_BASE_ADDRESS_0,
                                                PCI_REGION_MEM);
index ec849cc34d89847092154be41236e5caeb048b35..9b97a03ccb3f391bc8fce22049bca1ee1073c39d 100644 (file)
@@ -339,7 +339,7 @@ static int enetc_probe(struct udevice *dev)
        }
 
        /* initialize register */
-       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, 0);
+       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, 0);
        if (!priv->regs_base) {
                enetc_dbg(dev, "failed to map BAR0\n");
                return -EINVAL;
index f025c2255c38261d0259e506a1fda5d3cf41d028..50ad76dfeb55b6bca7d4a6f40fc811afb9bcd009 100644 (file)
@@ -125,7 +125,7 @@ static int enetc_mdio_probe(struct udevice *dev)
 {
        struct enetc_mdio_priv *priv = dev_get_priv(dev);
 
-       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, 0);
+       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, 0);
        if (!priv->regs_base) {
                enetc_dbg(dev, "failed to map BAR0\n");
                return -EINVAL;
index 0badb238282e4023f7531d7a62fc1483254c789d..709c9e3ef5153c86697abd1c5aaa884ba173c538 100644 (file)
@@ -292,13 +292,13 @@ static int felix_probe(struct udevice *dev)
                return -ENODEV;
        }
 
-       priv->imdio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, 0);
+       priv->imdio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, 0);
        if (!priv->imdio_base) {
                dev_err(dev, "failed to map BAR0\n");
                return -EINVAL;
        }
 
-       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, 0, 0, 0);
+       priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, 0, 0, PCI_REGION_TYPE, 0);
        if (!priv->regs_base) {
                dev_err(dev, "failed to map BAR4\n");
                return -EINVAL;
index cc8ef099c226cac955bdd6826135e0f04e90a390..b6592ff2ce54a2b47d6e015d2db66f9e7f379837 100644 (file)
@@ -1458,7 +1458,7 @@ int octeontx_bgx_probe(struct udevice *dev)
        int bgx_idx, node;
        int inc = 1;
 
-       bgx->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       bgx->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                       PCI_REGION_MEM);
        if (!bgx->reg_base) {
                debug("No PCI region found\n");
index 4754c042f10f8f1ace05fea28fa070f93618e0de..99886e3afc072e803849f8872adda74ca4e4931d 100644 (file)
@@ -713,7 +713,7 @@ int nic_initialize(struct udevice *dev)
                return -ENOMEM;
 
        /* MAP PF's configuration registers */
-       nic->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       nic->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                       PCI_REGION_MEM);
        if (!nic->reg_base) {
                printf("Cannot map config register space, aborting\n");
index 097df6df1eb2cbe3cfd9c50dcdb9f0a0e4e0f5f0..6e4d0a05121c2ea48fcfb9f7b1067441dd0335d4 100644 (file)
@@ -509,7 +509,7 @@ int nicvf_initialize(struct udevice *dev)
        /* Enable TSO support */
        nicvf->hw_tso = true;
 
-       nicvf->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       nicvf->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                         PCI_REGION_MEM);
 
        debug("nicvf->reg_base: %p\n", nicvf->reg_base);
index 2d521bd3ca7ef02bf3a6ff230a006a55f8a4c32a..233c26f7319a8254b4b0ddf5482a85133159d1ba 100644 (file)
@@ -322,7 +322,7 @@ int octeontx_smi_probe(struct udevice *dev)
        u64 baseaddr;
 
        debug("SMI PCI device: %x\n", bdf);
-       if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM)) {
+       if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM)) {
                printf("Failed to map PCI region for bdf %x\n", bdf);
                return -1;
        }
index eed31a9579339cf9fef1d2e127c9c1a22f154f75..c6ec3200c01ecb8ff414e3f4ea0cd20d66fe6720 100644 (file)
@@ -253,7 +253,7 @@ int cgx_probe(struct udevice *dev)
        struct cgx *cgx = dev_get_priv(dev);
        int err;
 
-       cgx->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       cgx->reg_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                       PCI_REGION_MEM);
        cgx->dev = dev;
        cgx->cgx_id = ((u64)(cgx->reg_base) >> 24) & 0x7;
index 47c1502ef8b24b46d84644021a580f65f00760c2..0d3a9ffe9ee18511d6c553d84e28a5c03b90fb4d 100644 (file)
@@ -127,7 +127,7 @@ int rvu_af_probe(struct udevice *dev)
 {
        struct rvu_af *af_ptr = dev_get_priv(dev);
 
-       af_ptr->af_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+       af_ptr->af_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                         PCI_REGION_MEM);
        debug("%s RVU AF BAR %p\n", __func__, af_ptr->af_base);
        af_ptr->dev = dev;
index 024e17e748345d6b52e749ef17ec7345612bca3f..5f3ea1f8eab1c34fe9aaee92b696ea5e10e59a81 100644 (file)
@@ -58,7 +58,8 @@ int rvu_pf_probe(struct udevice *dev)
 
        debug("%s: name: %s\n", __func__, dev->name);
 
-       rvu->pf_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_2, 0, 0, PCI_REGION_MEM);
+       rvu->pf_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_2, 0, 0,
+                                     PCI_REGION_TYPE, PCI_REGION_MEM);
        rvu->pfid = dev_seq(dev) + 1; // RVU PF's start from 1;
        rvu->dev = dev;
        if (!rvu_af_dev) {
index c795c8f15326ed47d596936d5b2e8d0116063026..ad7b5b8e99b7a5a3f33dc29c6538bf31daff25ce 100644 (file)
@@ -449,7 +449,7 @@ static int pch_gbe_probe(struct udevice *dev)
 
        priv->dev = dev;
 
-       iobase = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_1, 0, 0, PCI_REGION_MEM);
+       iobase = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_1, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM);
 
        plat->iobase = (ulong)iobase;
        priv->mac_regs = (struct pch_gbe_regs *)iobase;
index 3499a7b6e7233b28012ae30644d79401db5e0f5f..36bf9c5ffb731092d8e13fc541e38d7b37095bc4 100644 (file)
@@ -29,7 +29,7 @@ static int nvme_probe(struct udevice *udev)
 
        ndev->instance = trailing_strtol(udev->name);
        ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, 0, 0,
-                                  PCI_REGION_MEM);
+                                  PCI_REGION_TYPE, PCI_REGION_MEM);
        return nvme_init(udev);
 }
 
index a193e2511f6382b2491ff4a005893bc4f8a7c986..bb53e6ba5f72f2da7b3571654d50e28d5432abde 100644 (file)
@@ -1556,7 +1556,7 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, size_t offset,
 }
 
 void *dm_pci_map_bar(struct udevice *dev, int bar, size_t offset, size_t len,
-                    unsigned long flags)
+                    unsigned long mask, unsigned long flags)
 {
        struct pci_child_plat *pdata = dev_get_parent_plat(dev);
        struct udevice *udev = dev;
@@ -1596,8 +1596,8 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, size_t offset, size_t len,
         * a PCI range, but a better check would be to probe for the size of
         * the bar and prevent overflow more locally.
         */
-       return dm_pci_bus_to_virt(udev, pci_bus_addr + offset, len,
-                                 PCI_REGION_TYPE, flags, MAP_NOCACHE);
+       return dm_pci_bus_to_virt(udev, pci_bus_addr + offset, len, mask, flags,
+                                 MAP_NOCACHE);
 }
 
 static int _dm_pci_find_next_capability(struct udevice *dev, u8 pos, int cap)
index 2f8a8a86498dfac7fd1f35e772ac4b957a260f95..c2a7ee232b9493992ab6d2769a905dd6efd294a3 100644 (file)
@@ -568,7 +568,7 @@ static int octeon_spi_probe(struct udevice *dev)
                pci_dev_t bdf = dm_pci_get_bdf(dev);
 
                debug("SPI PCI device: %x\n", bdf);
-               priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
+               priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
                                            PCI_REGION_MEM);
                /* Add base offset */
                priv->base += 0x1000;
index 7c34e37b204175b808f18156c24e961fbc8d7b34..1ab306147fab0f2a7882704c3fca69b68c747535 100644 (file)
@@ -36,7 +36,8 @@ static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr,
                return ret;
 
        hccr = (struct ehci_hccr *)dm_pci_map_bar(dev,
-                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
+                       PCI_REGION_MEM);
        hcor = (struct ehci_hcor *)((uintptr_t) hccr +
                        HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
 
index eab0d96637c6b5351d97f9dd7619c488ad650302..f061aec28966fc8cb709666efe6d0a5f019f9153 100644 (file)
@@ -18,7 +18,7 @@ static int ohci_pci_probe(struct udevice *dev)
 {
        struct ohci_regs *regs;
 
-       regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+       regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM);
        return ohci_register(dev, regs);
 }
 
index 6ebcbd076376786a33b26abc5438b2d174ebcde0..11f1c02000af6dc06f08d7792f145e6a1c649577 100644 (file)
@@ -27,7 +27,8 @@ static int xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,
        u32 cmd;
 
        hccr = (struct xhci_hccr *)dm_pci_map_bar(dev,
-                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_MEM);
+                       PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
+                       PCI_REGION_MEM);
        if (!hccr) {
                printf("xhci-pci init cannot map PCI mem bar\n");
                return -EIO;
index 504a7ff7b978f5122c522e59c46836d25cb30858..cf5dfb17a94d65ebf9ef325a5805a9529abf8cbf 100644 (file)
@@ -319,7 +319,8 @@ static int virtio_pci_probe(struct udevice *udev)
        uc_priv->device = subdevice;
        uc_priv->vendor = subvendor;
 
-       priv->ioaddr = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_IO);
+       priv->ioaddr = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, 0, 0,
+                                     PCI_REGION_TYPE, PCI_REGION_IO);
        if (!priv->ioaddr)
                return -ENXIO;
        debug("(%s): virtio legacy device reg base %04lx\n",
index c0eefe9209c49cad321764f467181327cace8fe2..d7ed35dd523f046792b2b77f7ecc834abdee66eb 100644 (file)
@@ -1352,11 +1352,12 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t addr, size_t len,
  * @bar:       Bar register offset (PCI_BASE_ADDRESS_...)
  * @offset:     Offset from the base to map
  * @len:        Length to map
+ * @mask:       Mask to match flags for the region type
  * @flags:     Flags for the region type (PCI_REGION_...)
  * @return: pointer to the virtual address to use or 0 on error
  */
 void *dm_pci_map_bar(struct udevice *dev, int bar, size_t offset, size_t len,
-                    unsigned long flags);
+                    unsigned long mask, unsigned long flags);
 
 /**
  * dm_pci_find_next_capability() - find a capability starting from an offset
index 3b4bd652fb5433e5e4148ba10be7619249ee1bfe..70a736cfdb8abd63bcfe96f9cae7ddf4ed5c31aa 100644 (file)
@@ -268,27 +268,27 @@ static int dm_test_pci_ea(struct unit_test_state *uts)
        ut_asserteq(PCI_CAP_ID_EA_OFFSET, cap);
 
        /* test swap case in BAR 1 */
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_0, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnonnull(bar);
        *(int *)bar = 2; /* swap upper/lower */
 
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_1, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_1, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnonnull(bar);
        strcpy(bar, "ea TEST");
        unmap_sysmem(bar);
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_1, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_1, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnonnull(bar);
        ut_asserteq_str("EA test", bar);
 
        /* test magic values in BARs2, 4;  BAR 3 is n/a */
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_2, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_2, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnonnull(bar);
        ut_asserteq(PCI_EA_BAR2_MAGIC, *(u32 *)bar);
 
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_3, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_3, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnull(bar);
 
-       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_4, 0, 0, 0);
+       bar = dm_pci_map_bar(swap, PCI_BASE_ADDRESS_4, 0, 0, PCI_REGION_TYPE, 0);
        ut_assertnonnull(bar);
        ut_asserteq(PCI_EA_BAR4_MAGIC, *(u32 *)bar);