Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152611259
D56331.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56331.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D56331: ucode: Add ucode match helper function
Attached
Detach File
Event Timeline
Log In to Comment