blob: b76e33629098728cf81f89192a70d178e9ab4738 [file] [log] [blame]
Dan Williamsb94d5232015-05-19 22:54:31 -04001/*
2 * NVDIMM Firmware Interface Table - NFIT
3 *
4 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15#ifndef __NFIT_H__
16#define __NFIT_H__
17#include <linux/libnvdimm.h>
18#include <linux/types.h>
19#include <linux/uuid.h>
20#include <linux/acpi.h>
21#include <acpi/acuuid.h>
22
23#define UUID_NFIT_BUS "2f10e7a4-9e91-11e4-89d3-123b93f75cba"
24#define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66"
25
26enum nfit_uuids {
27 NFIT_SPA_VOLATILE,
28 NFIT_SPA_PM,
29 NFIT_SPA_DCR,
30 NFIT_SPA_BDW,
31 NFIT_SPA_VDISK,
32 NFIT_SPA_VCD,
33 NFIT_SPA_PDISK,
34 NFIT_SPA_PCD,
35 NFIT_DEV_BUS,
36 NFIT_DEV_DIMM,
37 NFIT_UUID_MAX,
38};
39
40struct nfit_spa {
41 struct acpi_nfit_system_address *spa;
42 struct list_head list;
43};
44
45struct nfit_dcr {
46 struct acpi_nfit_control_region *dcr;
47 struct list_head list;
48};
49
50struct nfit_bdw {
51 struct acpi_nfit_data_region *bdw;
52 struct list_head list;
53};
54
55struct nfit_memdev {
56 struct acpi_nfit_memory_map *memdev;
57 struct list_head list;
58};
59
60/* assembled tables for a given dimm/memory-device */
61struct nfit_mem {
Dan Williamse6dfb2d2015-04-25 03:56:17 -040062 struct nvdimm *nvdimm;
Dan Williamsb94d5232015-05-19 22:54:31 -040063 struct acpi_nfit_memory_map *memdev_dcr;
64 struct acpi_nfit_memory_map *memdev_pmem;
65 struct acpi_nfit_control_region *dcr;
66 struct acpi_nfit_data_region *bdw;
67 struct acpi_nfit_system_address *spa_dcr;
68 struct acpi_nfit_system_address *spa_bdw;
69 struct list_head list;
Dan Williams62232e452015-06-08 14:27:06 -040070 struct acpi_device *adev;
71 unsigned long dsm_mask;
Dan Williamsb94d5232015-05-19 22:54:31 -040072};
73
74struct acpi_nfit_desc {
75 struct nvdimm_bus_descriptor nd_desc;
76 struct acpi_table_nfit *nfit;
77 struct list_head memdevs;
78 struct list_head dimms;
79 struct list_head spas;
80 struct list_head dcrs;
81 struct list_head bdws;
82 struct nvdimm_bus *nvdimm_bus;
83 struct device *dev;
Dan Williams62232e452015-06-08 14:27:06 -040084 unsigned long dimm_dsm_force_en;
Dan Williamsb94d5232015-05-19 22:54:31 -040085};
86
87static inline struct acpi_nfit_memory_map *__to_nfit_memdev(
88 struct nfit_mem *nfit_mem)
89{
90 if (nfit_mem->memdev_dcr)
91 return nfit_mem->memdev_dcr;
92 return nfit_mem->memdev_pmem;
93}
Dan Williams45def222015-04-26 19:26:48 -040094
95static inline struct acpi_nfit_desc *to_acpi_desc(
96 struct nvdimm_bus_descriptor *nd_desc)
97{
98 return container_of(nd_desc, struct acpi_nfit_desc, nd_desc);
99}
Dan Williamsb94d5232015-05-19 22:54:31 -0400100#endif /* __NFIT_H__ */