mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
pds_core: pass opcode to devcmd_wait
Don't rely on the PCI memory for the devcmd opcode because we
read a 0xff value if the PCI bus is broken, which can cause us
to report a bogus dev_cmd opcode later.
Fixes: 523847df1b
("pds_core: add devcmd device interfaces")
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230824161754.34264-6-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
969cfd4c8c
commit
0ea064e74b
1 changed files with 2 additions and 5 deletions
|
@ -121,7 +121,7 @@ static const char *pdsc_devcmd_str(int opcode)
|
|||
}
|
||||
}
|
||||
|
||||
static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
|
||||
static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
|
||||
{
|
||||
struct device *dev = pdsc->dev;
|
||||
unsigned long start_time;
|
||||
|
@ -131,9 +131,6 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
|
|||
int done = 0;
|
||||
int err = 0;
|
||||
int status;
|
||||
int opcode;
|
||||
|
||||
opcode = ioread8(&pdsc->cmd_regs->cmd.opcode);
|
||||
|
||||
start_time = jiffies;
|
||||
max_wait = start_time + (max_seconds * HZ);
|
||||
|
@ -180,7 +177,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
|
|||
|
||||
memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
|
||||
pdsc_devcmd_dbell(pdsc);
|
||||
err = pdsc_devcmd_wait(pdsc, max_seconds);
|
||||
err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
|
||||
memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
|
||||
|
||||
if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
|
||||
|
|
Loading…
Add table
Reference in a new issue