[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180809171722.144325-8-swboyd@chromium.org>
Date: Thu, 9 Aug 2018 10:17:22 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Wei-Ning Huang <wnhuang@...omium.org>,
Julius Werner <jwerner@...omium.org>,
Brian Norris <briannorris@...omium.org>,
Samuel Holland <samuel@...lland.org>
Subject: [PATCH v3 7/7] firmware: coreboot: Request table region for exclusive access
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@...omium.org>
Cc: Julius Werner <jwerner@...omium.org>
Cc: Brian Norris <briannorris@...omium.org>
Cc: Samuel Holland <samuel@...lland.org>
Signed-off-by: Stephen Boyd <swboyd@...omium.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
Powered by blists - more mailing lists