#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pstore.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/compiler.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/mm.h>
#include "internal.h"
#include "ram_internal.h"
#define RAMOOPS_KERNMSG_HDR …
#define MIN_MEM_SIZE …
static ulong record_size = …;
module_param(record_size, ulong, 0400);
MODULE_PARM_DESC(…) …;
static ulong ramoops_console_size = …;
module_param_named(console_size, ramoops_console_size, ulong, 0400);
MODULE_PARM_DESC(…) …;
static ulong ramoops_ftrace_size = …;
module_param_named(ftrace_size, ramoops_ftrace_size, ulong, 0400);
MODULE_PARM_DESC(…) …;
static ulong ramoops_pmsg_size = …;
module_param_named(pmsg_size, ramoops_pmsg_size, ulong, 0400);
MODULE_PARM_DESC(…) …;
static unsigned long long mem_address;
module_param_hw(mem_address, ullong, other, 0400);
MODULE_PARM_DESC(…) …;
static char *mem_name;
module_param_named(mem_name, mem_name, charp, 0400);
MODULE_PARM_DESC(…) …;
static ulong mem_size;
module_param(mem_size, ulong, 0400);
MODULE_PARM_DESC(…) …;
static unsigned int mem_type;
module_param(mem_type, uint, 0400);
MODULE_PARM_DESC(…) …;
static int ramoops_max_reason = …;
module_param_named(max_reason, ramoops_max_reason, int, 0400);
MODULE_PARM_DESC(…) …;
static int ramoops_ecc;
module_param_named(ecc, ramoops_ecc, int, 0400);
MODULE_PARM_DESC(…) …;
static int ramoops_dump_oops = …;
module_param_named(dump_oops, ramoops_dump_oops, int, 0400);
MODULE_PARM_DESC(…) …;
struct ramoops_context { … };
static struct platform_device *dummy;
static int ramoops_pstore_open(struct pstore_info *psi)
{ … }
static struct persistent_ram_zone *
ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
struct pstore_record *record)
{ … }
static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
bool *compressed)
{ … }
static bool prz_ok(struct persistent_ram_zone *prz)
{ … }
static ssize_t ramoops_pstore_read(struct pstore_record *record)
{ … }
static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz,
struct pstore_record *record)
{ … }
static int notrace ramoops_pstore_write(struct pstore_record *record)
{ … }
static int notrace ramoops_pstore_write_user(struct pstore_record *record,
const char __user *buf)
{ … }
static int ramoops_pstore_erase(struct pstore_record *record)
{ … }
static struct ramoops_context oops_cxt = …;
static void ramoops_free_przs(struct ramoops_context *cxt)
{ … }
static int ramoops_init_przs(const char *name,
struct device *dev, struct ramoops_context *cxt,
struct persistent_ram_zone ***przs,
phys_addr_t *paddr, size_t mem_sz,
ssize_t record_size,
unsigned int *cnt, u32 sig, u32 flags)
{ … }
static int ramoops_init_prz(const char *name,
struct device *dev, struct ramoops_context *cxt,
struct persistent_ram_zone **prz,
phys_addr_t *paddr, size_t sz, u32 sig)
{ … }
static int ramoops_parse_dt_u32(struct platform_device *pdev,
const char *propname,
u32 default_value, u32 *value)
{ … }
static int ramoops_parse_dt(struct platform_device *pdev,
struct ramoops_platform_data *pdata)
{ … }
static int ramoops_probe(struct platform_device *pdev)
{ … }
static void ramoops_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id dt_match[] = …;
MODULE_DEVICE_TABLE(of, dt_match);
static struct platform_driver ramoops_driver = …;
static inline void ramoops_unregister_dummy(void)
{ … }
static void __init ramoops_register_dummy(void)
{ … }
static int __init ramoops_init(void)
{ … }
postcore_initcall(ramoops_init);
static void __exit ramoops_exit(void)
{ … }
module_exit(ramoops_exit);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;