[PATCH] Add support for MacModel autodetection on OpenBSD.
Owain G. Ainsworth
zerooa at googlemail.com
Tue Mar 30 09:14:02 PDT 2010
This allows radeon-equipped macs to work without an xorg.conf on openbsd.
Patch originally written by Mark Kettenis (kettenis at openbsd.org)
---
src/radeon_output.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 8648f27..3a0d1e9 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" :
--
1.6.5.7
More information about the xorg-driver-ati
mailing list