Merge tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the "big" char and misc driver patches for 4.18-rc1. It's not a lot of stuff here, but there are some highlights: - coreboot driver updates - soundwire driver updates - android binder updates - fpga big sync, mostly documentation - lots of minor driver updates All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (81 commits) vmw_balloon: fixing double free when batching mode is off MAINTAINERS: Add driver-api/fpga path fpga: clarify that unregister functions also free documentation: fpga: move fpga-region.txt to driver-api documentation: fpga: add bridge document to driver-api documentation: fpga: move fpga-mgr.txt to driver-api Documentation: fpga: move fpga overview to driver-api fpga: region: kernel-doc fixes fpga: bridge: kernel-doc fixes fpga: mgr: kernel-doc fixes fpga: use SPDX fpga: region: change api, add fpga_region_create/free fpga: bridge: change api, don't use drvdata fpga: manager: change api, don't use drvdata fpga: region: don't use drvdata in common fpga code Drivers: hv: vmbus: Removed an unnecessary cast from void * ver_linux: Drop redundant calls to system() to test if file is readable ver_linux: Move stderr redirection from function parameter to function body misc: IBM Virtual Management Channel Driver (VMC) rpmsg: Correct support for MODULE_DEVICE_TABLE() ...
This commit is contained in:
@@ -55,6 +55,14 @@ config GOOGLE_MEMCONSOLE_X86_LEGACY
|
||||
the EBDA on Google servers. If found, this log is exported to
|
||||
userland in the file /sys/firmware/log.
|
||||
|
||||
config GOOGLE_FRAMEBUFFER_COREBOOT
|
||||
tristate "Coreboot Framebuffer"
|
||||
depends on FB_SIMPLE
|
||||
depends on GOOGLE_COREBOOT_TABLE
|
||||
help
|
||||
This option enables the kernel to search for a framebuffer in
|
||||
the coreboot table. If found, it is registered with simplefb.
|
||||
|
||||
config GOOGLE_MEMCONSOLE_COREBOOT
|
||||
tristate "Firmware Memory Console"
|
||||
depends on GOOGLE_COREBOOT_TABLE
|
||||
|
||||
@@ -4,6 +4,7 @@ obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
|
||||
obj-$(CONFIG_GOOGLE_COREBOOT_TABLE) += coreboot_table.o
|
||||
obj-$(CONFIG_GOOGLE_COREBOOT_TABLE_ACPI) += coreboot_table-acpi.o
|
||||
obj-$(CONFIG_GOOGLE_COREBOOT_TABLE_OF) += coreboot_table-of.o
|
||||
obj-$(CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT) += framebuffer-coreboot.o
|
||||
obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
|
||||
obj-$(CONFIG_GOOGLE_MEMCONSOLE_COREBOOT) += memconsole-coreboot.o
|
||||
obj-$(CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY) += memconsole-x86-legacy.o
|
||||
|
||||
@@ -53,7 +53,7 @@ static int coreboot_table_acpi_probe(struct platform_device *pdev)
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
return coreboot_table_init(ptr);
|
||||
return coreboot_table_init(&pdev->dev, ptr);
|
||||
}
|
||||
|
||||
static int coreboot_table_acpi_remove(struct platform_device *pdev)
|
||||
|
||||
@@ -34,7 +34,7 @@ static int coreboot_table_of_probe(struct platform_device *pdev)
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
return coreboot_table_init(ptr);
|
||||
return coreboot_table_init(&pdev->dev, ptr);
|
||||
}
|
||||
|
||||
static int coreboot_table_of_remove(struct platform_device *pdev)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Module providing coreboot table access.
|
||||
*
|
||||
* Copyright 2017 Google Inc.
|
||||
* Copyright 2017 Samuel Holland <samuel@sholland.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License v2.0 as published by
|
||||
@@ -15,37 +16,96 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "coreboot_table.h"
|
||||
|
||||
struct coreboot_table_entry {
|
||||
u32 tag;
|
||||
u32 size;
|
||||
};
|
||||
#define CB_DEV(d) container_of(d, struct coreboot_device, dev)
|
||||
#define CB_DRV(d) container_of(d, struct coreboot_driver, drv)
|
||||
|
||||
static struct coreboot_table_header __iomem *ptr_header;
|
||||
|
||||
/*
|
||||
* This function parses the coreboot table for an entry that contains the base
|
||||
* address of the given entry tag. The coreboot table consists of a header
|
||||
* directly followed by a number of small, variable-sized entries, which each
|
||||
* contain an identifying tag and their length as the first two fields.
|
||||
*/
|
||||
int coreboot_table_find(int tag, void *data, size_t data_size)
|
||||
static int coreboot_bus_match(struct device *dev, struct device_driver *drv)
|
||||
{
|
||||
struct coreboot_table_header header;
|
||||
struct coreboot_table_entry entry;
|
||||
struct coreboot_device *device = CB_DEV(dev);
|
||||
struct coreboot_driver *driver = CB_DRV(drv);
|
||||
|
||||
return device->entry.tag == driver->tag;
|
||||
}
|
||||
|
||||
static int coreboot_bus_probe(struct device *dev)
|
||||
{
|
||||
int ret = -ENODEV;
|
||||
struct coreboot_device *device = CB_DEV(dev);
|
||||
struct coreboot_driver *driver = CB_DRV(dev->driver);
|
||||
|
||||
if (driver->probe)
|
||||
ret = driver->probe(device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coreboot_bus_remove(struct device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct coreboot_device *device = CB_DEV(dev);
|
||||
struct coreboot_driver *driver = CB_DRV(dev->driver);
|
||||
|
||||
if (driver->remove)
|
||||
ret = driver->remove(device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct bus_type coreboot_bus_type = {
|
||||
.name = "coreboot",
|
||||
.match = coreboot_bus_match,
|
||||
.probe = coreboot_bus_probe,
|
||||
.remove = coreboot_bus_remove,
|
||||
};
|
||||
|
||||
static int __init coreboot_bus_init(void)
|
||||
{
|
||||
return bus_register(&coreboot_bus_type);
|
||||
}
|
||||
module_init(coreboot_bus_init);
|
||||
|
||||
static void coreboot_device_release(struct device *dev)
|
||||
{
|
||||
struct coreboot_device *device = CB_DEV(dev);
|
||||
|
||||
kfree(device);
|
||||
}
|
||||
|
||||
int coreboot_driver_register(struct coreboot_driver *driver)
|
||||
{
|
||||
driver->drv.bus = &coreboot_bus_type;
|
||||
|
||||
return driver_register(&driver->drv);
|
||||
}
|
||||
EXPORT_SYMBOL(coreboot_driver_register);
|
||||
|
||||
void coreboot_driver_unregister(struct coreboot_driver *driver)
|
||||
{
|
||||
driver_unregister(&driver->drv);
|
||||
}
|
||||
EXPORT_SYMBOL(coreboot_driver_unregister);
|
||||
|
||||
int coreboot_table_init(struct device *dev, void __iomem *ptr)
|
||||
{
|
||||
int i, ret;
|
||||
void *ptr_entry;
|
||||
int i;
|
||||
|
||||
if (!ptr_header)
|
||||
return -EPROBE_DEFER;
|
||||
struct coreboot_device *device;
|
||||
struct coreboot_table_entry entry;
|
||||
struct coreboot_table_header header;
|
||||
|
||||
ptr_header = ptr;
|
||||
memcpy_fromio(&header, ptr_header, sizeof(header));
|
||||
|
||||
if (strncmp(header.signature, "LBIO", sizeof(header.signature))) {
|
||||
@@ -54,37 +114,41 @@ int coreboot_table_find(int tag, void *data, size_t data_size)
|
||||
}
|
||||
|
||||
ptr_entry = (void *)ptr_header + header.header_bytes;
|
||||
|
||||
for (i = 0; i < header.table_entries; i++) {
|
||||
memcpy_fromio(&entry, ptr_entry, sizeof(entry));
|
||||
if (entry.tag == tag) {
|
||||
if (data_size < entry.size)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy_fromio(data, ptr_entry, entry.size);
|
||||
device = kzalloc(sizeof(struct device) + entry.size, GFP_KERNEL);
|
||||
if (!device) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
dev_set_name(&device->dev, "coreboot%d", i);
|
||||
device->dev.parent = dev;
|
||||
device->dev.bus = &coreboot_bus_type;
|
||||
device->dev.release = coreboot_device_release;
|
||||
memcpy_fromio(&device->entry, ptr_entry, entry.size);
|
||||
|
||||
ret = device_register(&device->dev);
|
||||
if (ret) {
|
||||
put_device(&device->dev);
|
||||
break;
|
||||
}
|
||||
|
||||
ptr_entry += entry.size;
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
EXPORT_SYMBOL(coreboot_table_find);
|
||||
|
||||
int coreboot_table_init(void __iomem *ptr)
|
||||
{
|
||||
ptr_header = ptr;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(coreboot_table_init);
|
||||
|
||||
int coreboot_table_exit(void)
|
||||
{
|
||||
if (ptr_header)
|
||||
if (ptr_header) {
|
||||
bus_unregister(&coreboot_bus_type);
|
||||
iounmap(ptr_header);
|
||||
ptr_header = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
*
|
||||
* Internal header for coreboot table access.
|
||||
*
|
||||
* Copyright 2014 Gerd Hoffmann <kraxel@redhat.com>
|
||||
* Copyright 2017 Google Inc.
|
||||
* Copyright 2017 Samuel Holland <samuel@sholland.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License v2.0 as published by
|
||||
@@ -20,14 +22,6 @@
|
||||
|
||||
#include <linux/io.h>
|
||||
|
||||
/* List of coreboot entry structures that is used */
|
||||
struct lb_cbmem_ref {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
|
||||
uint64_t cbmem_addr;
|
||||
};
|
||||
|
||||
/* Coreboot table header structure */
|
||||
struct coreboot_table_header {
|
||||
char signature[4];
|
||||
@@ -38,11 +32,67 @@ struct coreboot_table_header {
|
||||
u32 table_entries;
|
||||
};
|
||||
|
||||
/* Retrieve coreboot table entry with tag *tag* and copy it to data */
|
||||
int coreboot_table_find(int tag, void *data, size_t data_size);
|
||||
/* List of coreboot entry structures that is used */
|
||||
/* Generic */
|
||||
struct coreboot_table_entry {
|
||||
u32 tag;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
/* Points to a CBMEM entry */
|
||||
struct lb_cbmem_ref {
|
||||
u32 tag;
|
||||
u32 size;
|
||||
|
||||
u64 cbmem_addr;
|
||||
};
|
||||
|
||||
/* Describes framebuffer setup by coreboot */
|
||||
struct lb_framebuffer {
|
||||
u32 tag;
|
||||
u32 size;
|
||||
|
||||
u64 physical_address;
|
||||
u32 x_resolution;
|
||||
u32 y_resolution;
|
||||
u32 bytes_per_line;
|
||||
u8 bits_per_pixel;
|
||||
u8 red_mask_pos;
|
||||
u8 red_mask_size;
|
||||
u8 green_mask_pos;
|
||||
u8 green_mask_size;
|
||||
u8 blue_mask_pos;
|
||||
u8 blue_mask_size;
|
||||
u8 reserved_mask_pos;
|
||||
u8 reserved_mask_size;
|
||||
};
|
||||
|
||||
/* A device, additionally with information from coreboot. */
|
||||
struct coreboot_device {
|
||||
struct device dev;
|
||||
union {
|
||||
struct coreboot_table_entry entry;
|
||||
struct lb_cbmem_ref cbmem_ref;
|
||||
struct lb_framebuffer framebuffer;
|
||||
};
|
||||
};
|
||||
|
||||
/* A driver for handling devices described in coreboot tables. */
|
||||
struct coreboot_driver {
|
||||
int (*probe)(struct coreboot_device *);
|
||||
int (*remove)(struct coreboot_device *);
|
||||
struct device_driver drv;
|
||||
u32 tag;
|
||||
};
|
||||
|
||||
/* Register a driver that uses the data from a coreboot table. */
|
||||
int coreboot_driver_register(struct coreboot_driver *driver);
|
||||
|
||||
/* Unregister a driver that uses the data from a coreboot table. */
|
||||
void coreboot_driver_unregister(struct coreboot_driver *driver);
|
||||
|
||||
/* Initialize coreboot table module given a pointer to iomem */
|
||||
int coreboot_table_init(void __iomem *ptr);
|
||||
int coreboot_table_init(struct device *dev, void __iomem *ptr);
|
||||
|
||||
/* Cleanup coreboot table module */
|
||||
int coreboot_table_exit(void);
|
||||
|
||||
115
drivers/firmware/google/framebuffer-coreboot.c
Normal file
115
drivers/firmware/google/framebuffer-coreboot.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* framebuffer-coreboot.c
|
||||
*
|
||||
* Memory based framebuffer accessed through coreboot table.
|
||||
*
|
||||
* Copyright 2012-2013 David Herrmann <dh.herrmann@gmail.com>
|
||||
* Copyright 2017 Google Inc.
|
||||
* Copyright 2017 Samuel Holland <samuel@sholland.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License v2.0 as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_data/simplefb.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "coreboot_table.h"
|
||||
|
||||
#define CB_TAG_FRAMEBUFFER 0x12
|
||||
|
||||
static const struct simplefb_format formats[] = SIMPLEFB_FORMATS;
|
||||
|
||||
static int framebuffer_probe(struct coreboot_device *dev)
|
||||
{
|
||||
int i;
|
||||
u32 length;
|
||||
struct lb_framebuffer *fb = &dev->framebuffer;
|
||||
struct platform_device *pdev;
|
||||
struct resource res;
|
||||
struct simplefb_platform_data pdata = {
|
||||
.width = fb->x_resolution,
|
||||
.height = fb->y_resolution,
|
||||
.stride = fb->bytes_per_line,
|
||||
.format = NULL,
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i) {
|
||||
if (fb->bits_per_pixel == formats[i].bits_per_pixel &&
|
||||
fb->red_mask_pos == formats[i].red.offset &&
|
||||
fb->red_mask_size == formats[i].red.length &&
|
||||
fb->green_mask_pos == formats[i].green.offset &&
|
||||
fb->green_mask_size == formats[i].green.length &&
|
||||
fb->blue_mask_pos == formats[i].blue.offset &&
|
||||
fb->blue_mask_size == formats[i].blue.length &&
|
||||
fb->reserved_mask_pos == formats[i].transp.offset &&
|
||||
fb->reserved_mask_size == formats[i].transp.length)
|
||||
pdata.format = formats[i].name;
|
||||
}
|
||||
if (!pdata.format)
|
||||
return -ENODEV;
|
||||
|
||||
memset(&res, 0, sizeof(res));
|
||||
res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
||||
res.name = "Coreboot Framebuffer";
|
||||
res.start = fb->physical_address;
|
||||
length = PAGE_ALIGN(fb->y_resolution * fb->bytes_per_line);
|
||||
res.end = res.start + length - 1;
|
||||
if (res.end <= res.start)
|
||||
return -EINVAL;
|
||||
|
||||
pdev = platform_device_register_resndata(&dev->dev,
|
||||
"simple-framebuffer", 0,
|
||||
&res, 1, &pdata,
|
||||
sizeof(pdata));
|
||||
if (IS_ERR(pdev))
|
||||
pr_warn("coreboot: could not register framebuffer\n");
|
||||
else
|
||||
dev_set_drvdata(&dev->dev, pdev);
|
||||
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
static int framebuffer_remove(struct coreboot_device *dev)
|
||||
{
|
||||
struct platform_device *pdev = dev_get_drvdata(&dev->dev);
|
||||
|
||||
platform_device_unregister(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct coreboot_driver framebuffer_driver = {
|
||||
.probe = framebuffer_probe,
|
||||
.remove = framebuffer_remove,
|
||||
.drv = {
|
||||
.name = "framebuffer",
|
||||
},
|
||||
.tag = CB_TAG_FRAMEBUFFER,
|
||||
};
|
||||
|
||||
static int __init coreboot_framebuffer_init(void)
|
||||
{
|
||||
return coreboot_driver_register(&framebuffer_driver);
|
||||
}
|
||||
|
||||
static void coreboot_framebuffer_exit(void)
|
||||
{
|
||||
coreboot_driver_unregister(&framebuffer_driver);
|
||||
}
|
||||
|
||||
module_init(coreboot_framebuffer_init);
|
||||
module_exit(coreboot_framebuffer_exit);
|
||||
|
||||
MODULE_AUTHOR("Samuel Holland <samuel@sholland.org>");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -15,9 +15,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "memconsole.h"
|
||||
#include "coreboot_table.h"
|
||||
@@ -73,18 +73,19 @@ static ssize_t memconsole_coreboot_read(char *buf, loff_t pos, size_t count)
|
||||
return done;
|
||||
}
|
||||
|
||||
static int memconsole_coreboot_init(phys_addr_t physaddr)
|
||||
static int memconsole_probe(struct coreboot_device *dev)
|
||||
{
|
||||
struct cbmem_cons __iomem *tmp_cbmc;
|
||||
|
||||
tmp_cbmc = memremap(physaddr, sizeof(*tmp_cbmc), MEMREMAP_WB);
|
||||
tmp_cbmc = memremap(dev->cbmem_ref.cbmem_addr,
|
||||
sizeof(*tmp_cbmc), MEMREMAP_WB);
|
||||
|
||||
if (!tmp_cbmc)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Read size only once to prevent overrun attack through /dev/mem. */
|
||||
cbmem_console_size = tmp_cbmc->size_dont_access_after_boot;
|
||||
cbmem_console = memremap(physaddr,
|
||||
cbmem_console = memremap(dev->cbmem_ref.cbmem_addr,
|
||||
cbmem_console_size + sizeof(*cbmem_console),
|
||||
MEMREMAP_WB);
|
||||
memunmap(tmp_cbmc);
|
||||
@@ -93,26 +94,11 @@ static int memconsole_coreboot_init(phys_addr_t physaddr)
|
||||
return -ENOMEM;
|
||||
|
||||
memconsole_setup(memconsole_coreboot_read);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int memconsole_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct lb_cbmem_ref entry;
|
||||
|
||||
ret = coreboot_table_find(CB_TAG_CBMEM_CONSOLE, &entry, sizeof(entry));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = memconsole_coreboot_init(entry.cbmem_addr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return memconsole_sysfs_init();
|
||||
}
|
||||
|
||||
static int memconsole_remove(struct platform_device *pdev)
|
||||
static int memconsole_remove(struct coreboot_device *dev)
|
||||
{
|
||||
memconsole_exit();
|
||||
|
||||
@@ -122,28 +108,27 @@ static int memconsole_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver memconsole_driver = {
|
||||
static struct coreboot_driver memconsole_driver = {
|
||||
.probe = memconsole_probe,
|
||||
.remove = memconsole_remove,
|
||||
.driver = {
|
||||
.drv = {
|
||||
.name = "memconsole",
|
||||
},
|
||||
.tag = CB_TAG_CBMEM_CONSOLE,
|
||||
};
|
||||
|
||||
static int __init platform_memconsole_init(void)
|
||||
static void coreboot_memconsole_exit(void)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
|
||||
pdev = platform_device_register_simple("memconsole", -1, NULL, 0);
|
||||
if (IS_ERR(pdev))
|
||||
return PTR_ERR(pdev);
|
||||
|
||||
platform_driver_register(&memconsole_driver);
|
||||
|
||||
return 0;
|
||||
coreboot_driver_unregister(&memconsole_driver);
|
||||
}
|
||||
|
||||
module_init(platform_memconsole_init);
|
||||
static int __init coreboot_memconsole_init(void)
|
||||
{
|
||||
return coreboot_driver_register(&memconsole_driver);
|
||||
}
|
||||
|
||||
module_exit(coreboot_memconsole_exit);
|
||||
module_init(coreboot_memconsole_init);
|
||||
|
||||
MODULE_AUTHOR("Google, Inc.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -286,20 +286,15 @@ static int vpd_sections_init(phys_addr_t physaddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vpd_probe(struct platform_device *pdev)
|
||||
static int vpd_probe(struct coreboot_device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct lb_cbmem_ref entry;
|
||||
|
||||
ret = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
|
||||
if (!vpd_kobj)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = vpd_sections_init(entry.cbmem_addr);
|
||||
ret = vpd_sections_init(dev->cbmem_ref.cbmem_addr);
|
||||
if (ret) {
|
||||
kobject_put(vpd_kobj);
|
||||
return ret;
|
||||
@@ -308,7 +303,7 @@ static int vpd_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vpd_remove(struct platform_device *pdev)
|
||||
static int vpd_remove(struct coreboot_device *dev)
|
||||
{
|
||||
vpd_section_destroy(&ro_vpd);
|
||||
vpd_section_destroy(&rw_vpd);
|
||||
@@ -318,41 +313,27 @@ static int vpd_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver vpd_driver = {
|
||||
static struct coreboot_driver vpd_driver = {
|
||||
.probe = vpd_probe,
|
||||
.remove = vpd_remove,
|
||||
.driver = {
|
||||
.drv = {
|
||||
.name = "vpd",
|
||||
},
|
||||
.tag = CB_TAG_VPD,
|
||||
};
|
||||
|
||||
static struct platform_device *vpd_pdev;
|
||||
|
||||
static int __init vpd_platform_init(void)
|
||||
static int __init coreboot_vpd_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = platform_driver_register(&vpd_driver);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
vpd_pdev = platform_device_register_simple("vpd", -1, NULL, 0);
|
||||
if (IS_ERR(vpd_pdev)) {
|
||||
platform_driver_unregister(&vpd_driver);
|
||||
return PTR_ERR(vpd_pdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return coreboot_driver_register(&vpd_driver);
|
||||
}
|
||||
|
||||
static void __exit vpd_platform_exit(void)
|
||||
static void __exit coreboot_vpd_exit(void)
|
||||
{
|
||||
platform_device_unregister(vpd_pdev);
|
||||
platform_driver_unregister(&vpd_driver);
|
||||
coreboot_driver_unregister(&vpd_driver);
|
||||
}
|
||||
|
||||
module_init(vpd_platform_init);
|
||||
module_exit(vpd_platform_exit);
|
||||
module_init(coreboot_vpd_init);
|
||||
module_exit(coreboot_vpd_exit);
|
||||
|
||||
MODULE_AUTHOR("Google, Inc.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
Reference in New Issue
Block a user