pmem.c 715 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2015, Christoph Hellwig.
  3. * Copyright (c) 2015, Intel Corporation.
  4. */
  5. #include <linux/platform_device.h>
  6. #include <linux/module.h>
  7. #include <linux/ioport.h>
  8. static int found(u64 start, u64 end, void *data)
  9. {
  10. return 1;
  11. }
  12. static __init int register_e820_pmem(void)
  13. {
  14. char *pmem = "Persistent Memory (legacy)";
  15. struct platform_device *pdev;
  16. int rc;
  17. rc = walk_iomem_res(pmem, IORESOURCE_MEM, 0, -1, NULL, found);
  18. if (rc <= 0)
  19. return 0;
  20. /*
  21. * See drivers/nvdimm/e820.c for the implementation, this is
  22. * simply here to trigger the module to load on demand.
  23. */
  24. pdev = platform_device_alloc("e820_pmem", -1);
  25. return platform_device_add(pdev);
  26. }
  27. device_initcall(register_e820_pmem);