summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOwain G. Ainsworth <zerooa@googlemail.com>2010-03-30 17:14:02 +0100
committerAlex Deucher <alexdeucher@gmail.com>2010-03-30 12:31:22 -0400
commit3a33b1a92c328b690bdc1aafa0011e4326109815 (patch)
treea2453ec348d803eda7435f9dea79951007eed60d /src
parentc7eeda8c3f3514ba95ebf2893fbe124bf526b3df (diff)
Add support for MacModel autodetection on OpenBSD.
This allows radeon-equipped macs to work without an xorg.conf on openbsd. Patch originally written by Mark Kettenis (kettenis@openbsd.org)
Diffstat (limited to 'src')
-rw-r--r--src/radeon_output.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 8648f278..3a0d1e94 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2616,6 +2616,11 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn)
#if defined(__powerpc__)
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
/*
* Returns RADEONMacModel or 0 based on lines 'detected as' and 'machine'
* in /proc/cpuinfo (on Linux) */
@@ -2708,6 +2713,72 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
#endif /* __linux */
+#ifdef __OpenBSD__
+ char model[32];
+ int mib[2];
+ size_t len;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_PRODUCT;
+ len = sizeof(model);
+ if (sysctl(mib, 2, model, &len, NULL, 0) >= 0) {
+ if (strcmp(model, "PowerBook5,1") == 0 ||
+ strcmp(model, "PowerBook5,2") == 0 ||
+ strcmp(model, "PowerBook5,3") == 0 ||
+ strcmp(model, "PowerBook5,4") == 0 ||
+ strcmp(model, "PowerBook5,5") == 0) {
+ ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* single link */
+ info->ext_tmds_chip = RADEON_SIL_164; /* works on 5,2 */
+ }
+
+ if (strcmp(model, "PowerBook5,6") == 0) {
+ ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual or single link */
+ }
+
+ if (strcmp(model, "PowerBook5,7") ||
+ strcmp(model, "PowerBook5,8") == 0 ||
+ strcmp(model, "PowerBook5,9") == 0) {
+ ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual link */
+ info->ext_tmds_chip = RADEON_SIL_1178; /* guess */
+ }
+
+ if (strcmp(model, "PowerBook3,3") == 0) {
+ ret = RADEON_MAC_POWERBOOK_VGA; /* vga rather than dvi */
+ }
+
+ if (strcmp(model, "PowerMac10,1") == 0) {
+ ret = RADEON_MAC_MINI_INTERNAL; /* internal tmds */
+ }
+
+ if (strcmp(model, "PowerMac10,2") == 0) {
+ ret = RADEON_MAC_MINI_EXTERNAL; /* external tmds */
+ }
+
+ if (strcmp(model, "PowerBook2,1") == 0 ||
+ strcmp(model, "PowerBook2,2") == 0 ||
+ strcmp(model, "PowerBook4,1") == 0 ||
+ strcmp(model, "PowerBook4,2") == 0 ||
+ strcmp(model, "PowerBook4,3") == 0 ||
+ strcmp(model, "PowerBook6,3") == 0 ||
+ strcmp(model, "PowerBook6,5") == 0 ||
+ strcmp(model, "PowerBook6,7") == 0) {
+ ret = RADEON_MAC_IBOOK;
+ }
+
+ if (strcmp(model, "PowerBook1,1") == 0 ||
+ strcmp(model, "PowerBook3,1") == 0 ||
+ strcmp(model, "PowerBook3,2") == 0 ||
+ strcmp(model, "PowerBook3,4") == 0 ||
+ strcmp(model, "PowerBook3,5") == 0) {
+ ret = RADEON_MAC_POWERBOOK_INTERNAL;
+ }
+
+ if (strcmp(model, "PowerMac12,1") == 0) {
+ ret = RADEON_MAC_IMAC_G5_ISIGHT;
+ }
+ }
+#endif /* __OpenBSD__ */
+
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Detected %s.\n",
ret == RADEON_MAC_POWERBOOK_EXTERNAL ? "PowerBook with external DVI" :