1
/* pci.c - Generic PCI interfaces. */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
6
* GRUB is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GRUB is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
22
#include <grub/emu/misc.h>
23
#include <grub/util/misc.h>
26
grub_pci_make_address (grub_pci_device_t dev, int reg)
28
grub_pci_address_t ret;
35
grub_pci_iterate (grub_pci_iteratefunc_t hook)
37
struct pci_device_iterator *iter;
38
struct pci_slot_match slot;
39
struct pci_device *dev;
40
slot.domain = PCI_MATCH_ANY;
41
slot.bus = PCI_MATCH_ANY;
42
slot.dev = PCI_MATCH_ANY;
43
slot.func = PCI_MATCH_ANY;
44
iter = pci_slot_match_iterator_create (&slot);
45
while ((dev = pci_device_next (iter)))
46
hook (dev, dev->vendor_id | (dev->device_id << 16));
47
pci_iterator_destroy (iter);
51
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
56
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
58
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
63
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
66
pci_device_unmap_range (dev, mem, size);
76
pci_system_cleanup ();