drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c- Extension
.c- Size
- 13206 bytes
- Lines
- 453
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bioscfg.h
Detected Declarations
function current_value_showfunction validate_enumeration_inputfunction update_enumeration_valuefunction type_showfunction hp_alloc_enumeration_datafunction hp_populate_enumeration_elements_from_packagefunction hp_populate_enumeration_package_datafunction hp_populate_enumeration_elements_from_bufferfunction hp_populate_enumeration_buffer_datafunction hp_exit_enumeration_attributes
Annotated Snippet
switch (enum_obj[elem].type) {
case ACPI_TYPE_STRING:
if (PREREQUISITES != elem && ENUM_POSSIBLE_VALUES != elem) {
ret = hp_convert_hexstr_to_str(enum_obj[elem].string.pointer,
enum_obj[elem].string.length,
&str_value, &value_len);
if (ret)
return -EINVAL;
}
break;
case ACPI_TYPE_INTEGER:
int_value = (u32)enum_obj[elem].integer.value;
break;
default:
pr_warn("Unsupported object type [%d]\n", enum_obj[elem].type);
continue;
}
/* Check that both expected and read object type match */
if (expected_enum_types[eloc] != enum_obj[elem].type) {
pr_err("Error expected type %d for elem %d, but got type %d instead\n",
expected_enum_types[eloc], elem, enum_obj[elem].type);
kfree(str_value);
return -EIO;
}
/* Assign appropriate element value to corresponding field */
switch (eloc) {
case NAME:
case VALUE:
break;
case PATH:
strscpy(enum_data->common.path, str_value);
break;
case IS_READONLY:
enum_data->common.is_readonly = int_value;
break;
case DISPLAY_IN_UI:
enum_data->common.display_in_ui = int_value;
break;
case REQUIRES_PHYSICAL_PRESENCE:
enum_data->common.requires_physical_presence = int_value;
break;
case SEQUENCE:
enum_data->common.sequence = int_value;
break;
case PREREQUISITES_SIZE:
if (int_value > MAX_PREREQUISITES_SIZE) {
pr_warn("Prerequisites size value exceeded the maximum number of elements supported or data may be malformed\n");
int_value = MAX_PREREQUISITES_SIZE;
}
enum_data->common.prerequisites_size = int_value;
/*
* This step is needed to keep the expected
* element list pointing to the right obj[elem].type
* when the size is zero. PREREQUISITES
* object is omitted by BIOS when the size is
* zero.
*/
if (int_value == 0)
eloc++;
break;
case PREREQUISITES:
size = min_t(u32, enum_data->common.prerequisites_size, MAX_PREREQUISITES_SIZE);
for (reqs = 0; reqs < size; reqs++) {
if (elem + reqs >= enum_obj_count) {
pr_err("Error enum-objects package is too small\n");
return -EINVAL;
}
ret = hp_convert_hexstr_to_str(enum_obj[elem + reqs].string.pointer,
enum_obj[elem + reqs].string.length,
&str_value, &value_len);
if (ret)
return -EINVAL;
strscpy(enum_data->common.prerequisites[reqs], str_value);
kfree(str_value);
str_value = NULL;
}
break;
case SECURITY_LEVEL:
enum_data->common.security_level = int_value;
break;
Annotation
- Immediate include surface: `bioscfg.h`.
- Detected declarations: `function current_value_show`, `function validate_enumeration_input`, `function update_enumeration_value`, `function type_show`, `function hp_alloc_enumeration_data`, `function hp_populate_enumeration_elements_from_package`, `function hp_populate_enumeration_package_data`, `function hp_populate_enumeration_elements_from_buffer`, `function hp_populate_enumeration_buffer_data`, `function hp_exit_enumeration_attributes`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.