diff options
-rw-r--r-- | lib/intel_io.h | 2 | ||||
-rw-r--r-- | lib/intel_mmio.c | 57 | ||||
-rw-r--r-- | tools/intel_reg.c | 2 | ||||
-rw-r--r-- | tools/intel_reg_snapshot.c | 2 |
4 files changed, 31 insertions, 32 deletions
diff --git a/lib/intel_io.h b/lib/intel_io.h index 1c3b4445..e2d6b470 100644 --- a/lib/intel_io.h +++ b/lib/intel_io.h @@ -32,7 +32,7 @@ #include <pciaccess.h> /* register access helpers from intel_mmio.c */ -extern void *mmio; +extern void *igt_global_mmio; void intel_mmio_use_pci_bar(struct pci_device *pci_dev); void intel_mmio_use_dump_file(char *file); diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c index be8f7d77..2fdb2b05 100644 --- a/lib/intel_mmio.c +++ b/lib/intel_mmio.c @@ -65,11 +65,12 @@ #define FAKEKEY 0x2468ace0 /** - * mmio: + * igt_global_mmio: * - * Pointer to the register range. It is not recommended to use this directly. + * Pointer to the register range, initialized using intel_register_access_init() + * or intel_mmio_use_dump_file(). It is not recommended to use this directly. */ -void *mmio; +void *igt_global_mmio; static struct _mmio_data { int inited; @@ -83,9 +84,9 @@ static struct _mmio_data { * intel_mmio_use_dump_file: * @file: name of the register dump file to open * - * Sets up #mmio to point at the data contained in @file. This allows the same - * code to get reused for dumping and decoding from running hardware as from - * register dumps. + * Sets up #igt_global_mmio to point at the data contained in @file. This allows + * the same code to get reused for dumping and decoding from running hardware as + * from register dumps. */ void intel_mmio_use_dump_file(char *file) @@ -98,8 +99,8 @@ intel_mmio_use_dump_file(char *file) "Couldn't open %s\n", file); fstat(fd, &st); - mmio = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); - igt_fail_on_f(mmio == MAP_FAILED, + igt_global_mmio = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); + igt_fail_on_f(igt_global_mmio == MAP_FAILED, "Couldn't mmap %s\n", file); close(fd); } @@ -108,9 +109,7 @@ intel_mmio_use_dump_file(char *file) * intel_mmio_use_pci_bar: * @pci_dev: intel gracphis pci device * - * Sets up #mmio to point at the data contained in @file. This allows the same - * code to get reused for dumping and decoding from running hardware as from - * register dumps. + * Sets up #igt_global_mmio to point at the mmio bar. * * @pci_dev can be obtained from intel_get_pci_device(). */ @@ -139,7 +138,7 @@ intel_mmio_use_pci_bar(struct pci_device *pci_dev) pci_dev->regions[mmio_bar].base_addr, mmio_size, PCI_DEV_MAP_FLAG_WRITABLE, - &mmio); + &igt_global_mmio); igt_fail_on_f(error != 0, "Couldn't map MMIO region\n"); @@ -160,7 +159,7 @@ release_forcewake_lock(int fd) * handling and also allows register access to be checked with an explicit * whitelist. * - * It also initializes #mmio like intel_mmio_use_pci_bar(). + * It also initializes #igt_global_mmio like intel_mmio_use_pci_bar(). * * @pci_dev can be obtained from intel_get_pci_device(). */ @@ -170,10 +169,10 @@ intel_register_access_init(struct pci_device *pci_dev, int safe) int ret; /* after old API is deprecated, remove this */ - if (mmio == NULL) + if (igt_global_mmio == NULL) intel_mmio_use_pci_bar(pci_dev); - igt_assert(mmio != NULL); + igt_assert(igt_global_mmio != NULL); if (mmio_data.inited) return -1; @@ -266,7 +265,7 @@ intel_register_read(uint32_t reg) } read_out: - ret = *(volatile uint32_t *)((volatile char *)mmio + reg); + ret = *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg); out: return ret; } @@ -303,7 +302,7 @@ intel_register_write(uint32_t reg, uint32_t val) "Register write blocked for safety ""(*0x%08x = 0x%x)\n", reg, val); write_out: - *(volatile uint32_t *)((volatile char *)mmio + reg) = val; + *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val; } @@ -314,14 +313,14 @@ write_out: * 32-bit read of the register at offset @reg. This function only works when the * new register access helper is initialized with intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. * * Returns: * The value read from the register. */ uint32_t INREG(uint32_t reg) { - return *(volatile uint32_t *)((volatile char *)mmio + reg); + return *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg); } /** @@ -331,14 +330,14 @@ uint32_t INREG(uint32_t reg) * 16-bit read of the register at offset @reg. This function only works when the * new register access helper is initialized with intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. * * Returns: * The value read from the register. */ uint16_t INREG16(uint32_t reg) { - return *(volatile uint16_t *)((volatile char *)mmio + reg); + return *(volatile uint16_t *)((volatile char *)igt_global_mmio + reg); } /** @@ -348,14 +347,14 @@ uint16_t INREG16(uint32_t reg) * 8-bit read of the register at offset @reg. This function only works when the * new register access helper is initialized with intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. * * Returns: * The value read from the register. */ uint8_t INREG8(uint32_t reg) { - return *((volatile uint8_t *)mmio + reg); + return *((volatile uint8_t *)igt_global_mmio + reg); } /** @@ -367,11 +366,11 @@ uint8_t INREG8(uint32_t reg) * when the new register access helper is initialized with * intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. */ void OUTREG(uint32_t reg, uint32_t val) { - *(volatile uint32_t *)((volatile char *)mmio + reg) = val; + *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val; } /** @@ -383,11 +382,11 @@ void OUTREG(uint32_t reg, uint32_t val) * when the new register access helper is initialized with * intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. */ void OUTREG16(uint32_t reg, uint16_t val) { - *(volatile uint16_t *)((volatile char *)mmio + reg) = val; + *(volatile uint16_t *)((volatile char *)igt_global_mmio + reg) = val; } /** @@ -399,9 +398,9 @@ void OUTREG16(uint32_t reg, uint16_t val) * when the new register access helper is initialized with * intel_register_access_init(). * - * This function directly accesses the #mmio without safety checks. + * This function directly accesses the #igt_global_mmio without safety checks. */ void OUTREG8(uint32_t reg, uint8_t val) { - *((volatile uint8_t *)mmio + reg) = val; + *((volatile uint8_t *)igt_global_mmio + reg) = val; } diff --git a/tools/intel_reg.c b/tools/intel_reg.c index 0f982669..090cc256 100644 --- a/tools/intel_reg.c +++ b/tools/intel_reg.c @@ -491,7 +491,7 @@ static int intel_reg_snapshot(struct config *config, int argc, char *argv[]) intel_mmio_use_pci_bar(config->pci_dev); /* XXX: error handling */ - write(1, mmio, config->pci_dev->regions[mmio_bar].size); + write(1, igt_global_mmio, config->pci_dev->regions[mmio_bar].size); if (config->verbosity > 0) printf("use this with --mmio=FILE --devid=0x%04X\n", diff --git a/tools/intel_reg_snapshot.c b/tools/intel_reg_snapshot.c index b756bf69..50dafd6a 100644 --- a/tools/intel_reg_snapshot.c +++ b/tools/intel_reg_snapshot.c @@ -45,7 +45,7 @@ int main(int argc, char** argv) else mmio_bar = 0; - ret = write(1, mmio, pci_dev->regions[mmio_bar].size); + ret = write(1, igt_global_mmio, pci_dev->regions[mmio_bar].size); assert(ret > 0); return 0; |