mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	lib: add 16 and 8 bit versions of INREG and OUTREG
Add INREG8, INREG16, OUTREG8, and OUTREG16. While at it, cleanup doc comments of INREG and OUTREG. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
		
							parent
							
								
									30e84df0c1
								
							
						
					
					
						commit
						23b7f08920
					
				@ -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);
 | 
			
		||||
 | 
			
		||||
@ -311,8 +311,8 @@ write_out:
 | 
			
		||||
 * INREG:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 *
 | 
			
		||||
 * 32-bit read of the register at @offset. This function only works when the new
 | 
			
		||||
 * register access helper is initialized with intel_register_access_init().
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
@ -325,12 +325,47 @@ uint32_t INREG(uint32_t reg)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * OUTRET:
 | 
			
		||||
 * INREG16:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns:
 | 
			
		||||
 * The value read from the register.
 | 
			
		||||
 */
 | 
			
		||||
uint16_t INREG16(uint32_t reg)
 | 
			
		||||
{
 | 
			
		||||
	return *(volatile uint16_t *)((volatile char *)mmio + reg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * INREG8:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns:
 | 
			
		||||
 * The value read from the register.
 | 
			
		||||
 */
 | 
			
		||||
uint8_t INREG8(uint32_t reg)
 | 
			
		||||
{
 | 
			
		||||
	return *((volatile uint8_t *)mmio + reg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * OUTREG:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 * @val: value to write
 | 
			
		||||
 *
 | 
			
		||||
 * 32-bit write to the register at @offset. This function only works when the new
 | 
			
		||||
 * register access helper is initialized with intel_register_access_init().
 | 
			
		||||
 * 32-bit write of @val to 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.
 | 
			
		||||
 */
 | 
			
		||||
@ -338,3 +373,35 @@ void OUTREG(uint32_t reg, uint32_t val)
 | 
			
		||||
{
 | 
			
		||||
	*(volatile uint32_t *)((volatile char *)mmio + reg) = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * OUTREG16:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 * @val: value to write
 | 
			
		||||
 *
 | 
			
		||||
 * 16-bit write of @val to 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.
 | 
			
		||||
 */
 | 
			
		||||
void OUTREG16(uint32_t reg, uint16_t val)
 | 
			
		||||
{
 | 
			
		||||
	*(volatile uint16_t *)((volatile char *)mmio + reg) = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * OUTREG8:
 | 
			
		||||
 * @reg: register offset
 | 
			
		||||
 * @val: value to write
 | 
			
		||||
 *
 | 
			
		||||
 * 8-bit write of @val to 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.
 | 
			
		||||
 */
 | 
			
		||||
void OUTREG8(uint32_t reg, uint8_t val)
 | 
			
		||||
{
 | 
			
		||||
	*((volatile uint8_t *)mmio + reg) = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user