intel-gpu-tools register range handling with forcewake hooks
RFC PATCH 1/1 intel-gpu-tools register range handling with forcewake hooks
Forcewake will not be fully implemented until the patches are upstream.
Meanwhile, the register range code from the kernel ioctls previously has been moved into a new API for register reads/writes.
We can deprecate the old code by using the non-safe flag in the new API. The safe flag should allow the previous behavior to continue.
--- lib/Makefile.am | 1 + lib/intel_chipset.h | 9 +++ lib/intel_gpu_tools.h | 27 ++++++++ lib/intel_mmio.c | 172 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/intel_reg_map.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 383 insertions(+), 0 deletions(-) create mode 100644 lib/intel_reg_map.c
lib/Makefile.am +1 -0
@@ -8,6 +8,7 @@ libintel_tools_la_SOURCES = \ intel_mmio.c \ intel_pci.c \ intel_reg.h \ + intel_reg_map.c \ instdone.c \ instdone.h \ drmtest.h
lib/intel_chipset.h +9 -0
@@ -147,3 +147,12 @@#define HAS_PCH_SPLIT (devid) (IS_GEN5(devid) || \ IS_GEN6(devid)) + +#define IS_BROADWATER (devid) (devid == PCI_CHIP_I946_GZ || \ + devid == PCI_CHIP_I965_G_1 || \ + devid == PCI_CHIP_I965_Q || \ + devid == PCI_CHIP_I965_G) + +#define IS_CRESTLINE (devid) (devid == PCI_CHIP_I965_GM || \ + devid == PCI_CHIP_I965_GME) +
lib/intel_gpu_tools.h +27 -0
@@ -37,6 +37,33 @@extern void *mmio;void intel_get_mmio (struct pci_device *pci_dev); +/* New style register access API */ +int intel_register_access_init (struct pci_device *pci_dev,int safe,int greedy); +void intel_register_access_fini (void ); +uint32_t intel_register_read (uint32_t reg); +void intel_register_write (uint32_t reg,uint32_t val); + +#define INTEL_RANGE_RSVD (0<<0)/* Shouldn't be read or written */ +#define INTEL_RANGE_READ (1<<0) +#define INTEL_RANGE_WRITE (1<<1) +#define INTEL_RANGE_RW (INTEL_RANGE_READ | INTEL_RANGE_WRITE) +#define INTEL_RANGE_END (1<<31) + +struct intel_register_range { +uint32_t base; +uint32_t size; +uint32_t flags; +}; + +struct intel_register_map { +struct intel_register_range *map; +uint32_t top; +uint32_t alignment_mask; +}; +struct intel_register_map intel_get_register_map (uint32_t devid); +struct intel_register_range *intel_get_register_range (struct intel_register_map map,uint32_t offset,int mode); + +static inline uint32_t INREG (uint32_t reg) {
lib/intel_mmio.c +172 -0
193 lines not on this page · raw message
lib/intel_reg_map.c new file +174 -0
174 lines not on this page · raw message
Signature · 1 line
1.7.3.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH v2 1/1 intel-gpu-tools register range handling with forcewake hooks
Forcewake will not be fully implemented until the patches are upstream.
Meanwhile, the register range code from the kernel ioctls previously has been moved into a new API for register reads/writes.
We can deprecate the old code by using the non-safe flag in the new API. The safe flag should allow the previous behavior to continue.
--- lib/Makefile.am | 1 + lib/intel_chipset.h | 9 +++ lib/intel_gpu_tools.h | 27 ++++++++ lib/intel_mmio.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/intel_reg_map.c | 174 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 386 insertions(+), 0 deletions(-) create mode 100644 lib/intel_reg_map.c
lib/Makefile.am +1 -0
@@ -8,6 +8,7 @@ libintel_tools_la_SOURCES = \ intel_mmio.c \ intel_pci.c \ intel_reg.h \ + intel_reg_map.c \ instdone.c \ instdone.h \ drmtest.h
lib/intel_chipset.h +9 -0
@@ -147,3 +147,12 @@#define HAS_PCH_SPLIT (devid) (IS_GEN5(devid) || \ IS_GEN6(devid)) + +#define IS_BROADWATER (devid) (devid == PCI_CHIP_I946_GZ || \ + devid == PCI_CHIP_I965_G_1 || \ + devid == PCI_CHIP_I965_Q || \ + devid == PCI_CHIP_I965_G) + +#define IS_CRESTLINE (devid) (devid == PCI_CHIP_I965_GM || \ + devid == PCI_CHIP_I965_GME) +
lib/intel_gpu_tools.h +27 -0
@@ -37,6 +37,33 @@extern void *mmio;void intel_get_mmio (struct pci_device *pci_dev); +/* New style register access API */ +int intel_register_access_init (struct pci_device *pci_dev,int safe,int greedy); +void intel_register_access_fini (void ); +uint32_t intel_register_read (uint32_t reg); +void intel_register_write (uint32_t reg,uint32_t val); + +#define INTEL_RANGE_RSVD (0<<0)/* Shouldn't be read or written */ +#define INTEL_RANGE_READ (1<<0) +#define INTEL_RANGE_WRITE (1<<1) +#define INTEL_RANGE_RW (INTEL_RANGE_READ | INTEL_RANGE_WRITE) +#define INTEL_RANGE_END (1<<31) + +struct intel_register_range { +uint32_t base; +uint32_t size; +uint32_t flags; +}; + +struct intel_register_map { +struct intel_register_range *map; +uint32_t top; +uint32_t alignment_mask; +}; +struct intel_register_map intel_get_register_map (uint32_t devid); +struct intel_register_range *intel_get_register_range (struct intel_register_map map,uint32_t offset,int mode); + +static inline uint32_t INREG (uint32_t reg) {
lib/intel_mmio.c +175 -0
196 lines not on this page · raw message
lib/intel_reg_map.c new file +174 -0
174 lines not on this page · raw message
Signature · 1 line
1.7.3.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx