Skip site navigation (1)Skip section navigation (2)
Date:      26 May 1999 17:17:00 +0200
From:      Anton Berezin <tobez@plab.ku.dk>
To:        multimedia@FreeBSD.ORG
Subject:   [A call for review] Patch to Matrox Meteor driver to make PPB cards work
Message-ID:  <86hfozvp1v.fsf@lion.plab.ku.dk>

next in thread | raw e-mail | index | archive | help
I hope this is the right mailing list to send this.  Also, should I
submit a PR in order to get this patch applied?  Or is it possible
that after reviewing someone with commit privileges will commit the
patch?

The patch is against /usr/src/sys/pci/meteor.c of today's -CURRENT.

--- sys/pci/meteor.c.orig	Sun May  9 19:12:25 1999
+++ sys/pci/meteor.c	Wed May 26 16:46:36 1999
@@ -161,6 +161,7 @@
 #include <sys/devfsext.h>
 #endif /* DEVFS */
 #include <sys/uio.h>
+#include <sys/bus.h>
 
 #if defined(METEOR_FreeBSD_210)
 #include <machine/cpu.h>	/* bootverbose */
@@ -171,7 +172,7 @@
 #include <vm/pmap.h>
 #include <vm/vm_extern.h>
 
-#include "pci.h"
+#include <pci.h>
 #if NPCI > 0
 #include <pci/pcivar.h>
 #include <pci/pcireg.h>
@@ -1000,12 +1001,51 @@
 	meteor_reg_t *mtr;
 	vm_offset_t buf;
 	u_long latency;
+	device_t bridge_dev;
+	pcici_t bridge_tag;
+	struct pci_devinfo *bridge_dinfo;
+	u_int32_t bridge_data;
 
 	if (unit >= NMETEOR) {
 		printf("meteor%d: attach: only %d units configured.\n",
 				unit, NMETEOR);
 		printf("meteor%d: attach: invalid unit number.\n", unit);
         	return ;
+	}
+
+	/*
+	 * Check for Meteor/PPB, reprogram IBM bridge if detected.
+	 */
+	if (tag-> bus != 0) {
+		bridge_dev = device_get_parent(device_get_parent(tag-> dev));
+		if (bridge_dev 
+		    && pci_get_devid(bridge_dev) == 0x00221014 /* IBM 82351,2,3 */
+		    && (bridge_dinfo = device_get_ivars(bridge_dev))
+		    && (bridge_tag = &bridge_dinfo->cfg) 
+		    && bridge_tag-> secondarybus == tag-> bus) {
+			if ( bootverbose)
+				printf("meteor%d: PPB device detected, reprogramming IBM bridge.\n", unit);
+
+			/* disable SERR */
+			bridge_data = pci_cfgread(bridge_tag, 0x05, 1);
+			bridge_data = 0x00;
+			pci_cfgwrite(bridge_tag, 0x05, 1, bridge_data);
+
+			/* set LATENCY */
+			bridge_data = pci_cfgread(bridge_tag, 0x0d, 1);
+			bridge_data = 0x20;
+			pci_cfgwrite(bridge_tag, 0x0d, bridge_data, 1);
+
+			/* write posting enable, prefetch enabled --> GRAB direction */
+			bridge_data = pci_cfgread(bridge_tag, 0x42, 1);
+			bridge_data = 0x14;
+			pci_cfgwrite(bridge_tag, 0x42, bridge_data, 1);
+
+			/* 0x4C (PRTR) Primary retry timer register */
+			bridge_data = pci_cfgread(bridge_tag, 0x4c, 1);
+			bridge_data = 0x10;
+			pci_cfgwrite(bridge_tag, 0x4c, bridge_data, 1);
+		}
 	}
 
 	mtr = &meteor[unit];


-- 
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86hfozvp1v.fsf>