Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 26 | enum 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 | |
| 40 | struct nfit_spa { |
| 41 | struct acpi_nfit_system_address *spa; |
| 42 | struct list_head list; |
| 43 | }; |
| 44 | |
| 45 | struct nfit_dcr { |
| 46 | struct acpi_nfit_control_region *dcr; |
| 47 | struct list_head list; |
| 48 | }; |
| 49 | |
| 50 | struct nfit_bdw { |
| 51 | struct acpi_nfit_data_region *bdw; |
| 52 | struct list_head list; |
| 53 | }; |
| 54 | |
| 55 | struct 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 */ |
| 61 | struct nfit_mem { |
Dan Williams | e6dfb2d | 2015-04-25 03:56:17 -0400 | [diff] [blame] | 62 | struct nvdimm *nvdimm; |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 63 | 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 Williams | 62232e45 | 2015-06-08 14:27:06 -0400 | [diff] [blame^] | 70 | struct acpi_device *adev; |
| 71 | unsigned long dsm_mask; |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | struct 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 Williams | 62232e45 | 2015-06-08 14:27:06 -0400 | [diff] [blame^] | 84 | unsigned long dimm_dsm_force_en; |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | static 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 Williams | 45def22 | 2015-04-26 19:26:48 -0400 | [diff] [blame] | 94 | |
| 95 | static 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 Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 100 | #endif /* __NFIT_H__ */ |