[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dualscan.faq
This is a preliminary HOW-TO on getting XWindows to run on a Thinkpad
dualscan model. I had NOTHING to do with the writing of the programs
mentioned. I have only successfully implemented them. These are my
procedures and results.
Thanks to Michael Steiner for Tpdualscan, and thanks to whoever put
his/her XF86Config on the Thinkpad web page. I used it as a model.
login is root.
Copy the XF86Config file to your /usr/X11R6/lib/X11/ directory.
copy tpdualscan.c to /usr/X11/bin
run 'make tpdualscan'
run 'tpdualscan -d'
make sure you have a .xinitrc working. if not, or you're unfamiliar with
this file check the man page.
run 'startx'
if your screen looks jumbled, hit Fn-F7 to clear it.
I usually get the famous doubled image the first time I load up X. so I
quit, and rerun tpdualscan and the second time it usually works.
note: when you quit, you may get the graphic error thingy again. hit
Fn-F7 to fix that too.
For future use, you will need to run 'tpdualscan -d' as root before
running xwindows. right now, I login normally, then on another
terminal(say, ALT-F2) as root. run tpdualscan, then startx, then quit,
then tpdualscan again, and then logout. then from my first login(say
back to ALT-F1), I run startx. works fine, but I'd like to simplify it.
XF86Config
# $XConsortium: XF86Conf.cpp,v 1.5 95/01/16 13:16:10 kaleb Exp $
# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.11 1995/01/28 15:46:18 dawes Exp $
#
# Copyright (c) 1994 by The XFree86 Project, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Except as contained in this notice, the name of the XFree86 Project shall
# not be used in advertising or otherwise to promote the sale, use or other
# dealings in this Software without prior written authorization from the
# XFree86 Project.
#
# **********************************************************************
# Refer to the XF86Config(4/5) man page for details about the format of
# this file. This man page is installed as /usr/X11R6/man/man5/XF86Config.5x
# **********************************************************************
# **********************************************************************
# Files section. This allows default font and rgb paths to be set
# **********************************************************************
Section "Files"
# The location of the RGB database. Note, this is the name of the
# file minus the extension (like ".txt" or ".db"). There is normally
# no need to change the default.
RgbPath "/usr/X11R6/lib/X11/rgb"
# Multiple FontPath entries are allowed (which are concatenated together),
# as well as specifying multiple comma-separated entries in one FontPath
# command (or a combination of both methods)
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
# FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection
# **********************************************************************
# Server flags section.
# **********************************************************************
Section "ServerFlags"
# Uncomment this to cause a core dump at the spot where a signal is
# received. This may leave the console in an unusable state, but may
# provide a better stack trace in the core dump to aid in debugging
# NoTrapSignals
# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
# This allows clients to receive this key event.
# DontZap
# Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
# sequences. This allows clients to receive these key events.
# DontZoom
EndSection
# **********************************************************************
# Input devices
# **********************************************************************
# **********************************************************************
# Keyboard section
# **********************************************************************
Section "Keyboard"
Protocol "Standard"
# when using XQUEUE, comment out the above line, and uncomment the
# following line
# Protocol "Xqueue"
AutoRepeat 500 5
# Let the server do the NumLock processing. This should only be required
# when using pre-R6 clients
# ServerNumLock
# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1))
# Xleds 1 2 3
# To set the LeftAlt to Meta, RightAlt key to ModeShift,
# RightCtl key to Compose, and ScrollLock key to ModeLock:
# LeftAlt Meta
# RightAlt ModeShift
# RightCtl Compose
# ScrollLock ModeLock
EndSection
# **********************************************************************
# Pointer section
# **********************************************************************
Section "Pointer"
Protocol "PS/2"
Device "/dev/psaux"
# When using XQUEUE, comment out the above two lines, and uncomment
# the following line.
# Protocol "Xqueue"
# Baudrate and SampleRate are only for some Logitech mice
# BaudRate 9600
# SampleRate 150
# Emulate3Buttons is an option for 2-button Microsoft mice
# Emulate3Buttons
# ChordMiddle is an option for some 3-button Logitech mice
# ChordMiddle
EndSection
# **********************************************************************
# Monitor section
# **********************************************************************
# Any number of monitor sections may be present
Section "Monitor"
Identifier "Generic Monitor"
VendorName "Unknown"
ModelName "Unknown"
# Bandwidth is in MHz unless units are specified
# Bandwidth 25.2
# HorizSync is in kHz unless units are specified.
# HorizSync may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
# HorizSync 31.5 # typical for a single frequency fixed-sync monitor
HorizSync 20-40 # typical for a single frequency fixed-sync monitor
# HorizSync 30-64 # multisync
# HorizSync 31.5, 35.2 # multiple fixed sync frequencies
# HorizSync 15-25, 30-50 # multiple ranges of sync frequencies
# VertRefresh is in Hz unless units are specified.
# VertRefresh may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
# VertRefresh 60 # typical for a single frequency fixed-sync monitor
VertRefresh 60-70 # typical for a single frequency fixed-sync monitor
# VertRefresh 50-100 # multisync
# VertRefresh 60, 65 # multiple fixed sync frequencies
# VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies
# Modes can be specified in two formats. A compact one-line format, or
# a multi-line format.
# A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
# These two are equivalent
ModeLine "640x480" 28.3 640 680 720 864 480 488 491 521
# Mode "640x480"
# DotClock 25.175
# HTimings 640 664 760 800
# VTimings 480 491 493 525
# EndMode
# These two are equivalent
# ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
# Mode "1024x768i"
# DotClock 45
# HTimings 1024 1048 1208 1264
# VTimings 768 776 784 817
# Flags "Interlace"
# EndMode
EndSection
# **********************************************************************
# Graphics device section
# **********************************************************************
# Any number of graphics device sections may be present
# Section "Device"
# Identifier "Generic VGA"
# VendorName "Unknown"
# BoardName "Unknown"
# Chipset "generic"
# VideoRam 256
# Clocks 25.2 28.3
# EndSection
Section "Device"
# SVGA server auto-detected chipset
Identifier "Generic SVGA"
VendorName "Unknown"
BoardName "Unknown"
VideoRam 512
Chipset "wd90c31"
EndSection
# Section "Device"
# Identifier "Any Trident TVGA 9000"
# VendorName "Trident"
# BoardName "TVGA 9000"
# Chipset "tvga9000"
# VideoRam 512
# Clocks 25 28 45 36 57 65 50 40 25 28 0 45 72 77 80 75
# EndSection
# Section "Device"
# Identifier "Actix GE32+ 2MB"
# VendorName "Actix"
# BoardName "GE32+"
# Ramdac "ATT20C490"
# Dacspeed 110
# Option "dac_8_bit"
# Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
# Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
# EndSection
# **********************************************************************
# Screen sections
# **********************************************************************
# The colour SVGA server
Section "Screen"
Driver "svga"
Device "Generic SVGA"
Monitor "Generic Monitor"
Subsection "Display"
Depth 8
Modes "640x480"
ViewPort 0 0
Virtual 768 682
EndSubsection
EndSection
# The 16-colour VGA server
# Section "Screen"
# Driver "vga16"
# Device "Generic VGA"
# Monitor "Generic Monitor"
# Subsection "Display"
# Modes "640x480"
# ViewPort 0 0
# Virtual 800 600
# EndSubsection
# EndSection
# The Mono server
# Section "Screen"
# Driver "vga2"
# Device "Generic VGA"
# Monitor "Generic Monitor"
# Subsection "Display"
# Modes "640x480"
# ViewPort 0 0
# Virtual 800 600
# EndSubsection
# EndSection
# The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32)
# Section "Screen"
# Driver "accel"
# Device "Actix GE32+ 2MB"
# Monitor "Generic Monitor"
# Subsection "Display"
# Depth 8
# Modes "640x480"
# ViewPort 0 0
# Virtual 1280 1024
# EndSubsection
# SubSection "Display"
# Depth 16
# Weight 565
# Modes "640x480"
# ViewPort 0 0
# Virtual 1024 768
# EndSubsection
# EndSection
Tpdualscan.c
/* T P D U A L S C A N . C
Author: Michael Steiner
<steiner@acm.org> <sti@zurich.ibm.com>
http://www.zurich.ibm.com/pub/sti/www/info.html
This program allows you to set videoram for dualscan equipped thinkpads
(at least for the 750Cs but probably also for others) to allow running
XFree86 without patching it. (normally you got all twice if the upper 512K
of videoram are not disabled)
*/
#define PROGNAME "tpdualscan"
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
/* the prototypes for helper routines (freely adapted from Xfree86 */
static __inline__ void outb(short port, char val);
static __inline__ unsigned int inb(short port);
void EnableIOPorts(int num_ioports, unsigned *io_ports);
void DisableIOPorts(int num_ioports, unsigned *io_ports);
/* define IO ports for vga and pvga (we probably don't need all but why bother ..) */
unsigned PVGA_IOPorts[] = {
/* normal vga ports */
0x3B4, 0x3B5, 0x3BA, 0x3C0, 0x3C1, 0x3C2, 0x3C4, 0x3C5, 0x3C6, 0x3C7,
0x3C8, 0x3C9, 0x3CA, 0x3CB, 0x3CC, 0x3CE, 0x3CF, 0x3D4, 0x3D5, 0x3DA,
/* extra ports for WD90C31 */
0x23C0, 0x23C1, 0x23C2, 0x23C3, 0x23C4, 0x23C5 };
int Num_PVGA_IOPorts = (sizeof(PVGA_IOPorts)/sizeof(PVGA_IOPorts[0]));
char usage[] = "usage: "PROGNAME"(-d(isable) | -e(nable) | -s(tatus))";
void main (int argc, char *argv[]) {
unsigned long vgaIOBase;
int colorEmulation, dualScan;
enum {enable, disable, status} mode = status;
unsigned char registr; /* ugly but register was already taken .. */
/* parse command line */
if ((argc > 2) || ((argc == 2) && (argv[1][0] != '-'))){
fprintf(stderr, "%s\n", usage); exit(1);
}
if (argc == 2) {
switch (argv[1][1]) {
case 'h':
printf("%s\ndisable/enable upper 512K of VRAM for dual-scan thinkpads\n", usage); exit(0);
case 'd': /* disable */
mode = disable; break;
case 'e': /* enable */
mode = enable; break;
case 's': /* status */
mode = status; break;
default:
fprintf(stderr, "invalid option %c\n%s\n", argv[1][1], usage); exit(1);
}
}
/* enable VGA and WD ports */
EnableIOPorts(Num_PVGA_IOPorts, PVGA_IOPorts);
/* set vga IO base depend from color mode */
colorEmulation = inb(0x3CC) & 0x01;
if (!colorEmulation) {
fprintf(stderr, "you are not running a dual scan thinkpad \n");
exit(1);
}
vgaIOBase = (colorEmulation) ? 0x3D0 : 0x3B0;
/* unlock flat panel registers PR18, PR19, PR!a, PR36-PR41 and PR44 */
outb(vgaIOBase + 4, 0x34); /* PR1B */
registr = inb(vgaIOBase + 5);
outb(vgaIOBase + 5, ((registr & 0x1F) | 0xA0)); /* set bits 5-7 to 101 */
/* check if we have a dual-scan LCD */
outb(vgaIOBase + 4, 0x31);
dualScan = ((inb(vgaIOBase + 5) & 0xB) == 0); /* dualScan == (PR18[bit:3,1,0] = 0) */
if (!dualScan) {
fprintf(stderr, "you are not running a dual scan thinkpad \n");
exit(1);
}
/* clear bit 6 to disable upper 512k The remaining 512Kbytes
of video memory are not disabled by clearing the bit, but it
is actually used as a shadow of first 512Kbyte */
outb(0x3CE, 0x0B);
registr = inb(0x3CF); /* PR1 */
if (mode == disable) {
printf("setting vramsize to 512K\n");
outb(0x3CE, 0x0B); outb(0x3CF, registr & 0xBF); /* enable 512 */
} else if (mode == enable) {
printf("setting vramsize to 1024K\n");
outb(0x3CE, 0x0B); outb(0x3CF, registr | 0xC0); /* enable 1024 */
} else {
printf("current vramsize is %dK\n", ( (registr & 0x40) ? 1024 : 512));
}
/* cleanup */
/* lock flat panel registers PR18, PR19, PR!a, PR36-PR41 and PR44 */
outb(vgaIOBase + 4, 0x34); /* PR1B */
registr = inb(vgaIOBase + 5);
outb(vgaIOBase + 5, (registr & 0x1F)); /* set bits 5-7 to other than 101 */
/* enable VGA and WD ports */
DisableIOPorts(Num_PVGA_IOPorts, PVGA_IOPorts);
}
/* helper functions (originaly borrowed from XFree86 but stripped unnecessary stuf) f*/
void EnableIOPorts(int num_ioports, unsigned *io_ports)
{
int i;
if (iopl(3) != 0) { /* for ports > 3FF */
fprintf(stderr, "%s: Failed to raise I/O privileges to 3 (%s)\n",
PROGNAME, strerror(errno));
}
for (i = 0; i < num_ioports; i++)
{
unsigned port = io_ports[i];
if (port > 0x3FF)
continue;
if (ioperm(port, 1, 1) < 0) {
fprintf(stderr, "%s: Failed to enable I/O port 0x%x (%s)\n",
PROGNAME, port, strerror(errno));
exit(1);
}
}
return;
}
void DisableIOPorts(int num_ioports, unsigned *io_ports)
{
int i;
if (iopl(0) != 0) { /* for ports > 3FF */
fprintf(stderr, "%s: Failed to lower I/O privileges to 0 (%s)\n",
PROGNAME, strerror(errno));
}
for (i = 0; i < num_ioports; i++)
{
unsigned port = io_ports[i];
if (port > 0x3FF)
continue;
if (ioperm(port, 1, 0) < 0) {
fprintf(stderr, "%s: Failed to disable I/O port 0x%x (%s)\n",
PROGNAME, port, strerror(errno));
}
}
return;
}
static __inline__ void
outb(port, val)
short port;
char val;
{
__asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
}
static __inline__ unsigned int
inb(port)
short port;
{
unsigned char ret;
__asm__ __volatile__("in%B0 (%1)" :
"=a" (ret) :
"d" (port));
return ret;
}
That's it folks. Good luck. send me corrections at conrada-b@nwu.edu.
BUT I AM NOT TECHNICAL SUPPORT. PLEASE REREAD THE MATERIAL, AND THE
APPROPRIATE FAQs AND HOWTOs BEFORE ASKING ME QUESTIONS. I figured out
how to use this stuff, so I'm sure you can too.