Page MenuHomeFreeBSD

D56331.diff
No OneTemporary

D56331.diff

diff --git a/sys/x86/include/ucode.h b/sys/x86/include/ucode.h
--- a/sys/x86/include/ucode.h
+++ b/sys/x86/include/ucode.h
@@ -62,6 +62,16 @@
} entries[0];
};
+/* Stepping can be 0x0 so we use -1 to match all instead of 0 */
+#define UCODE_MATCH_ALL -1
+
+struct ucode_match_rev_data {
+ u_int fam;
+ u_int model;
+ u_int stepping;
+ u_int64_t rev;
+};
+
typedef enum { SAFE, UNSAFE, EARLY } ucode_load_how;
const void *ucode_amd_find(const char *path, uint32_t signature,
@@ -75,5 +85,6 @@
void ucode_load_ap(int cpu);
void ucode_reload(void);
void * ucode_update(void *data);
+bool ucode_match_min(const struct ucode_match_rev_data *data);
#endif /* _MACHINE_UCODE_H_ */
diff --git a/sys/x86/x86/ucode.c b/sys/x86/x86/ucode.c
--- a/sys/x86/x86/ucode.c
+++ b/sys/x86/x86/ucode.c
@@ -483,3 +483,30 @@
newdata = NULL;
return (newdata);
}
+
+bool
+ucode_match_min(const struct ucode_match_rev_data *data)
+{
+ while (data->fam != 0 || data->model != 0 || data->stepping != 0 ||
+ data->rev != 0) {
+ if (data->fam != UCODE_MATCH_ALL &&
+ CPUID_TO_FAMILY(cpu_id) != data->fam) {
+ data++;
+ continue;
+ }
+ if (data->model != UCODE_MATCH_ALL &&
+ CPUID_TO_MODEL(cpu_id) != data->model) {
+ ++data;
+ continue;
+ }
+ if (data->stepping != UCODE_MATCH_ALL &&
+ CPUID_TO_STEPPING(cpu_id) != data->stepping) {
+ ++data;
+ continue;
+ }
+ if ((ucode_error ? ucode_orev : ucode_nrev) < data->rev)
+ return (false);
+ return (true);
+ }
+ return (false);
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 17, 12:04 AM (16 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31629517
Default Alt Text
D56331.diff (1 KB)

Event Timeline