Andrey Smirnov 33a631f026
feat: look up Links PCI vendor/product via PCI ID database
This increases `initramfs` size by 356060 bytes (raw text database is
1.3 MiB).

In QEMU:

```
$ talosctl -n 172.20.0.2 get links eth0 -o yaml
spec:
    ...
    productID: "0x1000"
    vendorID: "0x1af4"
    product: Virtio network device
    vendor: Red Hat, Inc.
```

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-05-23 17:21:49 +04:00

26 lines
650 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package pci provides methods to access PCI-related data.
package pci
import (
"github.com/siderolabs/go-pcidb/pkg/pcidb"
)
// Device describes PCI device.
type Device struct {
VendorID uint16
ProductID uint16
Vendor string
Product string
}
// LookupDB looks up device info in the PCI database.
func (d *Device) LookupDB() {
d.Vendor, _ = pcidb.LookupVendor(d.VendorID)
d.Product, _ = pcidb.LookupProduct(d.VendorID, d.ProductID)
}