[Qemu-devel] qemu patch for adding functionality to rtas_ibm_get_system_
From:
Tomohiro B Berry
Subject:
[Qemu-devel] qemu patch for adding functionality to rtas_ibm_get_system_parameter
Date:
Wed, 12 Mar 2014 10:50:57 -0500
Hi all,
rtas_ibm_get_system_parameter did not
previously have the functionality to return the appropriate string when
called with the SPLPAR_CHARACTERISTICS_TOKEN. I am proposing the
following patch to add that functionality. I am including the cases
for CMO_CHARACTERISTICS_TOKEN and CEDE_LATENCY_TOKEN because the function
gets called with those tokens during the boot process, but I understand
that they are currently redundant with the default case. I just figured
they would be useful for future development, but if we don't want them
in there right now I think that would be okay, too.
switch (parameter)
{
case DIAGNOSTICS_RUN_MODE:
@@ -244,6 +248,42 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU
*cpu,
ret = RTAS_OUT_SUCCESS;
}
break;
+ case SPLPAR_CHARACTERISTICS_TOKEN:
+
+ /*
Create a string locally to copy to buffer */
+
+ local_buffer=(char*)malloc(length*sizeof(char));
+ memset(local_buffer,0,length);
+
+ /*
These are the current system parameters supported. The spaces
at the
+
* start of the string are place holders for the string length. */
+
+ snprintf(local_buffer,length,"
MaxEntCap=%d,MaxPlatProcs=%d",max_cpus,smp_cpus);
+
+ /*
The first 16 bits of the buffer must contain the length of the string.
+
* These 16 bits are not included in the length of the string. */
+
+ ((uint16_t*)local_buffer)[0]=cpu_to_be16((uint16_t)strlen(&local_buffer[2]));
+
+ /*
Copy the string into buffer using rtas_st_buffer to
+
* convert the addresses. */
+
+ rtas_st_buffer(buffer,length,(uint8_t*)local_buffer);
+
+ /*
Free the local buffer and return success. */
+
+ free(local_buffer);
+ ret
= RTAS_OUT_SUCCESS;
+ break;
+ case CMO_CHARACTERISTICS_TOKEN:
+ ret
= RTAS_OUT_NOT_SUPPORTED;
+ break;
+ case CEDE_LATENCY_TOKEN:
+ ret
= RTAS_OUT_NOT_SUPPORTED;
+ break;
+ default:
+ ret
= RTAS_OUT_NOT_SUPPORTED;
+ break;
}
+/* This function will store a
buffer 1 byte at a time into the
+ * address at phys up to a maximum
of phys_len bytes. */
+
+static inline void rtas_st_buffer(target_ulong
phys, target_ulong phys_len, uint8_t* buffer){
+ uint32_t i;
+ for(i=0;i<phys_len;i++){
+ stb_phys(ppc64_phys_to_real(phys
+ i),buffer[i]);
+ }
+}
+
typedef void (*spapr_rtas_fn)(PowerPCCPU
*cpu, sPAPREnvironment *spapr,
uint32_t
token,
uint32_t
nargs, target_ulong args,
diff --git a/pixman b/pixman
--- a/pixman
+++ b/pixman
@@ -1 +1 @@
-Subproject commit 97336fad32acf802003855cd8bd6477fa49a12e3
+Subproject commit 97336fad32acf802003855cd8bd6477fa49a12e3-dirty