From patchwork Mon Aug 1 20:02:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 107800 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 41A71B810B for ; Tue, 2 Aug 2011 06:04:28 +1000 (EST) Received: from mail-ew0-f51.google.com (mail-ew0-f51.google.com [209.85.215.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 93D13B70B2; Tue, 2 Aug 2011 06:03:31 +1000 (EST) Received: by mail-ew0-f51.google.com with SMTP id 6so3056314ewy.38 for ; Mon, 01 Aug 2011 13:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=3EKYzBERq4wnb9+5CkA2OFteKmjN/H7Isi7gT/27pz8=; b=oi0JD9W6MDDOWaS9567+M4F5oryPLj71sp4t94bPJKxwIjdLbcJnzB0WQlfh0RuBoS DUjm1AtN9WOWnHcIW5WQdc1sZLigwE9WWAZ2/5suhtGYB1ast5AbsaZrqqpEfAvZFBFc jIvYp1YDv0beEnKNMtHXelvGb0uYQW/ioRMOQ= Received: by 10.204.10.67 with SMTP id o3mr1340410bko.161.1312229010861; Mon, 01 Aug 2011 13:03:30 -0700 (PDT) Received: from localhost.localdomain (f055205119.adsl.alicedsl.de [78.55.205.119]) by mx.google.com with ESMTPS id sz1sm1403030bkb.25.2011.08.01.13.03.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Aug 2011 13:03:30 -0700 (PDT) From: Andre Heider To: Geoff Levand Subject: [PATCH 05/15] ps3: Detect the current lpar environment Date: Mon, 1 Aug 2011 22:02:56 +0200 Message-Id: <1312228986-32307-6-git-send-email-a.heider@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1312228986-32307-1-git-send-email-a.heider@gmail.com> References: <1312228986-32307-1-git-send-email-a.heider@gmail.com> Cc: cbe-oss-dev@lists.ozlabs.org, Hector Martin , linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org There is more than the OtherOS lpar the kernel can be launched in. Detect it by reading the ss laid repository node, and be verbose about it. Signed-off-by: Andre Heider --- arch/powerpc/include/asm/ps3.h | 7 +++++++ arch/powerpc/platforms/ps3/platform.h | 4 ++++ arch/powerpc/platforms/ps3/repository.c | 19 +++++++++++++++++++ arch/powerpc/platforms/ps3/setup.c | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h index 7f065e1..136354a 100644 --- a/arch/powerpc/include/asm/ps3.h +++ b/arch/powerpc/include/asm/ps3.h @@ -39,6 +39,13 @@ union ps3_firmware_version { void ps3_get_firmware_version(union ps3_firmware_version *v); int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev); +enum ps3_ss_laid { + PS3_SS_LAID_GAMEOS = 0x1070000002000001UL, + PS3_SS_LAID_OTHEROS = 0x1080000004000001UL, +}; + +enum ps3_ss_laid ps3_get_ss_laid(void); + /* 'Other OS' area */ enum ps3_param_av_multi_out { diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 9a196a8..1ba15b8 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h @@ -232,4 +232,8 @@ int ps3_repository_read_spu_resource_id(unsigned int res_index, int ps3_repository_read_vuart_av_port(unsigned int *port); int ps3_repository_read_vuart_sysmgr_port(unsigned int *port); +/* repository ss info */ + +int ps3_repository_read_ss_laid(enum ps3_ss_laid *laid); + #endif diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c index 5e304c2..6fa3e96 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c @@ -1002,6 +1002,25 @@ int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar, lpar, rights); } +/** + * ps3_repository_read_ss_laid - Read the lpar auth id + */ + +int ps3_repository_read_ss_laid(enum ps3_ss_laid *laid) +{ + int result; + u64 id, v1; + + lv1_get_logical_partition_id(&id); + result = read_node(PS3_LPAR_ID_PME, + make_first_field("ss", 0), + make_field("laid", 0), + id, 0, + &v1, NULL); + *laid = v1; + return result; +} + #if defined(DEBUG) int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo) diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 149bea2..f430279 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c @@ -47,6 +47,7 @@ DEFINE_MUTEX(ps3_gpu_mutex); EXPORT_SYMBOL_GPL(ps3_gpu_mutex); static union ps3_firmware_version ps3_firmware_version; +static enum ps3_ss_laid ps3_ss_laid; void ps3_get_firmware_version(union ps3_firmware_version *v) { @@ -68,6 +69,12 @@ int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev) } EXPORT_SYMBOL_GPL(ps3_compare_firmware_version); +enum ps3_ss_laid ps3_get_ss_laid(void) +{ + return ps3_ss_laid; +} +EXPORT_SYMBOL_GPL(ps3_get_ss_laid); + static void ps3_power_save(void) { /* @@ -192,6 +199,7 @@ static int ps3_set_dabr(unsigned long dabr) static void __init ps3_setup_arch(void) { + const char *laid_str; DBG(" -> %s:%d\n", __func__, __LINE__); @@ -200,6 +208,20 @@ static void __init ps3_setup_arch(void) ps3_firmware_version.major, ps3_firmware_version.minor, ps3_firmware_version.rev); + ps3_repository_read_ss_laid(&ps3_ss_laid); + switch (ps3_ss_laid) { + case PS3_SS_LAID_GAMEOS: + laid_str = "GameOS"; + break; + case PS3_SS_LAID_OTHEROS: + laid_str = "OtherOS"; + break; + default: + laid_str = "unknown"; + break; + } + printk(KERN_INFO "Running in %s lpar\n", laid_str); + ps3_spu_set_platform(); #ifdef CONFIG_SMP