xviddetect for sparc (was: Re: autodectection of modules at boot time)
Adam Di Carlo wrote:
> In message <[🔎] 19991022182441.E5993@tausq.org> you wrote:
> >xvidetect was installed into the archives yesterday, so you should be able
> >to get it from your favorite mirror. Please note that the copy in the
> >archive is slightly different from the one that's in my homedir on master.
> >(it uses /usr/share/doc instead of /usr/doc)
>
> Excellent.
>
> >It'd be great if we
> >can get this in. One concern though is that it really only works well for
> >i386 at the moment.
>
> Don't you mean it only works for PCI video cards? I tested it on
> sparc (ultra5, mach64 video chip) and it worked great. Remember that
> PPC, new Sparcs, etc are all PCI.
>
> [...]
>
> >The good thing perhaps is that the other archs have a
> >much smaller number of X servers, and the typical {alpha,sparc,m68k,ppc}
> >user is probably more knowledgable about what to pick anyway.
>
> Yes -- to be cute, on Sparc/SBUS machines, you should be able to detect
> the proper video card from proc. Not sure on the details -- ask the
> right lists. Not sure about m68k.
>
> Anyhow, if it works, great, if not, oh well we tried.
>
> A solution that works for 70% of the time is a success, in my book.
> Right now people have no where at all to turn...
I added preliminary support for sparc SBUS to xviddetect (SBUS is a plug-n-play
system bus in case you was not aware of). The patch is attached to this mail.
I wrote it by scanning /proc/openpromfs for display devices entries. It works
at least on sparc2 (bwtwo framebuffer) & SparcClassic (cgthree), the only
hardware I can run it on, but I need other testers to be sure it also works on
CG2, CG4, CG6, CG8, CG14, TCX, Creator & Creator3D framebuffers.
I supposed that the names of display cards reported by OpenPROM are matching
their commercial names but I could be wrong, especially for Creator cards.
Comm. name OpenPROM name
BW2 -> bwtwo
CG2 -> cgtwo
CG3 -> cgthree
CG4 -> cgfour
CG6 -> cgsix
CG8 -> cgeight
CG14 -> cgfourteen
TCX -> tcx
Creator -> creator
Creator3D -> creator3d
I uploaded a patched release of xviddetect to my ftp site:
ftp://lix.polytechnique.fr/pub/Linux/debian/exp/xviddetect-0.2.1-1.deb
Any help in testing would be really appreciated.
Too know OpenPROM name of one device, look in /proc/openprom/iommu/sbus/<dev>/name
file and report unmatched names back to me.
Thanks in advance.
PS: what about multi-headed systems? I can plug more than one card in my
sparc, but xviddetect only reports the first one. Anyway, I don't know if
xfree is working in a multi-headed mode.
--
Eric Delaunay | "La guerre justifie l'existence des militaires.
delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)
diff -unr xviddetect-0.2.orig/debian/rules xviddetect-0.2/debian/rules
--- xviddetect-0.2.orig/debian/rules Tue Aug 31 06:09:02 1999
+++ xviddetect-0.2/debian/rules Sat Oct 23 19:13:34 1999
@@ -22,6 +22,7 @@
install -m 0755 xviddetect $(DESTDIR)/usr/bin/xviddetect
install -m 0644 video.ids $(DESTDIR)/usr/share/misc/video.ids
+ install -m 0644 pci.ids $(DESTDIR)/usr/share/misc/pci.ids
install -m 0644 README $(DESTDIR)/usr/doc/$(PACKAGE)/README
install -m 0644 debian/changelog $(DESTDIR)/usr/doc/$(PACKAGE)/changelog
install -m 0644 debian/copyright $(DESTDIR)/usr/doc/$(PACKAGE)/copyright
diff -uNr xviddetect-0.2.orig/video.ids xviddetect-0.2/video.ids
--- xviddetect-0.2.orig/video.ids Sat Aug 21 22:36:27 1999
+++ xviddetect-0.2/video.ids Sat Oct 23 18:26:16 1999
@@ -117,3 +117,14 @@
s3v|all|53338c01|S3 Inc.|ViRGE/MX
s3v|all|53338c02|S3 Inc.|ViRGE/MX+
s3v|all|53338c03|S3 Inc.|ViRGE/MX+MV
+xsun-mono|sparc|bwtwo|Sun|BW2 Monochrome Sun framebuffer
+xsun|sparc|cgtwo|Sun|CG2 8-bit Sun framebuffer
+xsun|sparc|cgthree|Sun|CG3 8-bit Sun framebuffer
+xsun|sparc|cgfour|Sun|CG4 8-bit Sun framebuffer
+xsun|sparc|cgsix|Sun|CG6 8-bit Sun framebuffer
+xsun|sparc|tcx|Sun|TCX Sun framebuffer in 8-bit color mode
+xsun24|sparc|tcx|Sun|TCX Sun framebuffer in 24-bit color mode
+xsun24|sparc|cgeight|Sun|CG8 24-bit Sun framebuffer
+xsun24|sparc|cgfourteen|Sun|CG14 24-bit Sun framebuffer
+xsun24|sparc|creator|Sun|Creator 24-bit Sun framebuffer
+xsun24|sparc|creator3d|Sun|Creator3D 24-bit Sun framebuffer
diff -uNr xviddetect-0.2.orig/xviddetect xviddetect-0.2/xviddetect
--- xviddetect-0.2.orig/xviddetect Tue Aug 31 06:11:25 1999
+++ xviddetect-0.2/xviddetect Sat Oct 23 19:13:44 1999
@@ -15,6 +15,7 @@
sub GetArch {
my $arch = `uname -m`;
+ chop $arch;
$arch = 'i386' if ($arch =~ /^i\d86/);
return $arch;
@@ -65,6 +66,9 @@
return;
oldpci:
+ # no report of error on sparc (could be an sbus machine)
+ return if ($arch eq "sparc");
+
print "Cannot open $pcidevice. You probably have an old kernel. Support\n";
print "for the old Linux PCI interface should be coming soon\n\n";
exit 0;
@@ -94,6 +98,59 @@
close F;
}
+# Read the SPARC SBus configuration to fill the device list with detected
+# display devices.
+sub ReadSBUS {
+ my $dir;
+ my $dev;
+ # first check for openpromfs
+ -f "/proc/openprom/.node" || die "This system is lacking openpromfs support.";
+ # then parse the tree to looking at display type entries
+ # Old sparc have their devices referenced under sbus@x,y and newer ones have
+ # one more level of indirection (iommu@x,y/sbus@x,y), so look in both trees.
+ opendir(D, "/proc/openprom");
+ my @bus = readdir(D);
+ closedir D;
+ my @io = grep { s/^iommu/\/proc\/openprom\/iommu/ } @bus;
+ my @bus = grep { s/^sbus/\/proc\/openprom\/sbus/ } @bus;
+ foreach $dir (@io) {
+ opendir(D, $dir);
+ push @bus, grep { s:^sbus:$dir/sbus: } readdir(D);
+ closedir D;
+ }
+ foreach $dir (@bus) {
+ # In the sbus dir, there is one subdir per device.
+ # Each subdir name is build from the name of the device, sbus slot number
+ # and sbus first address in slot (dev@x,y).
+ # Each device subdir contains may contains 2 files named device_type &
+ # name. The former is telling the type of device (eg. 'display' for a
+ # graphic card) and the latter gives his name ('cgthree', ...).
+ opendir(D, $dir);
+ # to know whether dir entry is a device subdir, we cannot use -d $_. It
+ # simply doesn't work with openpromfs :( One alternative is to looking for
+ # an '@' in the name.
+ my @devlist = grep { s:(.*@):$dir/\1: } readdir(D);
+ closedir D;
+ foreach $dev ( @devlist ) {
+ if (open(G, "<$dev/device_type")) {
+ my $id = <G>;
+ chop $id;
+ close G;
+ # a display device is referenced as such in the device_type file
+ if ($id eq "'display'") {
+ open(G, "<$dev/name") || die "Bad OpenPROM contents.";
+ # get the name of the device (remove surrounding quotes)
+ $id = <G>;
+ chop $id;
+ $id =~ s/'//g;
+ # register this device in the database
+ push @devices, $id;
+ }
+ }
+ }
+ }
+}
+
sub Help {
print <<EOF;
video.pl [--arch <architecture>] [--help]
@@ -118,6 +175,7 @@
&ReadVideoIDs;
&ReadPCIIDs;
&ReadPCI;
+&ReadSBUS if $arch eq "sparc";
if (!$quiet) {
print "Your architecture seems to be $arch.\n";
Reply to: