|
13 | 13 | SKIP_LINE_REGEX = re.compile(r"^\t{2,}") |
14 | 14 | VENDOR_REGEX = re.compile(r"^([0-9a-fA-F]{4})\s+(.*)") |
15 | 15 | DEVICE_REGEX = re.compile(r"^\t([0-9a-fA-F]{4})\s+(.*)") |
| 16 | +GPU_NAME_REGEXES = { |
| 17 | + AMD: { |
| 18 | + "include": re.compile(r"\b(?:radeon|instinct|fire|rage|polaris)\b", re.IGNORECASE), |
| 19 | + "exclude": re.compile(r"\b(?:audio|bridge)\b", re.IGNORECASE), |
| 20 | + }, |
| 21 | + INTEL: { |
| 22 | + "include": re.compile(r"\b(?:arc)\b", re.IGNORECASE), |
| 23 | + "exclude": re.compile(r"\b(?:audio|bridge)\b", re.IGNORECASE), |
| 24 | + }, |
| 25 | + NVIDIA: { |
| 26 | + "include": re.compile(r"\b(?:geforce|riva|quadro|tesla|ion|grid|rtx)\b", re.IGNORECASE), |
| 27 | + "exclude": re.compile( |
| 28 | + r"\b(?:audio|switch|pci|memory|smbus|ide|co-processor|bridge|usb|sata|controller)\b", re.IGNORECASE |
| 29 | + ), |
| 30 | + }, |
| 31 | +} |
16 | 32 |
|
17 | 33 |
|
18 | 34 | def process_pci_file(input_file: str, output_db: str): |
@@ -54,7 +70,10 @@ def process_pci_file(input_file: str, output_db: str): |
54 | 70 | if match_device and vendor_id and vendor_name: |
55 | 71 | device_id, device_name = match_device.groups() |
56 | 72 |
|
57 | | - if vendor_id == INTEL and not ARC_REGEX.search(device_name.lower()): |
| 73 | + include_regex = GPU_NAME_REGEXES[vendor_id]["include"] |
| 74 | + exclude_regex = GPU_NAME_REGEXES[vendor_id]["exclude"] |
| 75 | + |
| 76 | + if not include_regex.search(device_name) or exclude_regex.search(device_name): |
58 | 77 | continue |
59 | 78 |
|
60 | 79 | # Insert the vendor and device information into the database |
|
0 commit comments