spapr: add rtas_st_buffer_direct() helper
This is similar to the existing rtas_st_buffer(), but for cases where the guest is not expecting a length-encoded byte array. Namely, for calls where a "work area" buffer is used to pass around arbitrary fields/data. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
		
							parent
							
								
									886445a6ee
								
							
						
					
					
						commit
						ab316865db
					
				| 
						 | 
				
			
			@ -464,6 +464,13 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val)
 | 
			
		|||
    stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n), val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void rtas_st_buffer_direct(target_ulong phys,
 | 
			
		||||
                                         target_ulong phys_len,
 | 
			
		||||
                                         uint8_t *buffer, uint16_t buffer_len)
 | 
			
		||||
{
 | 
			
		||||
    cpu_physical_memory_write(ppc64_phys_to_real(phys), buffer,
 | 
			
		||||
                              MIN(buffer_len, phys_len));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len,
 | 
			
		||||
                                  uint8_t *buffer, uint16_t buffer_len)
 | 
			
		||||
| 
						 | 
				
			
			@ -473,8 +480,7 @@ static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len,
 | 
			
		|||
    }
 | 
			
		||||
    stw_be_phys(&address_space_memory,
 | 
			
		||||
                ppc64_phys_to_real(phys), buffer_len);
 | 
			
		||||
    cpu_physical_memory_write(ppc64_phys_to_real(phys + 2),
 | 
			
		||||
                              buffer, MIN(buffer_len, phys_len - 2));
 | 
			
		||||
    rtas_st_buffer_direct(phys + 2, phys_len - 2, buffer, buffer_len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue