From patchwork Wed Aug 21 10:15:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tangchen X-Patchwork-Id: 2847663 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 481189F2F4 for ; Wed, 21 Aug 2013 10:21:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E41B22055E for ; Wed, 21 Aug 2013 10:21:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92C002018C for ; Wed, 21 Aug 2013 10:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519Ab3HUKTu (ORCPT ); Wed, 21 Aug 2013 06:19:50 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:58595 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751949Ab3HUKTt (ORCPT ); Wed, 21 Aug 2013 06:19:49 -0400 X-IronPort-AV: E=Sophos;i="4.89,927,1367942400"; d="scan'208";a="8261327" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 21 Aug 2013 18:13:58 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r7LAH1P1008623; Wed, 21 Aug 2013 18:17:01 +0800 Received: from G08FNSTD090432.fnst.cn.fujitsu.com ([10.167.226.99]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013082118151573-828152 ; Wed, 21 Aug 2013 18:15:15 +0800 From: Tang Chen To: konrad.wilk@oracle.com, robert.moore@intel.com, lv.zheng@intel.com, rjw@sisk.pl, lenb@kernel.org, tglx@linutronix.de, mingo@elte.hu, hpa@zytor.com, akpm@linux-foundation.org, tj@kernel.org, trenn@suse.de, yinghai@kernel.org, jiang.liu@huawei.com, wency@cn.fujitsu.com, laijs@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, izumi.taku@jp.fujitsu.com, mgorman@suse.de, minchan@kernel.org, mina86@mina86.com, gong.chen@linux.intel.com, vasilis.liaskovitis@profitbricks.com, lwoodman@redhat.com, riel@redhat.com, jweiner@redhat.com, prarit@redhat.com, zhangyanfei@cn.fujitsu.com, yanghy@cn.fujitsu.com Cc: x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-acpi@vger.kernel.org Subject: [PATCH 1/8] x86: Make get_ramdisk_{image|size}() global. Date: Wed, 21 Aug 2013 18:15:36 +0800 Message-Id: <1377080143-28455-2-git-send-email-tangchen@cn.fujitsu.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1377080143-28455-1-git-send-email-tangchen@cn.fujitsu.com> References: <1377080143-28455-1-git-send-email-tangchen@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/08/21 18:15:15, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/08/21 18:15:17, Serialize complete at 2013/08/21 18:15:17 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yinghai Lu This patch does two things: 1. Make get_ramdisk_image() and get_ramdisk_size() global so that we can use them in the later patches. 2. In later patches, we are going to call them in head_32.S before paging is enabled. In that case, we can only use physical address to access global variable like boot_params. So make them take a boot_params pointer parameter so that we can pass va or pa to them. Signed-off-by: Yinghai Lu Acked-by: Tejun Heo Tested-by: Thomas Renninger Reviewed-by: Tang Chen Tested-by: Tang Chen --- arch/x86/include/asm/setup.h | 3 +++ arch/x86/kernel/setup.c | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index b7bf350..4f71d48 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h @@ -106,6 +106,9 @@ void *extend_brk(size_t size, size_t align); RESERVE_BRK(name, sizeof(type) * entries) extern void probe_roms(void); +u64 get_ramdisk_image(struct boot_params *bp); +u64 get_ramdisk_size(struct boot_params *bp); + #ifdef __i386__ void __init i386_start_kernel(void); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f8ec578..5bfd4c8 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -297,19 +297,19 @@ static void __init reserve_brk(void) #ifdef CONFIG_BLK_DEV_INITRD -static u64 __init get_ramdisk_image(void) +u64 __init get_ramdisk_image(struct boot_params *bp) { - u64 ramdisk_image = boot_params.hdr.ramdisk_image; + u64 ramdisk_image = bp->hdr.ramdisk_image; - ramdisk_image |= (u64)boot_params.ext_ramdisk_image << 32; + ramdisk_image |= (u64)bp->ext_ramdisk_image << 32; return ramdisk_image; } -static u64 __init get_ramdisk_size(void) +u64 __init get_ramdisk_size(struct boot_params *bp) { - u64 ramdisk_size = boot_params.hdr.ramdisk_size; + u64 ramdisk_size = bp->hdr.ramdisk_size; - ramdisk_size |= (u64)boot_params.ext_ramdisk_size << 32; + ramdisk_size |= (u64)bp->ext_ramdisk_size << 32; return ramdisk_size; } @@ -318,8 +318,8 @@ static u64 __init get_ramdisk_size(void) static void __init relocate_initrd(void) { /* Assume only end is not page aligned */ - u64 ramdisk_image = get_ramdisk_image(); - u64 ramdisk_size = get_ramdisk_size(); + u64 ramdisk_image = get_ramdisk_image(&boot_params); + u64 ramdisk_size = get_ramdisk_size(&boot_params); u64 area_size = PAGE_ALIGN(ramdisk_size); u64 ramdisk_here; unsigned long slop, clen, mapaddr; @@ -358,8 +358,8 @@ static void __init relocate_initrd(void) ramdisk_size -= clen; } - ramdisk_image = get_ramdisk_image(); - ramdisk_size = get_ramdisk_size(); + ramdisk_image = get_ramdisk_image(&boot_params); + ramdisk_size = get_ramdisk_size(&boot_params); printk(KERN_INFO "Move RAMDISK from [mem %#010llx-%#010llx] to" " [mem %#010llx-%#010llx]\n", ramdisk_image, ramdisk_image + ramdisk_size - 1, @@ -369,8 +369,8 @@ static void __init relocate_initrd(void) static void __init early_reserve_initrd(void) { /* Assume only end is not page aligned */ - u64 ramdisk_image = get_ramdisk_image(); - u64 ramdisk_size = get_ramdisk_size(); + u64 ramdisk_image = get_ramdisk_image(&boot_params); + u64 ramdisk_size = get_ramdisk_size(&boot_params); u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); if (!boot_params.hdr.type_of_loader || @@ -382,8 +382,8 @@ static void __init early_reserve_initrd(void) static void __init reserve_initrd(void) { /* Assume only end is not page aligned */ - u64 ramdisk_image = get_ramdisk_image(); - u64 ramdisk_size = get_ramdisk_size(); + u64 ramdisk_image = get_ramdisk_image(&boot_params); + u64 ramdisk_size = get_ramdisk_size(&boot_params); u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); u64 mapped_size;