Commit 7c237880 authored by Jean Delvare's avatar Jean Delvare

firmware: dmi: Add dmi_memdev_handle

Add a utility function dmi_memdev_handle() which returns the DMI
handle associated with a given memory slot. This will allow kernel
drivers to iterate over the memory slots.
Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
parent 9e0afe39
...@@ -1151,3 +1151,19 @@ u8 dmi_memdev_type(u16 handle) ...@@ -1151,3 +1151,19 @@ u8 dmi_memdev_type(u16 handle)
return 0x0; /* Not a valid value */ return 0x0; /* Not a valid value */
} }
EXPORT_SYMBOL_GPL(dmi_memdev_type); EXPORT_SYMBOL_GPL(dmi_memdev_type);
/**
* dmi_memdev_handle - get the DMI handle of a memory slot
* @slot: slot number
*
* Return the DMI handle associated with a given memory slot, or %0xFFFF
* if there is no such slot.
*/
u16 dmi_memdev_handle(int slot)
{
if (dmi_memdev && slot >= 0 && slot < dmi_memdev_nr)
return dmi_memdev[slot].handle;
return 0xffff; /* Not a valid value */
}
EXPORT_SYMBOL_GPL(dmi_memdev_handle);
...@@ -114,6 +114,7 @@ extern bool dmi_match(enum dmi_field f, const char *str); ...@@ -114,6 +114,7 @@ extern bool dmi_match(enum dmi_field f, const char *str);
extern void dmi_memdev_name(u16 handle, const char **bank, const char **device); extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
extern u64 dmi_memdev_size(u16 handle); extern u64 dmi_memdev_size(u16 handle);
extern u8 dmi_memdev_type(u16 handle); extern u8 dmi_memdev_type(u16 handle);
extern u16 dmi_memdev_handle(int slot);
#else #else
...@@ -144,6 +145,7 @@ static inline void dmi_memdev_name(u16 handle, const char **bank, ...@@ -144,6 +145,7 @@ static inline void dmi_memdev_name(u16 handle, const char **bank,
const char **device) { } const char **device) { }
static inline u64 dmi_memdev_size(u16 handle) { return ~0ul; } static inline u64 dmi_memdev_size(u16 handle) { return ~0ul; }
static inline u8 dmi_memdev_type(u16 handle) { return 0x0; } static inline u8 dmi_memdev_type(u16 handle) { return 0x0; }
static inline u16 dmi_memdev_handle(int slot) { return 0xffff; }
static inline const struct dmi_system_id * static inline const struct dmi_system_id *
dmi_first_match(const struct dmi_system_id *list) { return NULL; } dmi_first_match(const struct dmi_system_id *list) { return NULL; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment