@@ -14,6 +14,14 @@ menuconfig CHROME_PLATFORMS
if CHROME_PLATFORMS
+config CHROMEOS
+ bool
+ depends on NVRAM && ACPI_CHROMEOS
+ ---help---
+ Provides abstracted interfaces to the firmware features provided on
+ ChromeOS devices. It depends on a lowlevel driver to implement the
+ firmware interface on the platform.
+
config CHROMEOS_LAPTOP
tristate "Chrome OS Laptop"
depends on I2C && DMI && X86
@@ -1,4 +1,4 @@
-
+obj-$(CONFIG_CHROMEOS) += chromeos.o
obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o
obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o
cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \
new file mode 100644
@@ -0,0 +1,28 @@
+/*
+ * ChromeOS platform support code. Glue layer between higher level functions
+ * and per-platform firmware interfaces.
+ *
+ * Copyright (C) 2017 The Chromium OS Authors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/types.h>
+#include <linux/module.h>
+#include "chromeos.h"
+
+static struct chromeos_vbc *chromeos_vbc_ptr;
+
+int chromeos_vbc_register(struct chromeos_vbc *chromeos_vbc)
+{
+ chromeos_vbc_ptr = chromeos_vbc;
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 The Chromium OS Authors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+#ifndef _DRIVERS_PLATFORM_CHROMEOS_H
+#define _DRIVERS_PLATFORM_CHROMEOS_H
+
+struct chromeos_vbc {
+ /**
+ * Read vboot context to buffer
+ *
+ * @param buf Pointer to buffer for storing vboot context
+ * @param count Size of buffer
+ * @return on success, the number of bytes read is returned and
+ * on error, -err is returned.
+ */
+ ssize_t (*read)(void *buf, size_t count);
+
+ /**
+ * Write vboot context from buffer
+ *
+ * @param buf Pointer to buffer of new vboot context content
+ * @param count Size of buffer
+ * @return on success, the number of bytes written is returned and
+ * on error, -err is returned.
+ */
+ ssize_t (*write)(const void *buf, size_t count);
+
+ const char *name;
+};
+
+/**
+ * Register chromeos_vbc callbacks.
+ *
+ * @param chromeos_vbc Pointer to struct holding callbacks
+ * @return on success, return 0, on error, -err is returned.
+ */
+int chromeos_vbc_register(struct chromeos_vbc *chromeos_vbc);
+
+#endif /* _DRIVERS_PLATFORM_CHROMEOS_H */