blob: 14415aff18136524cfa3d4c9b07bdde6ee0d6f54 [file] [log] [blame]
Christoph Hellwigec776ef2015-04-01 09:12:18 +02001/*
2 * Copyright (c) 2015, Christoph Hellwig.
Dan Williams9f53f9f2015-06-09 15:33:45 -04003 * Copyright (c) 2015, Intel Corporation.
Christoph Hellwigec776ef2015-04-01 09:12:18 +02004 */
Christoph Hellwigec776ef2015-04-01 09:12:18 +02005#include <linux/platform_device.h>
Dan Williams9f53f9f2015-06-09 15:33:45 -04006#include <linux/module.h>
Dan Williamsbc0d0d02015-11-30 09:10:33 -08007#include <linux/ioport.h>
8
9static int found(u64 start, u64 end, void *data)
10{
11 return 1;
12}
Dan Williams9f53f9f2015-06-09 15:33:45 -040013
14static __init int register_e820_pmem(void)
Christoph Hellwigec776ef2015-04-01 09:12:18 +020015{
Dan Williamsbc0d0d02015-11-30 09:10:33 -080016 char *pmem = "Persistent Memory (legacy)";
Dan Williams7a678322015-08-19 00:34:34 -040017 struct platform_device *pdev;
Dan Williamsbc0d0d02015-11-30 09:10:33 -080018 int rc;
19
20 rc = walk_iomem_res(pmem, IORESOURCE_MEM, 0, -1, NULL, found);
21 if (rc <= 0)
22 return 0;
Dan Williams9f53f9f2015-06-09 15:33:45 -040023
Dan Williams7a678322015-08-19 00:34:34 -040024 /*
25 * See drivers/nvdimm/e820.c for the implementation, this is
26 * simply here to trigger the module to load on demand.
27 */
28 pdev = platform_device_alloc("e820_pmem", -1);
29 return platform_device_add(pdev);
Christoph Hellwigec776ef2015-04-01 09:12:18 +020030}
Dan Williams9f53f9f2015-06-09 15:33:45 -040031device_initcall(register_e820_pmem);