From patchwork Mon Dec 12 06:43:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Voevodin X-Patchwork-Id: 130640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0E39EB70BB for ; Mon, 12 Dec 2011 17:44:10 +1100 (EST) Received: from localhost ([::1]:52476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZzcE-0005UI-4K for incoming@patchwork.ozlabs.org; Mon, 12 Dec 2011 01:43:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:51703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZzby-0005GC-9I for qemu-devel@nongnu.org; Mon, 12 Dec 2011 01:43:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZzbw-0002fz-KD for qemu-devel@nongnu.org; Mon, 12 Dec 2011 01:43:42 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZzbw-0002ee-Fj for qemu-devel@nongnu.org; Mon, 12 Dec 2011 01:43:40 -0500 Received: from euspt2 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LW2000GKW0SJU@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Mon, 12 Dec 2011 06:43:40 +0000 (GMT) Received: from evvoevodinPC.rnd.samsung.ru ([106.109.8.48]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LW200LRSW0GC5@spt2.w1.samsung.com> for qemu-devel@nongnu.org; Mon, 12 Dec 2011 06:43:40 +0000 (GMT) Date: Mon, 12 Dec 2011 10:43:21 +0400 From: Evgeny Voevodin In-reply-to: <1323672206-11891-1-git-send-email-e.voevodin@samsung.com> To: qemu-devel@nongnu.org Message-id: <1323672206-11891-10-git-send-email-e.voevodin@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.4.1 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT References: <1323672206-11891-1-git-send-email-e.voevodin@samsung.com> X-detected-operating-system: by eggs.gnu.org: Solaris 9.1 X-Received-From: 210.118.77.12 Cc: m.kozlov@samsung.com, d.solodkiy@samsung.com, Evgeny Voevodin Subject: [Qemu-devel] [PATCH v3 09/14] hw/exynos4210.c: Boot secondary CPU. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Evgeny Voevodin --- hw/exynos4210.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/hw/exynos4210.c b/hw/exynos4210.c index e2c4bf5..055205d 100644 --- a/hw/exynos4210.c +++ b/hw/exynos4210.c @@ -93,8 +93,15 @@ #define EXYNOS4210_EXT_COMBINER_BASE_ADDR 0x10440000 #define EXYNOS4210_INT_COMBINER_BASE_ADDR 0x10448000 +/* Secondary CPU polling address to get loader start from */ +#define EXYNOS4210_SECOND_CPU_BOOTREG 0x10020814 + +/* Secondary CPU startup code is in IROM memory */ +#define EXYNOS4210_SMP_BOOT_ADDR EXYNOS4210_IROM_BASE_ADDR + static struct arm_boot_info exynos4210_binfo = { .loader_start = EXYNOS4210_BASE_BOOT_ADDR, + .smp_loader_start = EXYNOS4210_SMP_BOOT_ADDR, }; static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, @@ -208,6 +215,8 @@ static void exynos4210_init(ram_addr_t ram_size, MemoryRegion *irom_alias_mem = g_new(MemoryRegion, 1); MemoryRegion *dram0_mem = g_new(MemoryRegion, 1); MemoryRegion *dram1_mem = NULL; + MemoryRegion *hack_mem = g_new(MemoryRegion, 1); + MemoryRegion *bootreg_mem = g_new(MemoryRegion, 1); Exynos4210Irq *irqs; qemu_irq *irq_table; qemu_irq *irqp; @@ -221,9 +230,11 @@ static void exynos4210_init(ram_addr_t ram_size, switch (board_type) { case BOARD_EXYNOS4210_NURI: exynos4210_binfo.board_id = MACH_NURI_ID; + exynos4210_binfo.smp_bootreg_addr = EXYNOS4210_SECOND_CPU_BOOTREG; break; case BOARD_EXYNOS4210_SMDKC210: exynos4210_binfo.board_id = MACH_SMDKC210_ID; + exynos4210_binfo.smp_bootreg_addr = EXYNOS4210_SECOND_CPU_BOOTREG; break; default: break; @@ -367,6 +378,20 @@ static void exynos4210_init(ram_addr_t ram_size, memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR, dram0_mem); + /* + * Secondary CPU startup code will be placed here. + */ + memory_region_init_ram(hack_mem, NULL, "exynos4210.hack", 0x1000); + memory_region_add_subregion(system_mem, EXYNOS4210_SMP_BOOT_ADDR, + hack_mem); + + /* + * Hack: Map SECOND_CPU_BOOTREG, because it is in PMU USER5 register. + */ + memory_region_init_ram(bootreg_mem, NULL, "exynos4210.bootreg", 0x4); + memory_region_add_subregion(system_mem, EXYNOS4210_SECOND_CPU_BOOTREG, + bootreg_mem); + /* CMU */ sysbus_create_simple("exynos4210.cmu", EXYNOS4210_CMU_BASE_ADDR, NULL); @@ -441,6 +466,7 @@ static void exynos4210_init(ram_addr_t ram_size, exynos4210_binfo.kernel_filename = kernel_filename; exynos4210_binfo.initrd_filename = initrd_filename; exynos4210_binfo.kernel_cmdline = kernel_cmdline; + exynos4210_binfo.smp_priv_base = EXYNOS4210_SMP_PRIVATE_BASE_ADDR; arm_load_kernel(first_cpu, &exynos4210_binfo); }