BSD DevCenter
oreilly.comSafari Books Online.Conferences.


Laptops, PC Cards, and FreeBSD
Pages: 1, 2

Unlike most of the other default files, /etc/defaults/pccard.conf probably needs some changes. If nothing else, your IRQs probably need editing. Most of the card configurations are correct, however. When you find something in /etc/defaults/pccard.conf that doesn't meet your needs, you can make an entry in /etc/pccard.conf. Those entries will override the default file.

The pccard.conf file starts off with a list of available resources.

io      available I/O ports
irq     available IRQs
memory  available memory spaces and sizes

If you need to, you can specify multiple lines for each of these. The irq line accepts a list of space-separated values.

These are the most likely to require changes, especially the irq line. Grep /var/run/dmesg.boot for irq, and confirm that only open IRQs appear here. The pccard daemon won't think twice about assigning your card to a busy IRQ and crashing your system. Similarly, confirm that the I/O ports are actually open. If you have some cards statically compiled into the kernel (such as the zp card mentioned above), they can take memory spaces listed here and interfere with other PC cards.

Beneath this is a list of PC cards. This list contains most of the cards that work with FreeBSD. If you have a card that doesn't appear on this list and have a working configuration for it, please send-pr(1) it.

The pccard.conf file is built from information obtained directly from cards. Each PC card has a small amount of nonvolatile memory. When pccardd detects a card, it reads that memory and tries to match it to an entry in pccard.conf. If every characteristic matches the driver, and the laptop has the proper resources free, the card will run. If the card doesn't run, chances are the entry is incorrect somewhere.

Each entry starts with:

card [manufacturer] [version] [add_info1] [add_info2 ]

The manufacturer and version appear on every PC card. Some cards have one or two fields of additional information. Pccardd uses the manufacturer, version, and other information to match a card to a configuration.

Every entry also contains the line:

config [index] [driver] [interrupt] [flags]

The index entry indicates which of the card's possible configurations to use. The driver is the kernel driver this card uses. The interrupt is the IRQ the card takes. Whenever possible, use ? as the interrupt number. It's much better in the long run to get the irq line correct than to tweak individual entries. The flags are the same ones used in kernel configuration; you can get them from the device driver man page.

The optional ether keyword indicates that the card stores its physical MAC address in the card's memory. The offset is the distance into memory where the information can be found. If you find yourself changing this value, you're probably looking at the wrong entry.

The optional reset keyword tells pccardd to reset the card a certain number of milliseconds after it is inserted. This gives the card a chance to power on and warm up. By default, cards are reset 100 ms after insertion. If your card doesn't work well, you might need to increase this value.

The iosize and memsize keywords allow you to set I/O port and memory size information, if they are not specified on the card itself.

The insert keyword marks a shell command that is run when the card is inserted and activated. Similarly, the remove keyword is a shell command to run when the card is removed.

Lastly, the logstr line is a free-text string that will be entered in the system log when the card is inserted or removed. (This only works in 4.0 and newer.)

You use the above to tell FreeBSD what to match on the card and to issue instructions to the card. The matching part can be a problem if you don't know what the card says. You can read the card directly with the pccardc program.

Make sure your card is inserted and type:

pccardc dumpcis

This will generate a lot of information. Try it again, and redirect the output to a file.

Each card gives information in "tuples." Some tuples include generic card information, while others give specifics on interrupts and memory slots the card can use. For example, my Xircom includes the tuple shown here.

This is a gold mine of card information. First of all, the fourth line down gives you the config index for this card. Near the bottom you'll find IRQs. (IRQs given by "pccardc dumpcis" are hints only. Each card only has one valid interrupt. This gives you a place to start looking, however.) If you look in tuple #3, you find the description and manufacturer. You can use this information to tweak /etc/defaults/pccard.conf or to create your own custom /etc/pccard.conf.

Laptop FreeBSD is a huge topic, and I could easily write much more about management versus polling mode, suspend, resume, and all the horrible little details of Unix management. Getting your system on the network is a vital first step, however, and the above should get you there.

I've worked with a FreeBSD laptop as my primary system for some time now. On one memorable occasion, I plugged it in as a replacement firewall and the users said the network was running faster than with a proprietary solution. It makes a wonderful portable packet sniffer, dumb terminal, e-mail reader, and all-around BSD workstation.

Plus, royal-blooded Unix on a laptop is simply too cool for words.

Thanks to many, many readers of freebsd-mobile for their kind review of this article. Anyone who says that BSD is snobbish should hang out there for a while.

Michael W. Lucas

Read more Big Scary Daemons columns.

Discuss this article in the Operating Systems Forum.

Return to the BSD DevCenter.


Sponsored by: