[PATCH] Move the logic for matching devices out of probe routine.
aplattner at nvidia.com
Sun Sep 13 16:53:44 PDT 2009
On Sat, Sep 12, 2009 at 07:37:39AM -0700, Mario Limonciello wrote:
> This prevents the X server from "claiming" a slot but not
> freeing it up since the driver used to abort on the probe routine.
> To achieve this a few things had to be done:
> 1) Move the list of devices into a parsable CSV file.
> 2) Add a parsing perl script for generating the two static
> arrays that contain all the device lists. This came from
> initially xf86-video-ati with some modifications.
> 3) Disable any code in the probe routine that was "ignoring"
> src/nv_driver.c | 452 +-------------------------
> src/pcidb/nv_list.csv | 638 +++++++++++++++++++++++++++++++++++++
> src/pcidb/parse_pci_ids.pl | 82 +++++
> 3 files changed, 729 insertions(+), 443 deletions(-)
> create mode 100644 src/nvidia_chipset_gen.h
> create mode 100644 src/nvidia_pci_device_match_gen.h
> create mode 100644 src/pcidb/nv_list.csv
> create mode 100755 src/pcidb/parse_pci_ids.pl
I'm somewhat baffled and saddened by the fact that we have a driver probe
routine when the driver is not allowed to probe the hardware and make
decisions based on things other than the PCI ID. It seems like this really
ought to be fixed in the server. That said, it does seem relatively easy
to just generate a ridiculously big table with all the current PCI IDs plus
anything that the NVIsSupported function would allow, as a workaround.
libpciaccess really ought to have had mask-based matches for device_id like
it does for device_class, but it's too late for that now.
I do object to having a Perl script generate this information from a CSV
file. If you absolutely must have the PCI ID table somewhere outside the
driver, the right way to do it is to generate the CSV file from a header
file using a C small helper program, not the other way around with Perl.
Gaetan has some very good points about why a static PCI ID table is not a
very good idea.
More information about the xorg-devel