2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <device/device.h>
16 #include <device/pci.h>
17 #include <device/pci_ids.h>
20 static void iommu_read_resources(struct device
*dev
)
24 /* Get the normal pci resources of this device */
25 pci_dev_read_resources(dev
);
27 /* Add an extra subtractive resource for both memory and I/O. */
28 res
= new_resource(dev
, 0x44);
29 res
->size
= 512 * 1024;
30 res
->align
= log2(res
->size
);
31 res
->gran
= log2(res
->size
);
32 res
->limit
= 0xffffffff; /* 4G */
33 res
->flags
= IORESOURCE_MEM
;
36 static struct pci_operations lops_pci
= {
37 .set_subsystem
= pci_dev_set_subsystem
,
40 static struct device_operations iommu_ops
= {
41 .read_resources
= iommu_read_resources
,
42 .set_resources
= pci_dev_set_resources
,
43 .enable_resources
= pci_dev_enable_resources
,
47 static const unsigned short pci_device_ids
[] = {
48 PCI_DEVICE_ID_AMD_15H_MODEL_303F_NB_IOMMU
,
49 PCI_DEVICE_ID_AMD_15H_MODEL_707F_NB_IOMMU
,
50 PCI_DEVICE_ID_AMD_17H_MODEL_101F_NB_IOMMU
,
54 static const struct pci_driver iommu_driver __pci_driver
= {
56 .vendor
= PCI_VENDOR_ID_AMD
,
57 .devices
= pci_device_ids
,