[BACK]Return to gen_firmware_patterns.c CVS log [TXT][DIR] Up to [local] / openbsd / fw_update

Annotation of openbsd/fw_update/gen_firmware_patterns.c, Revision 1.1

1.1     ! afresh1     1: #include <sys/types.h>
        !             2: #include <stdio.h>
        !             3: #include <dev/pci/pcireg.h>
        !             4: #include <dev/pci/pcivar.h>
        !             5: #include <dev/pci/pcidevs.h>
        !             6: #include <dev/pci/pcidevs_data.h>
        !             7:
        !             8: struct pci_matchid {
        !             9:        pci_vendor_id_t         pm_vid;
        !            10:        pci_product_id_t        pm_pid;
        !            11: };
        !            12:
        !            13: #include "amdgpu_devlist.h"
        !            14: #include "i915_devlist.h"
        !            15: #include "radeon_devlist.h"
        !            16:
        !            17: #define nitems(_a)     (sizeof((_a)) / sizeof((_a)[0]))
        !            18:
        !            19: const char *
        !            20: pci_findvendor(pci_vendor_id_t vendor)
        !            21: {
        !            22:        const struct pci_known_vendor *kdp;
        !            23:
        !            24:        kdp = pci_known_vendors;
        !            25:         while (kdp->vendorname != NULL) {      /* all have vendor name */
        !            26:                 if (kdp->vendor == vendor)
        !            27:                         break;
        !            28:                kdp++;
        !            29:        }
        !            30:         return (kdp->vendorname);
        !            31: }
        !            32:
        !            33: const char *
        !            34: pci_findproduct(pci_vendor_id_t vendor, pci_product_id_t product)
        !            35: {
        !            36:        const struct pci_known_product *pkp;
        !            37:
        !            38:        pkp = pci_known_products;
        !            39:        while (pkp->productname != NULL) {      /* all have product name */
        !            40:                if (pkp->vendor == vendor && pkp->product == product)
        !            41:                        break;
        !            42:                pkp++;
        !            43:        }
        !            44:        return (pkp->productname);
        !            45: }
        !            46:
        !            47: void
        !            48: print_devices(char driver[], const struct pci_matchid devices[], int items)
        !            49: {
        !            50:        int i;
        !            51:        const char *v, *p;
        !            52:        for (i = 0; i < items; i++) {
        !            53:                v = pci_findvendor(devices[i].pm_vid);
        !            54:                p = pci_findproduct(devices[i].pm_vid,
        !            55:                    devices[i].pm_pid);
        !            56:                /*
        !            57:                printf("%04x:%04x ", devices[i].pm_vid,
        !            58:                    devices[i].pm_pid);
        !            59:                */
        !            60:                if ( v && p )
        !            61:                    printf("%s \"%s %s\"\n", driver, v ? v : "", p ? p : "");
        !            62:        }
        !            63: }
        !            64:
        !            65: int
        !            66: main(void)
        !            67: {
        !            68:        printf("%s\n", "acx");
        !            69:        printf("%s\n", "amdgpu");
        !            70:        print_devices("amdgpu", amdgpu_devices, nitems(amdgpu_devices));
        !            71:        printf("%s\n", "athn");
        !            72:        printf("%s\n", "bwfm");
        !            73:        printf("%s\n", "bwi");
        !            74:        printf("%s\n", "intel");
        !            75:        printf("%s\n", "intel ^cpu0: Intel");
        !            76:        printf("%s\n", "inteldrm");
        !            77:        print_devices("inteldrm", i915_devices, nitems(i915_devices));
        !            78:        printf("%s\n", "ipw");
        !            79:        printf("%s\n", "iwi");
        !            80:        printf("%s\n", "iwm");
        !            81:        printf("%s\n", "iwn");
        !            82:        printf("%s\n", "iwx");
        !            83:        printf("%s\n", "malo");
        !            84:        printf("%s\n", "ogx");
        !            85:        printf("%s\n", "otus");
        !            86:        printf("%s\n", "pgt");
        !            87:        printf("%s\n", "radeondrm");
        !            88:        print_devices("radeondrm", radeon_devices, nitems(radeon_devices));
        !            89:        printf("%s\n", "rsu");
        !            90:        printf("%s\n", "rtwn");
        !            91:        printf("%s\n", "uath");
        !            92:        printf("%s\n", "upgt");
        !            93:        printf("%s\n", "urtwn");
        !            94:        printf("%s\n", "uvideo");
        !            95:        printf("%s\n", "vmm");
        !            96:        printf("%s\n", "wpi");
        !            97:
        !            98:        return 0;
        !            99: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>