Page MenuHomeFreeBSD

nvdimm: factor out NFIT table walking
Needs ReviewPublic

Authored by scott.d.phillips_intel.com on Wed, Dec 5, 5:33 PM.

Details

Reviewers
kib
bwidawsk
Summary

Factor the NFIT table walking logic into a handful of helper
functions which pass back a temporarily malloc'd array of
pointers.

The complexity tradeoff of embedded-walks vs factored-out-walks in
the existing logic is mostly neutral, but the complexity win will
come with upcoming namespace support where we would need to do
three nested walks to correlate each SPA with many NVDIMM Region
Mapping Structures, and then each of those regions with an NVDIMM
Control Region Structure.

Notably, this change allows us to modify the way in which NVDIMM
devices are enumerated. Previously, we would create an NVDIMM
device for each child of the ACPI NVDIMM root device. On many
systems (and allowed by the spec), these child devices only
represent a slot where an NVDIMM could possibly be plugged in.
With this change, we have the acpi_nfit_get_dimm_ids() function
which walks SPAs, to regions, to control regions to find actually
present NVDIMMs.

Test Plan

kldload nvdimm, see all the same spas as before, see only dimm devices for present dimms.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

FYI, this diff is on top of D18346

scott.d.phillips_intel.com edited the summary of this revision. (Show Details)

rebase diff so that it is no longer against D18346

sys/dev/nvdimm/nvdimm.c
170

Here we also need AcpiAttachData(handle, acpi_fake_objhandler, child); so that acpi_get_device() can work in nvdimm_find_by_handle()