intel_reg_{read,write}: switch to INREG and OUTREG

Use INREG and OUTREG instead of using mmio directly.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2015-04-15 15:47:34 +03:00
parent 87eb37c86b
commit 12d785bcd4
2 changed files with 5 additions and 8 deletions

View File

@ -51,8 +51,7 @@ static void dump_range(uint32_t start, uint32_t end)
int i;
for (i = start; i < end; i += 4)
printf("0x%X : 0x%X\n", i,
*(volatile uint32_t *)((volatile char*)mmio + i));
printf("0x%X : 0x%X\n", i, INREG(i));
}
static void usage(char *cmdname)
@ -130,7 +129,7 @@ int main(int argc, char** argv)
dump_range(reg, reg + (dwords * 4));
if (decode_bits)
bit_decode(*(volatile uint32_t *)((volatile char*)mmio + reg));
bit_decode(INREG(reg));
}
}

View File

@ -35,7 +35,6 @@
int main(int argc, char** argv)
{
uint32_t reg, value;
volatile uint32_t *ptr;
if (argc < 3) {
printf("Usage: %s addr value\n", argv[0]);
@ -47,11 +46,10 @@ int main(int argc, char** argv)
intel_register_access_init(intel_get_pci_device(), 0);
sscanf(argv[1], "0x%x", &reg);
sscanf(argv[2], "0x%x", &value);
ptr = (volatile uint32_t *)((volatile char *)mmio + reg);
printf("Value before: 0x%X\n", *ptr);
*ptr = value;
printf("Value after: 0x%X\n", *ptr);
printf("Value before: 0x%X\n", INREG(reg));
OUTREG(reg, value);
printf("Value after: 0x%X\n", INREG(reg));
intel_register_access_fini();
return 0;