lkml.org 
[lkml]   [2018]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 7/7] firmware: coreboot: Request table region for exclusive access
Date
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
\
 
 \ /
  Last update: 2018-08-09 19:18    [W:0.151 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site