aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-10-12 10:52:48 -0400
committerTom Rini <trini@konsulko.com>2019-10-12 10:52:48 -0400
commit9189d6f1e9c4ae40a14558636ed7b59b53c4c885 (patch)
tree88cf3ab7d7c967e2de9cdfd9cc9a3e8c99cb64c0 /drivers/pci
parent0c9cc5155cb5027ae17ace986f349e2f0d1fb9a3 (diff)
parentc443f56cc699f25feb4618791730d11a0eb6280a (diff)
downloadu-boot-9189d6f1e9c4ae40a14558636ed7b59b53c4c885.zip
u-boot-9189d6f1e9c4ae40a14558636ed7b59b53c4c885.tar.gz
u-boot-9189d6f1e9c4ae40a14558636ed7b59b53c4c885.tar.bz2
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Remember the device being emulated for Sandbox PCI - Update Kconfig options for FSP 1.0 - Drop RESET_BASE and RESET_SEG_SIZE that are no longer used
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-emul-uclass.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c
index 0dcf937..0f63e49 100644
--- a/drivers/pci/pci-emul-uclass.c
+++ b/drivers/pci/pci-emul-uclass.c
@@ -18,6 +18,7 @@ struct sandbox_pci_emul_priv {
int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
struct udevice **containerp, struct udevice **emulp)
{
+ struct pci_emul_uc_priv *upriv;
struct udevice *dev;
int ret;
@@ -30,16 +31,32 @@ int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
}
*containerp = dev;
- /*
- * See commit 4345998ae9df,
- * "pci: sandbox: Support dynamically binding device driver"
- */
ret = uclass_get_device_by_phandle(UCLASS_PCI_EMUL, dev, "sandbox,emul",
emulp);
- if (ret && device_get_uclass_id(dev) != UCLASS_PCI_GENERIC)
+ if (!ret) {
+ upriv = dev_get_uclass_priv(*emulp);
+
+ upriv->client = dev;
+ } else if (device_get_uclass_id(dev) != UCLASS_PCI_GENERIC) {
+ /*
+ * See commit 4345998ae9df,
+ * "pci: sandbox: Support dynamically binding device driver"
+ */
*emulp = dev;
+ }
+
+ return 0;
+}
- return *emulp ? 0 : -ENODEV;
+int sandbox_pci_get_client(struct udevice *emul, struct udevice **devp)
+{
+ struct pci_emul_uc_priv *upriv = dev_get_uclass_priv(emul);
+
+ if (!upriv->client)
+ return -ENOENT;
+ *devp = upriv->client;
+
+ return 0;
}
uint sandbox_pci_read_bar(u32 barval, int type, uint size)
@@ -88,6 +105,7 @@ UCLASS_DRIVER(pci_emul) = {
.post_probe = sandbox_pci_emul_post_probe,
.pre_remove = sandbox_pci_emul_pre_remove,
.priv_auto_alloc_size = sizeof(struct sandbox_pci_emul_priv),
+ .per_device_auto_alloc_size = sizeof(struct pci_emul_uc_priv),
};
/*