drivers, char: add U-Boot bootcount driver
Subsystems (3)
PATCH 1/1 drivers, char: add U-Boot bootcount driver
This driver implements the Linux kernel half of the boot count feature - the boot counter can only be reset after it is clear that the application has been started and is running correctly, which usually can only be determined by the application code itself. Thus the reset of the boot counter must be done by application code, which thus needs an appropriate driver.
Required feature by the Carrier Grade Linux Requirements Definition; see for example document "Carrier Grade Linux Requirements Definition Overview V3.0" at
http://www.linuxfoundation.org/collaborate/workgroups/cgl/requirements#SMM.6.0_Boot_Cycle_Detection
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle due to recurring failures. This detection should happen in user space before system services are started.
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
The bootcountregister gets configured via DTS.
for example on the enbw_cmc board:
bootcount@0x23060 {
compatible = "uboot,bootcount";
reg = <0x23060 0x20>;
};original post from:
http://old.nabble.com/-POWERPC--add-U-Boot-bootcount-driver.-td26804029.html
--- .../devicetree/bindings/char/bootcount.txt | 13 ++ drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/bootcount.c | 210 ++++++++++++++++++++ 4 files changed, 231 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/char/bootcount.txt create mode 100644 drivers/char/bootcount.c
Documentation/devicetree/bindings/char/bootcount.txt new file +13 -0
@@ -0,0 +1,13 @@ +Bootcount driver + +Required properties: + + - compatible : should be "uboot,bootcount" + - reg: the address of the bootcounter + +Example: + +bootcount@1c23000 { + compatible = "uboot,bootcount"; + reg = <0x23060 0x20>; +};
drivers/char/Kconfig +7 -0
@@ -577,6 +577,13 @@ config UV_MMTIMER The uv_mmtimer device allows direct userspace access to the UV system timer. +config BOOTCOUNT + tristate "U-Boot Bootcount driver" + depends on OF + help + The U-Boot Bootcount driver allows to access the + bootcounter through procFS or sysFS files. + source "drivers/char/tpm/Kconfig" config TELCLOCK
drivers/char/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_GPIO_TB0219) += tb0219.o obj-$(CONFIG_TELCLOCK) += tlclk.o +obj-$(CONFIG_BOOTCOUNT) += bootcount.o obj-$(CONFIG_MWAVE) += mwave/ obj-$(CONFIG_AGP) += agp/
drivers/char/bootcount.c new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
1.7.6.4
hi,
some comments inline
El Sun, Dec 04, 2011 at 10:45:21AM +0100 Heiko Schocher ha dit:
Quoted 145 lines
This driver implements the Linux kernel half of the boot count feature - the boot counter can only be reset after it is clear that the application has been started and is running correctly, which usually can only be determined by the application code itself. Thus the reset of the boot counter must be done by application code, which thus needs an appropriate driver.
Required feature by the Carrier Grade Linux Requirements Definition; see for example document "Carrier Grade Linux Requirements Definition Overview V3.0" at
http://www.linuxfoundation.org/collaborate/workgroups/cgl/requirements#SMM.6.0_Boot_Cycle_Detection
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle due to recurring failures. This detection should happen in user space before system services are started.
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
The bootcountregister gets configured via DTS.
for example on theenbw_cmcboard:bootcount@0x23060 { compatible = "uboot,bootcount"; reg = <0x23060 0x20>; };original post from:
http://old.nabble.com/-POWERPC--add-U-Boot-bootcount-driver.-td26804029.htmlSigned-off-by Heiko Schocher <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Vitaly Bordug <[email protected]>--- .../devicetree/bindings/char/bootcount.txt | 13 ++ drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/bootcount.c | 210 ++++++++++++++++++++ 4 files changed, 231 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/char/bootcount.txt create mode 100644 drivers/char/bootcount.cDocumentation/devicetree/bindings/char/bootcount.txt new file +13
-0@@ -0,0 +1,13 @@ +Bootcount driver + +Required properties: + + - compatible : should be "uboot,bootcount" + - reg: the address of the bootcounter + +Example: + +bootcount@1c23000 { + compatible = "uboot,bootcount"; + reg = <0x23060 0x20>; +};drivers/char/Kconfig +7
-0@@ -577,6 +577,13 @@ config UV_MMTIMER The uv_mmtimer device allows direct userspace access to the UV system timer. +config BOOTCOUNT + tristate "U-Boot Bootcount driver" + depends on OF + help + The U-Boot Bootcount driver allows to access the + bootcounter through procFS or sysFS files. + source "drivers/char/tpm/Kconfig" config TELCLOCKdrivers/char/Makefile +1
-0@@ -49,6 +49,7 @@ obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_GPIO_TB0219) += tb0219.o obj-$(CONFIG_TELCLOCK) += tlclk.o +obj-$(CONFIG_BOOTCOUNT) += bootcount.o obj-$(CONFIG_MWAVE) += mwave/ obj-$(CONFIG_AGP) += agp/drivers/char/bootcount.c new file +44
-0@@ -0,0 +1,210 @@ +/* +* This driver gives access(read/write) to the bootcounter used by u-boot. +* Access is supported via procFS and sysFS. +* +* Copyright 2008 DENX Software Engineering GmbH +* Author: Heiko Schocher <[email protected]> +* Based on work from: Steffen Rumler ([email protected]) +* +* 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. +*/ + +#include <linux/capability.h> +#include <linux/device.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/mm.h> +#include <linux/mman.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> +#include <linux/ptrace.h> +#include <linux/uaccess.h> + +#ifndef CONFIG_PROC_FS +#error "PROC FS support must be switched-on" +#endif +#include <linux/proc_fs.h> + +#define UBOOT_BOOTCOUNT_MAGIC_OFFSET 0x04/* offset of magic number */ +#define UBOOT_BOOTCOUNT_MAGIC 0xB001C041/* magic number value */ + +#define UBOOT_BOOTCOUNT_PROC_ENTRY "driver/bootcount" + +/* +* This macro frees the machine specific function from bounds checking and +* this like that... +*/ +#define PRINT_PROC(fmt, args...) \ + do { \
drivers/char/bootcount.c line 54
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ *len += sprintf(buffer + *len, fmt, ##args); \ +if (*begin + *len > offset + size) \ +return 0 ; \ +if (*begin + *len < offset) { \ + *begin += *len; \ + *len =0 ; \ + } \ + }while (0 ) + +void__iomem *mem;
+static void __iomem *mem;
drivers/char/bootcount.c line 65
Quoted 11 lines
drivers/char/bootcount.c new file +11
-0+/* +* read U-Boot bootcounter +*/ +static int +read_bootcounter_info (char *buffer,int *len,off_t * begin,off_t offset, +int size) +{ +unsigned long magic; +unsigned long counter; + +
remove second empty line
drivers/char/bootcount.c line 74
Quoted 9 lines
drivers/char/bootcount.c new file +9
-0+ magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); + counter =be32_to_cpu (readl (mem)); + +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) { +PRINT_PROC ("%lu\n" , counter); + }else { +PRINT_PROC ("bad magic: 0x%lu != 0x%lu\n" , magic, + (unsigned long )UBOOT_BOOTCOUNT_MAGIC ); + }
no need for curly braces
Quoted 5 lines
drivers/char/bootcount.c new file +5
-0+ +return 1 ; +} + +/*
drivers/char/bootcount.c line 89
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+* read U-Boot bootcounter (wrapper) +*/ +static int +read_bootcounter (char *buffer,char **start,off_t offset,int size, +int *eof,void *arg) +{ +int len =0 ; +off_t begin =0 ; + +
remove second empty line
Quoted 47 lines
drivers/char/bootcount.c new file +47
-0+ *eof =read_bootcounter_info (buffer, &len, &begin, offset, size); + +if (offset >= begin + len) +return 0 ; + + *start = buffer + (offset - begin); +return size < begin + len - offset ? size : begin + len - offset; +} + +/* +* write new value to U-Boot bootcounter +*/ +static int +write_bootcounter (struct file *file,const char *buffer,unsigned long count, +void *data) +{ +unsigned long magic; + + magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) +writel (cpu_to_be32 (simple_strtol (buffer,NULL ,10 )), mem); +else +return -EINVAL ; + +return count; +} + +/* helper for the sysFS */ +static int show_str_bootcount (struct device *device, +struct device_attribute *attr, +char *buf) +{ +int ret =0 ; +off_t begin =0 ; + +read_bootcounter_info (buf, &ret, &begin,0 ,20 ); +return ret; +} +static int store_str_bootcount (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +write_bootcounter (NULL , buf, count,NULL ); +return count; +} +static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
drivers/char/bootcount.c line 146
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ store_str_bootcount); + +static int __devinit bootcount_probe (struct platform_device *ofdev) +{ +struct device_node *np =of_node_get (ofdev->dev.of_node); +struct proc_dir_entry *bootcount; + + mem =of_iomap (np,0 ); +if (mem ==NULL ) +dev_err (&ofdev->dev,"%s couldnt map register.\n" , __func__);
return -1; ?
also applies to other error paths in this function. carrying on without the register mapped or without access to the bootcounter doesn't seem to make much sense
Quoted 64 lines
drivers/char/bootcount.c new file +64
-0+ +/* init ProcFS */ + bootcount =create_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,0600 ,NULL ); +if (bootcount ==NULL ) { +dev_err (&ofdev->dev,"\n%s (%d): cannot create /proc/%s\n" , + __FILE__, __LINE__,UBOOT_BOOTCOUNT_PROC_ENTRY ); + }else { + + bootcount->read_proc = read_bootcounter; + bootcount->write_proc = write_bootcounter; +dev_info (&ofdev->dev,"created \"/proc/%s\"\n" , +UBOOT_BOOTCOUNT_PROC_ENTRY ); + } + +if (device_create_file (&ofdev->dev, &dev_attr_bootcount)) +dev_warn (&ofdev->dev,"%s couldnt register sysFS entry.\n" , + __func__); + +return 0 ; +} + +static int __devexit bootcount_remove(struct platform_device *ofdev) +{ +BUG (); +return 0 ; +} + +static const struct of_device_id __devinitconst bootcount_match[] = { + { + .compatible ="uboot,bootcount" , + }, + {}, +}; +MODULE_DEVICE_TABLE (of, bootcount_match); + +static struct platform_driver bootcount_driver = { + .driver = { + .name ="bootcount" , + .of_match_table = bootcount_match, + .owner =THIS_MODULE , + }, + .probe = bootcount_probe, + .remove = bootcount_remove, +}; + + +static int __init uboot_bootcount_init (void ) +{ +return platform_driver_register (&bootcount_driver); +} + +static void __exit uboot_bootcount_cleanup(void) +{ +if (mem !=NULL ) +iounmap (mem); +remove_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,NULL ); +} + +module_init (uboot_bootcount_init); +module_exit (uboot_bootcount_cleanup); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Steffen Rumler <[email protected]>" ); +MODULE_DESCRIPTION ("Provide (read/write) access to the U-Boot bootcounter via PROC FS" );
Signature · 10 lines
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam
The opposite of love is not hate, it's indifference
(Elie Wiesel)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-Quoted 6 lines · Heiko Schocher
This driver implements the Linux kernel half of the boot count feature - the boot counter can only be reset after it is clear that the application has been started and is running correctly, which usually can only be determined by the application code itself. Thus the reset of the boot counter must be done by application code, which thus needs an appropriate driver.
An appropriate mechanism, not necessarily a driver, see below.
Quoted 10 lines
Required feature by the Carrier Grade Linux Requirements Definition; see for example document "Carrier Grade Linux Requirements Definition Overview V3.0" at
http://www.linuxfoundation.org/collaborate/workgroups/cgl/requirements#SMM.6.0_Boot_Cycle_Detection
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle
due to recurring failures. This detection should happen in user space before system services are started.
So, technically, a flag would be enough, not necessarily a counter? Although a counter probably has more advantages...
Quoted 2 lines
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
Why ProcFS? Why ProcFS and/or SysFS? Which has priority? Why not /dev?
Quoted 5 lines
The bootcountregister gets configured via DTS.
for example on theenbw_cmcboard:bootcount@0x23060 { compatible = "uboot,bootcount";
No. I assume you are not the vendor of what is at 0x23060, the actual device. Only the device must be encoded in the compatible-entry which then implies the bootcount functionality. Also, keep in mind that your solution should be generic for bootloaders.
Quoted 1 line
reg = <0x23060 0x20>;
I assume that non-volatile memory would qualify as a boot-counter, so those could be tied to I2C busses etc? reg would not fit then.
I do wonder if it makes more sense to add such functionality to the watchdog-core to save the additional device (CCed). Needs a second thought, though...
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Dear Wolfram,
Quoted 8 lines · in message <[email protected]> you wrote:
Quoted 5 lines
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle
due to recurring failures. This detection should happen in user space before system services are started.So, technically, a flag would be enough, not necessarily a counter? Although a counter probably has more advantages...
The real-life applications we have seen so far all required a counter. They all required to switch to a recovery mode or other alternative boot sequence after N failed boot attempts, with N > 1 in all cases.
Quoted 4 lines
Quoted 1 line
reg = <0x23060 0x20>;I assume that non-volatile memory would qualify as a boot-counter, so those could be tied to I2C busses etc? reg would not fit then.
Actually all kind of non-volatile storage can be used - it depends on specific hardware roperties. Some SoCs have registers that are guaranteed not to change theier value during a reset; on other systems we have storage or NVRAM in RTCs or similar, or we can use SRAM, or I2C or SPI attached EEPROM, or even storage on SDCard, USB or other storage devices.
This binding covers the memory type only.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] "There is nothing new under the sun, but there are lots of old things we don't know yet." - Ambrose Bierce
Heiko,
Some minor comments follow. These should touch things not yet covered by Matthias Kaehlcke or Wolfram Sang.
Quoted 6 lines · Heiko Schocher
[...]
drivers/char/Kconfig +0
-0
drivers/char/Kconfig config UV_MMTIMER · line 585
Quoted 9 lines
drivers/char/Kconfig +6
-0@@ -577,6 +577,13 @@ config UV_MMTIMER The uv_mmtimer device allows direct userspace access to the UV system timer. +config BOOTCOUNT + tristate "U-Boot Bootcount driver" + depends on OF + help + The U-Boot Bootcount driver allows to access the + bootcounter through procFS or sysFS files.
This is apparently U-Boot specific. So perhaps you could rename this to config UBOOT_BOOTCOUNT. That should make it easier to later add config [...]_BOOTCOUNT for other bootloaders and push all common stuff under config BOOTCOUNT (a rather generic name).
Quoted 10 lines
drivers/char/Kconfig +0
-0source "drivers/char/tpm/Kconfig" config TELCLOCKdrivers/char/bootcount.c new file +0
-0
drivers/char/bootcount.c line 7
Quoted 7 lines
drivers/char/bootcount.c new file +7
-0@@ -0,0 +1,210 @@ +/* +* This driver gives access(read/write) to the bootcounter used by u-boot. +* Access is supported via procFS and sysFS. +* +* Copyright 2008 DENX Software Engineering GmbH +* Author: Heiko Schocher <[email protected]> +* Based on work from: Steffen Rumler ([email protected])
Angle brackets for the email address?
Quoted 14 lines
drivers/char/bootcount.c new file +14
-0+* +* 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. +*/ + +#include <linux/capability.h> +#include <linux/device.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/mm.h> +#include <linux/mman.h> +#include <linux/module.h>
drivers/char/bootcount.c line 31
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> +#include <linux/ptrace.h> +#include <linux/uaccess.h> + +#ifndef CONFIG_PROC_FS +#error "PROC FS support must be switched-on" +#endif
Why is this error needed? Can't you depend on PROC_FS in the Kconfig file?
Quoted 13 lines
drivers/char/bootcount.c new file +13
-0+#include <linux/proc_fs.h> + +#define UBOOT_BOOTCOUNT_MAGIC_OFFSET 0x04/* offset of magic number */ +#define UBOOT_BOOTCOUNT_MAGIC 0xB001C041/* magic number value */ + +#define UBOOT_BOOTCOUNT_PROC_ENTRY "driver/bootcount" + +/* +* This macro frees the machine specific function from bounds checking and +* this like that... +*/ +#define PRINT_PROC(fmt, args...) \ + do { \
drivers/char/bootcount.c line 54
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ *len += sprintf(buffer + *len, fmt, ##args); \ +if (*begin + *len > offset + size) \ +return 0 ; \ +if (*begin + *len < offset) { \ + *begin += *len; \ + *len =0 ; \ + } \ + }while (0 ) + +void__iomem *mem;
Empty line here.
drivers/char/bootcount.c line 57
Quoted 3 lines
drivers/char/bootcount.c new file +3
-0+/* +* read U-Boot bootcounter +*/
This comment basically repeats the function name.
Quoted 14 lines
drivers/char/bootcount.c new file +14
-0+static int +read_bootcounter_info (char *buffer,int *len,off_t * begin,off_t offset, +int size) +{ +unsigned long magic; +unsigned long counter; + + + magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); + counter =be32_to_cpu (readl (mem)); + +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) { +PRINT_PROC ("%lu\n" , counter); + }else {
drivers/char/bootcount.c line 81
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+PRINT_PROC ("bad magic: 0x%lu != 0x%lu\n" , magic, + (unsigned long )UBOOT_BOOTCOUNT_MAGIC ); + } + +return 1 ; +} + +/* +* read U-Boot bootcounter (wrapper) +*/
Ditto.
Quoted 36 lines
drivers/char/bootcount.c new file +36
-0+static int +read_bootcounter (char *buffer,char **start,off_t offset,int size, +int *eof,void *arg) +{ +int len =0 ; +off_t begin =0 ; + + + *eof =read_bootcounter_info (buffer, &len, &begin, offset, size); + +if (offset >= begin + len) +return 0 ; + + *start = buffer + (offset - begin); +return size < begin + len - offset ? size : begin + len - offset; +} + +/* +* write new value to U-Boot bootcounter +*/ +static int +write_bootcounter (struct file *file,const char *buffer,unsigned long count, +void *data) +{ +unsigned long magic; + + magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) +writel (cpu_to_be32 (simple_strtol (buffer,NULL ,10 )), mem); +else +return -EINVAL ; + +return count; +} + +/* helper for the sysFS */
drivers/char/bootcount.c line 127
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+static int show_str_bootcount (struct device *device, +struct device_attribute *attr, +char *buf) +{ +int ret =0 ; +off_t begin =0 ; + +read_bootcounter_info (buf, &ret, &begin,0 ,20 ); +return ret; +}
Empty line here.
drivers/char/bootcount.c line 135
Quoted 8 lines
drivers/char/bootcount.c new file +8
-0+static int store_str_bootcount (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +write_bootcounter (NULL , buf, count,NULL ); +return count; +}
Empty line here.
Quoted 25 lines
drivers/char/bootcount.c new file +25
-0+static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount, + store_str_bootcount); + +static int __devinit bootcount_probe (struct platform_device *ofdev) +{ +struct device_node *np =of_node_get (ofdev->dev.of_node); +struct proc_dir_entry *bootcount; + + mem =of_iomap (np,0 ); +if (mem ==NULL ) +dev_err (&ofdev->dev,"%s couldnt map register.\n" , __func__); + +/* init ProcFS */ + bootcount =create_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,0600 ,NULL ); +if (bootcount ==NULL ) { +dev_err (&ofdev->dev,"\n%s (%d): cannot create /proc/%s\n" , + __FILE__, __LINE__,UBOOT_BOOTCOUNT_PROC_ENTRY ); + }else { + + bootcount->read_proc = read_bootcounter; + bootcount->write_proc = write_bootcounter; +dev_info (&ofdev->dev,"created \"/proc/%s\"\n" , +UBOOT_BOOTCOUNT_PROC_ENTRY ); + } +
drivers/char/bootcount.c line 170
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+if (device_create_file (&ofdev->dev, &dev_attr_bootcount)) +dev_warn (&ofdev->dev,"%s couldnt register sysFS entry.\n" , + __func__); + +return 0 ; +} + +static int __devexit bootcount_remove(struct platform_device *ofdev) +{ +BUG ();
Why BUG() here? And there's no comment, so someone like me - entirely unfamiliar with this stuff - who triggers this bug and checks this location will still not know what went wrong.
drivers/char/bootcount.c line 171
Quoted 1 line
drivers/char/bootcount.c new file +1
-0+return 0 ;
And can't you return non-zero here? I haven't checked this interface, but returning zero after BUG() looks odd.
Quoted 8 lines
drivers/char/bootcount.c new file +8
-0+} + +static const struct of_device_id __devinitconst bootcount_match[] = { + { + .compatible ="uboot,bootcount" , + }, + {}, +};
drivers/char/bootcount.c line 189
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+MODULE_DEVICE_TABLE (of, bootcount_match); + +static struct platform_driver bootcount_driver = { + .driver = { + .name ="bootcount" , + .of_match_table = bootcount_match, + .owner =THIS_MODULE , + }, + .probe = bootcount_probe, + .remove = bootcount_remove,
Perhaps .remove can be dropped entirely (again, I haven't checked this interface). Then the BUG() is unneeded, isn't it?
drivers/char/bootcount.c line 191
Quoted 2 lines
drivers/char/bootcount.c new file +2
-0+}; +
Drop newline here.
Quoted 7 lines
drivers/char/bootcount.c new file +7
-0+static int __init uboot_bootcount_init (void ) +{ +return platform_driver_register (&bootcount_driver); +} + +static void __exit uboot_bootcount_cleanup(void) +{
drivers/char/bootcount.c line 209
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+if (mem !=NULL ) +iounmap (mem); +remove_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,NULL ); +} + +module_init (uboot_bootcount_init); +module_exit (uboot_bootcount_cleanup); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Steffen Rumler <[email protected]>" );
In the comment at the top you're the author. Steffen is here. And Steffen is also not mailed this patch directly. Does Steffen wish to be sent messages regarding this driver in the future?
drivers/char/bootcount.c line 210
Quoted 1 line
drivers/char/bootcount.c new file +1
-0+MODULE_DESCRIPTION ("Provide (read/write) access to the U-Boot bootcounter via PROC FS" );
What happened to sysfs here?
Paul Bolle
Quoted 13 lines · Heiko Schocher
This driver implements the Linux kernel half of the boot count feature - the boot counter can only be reset after it is clear that the application has been started and is running correctly, which usually can only be determined by the application code itself. Thus the reset of the boot counter must be done by application code, which thus needs an appropriate driver.
Required feature by the Carrier Grade Linux Requirements Definition; see for example document "Carrier Grade Linux Requirements Definition Overview V3.0" at
http://www.linuxfoundation.org/collaborate/workgroups/cgl/requirements#SMM.6.0_Boot_Cycle_Detection
Quoted 7 lines
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle due to recurring failures. This detection should happen in user space before system services are started.
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
You should just support one interface. Sysfs seems much more appropriate for something like this. You should also add documentation for the sysfs interface to Documentation/ABI/ for the interface.
Quoted 49 lines
The bootcountregister gets configured via DTS.
for example on theenbw_cmcboard:bootcount@0x23060 { compatible = "uboot,bootcount"; reg = <0x23060 0x20>; };original post from:
http://old.nabble.com/-POWERPC--add-U-Boot-bootcount-driver.-td26804029.htmlSigned-off-by Heiko Schocher <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Vitaly Bordug <[email protected]>--- .../devicetree/bindings/char/bootcount.txt | 13 ++ drivers/char/Kconfig | 7 + drivers/char/Makefile | 1 + drivers/char/bootcount.c | 210 ++++++++++++++++++++ 4 files changed, 231 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/char/bootcount.txt create mode 100644 drivers/char/bootcount.cDocumentation/devicetree/bindings/char/bootcount.txt new file +13
-0@@ -0,0 +1,13 @@ +Bootcount driver + +Required properties: + + - compatible : should be "uboot,bootcount" + - reg: the address of the bootcounter + +Example: + +bootcount@1c23000 { + compatible = "uboot,bootcount"; + reg = <0x23060 0x20>; +};drivers/char/Kconfig +0
-0
drivers/char/Kconfig config UV_MMTIMER · line 580
Quoted 4 lines
drivers/char/Kconfig +1
-0@@ -577,6 +577,13 @@ config UV_MMTIMER The uv_mmtimer device allows direct userspace access to the UV system timer. +config BOOTCOUNT
Should be called UBOOT_BOOTCOUNT or similar.
drivers/char/Kconfig config UV_MMTIMER · line 582
Quoted 2 lines
drivers/char/Kconfig +2
-0+ tristate "U-Boot Bootcount driver" + depends on OF
Why does it depend on OF? Can't you pass the required information in platform_data for non-OF platforms?
drivers/char/bootcount.c
Quoted 22 lines
drivers/char/Kconfig +4
-0+ help + The U-Boot Bootcount driver allows to access the + bootcounter through procFS or sysFS files. + source "drivers/char/tpm/Kconfig" config TELCLOCKdrivers/char/Makefile +1
-0@@ -49,6 +49,7 @@ obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_GPIO_TB0219) += tb0219.o obj-$(CONFIG_TELCLOCK) += tlclk.o +obj-$(CONFIG_BOOTCOUNT) += bootcount.oobj-$(CONFIG_MWAVE) += mwave/
obj-$(CONFIG_AGP) += agp/drivers/char/bootcount.c +0
-0
Probably uboot_bootcount is a better name for the file also. Why is this in drivers char when it isn't a char device? drivers/misc might be a better place for this. I also wonder if it needs to be a driver at all, though not sure where the best place to put its sysfs files would be if not.
Someone else suggested hooking onto the existing watchdog subsystem. It might be a good idea to make a more generic bootcount interface with this as a user of it.
Quoted 22 lines
new file mode 100644
index 0000000..0ee457fdrivers/char/bootcount.c new file +17
-0@@ -0,0 +1,210 @@ +/* +* This driver gives access(read/write) to the bootcounter used by u-boot. +* Access is supported via procFS and sysFS. +* +* Copyright 2008 DENX Software Engineering GmbH +* Author: Heiko Schocher <[email protected]> +* Based on work from: Steffen Rumler ([email protected]) +* +* 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. +*/ + +#include <linux/capability.h> +#include <linux/device.h> +#include <linux/init.h>
drivers/char/bootcount.c line 27
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+#include <linux/io.h> +#include <linux/mm.h> +#include <linux/mman.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> +#include <linux/ptrace.h> +#include <linux/uaccess.h>
I don't think you need all of these headers included. Strip out the ones you aren't using.
Quoted 15 lines
drivers/char/bootcount.c new file +15
-0+ +#ifndef CONFIG_PROC_FS +#error "PROC FS support must be switched-on" +#endif +#include <linux/proc_fs.h> + +#define UBOOT_BOOTCOUNT_MAGIC_OFFSET 0x04/* offset of magic number */ +#define UBOOT_BOOTCOUNT_MAGIC 0xB001C041/* magic number value */ + +#define UBOOT_BOOTCOUNT_PROC_ENTRY "driver/bootcount" + +/* +* This macro frees the machine specific function from bounds checking and +* this like that... +*/
drivers/char/bootcount.c line 52
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+#define PRINT_PROC(fmt, args...) \ + do { \ + *len += sprintf(buffer + *len, fmt, ##args); \ + if (*begin + *len > offset + size) \ + return 0; \ + if (*begin + *len < offset) { \ + *begin += *len; \ + *len = 0; \ + } \ + } while (0)
Ick. This sort of thing should be written as a function, not a macro. You are also referring to a variable called len which is not passed in, and calling return inside a macro. Nasty.
I think the seq_file interface does what you want. However, if you just stick to sysfs, then you shouldn't need all this magic at all.
drivers/char/bootcount.c line 54
Quoted 2 lines
drivers/char/bootcount.c new file +2
-0+ +void __iomem *mem;
Static.
drivers/char/bootcount.c line 57
Quoted 3 lines
drivers/char/bootcount.c new file +3
-0+/* +* read U-Boot bootcounter +*/
Pointless comment.
drivers/char/bootcount.c line 60
Quoted 3 lines
drivers/char/bootcount.c new file +3
-0+static int +read_bootcounter_info (char *buffer,int *len,off_t * begin,off_t offset, +int size)
const char *buffer?
What are begin, offset and size for? They don't get used in this function.
drivers/char/bootcount.c line 65
Quoted 5 lines
drivers/char/bootcount.c new file +5
-0+{ +unsigned long magic; +unsigned long counter; + +
Unnecessary whitespace.
drivers/char/bootcount.c line 74
Quoted 9 lines
drivers/char/bootcount.c new file +9
-0+ magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); + counter =be32_to_cpu (readl (mem)); + +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) { +PRINT_PROC ("%lu\n" , counter); + }else { +PRINT_PROC ("bad magic: 0x%lu != 0x%lu\n" , magic, + (unsigned long )UBOOT_BOOTCOUNT_MAGIC ); + }
Don't need the braces on the if/else. In the failure case you shouldn't print anything and instead return a proper error code so that userspace can detect the failure properly.
drivers/char/bootcount.c line 76
Quoted 2 lines
drivers/char/bootcount.c new file +2
-0+ +return 1 ;
What does 1 mean?
drivers/char/bootcount.c line 81
Quoted 5 lines
drivers/char/bootcount.c new file +5
-0+} + +/* +* read U-Boot bootcounter (wrapper) +*/
Pointless comment.
drivers/char/bootcount.c line 87
Quoted 6 lines
drivers/char/bootcount.c new file +6
-0+static int +read_bootcounter (char *buffer,char **start,off_t offset,int size, +int *eof,void *arg) +{ +int len =0 ; +off_t begin =0 ;
Begin isn't used. It gets passed by reference into read_bootcount_info which does nothing with it, so it is always zero?
Oh, wait, begin is actually used by the overly magic PRINT_PROC macro. Fix it.
drivers/char/bootcount.c line 89
Quoted 2 lines
drivers/char/bootcount.c new file +2
-0+ +
Unnecessary whitespace.
drivers/char/bootcount.c line 96
Quoted 9 lines
drivers/char/bootcount.c new file +7
-0+ *eof =read_bootcounter_info (buffer, &len, &begin, offset, size); + +if (offset >= begin + len) +return 0 ; + + *start = buffer + (offset - begin); +return size < begin + len - offset ? size : begin + len - offset;
This seems to be a rather complicated way of writing:
return min(size, begin + len - offset);
?
Quoted 4 lines
drivers/char/bootcount.c new file +4
-0+} + +/* +* write new value to U-Boot bootcounter
drivers/char/bootcount.c line 110
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+*/ +static int +write_bootcounter (struct file *file,const char *buffer,unsigned long count, +void *data) +{ +unsigned long magic; + + magic =be32_to_cpu (readl (mem +UBOOT_BOOTCOUNT_MAGIC_OFFSET )); +if (magic ==UBOOT_BOOTCOUNT_MAGIC ) +writel (cpu_to_be32 (simple_strtol (buffer,NULL ,10 )), mem);
You should use strict_strtol, and check its return value.
Does it make sense to write any value to the boot counter or just zero to clear it?
Also, you should just check the UBOOT_BOOTCOUNT_MAGIC at probe time and fail the probe if it is not correct rather than checking it everytime you read or write the boot count.
drivers/char/bootcount.c line 112
Quoted 2 lines
drivers/char/bootcount.c new file +2
-0+else +return -EINVAL ;
Returning -EINVAL because the boot count magic is incorrect is a bit misleading.
drivers/char/bootcount.c line 125
Quoted 13 lines
drivers/char/bootcount.c new file +13
-0+ +return count; +} + +/* helper for the sysFS */ +static int show_str_bootcount (struct device *device, +struct device_attribute *attr, +char *buf) +{ +int ret =0 ; +off_t begin =0 ; + +read_bootcounter_info (buf, &ret, &begin,0 ,20 );
What is 20? Why is ret passed back in an argument rather than as the return value of read_bootcounter_info?
Quoted 11 lines
drivers/char/bootcount.c new file +11
-0+return ret; +} +static int store_str_bootcount (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +write_bootcounter (NULL , buf, count,NULL ); +return count; +} +static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
drivers/char/bootcount.c line 146
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ store_str_bootcount); + +static int __devinit bootcount_probe (struct platform_device *ofdev) +{ +struct device_node *np =of_node_get (ofdev->dev.of_node); +struct proc_dir_entry *bootcount; + + mem =of_iomap (np,0 ); +if (mem ==NULL ) +dev_err (&ofdev->dev,"%s couldnt map register.\n" , __func__);
You don't want to fail the probe here? You don't really need to print the value of __func__ here.
Quoted 7 lines
drivers/char/bootcount.c new file +7
-0+ +/* init ProcFS */ + bootcount =create_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,0600 ,NULL ); +if (bootcount ==NULL ) { +dev_err (&ofdev->dev,"\n%s (%d): cannot create /proc/%s\n" , + __FILE__, __LINE__,UBOOT_BOOTCOUNT_PROC_ENTRY ); + }else {
drivers/char/bootcount.c line 163
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ + bootcount->read_proc = read_bootcounter; + bootcount->write_proc = write_bootcounter; +dev_info (&ofdev->dev,"created \"/proc/%s\"\n" , +UBOOT_BOOTCOUNT_PROC_ENTRY ); + } + +if (device_create_file (&ofdev->dev, &dev_attr_bootcount)) +dev_warn (&ofdev->dev,"%s couldnt register sysFS entry.\n" , + __func__);
Again, you should fail the probe if the interface cannot be registered properly, otherwise the driver is largely useless. Get rid of the __FILE__, __LINE__, and __func__ things since they aren't really necessary and the dev_info is also mostly just syslog noise.
drivers/char/bootcount.c line 171
Quoted 8 lines
drivers/char/bootcount.c new file +8
-0+ +return 0 ; +} + +static int __devexit bootcount_remove(struct platform_device *ofdev) +{ +BUG (); +return 0 ;
Why can't you uninstall this module?
Quoted 11 lines
drivers/char/bootcount.c new file +11
-0+} + +static const struct of_device_id __devinitconst bootcount_match[] = { + { + .compatible ="uboot,bootcount" , + }, + {}, +}; +MODULE_DEVICE_TABLE (of, bootcount_match); + +static struct platform_driver bootcount_driver = {
drivers/char/bootcount.c line 192
Quoted 10 lines
drivers/char/bootcount.c new file +10
-0+ .driver = { + .name = "bootcount", + .of_match_table = bootcount_match, + .owner = THIS_MODULE, + }, + .probe = bootcount_probe, + .remove = bootcount_remove, +}; + +
Remove second blank line.
drivers/char/bootcount.c line 201
Quoted 9 lines
drivers/char/bootcount.c new file +9
-0+static int __init uboot_bootcount_init (void ) +{ +return platform_driver_register (&bootcount_driver); +} + +static void __exit uboot_bootcount_cleanup(void) +{ +if (mem !=NULL ) +iounmap (mem);
Why would mem be NULL?
drivers/char/bootcount.c line 202
Quoted 1 line
drivers/char/bootcount.c new file +1
-0+remove_proc_entry (UBOOT_BOOTCOUNT_PROC_ENTRY ,NULL );
Remove the sysfs file?
Quoted 8 lines
drivers/char/bootcount.c new file +8
-0+} + +module_init (uboot_bootcount_init); +module_exit (uboot_bootcount_cleanup); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Steffen Rumler <[email protected]>" ); +MODULE_DESCRIPTION ("Provide (read/write) access to the U-Boot bootcounter via PROC FS" );
Quoted 1 line · Wolfram Sang
On Sun, Dec 04, 2011 at 10:45:21AM +0100, Heiko Schocher wrote:
[...]
Quoted 4 lines
Quoted 1 line
reg = <0x23060 0x20>;I assume that non-volatile memory would qualify as a boot-counter, so those could be tied to I2C busses etc? reg would not fit then.
This is not really on-topic, but in the device-tree the "reg" property is used to encode an I2C device's slave address.
Thierry
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
Hello Wolfram,
Quoted 21 lines · Wolfram Sang
Quoted 6 lines · Heiko Schocher
This driver implements the Linux kernel half of the boot count feature - the boot counter can only be reset after it is clear that the application has been started and is running correctly, which usually can only be determined by the application code itself. Thus the reset of the boot counter must be done by application code, which thus needs an appropriate driver.
An appropriate mechanism, not necessarily a driver, see below.
Quoted 10 lines
Required feature by the Carrier Grade Linux Requirements Definition; see for example document "Carrier Grade Linux Requirements Definition Overview V3.0" at
http://www.linuxfoundation.org/collaborate/workgroups/cgl/requirements#SMM.6.0_Boot_Cycle_Detection
Description: OSDL CGL specifies that carrier grade Linux shall provide support for detecting a repeating reboot cycle
due to recurring failures. This detection should happen in user space before system services are started.
Quoted 7 lines
So, technically, a flag would be enough, not necessarily a counter? Although a counter probably has more advantages...
Quoted 2 lines
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
Why ProcFS? Why ProcFS and/or SysFS? Which has priority? Why not /dev?
I drop the ProcFS support for v2.
Quoted 10 lines
Quoted 5 lines
The bootcountregister gets configured via DTS.
for example on theenbw_cmcboard:bootcount@0x23060 { compatible = "uboot,bootcount";No. I assume you are not the vendor of what is at
0x23060, the actual device. Only the device must be encoded in the compatible-entry which then implies the bootcount functionality. Also, keep in mind that your solution should be generic for bootloaders.
So I should call it compatible = "generic, bootcount" ?
Quoted 4 lines
Quoted 1 line
reg = <0x23060 0x20>;I assume that non-volatile memory would qualify as a boot-counter, so those could be tied to I2C busses etc? reg would not fit then.
Currently, mem only supported, add this to the Documentation and log message.
Quoted 3 lines
I do wonder if it makes more sense to add such functionality to the watchdog-core to save the additional device (CCed). Needs a second thought, though...
Thanks!
bye,
heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi Heiko,
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This driver provides read/write access to the U-Boot bootcounter through PROC FS and/or sysFS file.
Why ProcFS? Why ProcFS and/or SysFS? Which has priority? Why not /dev?
I drop the ProcFS support for v2.
Don't bother. This approach starts from the wrong side.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
The bootcountregister gets configured via DTS.
for example on theenbw_cmcboard:bootcount@0x23060 { compatible = "uboot,bootcount";
Quoted 6 lines
Quoted 4 lines
No. I assume you are not the vendor of what is at
0x23060, the actual device. Only the device must be encoded in the compatible-entry which then implies the bootcount functionality. Also, keep in mind that your solution should be generic for bootloaders.So I should call it compatible = "generic, bootcount" ?
Nope, you should give it the name of the device. Remember that 'compatible' is no 1:1 replacement for platform_driver-binding. Check
http://devicetree.org/Device_Tree_Usage, especially the sections about the compatible-property.
bootcount itself is not a device. It is a feature of certain devices. And that needs to be implemented; possibly generic enough that it can work for register based, i2c based, and so forth, accesses.
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Dear Wolfram,
Quoted 4 lines · In message <[email protected]>…
bootcount itself is not a device. It is a feature of certain devices. And that needs to be implemented; possibly generic enough that it can work for register based, i2c based, and so forth, accesses.
If "boot counter" is not a good name for such a device, then what name would you suggest?
Or do you think a counter (which can be implemented in a number of different ways, depending on hardware specifics) is not a device? What would be such a device, then?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] "How is this place run - is it an anarchy?" "No, I wouldn't say so; it is not that well organised..."
Quoted 7 lines
Quoted 4 lines
bootcount itself is not a device. It is a feature of certain devices. And that needs to be implemented; possibly generic enough that it can work for register based, i2c based, and so forth, accesses.
If "boot counter" is not a good name for such a device, then what name would you suggest?
None.
Quoted 2 lines
Or do you think a counter (which can be implemented in a number of different ways, depending on hardware specifics) is not a device?
Yes.
Quoted 1 line
What would be such a device, then?
"maxim,ds1338"
Please have a look at the devicetree.org-wiki-page I just mentioned:
http://devicetree.org/Device_Tree_Usage
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 15 lines · Wolfram Sang
Quoted 7 lines
Quoted 4 lines
bootcount itself is not a device. It is a feature of certain devices. And that needs to be implemented; possibly generic enough that it can work for register based, i2c based, and so forth, accesses.
If "boot counter" is not a good name for such a device, then what name would you suggest?
None.
Quoted 2 lines
Or do you think a counter (which can be implemented in a number of different ways, depending on hardware specifics) is not a device?
Yes.
Quoted 8 lines
Quoted 1 line
What would be such a device, then?
"maxim,ds1338"
Please have a look at the devicetree.org-wiki-page I just mentioned:
Perhaps fs/pstore would be a good choice for the user space interface (defining a new file bootcount). This can support any arbitrary backing device although pretty much only ACPI is implemented.
Rob
Hello Rob,
Sorry for the late reply ...
Quoted 15 lines · Rob Herring
Quoted 14 lines · Wolfram Sang
Quoted 5 lines
Quoted 3 lines
bootcount itself is not a device. It is a feature of certain devices. And that needs to be implemented; possibly generic enough that it can work for register based, i2c based, and so forth, accesses.
If "boot counter" is not a good name for such a device, then what name would you suggest?
None.
Quoted 2 lines
Or do you think a counter (which can be implemented in a number of different ways, depending on hardware specifics) is not a device?
Yes.
Quoted 1 line
What would be such a device, then?
"maxim,ds1338"
Quoted 8 lines
Quoted 4 lines
Please have a look at the devicetree.org-wiki-page I just mentioned:
Perhaps fs/pstore would be a good choice for the user space interface (defining a new file bootcount). This can support any arbitrary backing device although pretty much only ACPI is implemented.
I tried to use fs/pstore for the bootcount feature, and I can mount and read the bootcount value from the file, I created. But I could not write to that file ... I only see the callback from include/linux/pstore.h
struct pstore_info {
[...]
int (*write)(enum pstore_type_id type,
enum kmsg_dump_reason reason, u64 *id, unsigned int part, size_t size, struct pstore_info *psi);
called, if I reboot ... do I miss something? Or is it not possible to write to the files created through fs/pstore?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany