diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2023-02-06 15:19:11 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-02-08 15:07:45 +0000 |
commit | 6a6ac1e0b929a47aedcff41420990cd700e22d13 (patch) | |
tree | 669b654a6876be7ae88045783bda9254b55e457e /src/soc/intel | |
parent | 2fe5d3e5a5982169aeac86188949a301ab9ed0aa (diff) |
arch/x86/cpu: introduce and use device_match_mask
Instead of always doing exact matches between the CPUID read in
identify_cpu and the device entries of the CPU device ID table,
offer the possibility to use a bit mask in the CPUID matching. This
allows covering all steppings of a CPU family/model with one entry and
avoids that case of a missing new stepping causing the CPUs not being
properly initialized.
Some of the CPU device ID tables can now be deduplicated using the
CPUID_ALL_STEPPINGS_MASK define, but that's outside of the scope of this
patch.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I0540b514ca42591c0d3468307a82b5612585f614
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72847
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/apollolake/cpu.c | 14 | ||||
-rw-r--r-- | src/soc/intel/baytrail/cpu.c | 8 | ||||
-rw-r--r-- | src/soc/intel/braswell/cpu.c | 8 | ||||
-rw-r--r-- | src/soc/intel/common/block/cpu/mp_init.c | 100 | ||||
-rw-r--r-- | src/soc/intel/denverton_ns/cpu.c | 9 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/cpu.c | 6 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/skx/cpu.c | 8 |
7 files changed, 77 insertions, 76 deletions
diff --git a/src/soc/intel/apollolake/cpu.c b/src/soc/intel/apollolake/cpu.c index 7407415737..c942b595cf 100644 --- a/src/soc/intel/apollolake/cpu.c +++ b/src/soc/intel/apollolake/cpu.c @@ -110,13 +110,13 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_E0 }, - { X86_VENDOR_INTEL, CPUID_GLK_A0 }, - { X86_VENDOR_INTEL, CPUID_GLK_B0 }, - { X86_VENDOR_INTEL, CPUID_GLK_R0 }, - { 0, 0 }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_E0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_R0, CPUID_EXACT_MATCH_MASK }, + { 0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/baytrail/cpu.c b/src/soc/intel/baytrail/cpu.c index 1dbc3d7751..db0c4ee168 100644 --- a/src/soc/intel/baytrail/cpu.c +++ b/src/soc/intel/baytrail/cpu.c @@ -59,10 +59,10 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - { X86_VENDOR_INTEL, 0x30673 }, - { X86_VENDOR_INTEL, 0x30678 }, - { X86_VENDOR_INTEL, 0x30679 }, - { 0, 0 }, + { X86_VENDOR_INTEL, 0x30673, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, 0x30678, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, 0x30679, CPUID_EXACT_MATCH_MASK }, + { 0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/braswell/cpu.c b/src/soc/intel/braswell/cpu.c index b11007d4f5..e45804fd74 100644 --- a/src/soc/intel/braswell/cpu.c +++ b/src/soc/intel/braswell/cpu.c @@ -59,10 +59,10 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - { X86_VENDOR_INTEL, 0x406c4 }, - { X86_VENDOR_INTEL, 0x406c3 }, - { X86_VENDOR_INTEL, 0x406c2 }, - { 0, 0 }, + { X86_VENDOR_INTEL, 0x406c4, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, 0x406c3, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, 0x406c2, CPUID_EXACT_MATCH_MASK }, + { 0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c index 4636b3b609..6d51f991c8 100644 --- a/src/soc/intel/common/block/cpu/mp_init.c +++ b/src/soc/intel/common/block/cpu/mp_init.c @@ -32,56 +32,56 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - { X86_VENDOR_INTEL, CPUID_METEORLAKE_A0_1}, - { X86_VENDOR_INTEL, CPUID_METEORLAKE_A0_2}, - { X86_VENDOR_INTEL, CPUID_SKYLAKE_C0 }, - { X86_VENDOR_INTEL, CPUID_SKYLAKE_D0 }, - { X86_VENDOR_INTEL, CPUID_SKYLAKE_HQ0 }, - { X86_VENDOR_INTEL, CPUID_SKYLAKE_HR0 }, - { X86_VENDOR_INTEL, CPUID_KABYLAKE_G0 }, - { X86_VENDOR_INTEL, CPUID_KABYLAKE_H0 }, - { X86_VENDOR_INTEL, CPUID_KABYLAKE_Y0 }, - { X86_VENDOR_INTEL, CPUID_KABYLAKE_HA0 }, - { X86_VENDOR_INTEL, CPUID_KABYLAKE_HB0 }, - { X86_VENDOR_INTEL, CPUID_CANNONLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_CANNONLAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_CANNONLAKE_C0 }, - { X86_VENDOR_INTEL, CPUID_CANNONLAKE_D0 }, - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_E0 }, - { X86_VENDOR_INTEL, CPUID_GLK_A0 }, - { X86_VENDOR_INTEL, CPUID_GLK_B0 }, - { X86_VENDOR_INTEL, CPUID_GLK_R0 }, - { X86_VENDOR_INTEL, CPUID_WHISKEYLAKE_V0 }, - { X86_VENDOR_INTEL, CPUID_WHISKEYLAKE_W0 }, - { X86_VENDOR_INTEL, CPUID_COFFEELAKE_U0 }, - { X86_VENDOR_INTEL, CPUID_COFFEELAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_COFFEELAKE_P0 }, - { X86_VENDOR_INTEL, CPUID_COFFEELAKE_R0 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_U_A0 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_U_K0_S0 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_6_2_G0 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_6_2_G1 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_P0 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_P1 }, - { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_Q0 }, - { X86_VENDOR_INTEL, CPUID_TIGERLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_TIGERLAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_TIGERLAKE_R0 }, - { X86_VENDOR_INTEL, CPUID_ELKHARTLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_ELKHARTLAKE_B0 }, - { X86_VENDOR_INTEL, CPUID_JASPERLAKE_A0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_S_A0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_J0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_K0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_L0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_Q0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_R0 }, - { X86_VENDOR_INTEL, CPUID_ALDERLAKE_N_A0 }, - { X86_VENDOR_INTEL, CPUID_RAPTORLAKE_P_J0 }, - { X86_VENDOR_INTEL, CPUID_RAPTORLAKE_P_Q0 }, - { 0, 0 }, + { X86_VENDOR_INTEL, CPUID_METEORLAKE_A0_1, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_METEORLAKE_A0_2, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_SKYLAKE_C0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_SKYLAKE_D0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_SKYLAKE_HQ0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_SKYLAKE_HR0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_KABYLAKE_G0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_KABYLAKE_H0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_KABYLAKE_Y0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_KABYLAKE_HA0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_KABYLAKE_HB0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_CANNONLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_CANNONLAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_CANNONLAKE_C0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_CANNONLAKE_D0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_APOLLOLAKE_E0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_GLK_R0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_WHISKEYLAKE_V0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_WHISKEYLAKE_W0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COFFEELAKE_U0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COFFEELAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COFFEELAKE_P0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COFFEELAKE_R0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_U_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_U_K0_S0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_6_2_G0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_6_2_G1, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_P0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_P1, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_COMETLAKE_H_S_10_2_Q0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_TIGERLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_TIGERLAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_TIGERLAKE_R0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ELKHARTLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ELKHARTLAKE_B0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_JASPERLAKE_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_S_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_J0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_K0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_L0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_Q0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_R0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_ALDERLAKE_N_A0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_RAPTORLAKE_P_J0, CPUID_EXACT_MATCH_MASK }, + { X86_VENDOR_INTEL, CPUID_RAPTORLAKE_P_Q0, CPUID_EXACT_MATCH_MASK }, + { 0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/denverton_ns/cpu.c b/src/soc/intel/denverton_ns/cpu.c index 8b5fb40e3c..210aefe312 100644 --- a/src/soc/intel/denverton_ns/cpu.c +++ b/src/soc/intel/denverton_ns/cpu.c @@ -122,10 +122,11 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - {X86_VENDOR_INTEL, - CPUID_DENVERTON_A0_A1}, /* Denverton-NS A0/A1 CPUID */ - {X86_VENDOR_INTEL, CPUID_DENVERTON_B0}, /* Denverton-NS B0 CPUID */ - {0, 0}, + /* Denverton-NS A0/A1 CPUID */ + {X86_VENDOR_INTEL, CPUID_DENVERTON_A0_A1, CPUID_EXACT_MATCH_MASK }, + /* Denverton-NS B0 CPUID */ + {X86_VENDOR_INTEL, CPUID_DENVERTON_B0, CPUID_EXACT_MATCH_MASK }, + {0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/xeon_sp/cpx/cpu.c b/src/soc/intel/xeon_sp/cpx/cpu.c index 8a7dd2ab20..bf26f7c667 100644 --- a/src/soc/intel/xeon_sp/cpx/cpu.c +++ b/src/soc/intel/xeon_sp/cpx/cpu.c @@ -127,9 +127,9 @@ static struct device_operations cpu_dev_ops = { }; static const struct cpu_device_id cpu_table[] = { - {X86_VENDOR_INTEL, CPUID_COOPERLAKE_SP_A0}, - {X86_VENDOR_INTEL, CPUID_COOPERLAKE_SP_A1}, - {0, 0}, + {X86_VENDOR_INTEL, CPUID_COOPERLAKE_SP_A0, CPUID_EXACT_MATCH_MASK }, + {X86_VENDOR_INTEL, CPUID_COOPERLAKE_SP_A1, CPUID_EXACT_MATCH_MASK }, + {0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { diff --git a/src/soc/intel/xeon_sp/skx/cpu.c b/src/soc/intel/xeon_sp/skx/cpu.c index 24984e14e0..2656b9a828 100644 --- a/src/soc/intel/xeon_sp/skx/cpu.c +++ b/src/soc/intel/xeon_sp/skx/cpu.c @@ -148,12 +148,12 @@ static struct device_operations cpu_dev_ops = { static const struct cpu_device_id cpu_table[] = { /* Skylake-SP A0/A1 CPUID 0x506f0*/ - {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_A0_A1}, + {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_A0_A1, CPUID_EXACT_MATCH_MASK }, /* Skylake-SP B0 CPUID 0x506f1*/ - {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_B0}, + {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_B0, CPUID_EXACT_MATCH_MASK }, /* Skylake-SP 4 CPUID 0x50654*/ - {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_4}, - {0, 0}, + {X86_VENDOR_INTEL, CPUID_SKYLAKE_SP_4, CPUID_EXACT_MATCH_MASK }, + {0, 0, 0 }, }; static const struct cpu_driver driver __cpu_driver = { |