drivers/firmware/arm_scmi/quirks.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/quirks.c- Extension
.c- Size
- 9092 bytes
- Lines
- 325
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ctype.hlinux/cleanup.hlinux/device.hlinux/export.hlinux/hashtable.hlinux/kstrtox.hlinux/of.hlinux/slab.hlinux/static_key.hlinux/string.hlinux/stringhash.hlinux/types.hquirks.h
Detected Declarations
struct scmi_quirkfunction scmi_quirk_signaturefunction scmi_quirk_range_parsefunction scmi_quirks_initializefunction scmi_quirks_enablefunction hash_for_each_possible
Annotated Snippet
struct scmi_quirk {
bool enabled;
const char *name;
const char *vendor;
const char *sub_vendor_id;
const char *impl_ver_range;
u32 start_range;
u32 end_range;
struct static_key_false *key;
struct hlist_node hash;
unsigned int hkey;
const char *const compats[];
};
#define __DEFINE_SCMI_QUIRK_ENTRY(_qn, _ven, _sub, _impl, ...) \
static struct scmi_quirk scmi_quirk_entry_ ## _qn = { \
.name = __stringify(quirk_ ## _qn), \
.vendor = _ven, \
.sub_vendor_id = _sub, \
.impl_ver_range = _impl, \
.key = &(scmi_quirk_ ## _qn), \
.compats = { __VA_ARGS__ __VA_OPT__(,) NULL }, \
}
#define __DECLARE_SCMI_QUIRK_ENTRY(_qn) (&(scmi_quirk_entry_ ## _qn))
/*
* Define a quirk by name and provide the matching tokens where:
*
* _qn: A string which will be used to build the quirk and the global
* static_key names.
* _ven : SCMI Vendor ID string match, NULL means any.
* _sub : SCMI SubVendor ID string match, NULL means any.
* _impl : SCMI Implementation Version string match, NULL means any.
* This string can be used to express version ranges which will be
* interpreted as follows:
*
* NULL [0, 0xFFFFFFFF]
* "X" [X, X]
* "X-" [X, 0xFFFFFFFF]
* "-X" [0, X]
* "X-Y" [X, Y]
*
* with X <= Y and <v> in [X, Y] meaning X <= <v> <= Y
*
* ... : An optional variadic macros argument used to provide a comma-separated
* list of compatible strings matches; when no variadic argument is
* provided, ANY compatible will match this quirk.
*
* This implicitly define also a properly named global static-key that
* will be used to dynamically enable the quirk at initialization time.
*
* Note that it is possible to associate multiple quirks to the same
* matching pattern, if your firmware quality is really astounding :P
*
* Example:
*
* Compatibles list NOT provided, so ANY compatible will match:
*
* DEFINE_SCMI_QUIRK(my_new_issue, "Vend", "SVend", "0x12000-0x30000");
*
*
* A few compatibles provided to match against:
*
* DEFINE_SCMI_QUIRK(my_new_issue, "Vend", "SVend", "0x12000-0x30000",
* "xvend,plat_a", "xvend,plat_b", "xvend,sku_name");
*/
#define DEFINE_SCMI_QUIRK(_qn, _ven, _sub, _impl, ...) \
DEFINE_STATIC_KEY_FALSE(scmi_quirk_ ## _qn); \
__DEFINE_SCMI_QUIRK_ENTRY(_qn, _ven, _sub, _impl, ##__VA_ARGS__)
/*
* Same as DEFINE_SCMI_QUIRK but EXPORTED: this is meant to address quirks
* that possibly reside in code that is included in loadable kernel modules
* that needs to be able to access the global static keys at runtime to
* determine if enabled or not. (see SCMI_QUIRK to understand usage)
*/
#define DEFINE_SCMI_QUIRK_EXPORTED(_qn, _ven, _sub, _impl, ...) \
DEFINE_STATIC_KEY_FALSE(scmi_quirk_ ## _qn); \
EXPORT_SYMBOL_GPL(scmi_quirk_ ## _qn); \
__DEFINE_SCMI_QUIRK_ENTRY(_qn, _ven, _sub, _impl, ##__VA_ARGS__)
/* Global Quirks Definitions */
DEFINE_SCMI_QUIRK(clock_rates_triplet_out_of_spec, NULL, NULL, NULL);
DEFINE_SCMI_QUIRK(perf_level_get_fc_force, "Qualcomm", NULL, "0x20000-");
/*
* Quirks Pointers Array
*
* This is filled at compile-time with the list of pointers to all the currently
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/cleanup.h`, `linux/device.h`, `linux/export.h`, `linux/hashtable.h`, `linux/kstrtox.h`, `linux/of.h`, `linux/slab.h`.
- Detected declarations: `struct scmi_quirk`, `function scmi_quirk_signature`, `function scmi_quirk_range_parse`, `function scmi_quirks_initialize`, `function scmi_quirks_enable`, `function hash_for_each_possible`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: integration 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.