diff options
author | Jonathan Gray <jsg@jsg.id.au> | 2013-02-21 12:53:04 +1100 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-02-21 12:53:04 +1100 |
commit | 63983645627bbbe811c21cd258d9e67e6d5a8332 (patch) | |
tree | 1243bab160225b2ddc724ad02de56d7f5b905ebc | |
parent | fbf0550ee7f66877c55d5909b47f9979f62b134c (diff) |
use hw_prod/hw_vendor for smbios based quirks matching
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/intel_bios.c | 47 |
2 files changed, 47 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 01941ff19ba..58e51442267 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -750,7 +750,7 @@ struct dmi_system_id { struct dmi_strmatch matches[4]; }; #define DMI_MATCH(a, b) {(a), (b)} -bool dmi_check_system(const struct dmi_system_id *); +int dmi_check_system(const struct dmi_system_id *); /* Device setup support (drm_drv.c) */ diff --git a/sys/dev/pci/drm/intel_bios.c b/sys/dev/pci/drm/intel_bios.c index bbcfe2fb6a3..7b6ddf57390 100644 --- a/sys/dev/pci/drm/intel_bios.c +++ b/sys/dev/pci/drm/intel_bios.c @@ -61,6 +61,7 @@ const struct lvds_fp_timing * get_lvds_fp_timing(const struct bdb_header *, const struct bdb_lvds_lfp_data *, const struct bdb_lvds_lfp_data_ptrs *, int); +bool dmi_found(const struct dmi_system_id *); static int panel_type; unsigned int i915_lvds_downclock = 0; @@ -711,10 +712,54 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +extern char *hw_vendor, *hw_prod; + bool +dmi_found(const struct dmi_system_id *dsi) +{ + int i, slot; + + for (i = 0; i < nitems(dsi->matches); i++) { + slot = dsi->matches[i].slot; + switch (slot) { + case DMI_NONE: + break; + case DMI_SYS_VENDOR: + case DMI_BOARD_VENDOR: + if (hw_vendor != NULL && + !strcmp(hw_vendor, dsi->matches[i].substr)) + break; + else + return false; + case DMI_PRODUCT_NAME: + case DMI_BOARD_NAME: + if (hw_prod != NULL && + !strcmp(hw_prod, dsi->matches[i].substr)) + break; + else + return false; + default: + return false; + } + } + + return true; +} + +int dmi_check_system(const struct dmi_system_id *sysid) { - return (false); + const struct dmi_system_id *dsi; + int num = 0; + + for (dsi = sysid; dsi->matches[0].slot != 0 ; dsi++) { + if (dmi_found(dsi)) { + num++; + if (dsi->callback && dsi->callback(dsi)) + break; + } + } + return (num); } #define VGA_BIOS_ADDR 0xc0000 |