[PATCH i-g-t 01/10] lib: add 16 and 8 bit versions of INREG and OUTREG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 lib/intel_io.h   |  4 ++++
 lib/intel_mmio.c | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/lib/intel_io.h b/lib/intel_io.h
index 04aa3fd496b4..1c3b4445cd5b 100644
--- a/lib/intel_io.h
+++ b/lib/intel_io.h
@@ -43,7 +43,11 @@ void intel_register_write(uint32_t reg, uint32_t val);
 int intel_register_access_needs_fakewake(void);
 
 uint32_t INREG(uint32_t reg);
+uint16_t INREG16(uint32_t reg);
+uint8_t INREG8(uint32_t reg);
 void OUTREG(uint32_t reg, uint32_t val);
+void OUTREG16(uint32_t reg, uint16_t val);
+void OUTREG8(uint32_t reg, uint8_t val);
 
 /* sideband access functions from intel_iosf.c */
 uint32_t intel_dpio_reg_read(uint32_t reg, int phy);
diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
index 9a2ee27bd5e5..40ce94c8f600 100644
--- a/lib/intel_mmio.c
+++ b/lib/intel_mmio.c
@@ -324,6 +324,18 @@ uint32_t INREG(uint32_t reg)
 	return *(volatile uint32_t *)((volatile char *)mmio + reg);
 }
 
+/* 16-bit version of INREG */
+uint16_t INREG16(uint32_t reg)
+{
+	return *(volatile uint16_t *)((volatile char *)mmio + reg);
+}
+
+/* 8-bit version of INREG */
+uint8_t INREG8(uint32_t reg)
+{
+	return *((volatile uint8_t *)mmio + reg);
+}
+
 /**
  * OUTRET:
  * @reg: register offset
@@ -338,3 +350,15 @@ void OUTREG(uint32_t reg, uint32_t val)
 {
 	*(volatile uint32_t *)((volatile char *)mmio + reg) = val;
 }
+
+/* 16-bit version of OUTREG */
+void OUTREG16(uint32_t reg, uint16_t val)
+{
+	*(volatile uint16_t *)((volatile char *)mmio + reg) = val;
+}
+
+/* 8-bit version of OUTREG */
+void OUTREG8(uint32_t reg, uint8_t val)
+{
+	*((volatile uint8_t *)mmio + reg) = val;
+}
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux