Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/nvdimm/nvdimm.c
Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (index < 0 || index >= NVDIMM_ROOT_IVAR_MAX) | if (index < 0 || index >= NVDIMM_ROOT_IVAR_MAX) | ||||
return (ENOENT); | return (ENOENT); | ||||
((uintptr_t *)device_get_ivars(child))[index] = value; | ((uintptr_t *)device_get_ivars(child))[index] = value; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | |||||
nvdimm_root_child_location_str(device_t dev, device_t child, char *buf, | |||||
size_t buflen) | |||||
{ | |||||
ACPI_HANDLE handle; | |||||
int res; | |||||
handle = nvdimm_root_get_acpi_handle(child); | |||||
if (handle != NULL) | |||||
res = snprintf(buf, buflen, "handle=%s", acpi_name(handle)); | |||||
else | |||||
res = snprintf(buf, buflen, "unknown"); | |||||
if (res >= buflen) | |||||
return (EOVERFLOW); | |||||
return (0); | |||||
} | |||||
static device_method_t nvdimm_methods[] = { | static device_method_t nvdimm_methods[] = { | ||||
DEVMETHOD(device_probe, nvdimm_probe), | DEVMETHOD(device_probe, nvdimm_probe), | ||||
DEVMETHOD(device_attach, nvdimm_attach), | DEVMETHOD(device_attach, nvdimm_attach), | ||||
DEVMETHOD(device_detach, nvdimm_detach), | DEVMETHOD(device_detach, nvdimm_detach), | ||||
DEVMETHOD(device_suspend, nvdimm_suspend), | DEVMETHOD(device_suspend, nvdimm_suspend), | ||||
DEVMETHOD(device_resume, nvdimm_resume), | DEVMETHOD(device_resume, nvdimm_resume), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t nvdimm_driver = { | static driver_t nvdimm_driver = { | ||||
"nvdimm", | "nvdimm", | ||||
nvdimm_methods, | nvdimm_methods, | ||||
sizeof(struct nvdimm_dev), | sizeof(struct nvdimm_dev), | ||||
}; | }; | ||||
static device_method_t nvdimm_root_methods[] = { | static device_method_t nvdimm_root_methods[] = { | ||||
DEVMETHOD(device_probe, nvdimm_root_probe), | DEVMETHOD(device_probe, nvdimm_root_probe), | ||||
DEVMETHOD(device_attach, nvdimm_root_attach), | DEVMETHOD(device_attach, nvdimm_root_attach), | ||||
DEVMETHOD(device_detach, nvdimm_root_detach), | DEVMETHOD(device_detach, nvdimm_root_detach), | ||||
DEVMETHOD(bus_add_child, bus_generic_add_child), | DEVMETHOD(bus_add_child, bus_generic_add_child), | ||||
DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar), | DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar), | ||||
DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar), | DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar), | ||||
DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str), | |||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t nvdimm_root_driver = { | static driver_t nvdimm_root_driver = { | ||||
"nvdimm_root", | "nvdimm_root", | ||||
nvdimm_root_methods, | nvdimm_root_methods, | ||||
sizeof(struct nvdimm_root_dev), | sizeof(struct nvdimm_root_dev), | ||||
}; | }; | ||||
DRIVER_MODULE(nvdimm_root, acpi, nvdimm_root_driver, nvdimm_root_devclass, NULL, | DRIVER_MODULE(nvdimm_root, acpi, nvdimm_root_driver, nvdimm_root_devclass, NULL, | ||||
NULL); | NULL); | ||||
DRIVER_MODULE(nvdimm, nvdimm_root, nvdimm_driver, nvdimm_devclass, NULL, NULL); | DRIVER_MODULE(nvdimm, nvdimm_root, nvdimm_driver, nvdimm_devclass, NULL, NULL); | ||||
MODULE_DEPEND(nvdimm, acpi, 1, 1, 1); | MODULE_DEPEND(nvdimm, acpi, 1, 1, 1); |