#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/module.h>
+#include <linux/version.h>
#include <linux/pstore.h>
#include <linux/time.h>
#include <linux/io.h>
for (i = 0; i < cxt->max_dump_cnt; i++) {
size_t sz = cxt->record_size;
- cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc_size);
+ cxt->przs[i] = persistent_ram_new(*paddr, sz, 0, cxt->ecc_size);
if (IS_ERR(cxt->przs[i])) {
err = PTR_ERR(cxt->przs[i]);
dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
struct persistent_ram_zone **prz,
- phys_addr_t *paddr, size_t sz)
+ phys_addr_t *paddr, size_t sz, u32 sig)
{
if (!sz)
return 0;
if (*paddr + sz > *paddr + cxt->size)
return -ENOMEM;
- *prz = persistent_ram_new(*paddr, sz, cxt->ecc_size);
+ *prz = persistent_ram_new(*paddr, sz, sig, cxt->ecc_size);
if (IS_ERR(*prz)) {
int err = PTR_ERR(*prz);
if (err)
goto fail_out;
- err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr, cxt->console_size);
+ err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr,
+ cxt->console_size, 0);
if (err)
goto fail_init_cprz;
- err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size);
+ err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size,
+ LINUX_VERSION_CODE);
if (err)
goto fail_init_fprz;
}
static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz,
- int ecc_size)
+ u32 sig, int ecc_size)
{
int ret;
if (ret)
return ret;
- if (prz->buffer->sig == PERSISTENT_RAM_SIG) {
+ sig ^= PERSISTENT_RAM_SIG;
+
+ if (prz->buffer->sig == sig) {
if (buffer_size(prz) > prz->buffer_size ||
buffer_start(prz) > buffer_size(prz))
pr_info("persistent_ram: found existing invalid buffer,"
" (sig = 0x%08x)\n", prz->buffer->sig);
}
- prz->buffer->sig = PERSISTENT_RAM_SIG;
+ prz->buffer->sig = sig;
persistent_ram_zap(prz);
return 0;
}
struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start,
- size_t size,
+ size_t size, u32 sig,
int ecc_size)
{
struct persistent_ram_zone *prz;
if (ret)
goto err;
- ret = persistent_ram_post_init(prz, ecc_size);
+ ret = persistent_ram_post_init(prz, sig, ecc_size);
if (ret)
goto err;