28th December 2008

FreeBSD on the IBM ThinkPad A20p

Warning: My ThinkPad A20p no longer works. It has long been replaced by an X40, see FreeBSD on the IBM ThinkPad X40. I do not maintain this page anymore; information will be outdated by the time you read this.

In this document, I will try to give a comprehensive report on installing FreeBSD on an IBM Thinkpad A20p – what I got to work, and how, and what still does not work for me. I provide this information in the hope that it might be useful, but without any implied warranty whatsoever. If you have corrections, additional insight or feedback regarding FreeBSD on the IBM ThinkPad A20p to share, please drop me a line.

My machine is an IBM ThinkPad A20p, type 2629-62G, and it used to run the SECURITY branch of FreeBSD 5.2.1 with an almost GENERIC kernel. Parts of this document might also contain useful bits of information for running NetBSD, OpenBSD, or any of the GNU/Linux flavours on the A20 series ThinkPad.

Major Showstoppers

I experienced severe freezes of XFree86-4.3 with 5.2 and 5.2.1 when entering or leaving X with ACPI enabled. I was able to work around this by compiling a custom kernel without SMP support. I still use APIC though. To build your own kernel, follow the instructions provided in the FreeBSD Handbook and make sure you edit your kernel configuration file to comment out options SMP.

The other major problem I have at the moment is threading. Some applications, most annoyingly GNU Cash (guile actually), sometimes bail out with:

Fatal error 'Unable to read from thread kernel pipe' at line 1100 in file
/usr/src/lib/libc_r/uthread/uthread_kern.c (errno = 0)

I have tried switching the kernel scheduler, I have tried libmapping to alternative threading libraries, I have tried recompiling guile without threading support; still no luck, still the same error. I have seen reports of the problem with Apache 2, xfce, Perl, and other applications, but no solution other than upgrading to -CURRENT. I currently know of no solution or workaround to the issue, but hopefully this will be fixed in the long awaited 5.3-RELEASE.

BIOS Version and Settings

In ThinkPad BIOS versions prior to 1.05/IVET62WW, there is a critical bug which prevents the machine from booting from hard drives containing UFS partitions as used by FreeBSD. Make sure you update your BIOS before partitioning. You will be sorry if you don’t do this!

Get the latest BIOS at IBM Personal Computing Support. You will need some kind of operating system from Redmond to either ugrade the BIOS directly (Non-Diskette version), or create a BIOS upgrade diskette (Diskette version). If you find a way to flash the BIOS without ever needing a non-free OS in the process, please let me know.

Make sure you turn off the PCI bus power down functionality in the BIOS. Enabling this caused me problems with the sound subsystem, and I have seen reports of (even more) problems with ACPI/APM in conjunction with this option.

Power Managment / ACPI & APM

It runs fine with ACPI enabled, after resolving the severe freezes of XFree86-4.3 with 5.2 and 5.2.1, as described above.

An annoyance I had when booting with ACPI was that after shutting the system down using shutdown -p, the machine would turn itself back on after some random amount of time (5 minutes to an hour). This can be prevented by adding the following to /etc/sysctl.conf:

hw.acpi.disable_on_poweroff="0"

I had major annoyances when booting without ACPI, like kernel time running way too fast, so I really recommend booting with a non SMP kernel and ACPI enabled.

PCMCIA / CardBus / PC Card

The kernel has correctly detected the device:

cbb0: <TI1450 PCI-CardBus Bridge> mem 0x50000000-0x50000fff irq 11 at device 2.0 on pci0
cardbus0: <CardBus bus> on cbb0
pccard0: <16-bit PCCard bus> on cbb0
cbb1: <TI1450 PCI-CardBus Bridge> mem 0x50100000-0x50100fff irq 11 at device 2.1 on pci0
cardbus1: <[Card Bus](CardBus) bus> on cbb1
pccard1: <16-bit PCCard bus> on cbb1

I have enabled the PC Card daemon in /etc/rc.conf, and all of my PCMCIA cards work just fine. They are a Cisco Aironet 340 802.11b NIC (an driver), a D-Link DWL-660 802.11b NIC (wi driver), a D-Link DRC-650 802.11b NIC (wi driver) and a D-Link DRP-16CT Ethernet NIC (ed driver):

an0: <Cisco Systems 340 Series Wireless LAN Adapter> at port 0x100-0x13f irq 11 
an0: got RSSI \<-> dBM map
an0: Ethernet address: 00:40:xx:xx:xx:xx
an0: supported rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

wi0: <D-Link D-Link Air DWL-660 Wireless PC Card> at port 0x100-0x13f irq 11 function 0 config 1 on pccard1
wi0: 802.11 address: 00:05:xx:xx:xx:xx
wi0: using Lucent Technologies, WaveLAN/IEEE
wi0: Lucent Firmware: Station (8.10.1)
wi0: supported rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

wi0: <D Link DRC-650 11Mbps WLAN Card> at port 0x100-0x13f irq 11 function 0 config 1 on pccard1
wi0: 802.11 address: 00:05:xx:xx:xx:xx
wi0: using RF:PRISM2.5 MAC:ISL3873
wi0: Intersil Firmware: Primary (1.0.5), Station (1.3.4)
wi0: supported rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

ed1: <Ethernet Adapter> at port 0x100-0x11f irq 11 function 0 config 0 on pccard
ed1: address 00:e0:xx:xx:xx:xx, type NE2000 (16 bit)

The DWL-660 works fine in monitor mode and with dstumbler from the BSD Airtools.

Universal Serial Bus

The USB chipset was detected correctly by the kernel:

uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0x1c20-0x1c3f irq 11 at device 7.2 on pci0
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0

I have enabled the USB daemon in /etc/rc.conf, and USB works fine with my Logitech optical 3-button mouse:

ums0: Logitech USB-PS/2 Optical Mouse, rev 2.00/11.10, addr 2, iclass 3/1
ums0: 3 buttons and Z dir.

Since 5.2, even my SanDisk ImageMate SDDR-77 Dual Reader for CF/MS works, with the annoying limitation that I cannot swap CF cards. The reader effectively only works a single time, I have to actually reboot the machine to reinsert another CF card. But this is still a huge improvement over 5.1, where the kernel would segfault as soon as a CF card was inserted into the reader, effectively rendering it useless.

Console Mouse

I have enabled the mouse daemon in /etc/rc.conf using the settings below:

moused_flags=""
moused_port="/dev/psm0"
moused_type="auto"
moused_enable="YES"

Both the built-in trackpad and the external USB mouse work fine:

psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model Generic PS/2 mouse, device ID 0

Internal Modem

I have installed the comms/ltmdm port (requires the kernel sources be installed), and dialing an ISP using /dev/cual0 in /etc/ppp/ppp.conf works just fine. The modem is a Lucent/Agere Systems (Was: AT&T \MicroElectronics) LT Winmodem 56k:

ltmdm0: <Lucent Winmodem> port 0x1800-0x18ff,0x1c00-0x1c07 mem 0xf0101000-0xf010
ltmdm0: type Virtual 16550A

XFree86

The various XFree86 configuration utilities never worked for me on this machine, I had to edit /usr/X11R6/lib/X11/XF86Config myself. I am currently using the configuration below, though be aware that it probably is not optimal; do not copy literally, and please make sure you use your own path and module sections.

Section "ServerLayout"
    Identifier  "IBM Thinkpad A20p"
    Screen    0 "Screen0" 0 0
    InputDevice "Mouse0" "CorePointer"
    InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    RgbPath     "/usr/X11R6/lib/X11/rgb"
    ModulePath  "/usr/X11R6/lib/modules"
    FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath    "/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath    "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "Module"
    Load        "dbe"
    Load        "dri"
    Load        "extmod"
    Load        "glx"
    Load        "record"
    Load        "xtrap"
    Load        "speedo"
    Load        "type1"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "keyboard"
    Option      "AutoRepeat"    "500 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "de_CH"
    Option      "XkbOptions"    "ctrl:nocaps"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option      "Protocol" "auto"
    Option      "Device" "/dev/sysmouse"
EndSection

Section "Monitor"
    Identifier  "Monitor0"
    VendorName  "IBM"
    ModelName   "ITSX93"
    HorizSync   30-100
    VertRefresh 50-100
    ModeLine    "1400x1050" 122.00 1400 1464 1784 1912 1050 1052 1064 1090 -HSync -VSync
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "r128"
    VendorName  "ATI Technologies Inc"
    BoardName   "Rage Mobility M3 AGP 2x"
    BusID       "PCI:1:0:0"
    Option      "Display"   "FP"
#   Option      "Display"   "CRT"
#   Option      "Display"   "Mirror"
#   Option      "Display"   "BIOS"
EndSection

Section "Screen"
    Identifier  "Screen0"
    Device      "Card0"
    Monitor     "Monitor0"
    DefaultColorDepth 16
    SubSection "Display"
        Depth   1
        Modes   "1400x1050"
    EndSubSection
    SubSection "Display"
        Depth   4
        Modes   "1400x1050"
    EndSubSection
    SubSection "Display"
        Depth   8
        Modes   "1400x1050"
    EndSubSection
    SubSection "Display"
        Depth   15
        Modes   "1400x1050"
    EndSubSection
    SubSection "Display"
        Depth   16
        Modes   "1400x1050"
    EndSubSection
    SubSection "Display"
        Depth   24
        Modes   "1400x1050"
    EndSubSection
EndSection

Both built-in trackpad and external USB mouse work, keyboard works, the built-in TFT monitor IBM ITSX93 and graphics adapter ATI Rage Mobility M3 work too, including the xv extensions which are essential for video playback. Using an external CRT using Option "Display" works, but switching display using Fn+F7 has no effect when in X.

drm0: <ATI Rage 128 Mobility LF (AGP)> port 0x2000-0x20ff mem 0xf0200000-0xf0203fff,0xf8000000-0xfbffffff irq 11 at device 0.0 on pci1
info: [drm] AGP at 0xf4000000 64MB
info: [drm] Initialized r128 2.3.0 20021029 on minor 0

Sara Sinclair (at wellesley.edu) reported luck with the above VertRefresh and HorizSync settings on RedHat 9, where the installer auto-detected wrong values for those options and IBM tech support couldn’t/wouldn’t give working values either.

Sound

The sound card is a ‘’‘Cirrus Logic Crystal CS4610/14/22/24/30 SoundFusion PCI Audio Accelerator’‘’, and the snd_csa kernel loadable module can handle it:

csa0: <CS4280/CS4614/CS4622/CS4624/CS4630> mem 0xf0000000-0xf00fffff,0xf0100000-
csa: card is Thinkpad 600X/A20/T20
pcm0: <CS461x PCM Audio> on csa0
pcm0: <Cirrus Logic CS4297A AC97 Codec>

However, sound sometimes does not work, most notably after a warm reboot from another operating system. I have the very same problem with this sound card under Linux, so this does not seem to be a FreeBSD specific problem. Turning the machine off before rebooting into FreeBSD is a workaround.

Formi (at sdf-eu.org) reports that loading the kernel module snd_csa.ko after booting instead of via loader.conf, or unloading/reloading it manually, fixes this problem on his ThinkPad 570, which has the same sound card as the A20p.

DVD Playback

The hard disk and DVD drives are UDMA33 capable:

ad0: 17297MB <IBM-DARA-218000> [37488/15/63] at ata0-master UDMA33
acd0: DVD-ROM <MATSHITADVD-ROM SR-8174> at ata1-master UDMA33

I had to explicitly enable DMA on the DVD drive by adding the following line to /boot/loader.conf:

hw.ata.atapi_dma="1"

In order to remove region protection on the Matshita SR-8174 DVD drive, I have downgraded its firmware to an unofficially modified firmware which seems to be based on version X113. You will need a bootable DOS floppy in order to use the firmware flashing tool included with the firmware. I am told removing region protection is perfectly legal according to Swiss law, because region protection is considered harmful to consumer rights here. If you live outside Switzerland, do not download this unless you are sure it is legal for you! It works fine for me, however please note that this effectively is a firmware downgrade, and as such might reintroduce bugs that were fixed in later releases. On a sidenote: the DVD players on the Redmond operating systems still think the drive is region protected; this is probably a software thing, but be warned that this region-free firmware only worked for me with the free players on FreeBSD and Linux, but not with any proprietary DVD player software or operating system (YMMV).

To increase performance of video playback, I made sure that the xv extensions worked, see above. Running the xvinfo and xdpyinfo utilities will tell you whether you got xv working.

To further optimise performance, the FreeBSD Handbook suggests tweaking some sysctl vars in /etc/sysctl.conf, which works for me:

kern.ipc.shmmax=67108864
kern.ipc.shmall=32768

The kernel option CPU_ENABLE_SSE mentioned in the FreeBSD Handbook only applies to FreeBSD 4.x, as SSE support is automatically enabled in 5.x kernels on CPUs supporting it.

I have tried all of Xine, Ogle and MPlayer (from the graphics/xine, graphics/ogle and graphics/mplayer port respectively), and after adding the required symlinks from /dev/{rdvd,dvd,cdrom} to /dev/acd0 they work, but with 5.1 sometimes gave me noticeable dropped frames (Xine, Ogle) or warnings about not enough CPU power (MPlayer), even though I compiled it with the WITH_OPTIMIZED_CFLAGS knob enabled. Some runtime option tweaking (see man page) gave me acceptable results with most but not all DVDs with MPlayer, but I could not get good results with Xine and Ogle at all. Starting with 5.2, performance seems to have increased to acceptable levels.

Other Devices

Floppy works fine out-of-the-box:

fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> port 0x3f7,0x3f0-0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0

Still on my TODO list are the serial, parallel, infrared and s/video ports. Serial and parallel look good but I have not actually tried them yet; infrared and s/video I am rather pessimistic about.

External Links

This report is listed in the TuxMobil Linux and BSD Laptop and Notebook Survey.

Ƿ