Messages in this thread Patch in this message | | | From | Stephen Boyd <> | Subject | [PATCH v3 7/7] firmware: coreboot: Request table region for exclusive access | Date | Thu, 9 Aug 2018 10:17:22 -0700 |
| |
Call request_mem_region() on the entire coreboot table to make sure other devices don't attempt to map the coreboot table in their drivers. If drivers need that support, it would be better to provide bus APIs they can use to do that through the mapping created in this file.
Cc: Wei-Ning Huang <wnhuang@chromium.org> Cc: Julius Werner <jwerner@chromium.org> Cc: Brian Norris <briannorris@chromium.org> Cc: Samuel Holland <samuel@sholland.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- drivers/firmware/google/coreboot_table.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c index 814913606d22..94c41d814ea5 100644 --- a/drivers/firmware/google/coreboot_table.c +++ b/drivers/firmware/google/coreboot_table.c @@ -132,6 +132,7 @@ static int coreboot_table_probe(struct platform_device *pdev) struct coreboot_table_header *header; struct resource *res; struct device *dev = &pdev->dev; + const char *name; void *ptr; int ret; @@ -153,10 +154,17 @@ static int coreboot_table_probe(struct platform_device *pdev) return -ENODEV; } - ptr = devm_memremap(dev, res->start, - header->header_bytes + header->table_bytes, - MEMREMAP_WB); + len = header->header_bytes + header->table_bytes; + res->end = res->start + len - 1; + name = res->name ?: dev_name(dev); memunmap(header); + + if (!devm_request_mem_region(dev, res->start, len, name)) { + dev_err(dev, "can't request region for resource %pR\n", res); + return -EBUSY; + } + + ptr = devm_memremap(dev, res->start, len, MEMREMAP_WB); if (!ptr) return -ENOMEM; -- Sent by a computer through tubes
| |