diff --git a/src/amd/common.c b/src/amd/common.c index 467428c..24fe28d 100644 --- a/src/amd/common.c +++ b/src/amd/common.c @@ -35,6 +35,7 @@ int amd_common_pre_reset(struct vendor_reset_dev *dev) return -ENOMEM; dev->vendor_private = priv; + priv->vdev = dev; spin_lock_init(&priv->pcie_lock); spin_lock_init(&priv->reg_lock); @@ -80,6 +81,9 @@ int amd_common_post_reset(struct vendor_reset_dev *dev) if (!dev->reset_ret) pci_set_power_state(pdev, PCI_D3hot); + kzfree(priv); + dev->vendor_private = NULL; + return 0; } @@ -96,7 +100,7 @@ int smum_send_msg_to_smc(struct amd_fake_dev *adev, uint16_t msg, uint32_t *resp --timeout) udelay(1); if ((ret = RREG32(mmMP1_SMN_C2PMSG_90)) != 0x1) - pci_info(to_vendor_reset_dev(adev->private)->pdev, "SMU error 0x%x (line %d)\n", + pci_info(adev->private->vdev->pdev, "SMU error 0x%x (line %d)\n", ret, __LINE__); mutex_unlock(&adev->private->smu_lock); diff --git a/src/amd/common.h b/src/amd/common.h index ff7ef2e..560b9e6 100644 --- a/src/amd/common.h +++ b/src/amd/common.h @@ -163,6 +163,7 @@ struct amd_vendor_private { u16 cfg; + struct vendor_reset_dev *vdev; struct pci_saved_state *saved_state; struct amd_fake_dev adev; @@ -175,7 +176,6 @@ struct amd_vendor_private struct mutex smu_lock; }; -#define to_vendor_reset_dev(priv) container_of((void *)priv, struct vendor_reset_dev, vendor_private) #define amd_private(vdev) ((struct amd_vendor_private *)(vdev->vendor_private)) int amd_common_pre_reset(struct vendor_reset_dev *); diff --git a/src/amd/vega10.c b/src/amd/vega10.c index f04260f..227990f 100644 --- a/src/amd/vega10.c +++ b/src/amd/vega10.c @@ -134,12 +134,12 @@ static int amd_vega10_reset(struct vendor_reset_dev *dev) for (timeout = 100000; timeout; --timeout) { sol = RREG32(mmMP0_SMN_C2PMSG_81); - if (sol != 0xFFFFFFFF) + if (sol != 0xFFFFFFFF && sol != 0) break; udelay(1); } - if (sol == 0xFFFFFFFF) + if (!sol) { pci_warn(dev->pdev, "Vega10: Timed out waiting for SOL to be valid\n"); return -EINVAL;