From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2rEw-0007iS-UJ for qemu-devel@nongnu.org; Mon, 13 Jan 2014 18:48:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2rEo-0004U9-Hf for qemu-devel@nongnu.org; Mon, 13 Jan 2014 18:48:18 -0500 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:35881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2rEo-0004Ty-DN for qemu-devel@nongnu.org; Mon, 13 Jan 2014 18:48:10 -0500 Received: by mail-qc0-f181.google.com with SMTP id e9so7028452qcy.12 for ; Mon, 13 Jan 2014 15:48:10 -0800 (PST) Sender: Alistair Francis From: Alistair Francis Date: Tue, 14 Jan 2014 09:48:06 +1000 Message-Id: <2de138a60e612a72f39dce25df726bddf9a6d38c.1389656647.git.alistair.francis@xilinx.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH arm-midr v2 1/2] ARM: Convert MIDR to a property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, afaerber@suse.de Convert the MIDR register to a property. This allows boards to later set a custom MIDR value. This has been done in such a way to maintain compatibility with all existing CPUs and boards Signed-off-by: Alistair Francis --- I originally added the properties to the cpu->midr variable in a similar method to how Peter Crosthwaite did in his 'Fix Support for ARM CBAR and reset-hivecs' series. V2: Use dc->props to avoid using qdev_* target-arm/cpu.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 408d207..52f7f06 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -253,6 +253,7 @@ static void arm_cpu_post_init(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); Error *err = NULL; + uint32_t temp = cpu->midr; if (arm_feature(&cpu->env, ARM_FEATURE_CBAR)) { qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property, @@ -265,6 +266,17 @@ static void arm_cpu_post_init(Object *obj) &err); assert_no_error(err); } + + /* + * Initialise the midr property and set it to the original CPU MIDR + * This is used to maintain compatibility with boards that don't set + * a custom MIDR + */ + object_property_set_int(OBJECT(cpu), temp, "midr", &err); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } } static void arm_cpu_finalizefn(Object *obj) @@ -984,6 +996,7 @@ static const ARMCPUInfo arm_cpus[] = { static Property arm_cpu_properties[] = { DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false), + DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), DEFINE_PROP_END_OF_LIST() }; -- 1.7.1