3
matches_file = grub.getenv("matches_file")
4
class_match = tonumber(grub.getenv("class_match"))
8
function test_device(bus, dev, func, pciid, subpciid, class)
9
baseclass = bit.rshift(class, 24)
11
if (class_match and class_match ~= baseclass) then return end
13
vendor = bit.band(0xffff, pciid)
14
device = bit.rshift(pciid, 16)
15
subvendor = bit.band(0xffff, subpciid)
16
subdevice = bit.rshift(subpciid, 16)
17
subclass = bit.band(0xff, bit.rshift(class, 16))
19
id = string.format("v%04xd%04xsv%04xsd%04xbc%02xsc%02x",
27
matches = grub.file_open(matches_file)
29
while (not grub.file_eof(matches)) do
30
line = grub.file_getline(matches)
31
if (line ~= "" and string.find(id, string.format("^%s$", line))) then
38
if (grub.file_exist(matches_file)) then
39
grub.enum_pci(test_device)
42
grub.setenv("match", match)