diff options
author | jakllsch <jakllsch@pkgsrc.org> | 2011-11-15 20:44:58 +0000 |
---|---|---|
committer | jakllsch <jakllsch@pkgsrc.org> | 2011-11-15 20:44:58 +0000 |
commit | 343b5ed02393fb98fc3ba7be9e483cace33ece11 (patch) | |
tree | 39eecb375f2a95f43c8c07ed7c9946cead688f7a /x11 | |
parent | e6deec5d03844be4282687bb811322d5115f5a26 (diff) | |
download | pkgsrc-343b5ed02393fb98fc3ba7be9e483cace33ece11.tar.gz |
Add DMI support on NetBSD.
Diffstat (limited to 'x11')
-rw-r--r-- | x11/xf86-video-intel/Makefile | 4 | ||||
-rw-r--r-- | x11/xf86-video-intel/distinfo | 3 | ||||
-rw-r--r-- | x11/xf86-video-intel/patches/patch-src_i830__quirks.c | 90 |
3 files changed, 94 insertions, 3 deletions
diff --git a/x11/xf86-video-intel/Makefile b/x11/xf86-video-intel/Makefile index 5b6e638a3a4..b42585e0575 100644 --- a/x11/xf86-video-intel/Makefile +++ b/x11/xf86-video-intel/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.25 2011/06/06 12:48:14 seanb Exp $ +# $NetBSD: Makefile,v 1.26 2011/11/15 20:44:58 jakllsch Exp $ DISTNAME= xf86-video-intel-2.7.1 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= x11 MASTER_SITES= ${MASTER_SITE_XORG:=driver/} EXTRACT_SUFX= .tar.bz2 diff --git a/x11/xf86-video-intel/distinfo b/x11/xf86-video-intel/distinfo index 976668fb706..b2ac5bd27a2 100644 --- a/x11/xf86-video-intel/distinfo +++ b/x11/xf86-video-intel/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.19 2011/06/06 12:48:14 seanb Exp $ +$NetBSD: distinfo,v 1.20 2011/11/15 20:44:58 jakllsch Exp $ SHA1 (xf86-video-intel-2.7.1.tar.bz2) = f863ee65b4b7779077af9f819b07033264284628 RMD160 (xf86-video-intel-2.7.1.tar.bz2) = 25208fe03f0fe849974a703f4a81e734e67cad18 @@ -6,3 +6,4 @@ Size (xf86-video-intel-2.7.1.tar.bz2) = 780625 bytes SHA1 (patch-aa) = 7804346b3442c1435bd9292e9c2d411854dbd4e2 SHA1 (patch-ad) = 9b001f43451daa8a68acb5059f993bcc1f3588f8 SHA1 (patch-ag) = 68f282d59e03c74727de4577eb48297d9022e542 +SHA1 (patch-src_i830__quirks.c) = 43dc7261630c3499687f229e7549286269787fef diff --git a/x11/xf86-video-intel/patches/patch-src_i830__quirks.c b/x11/xf86-video-intel/patches/patch-src_i830__quirks.c new file mode 100644 index 00000000000..4b69c60f2c2 --- /dev/null +++ b/x11/xf86-video-intel/patches/patch-src_i830__quirks.c @@ -0,0 +1,90 @@ +$NetBSD: patch-src_i830__quirks.c,v 1.1 2011/11/15 20:44:58 jakllsch Exp $ + +--- src/i830_quirks.c.orig 2009-05-13 00:12:11.000000000 +0000 ++++ src/i830_quirks.c +@@ -32,8 +32,14 @@ + + #define SUBSYS_ANY (~0) + ++#ifdef __NetBSD__ ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#define DMIID_SYSCTL_PREFIX "machdep.dmi." ++#else + #define DMIID_DIR "/sys/class/dmi/id/" + #define DMIID_FILE(x) (DMIID_DIR # x) ++#endif + + typedef struct { + int chipType; +@@ -66,6 +72,62 @@ enum i830_dmi_data_t { + + static char *i830_dmi_data[dmi_data_max]; + ++#ifdef __NetBSD__ ++/* NetBSD 6.0+ stores DMI data in sysctl machdep.dmi.* */ ++static void ++i830_dmi_sysctl_load(enum i830_dmi_data_t field) ++{ ++ const char *name; ++ char *buf; ++ size_t buflen = 0; ++ int err; ++ ++ switch (field) { ++ case bios_vendor: name = DMIID_SYSCTL_PREFIX "bios-vendor"; break; ++ case bios_version: name = DMIID_SYSCTL_PREFIX "bios-version"; break; ++ case bios_date: name = DMIID_SYSCTL_PREFIX "bios-date"; break; ++ case sys_vendor: name = DMIID_SYSCTL_PREFIX "system-vendor"; break; ++ case product_name: name = DMIID_SYSCTL_PREFIX "system-product"; break; ++ case product_version: name = DMIID_SYSCTL_PREFIX "system-version"; break; ++ case product_serial: name = DMIID_SYSCTL_PREFIX "system-serial"; break; ++ case product_uuid: name = DMIID_SYSCTL_PREFIX "system-uuid"; break; ++ case board_vendor: name = DMIID_SYSCTL_PREFIX "board-vendor"; break; ++ case board_name: name = DMIID_SYSCTL_PREFIX "board-product"; break; ++ case board_version: name = DMIID_SYSCTL_PREFIX "board-version"; break; ++ case board_serial: name = DMIID_SYSCTL_PREFIX "board-serial"; break; ++ default: goto not_found; ++ } ++ ++ err = sysctlbyname(name, buf, &buflen, NULL, 0); ++ if (err || buflen == 0) ++ goto not_found; ++ ++ buf = xcalloc(1, buflen); ++ if (buf == NULL) ++ goto not_found; ++ ++ err = sysctlbyname(name, buf, &buflen, NULL, 0); ++ if (err) ++ goto not_found; ++ ++ /* i830_dmi_scan uses a fixed-size buffer, use our own instead */ ++ xfree(i830_dmi_data[field]); ++ i830_dmi_data[field] = buf; ++ ++ return; ++ ++not_found: ++ xfree(i830_dmi_data[field]); ++ i830_dmi_data[field] = NULL; ++} ++ ++#define I830_DMI_FIELD_FUNC(field) \ ++static void i830_dmi_store_##field(void) \ ++{\ ++ i830_dmi_sysctl_load(field);\ ++} ++#else ++/* Linux stores DMI data in /sys/class/dmi/id/... */ + #define I830_DMI_FIELD_FUNC(field) \ + static void i830_dmi_store_##field(void) \ + {\ +@@ -78,6 +140,7 @@ static void i830_dmi_store_##field(void) + fread(i830_dmi_data[field], 64, 1, f);\ + fclose(f);\ + } ++#endif + + I830_DMI_FIELD_FUNC(bios_vendor); + I830_DMI_FIELD_FUNC(bios_version); |