diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2023-03-05 12:34:35 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2023-03-05 20:17:21 +0000 |
commit | cb894f746c07001dd5aebfafca596374ec335964 (patch) | |
tree | 436cd271933e73a6bc789072563b10b94aaad524 /sys/arm64/cavium | |
parent | 3689f8aeab82150da6789be87b6c2f9385810c23 (diff) | |
download | src-cb894f746c07001dd5aebfafca596374ec335964.tar.gz src-cb894f746c07001dd5aebfafca596374ec335964.zip |
Diffstat (limited to 'sys/arm64/cavium')
-rw-r--r-- | sys/arm64/cavium/thunder_pcie_pem.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index cbc70d7862de..3f4df8a621a3 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -745,6 +745,8 @@ thunder_pem_probe(device_t dev) static int thunder_pem_attach(device_t dev) { + struct resource_map_request req; + struct resource_map map; devclass_t pci_class; device_t parent; struct thunder_pem_softc *sc; @@ -766,11 +768,20 @@ thunder_pem_attach(device_t dev) rid = RID_PEM_SPACE; sc->reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &rid, RF_ACTIVE); + &rid, RF_ACTIVE | RF_UNMAPPED); if (sc->reg == NULL) { device_printf(dev, "Failed to allocate resource\n"); return (ENXIO); } + resource_init_map_request(&req); + req.memattr = VM_MEMATTR_DEVICE_NP; + error = bus_map_resource(dev, SYS_RES_MEMORY, sc->reg, &req, &map); + if (error != 0) { + device_printf(dev, "could not map memory.\n"); + return (error); + } + rman_set_mapping(sc->reg, &map); + sc->reg_bst = rman_get_bustag(sc->reg); sc->reg_bsh = rman_get_bushandle(sc->reg); |