mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
iosf: make iosf_rw take a larger addr
For higher DPIO ranges for example. Also fix it up to use intel_register_read/write. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
e558dd998d
commit
5e21b434da
@ -7,10 +7,9 @@
|
|||||||
|
|
||||||
#define TIMEOUT_US 500000
|
#define TIMEOUT_US 500000
|
||||||
|
|
||||||
static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint8_t addr,
|
static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint32_t addr,
|
||||||
uint32_t *val)
|
uint32_t *val)
|
||||||
{
|
{
|
||||||
volatile uint32_t *ptr;
|
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
uint32_t cmd, devfn, be, bar;
|
uint32_t cmd, devfn, be, bar;
|
||||||
int is_read = (opcode == PUNIT_OPCODE_REG_READ ||
|
int is_read = (opcode == PUNIT_OPCODE_REG_READ ||
|
||||||
@ -24,43 +23,33 @@ static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint8_t addr,
|
|||||||
(port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
|
(port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
|
||||||
(bar << IOSF_BAR_SHIFT);
|
(bar << IOSF_BAR_SHIFT);
|
||||||
|
|
||||||
ptr = (volatile uint32_t*)((volatile char*)mmio +
|
if (intel_register_read(VLV_IOSF_DOORBELL_REQ) & IOSF_SB_BUSY) {
|
||||||
VLV_IOSF_DOORBELL_REQ);
|
|
||||||
|
|
||||||
if (*ptr & IOSF_SB_BUSY) {
|
|
||||||
fprintf(stderr, "warning: pcode (%s) mailbox access failed\n",
|
fprintf(stderr, "warning: pcode (%s) mailbox access failed\n",
|
||||||
is_read ? "read" : "write");
|
is_read ? "read" : "write");
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = (volatile uint32_t*)((volatile char*)mmio + VLV_IOSF_ADDR);
|
intel_register_write(VLV_IOSF_ADDR, addr);
|
||||||
*ptr = addr;
|
if (!is_read)
|
||||||
if (!is_read) {
|
intel_register_write(VLV_IOSF_DATA, *val);
|
||||||
ptr = (volatile uint32_t*)((volatile char*)mmio +
|
|
||||||
VLV_IOSF_DATA);
|
intel_register_write(VLV_IOSF_DOORBELL_REQ, cmd);
|
||||||
*ptr = *val;
|
|
||||||
}
|
|
||||||
ptr = (volatile uint32_t*)((volatile char*)mmio +
|
|
||||||
VLV_IOSF_DOORBELL_REQ);
|
|
||||||
*ptr = cmd;
|
|
||||||
do {
|
do {
|
||||||
usleep(1);
|
usleep(1);
|
||||||
timeout++;
|
timeout++;
|
||||||
} while ((*ptr & IOSF_SB_BUSY) && timeout < TIMEOUT_US);
|
} while (intel_register_read(VLV_IOSF_DOORBELL_REQ) & IOSF_SB_BUSY &&
|
||||||
|
timeout < TIMEOUT_US);
|
||||||
|
|
||||||
if (timeout >= TIMEOUT_US) {
|
if (timeout >= TIMEOUT_US) {
|
||||||
fprintf(stderr, "timeout waiting for pcode %s (%d) to finish\n",
|
fprintf(stderr, "timeout waiting for pcode %s (%d) to finish\n",
|
||||||
opcode == PUNIT_OPCODE_REG_READ ? "read" : "write",
|
is_read ? "read" : "write", addr);
|
||||||
addr);
|
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_read) {
|
if (is_read)
|
||||||
ptr = (volatile uint32_t*)((volatile char*)mmio +
|
*val = intel_register_read(VLV_IOSF_DATA);
|
||||||
VLV_IOSF_DATA);
|
intel_register_write(VLV_IOSF_DATA, 0);
|
||||||
*val = *ptr;
|
|
||||||
}
|
|
||||||
*ptr = 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user