list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) {
__nvdimm_create();
}
acpi_nfit_desc
+-----------------------------------------------+
|dimms | a list of nfit_mem
| (struct list_head) | parsed from above spa & memdevs
| +------------------------------------------+
| |nvdimm | *
| | (struct nvdimm*) |
| | +------------------------------------+
| | |dev |
| | | (struct device) |
| | | +--------------------------------+
| | | |name | = "nmem%d"
| | | |groups | = acpi_nfit_dimm_attribute_groups
| | | | |
| | | |driver_data | = struct nvdimm_drvdata
| | | | (void*) |
| | | | +-----------------------------+
| | | | |dev |
| | | | | (struct device*) |
| | | | |ns_current, ns_next |
| | | | |nslabel_size | = 128
| | | | | (int) |
| | | | |nsarea |
| | | | | (nd_cmd_get_config_size)|
| | | | |data | config data
| | | | | (void*) | namespace index + namespace label
| | | | |dpa | created from namespace label
| | | | | (struct resource) | from nvdimm_drvdata->data
| | | | +-----------------------------+
| | | | |
| | | +--------------------------------+
| | |provider_data | = nfit_mem
| | | (void*) |
| | |flush_wpq |
| | | (struct resource*) |
| | |dwork |
| | | (struct delayed_work) |
| | |sec.ops |
| | | |
| | | |
| +-----+------------------------------------+
| |memdev_dcr |
| |memdev_pmem |
| |memdev_bdw |
| | (struct acpi_nfit_memory_map) |
| | |
| +------------------------------------------+
| |
+-----------------------------------------------+
在这个数据结构的部分截取中可以看到,acpi_nfit_desc中包含了一个类型为nfit_mem的链表。而函数acpi_nfit_register_dimms就是根据这个链表来构造硬件相对无关的nvdimm数据。