]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/pci/pci_compat.c
Merge git://git.denx.de/u-boot-marvell
[people/ms/u-boot.git] / drivers / pci / pci_compat.c
CommitLineData
ff3e077b
SG
1/*
2 * Compatibility functions for pre-driver-model code
3 *
4 * Copyright (C) 2014 Google, Inc
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8#define DEBUG
9#include <common.h>
10#include <dm.h>
11#include <errno.h>
12#include <malloc.h>
13#include <pci.h>
14#include <dm/device-internal.h>
15#include <dm/lists.h>
16
17#define PCI_HOSE_OP(rw, name, size, type) \
18int pci_hose_##rw##_config_##name(struct pci_controller *hose, \
19 pci_dev_t dev, \
20 int offset, type value) \
21{ \
22 return pci_##rw##_config##size(dev, offset, value); \
23}
24
25PCI_HOSE_OP(read, byte, 8, u8 *)
26PCI_HOSE_OP(read, word, 16, u16 *)
27PCI_HOSE_OP(read, dword, 32, u32 *)
28PCI_HOSE_OP(write, byte, 8, u8)
29PCI_HOSE_OP(write, word, 16, u16)
30PCI_HOSE_OP(write, dword, 32, u32)
31
32pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
33{
4b515e4f 34 struct udevice *dev;
ff3e077b
SG
35
36 if (pci_find_device_id(ids, index, &dev))
37 return -1;
4b515e4f 38 return pci_get_bdf(dev);
ff3e077b 39}