How to add an (S)VGA driver to XFree86 : The Driver Itself : The Probe() function
Previous: The ClockSelect() function
Next: The EnterLeave() function

## 6.5. The Probe() function

The Probe() function is perhaps the most important, and perhaps the least intuitive function in the driver. The Probe function is required to identify the chipset independent of all other chipsets. If the user has specified a ``Chipset`' line in the XF86Config file, this is a simple string comparison check. Otherwise, you must use some other technique to figure out what chipset is installed. If you are lucky, the chipset will have an identification mechanism (ident/version registers, etc), and this will be documented in the databook. Otherwise, you will have to determine some scheme, using the reference materials listed below.

The identification is often done by looking for particular patterns in register, or for the existence of certain extended registers. Or with some boards/chipsets, the requisite information can be obtained by reading the BIOS for certain signature strings. The best advise is to study the existing probe functions, and use the reference documentation. You must be certain that your probe is non-destructive - if you modify a register, it must be saved before, and restored after.

Once the chipset is successfully identified, the Probe() function must do some other initializations:

1. If the user has not specified the ``VideoRam`' parameter in the XF86Config file, the amount of installed memory must be determined.
2. If the user has not specified the ``Clocks`' parameter in the XF86Config file, the values for the available dot-clocks must be determined. This is done by calling the vgaGetClocks() function, and passing it the number of clocks available and a pointer to the ClockSelect() function.
3. It is recommended that the `maxClock' field of the server's `vga256InfoRec' structure be filled in with the maximum dot-clock rate allowed for this chipset (specified in KHz). If this is not filled in a probe time, a default (currently 90MHz) will be used.
4. The `chipset' field of the server's `vga256InfoRec' structure must be initialized to the name of the installed chipset.
5. If the driver will be used with the monochrome server, the `bankedMono' field of the server's `vga256InfoRec' structure must be set to indicate whether the monochrome driver supports banking.
6. If any option flags are used by this driver, the `ChipOptionFlags' structure in the `vgaVideoChipRec' must be initialized with the allowed option flags using the OFLG_SET() macro.

How to add an (S)VGA driver to XFree86 : The Driver Itself : The Probe() function
Previous: The ClockSelect() function
Next: The EnterLeave() function