From patchwork Thu Aug 11 19:31:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 109672 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 94130B8953 for ; Fri, 12 Aug 2011 05:33:07 +1000 (EST) Received: from mail-bw0-f51.google.com (mail-bw0-f51.google.com [209.85.214.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 D431FB72E2; Fri, 12 Aug 2011 05:31:32 +1000 (EST) Received: by mail-bw0-f51.google.com with SMTP id r19so1201107bka.38 for ; Thu, 11 Aug 2011 12:31:32 -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=LQ4pDw7bPDBnrT+mO6VjR75SQIm6OQEFty1CmoXyQS8=; b=xhEZpYkfIJbhcSaWhanvSI/ly+fsR/8hrXO4KTO5BUUbVYvSYhWuugI1fTOoJNZjbg 0yU+RDLOubCYz592JwRwSYr7hwcgBMTWHY3slZnhBFfs4fo0aEAhTkDYxuZ7bkEIbOm8 KTmpBKldhY34Q/TeVZL6CU20XAJs0an0FPuA4= Received: by 10.204.3.13 with SMTP id 13mr1967760bkl.360.1313091092202; Thu, 11 Aug 2011 12:31:32 -0700 (PDT) Received: from localhost.localdomain (g227146205.adsl.alicedsl.de [92.227.146.205]) by mx.google.com with ESMTPS id r24sm604446bkr.59.2011.08.11.12.31.30 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Aug 2011 12:31:31 -0700 (PDT) From: Andre Heider To: Geoff Levand Subject: [PATCH part1 v2 6/9] ps3: Detect the current lpar Date: Thu, 11 Aug 2011 21:31:10 +0200 Message-Id: <1313091073-4572-7-git-send-email-a.heider@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1313091073-4572-1-git-send-email-a.heider@gmail.com> References: <1312228986-32307-1-git-send-email-a.heider@gmail.com> <1313091073-4572-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 Detect it by reading the ss laid repository node, and make it accessible via ps3_get_ss_laid(). Signed-off-by: Andre Heider --- arch/powerpc/include/asm/ps3.h | 6 ++++++ arch/powerpc/platforms/ps3/platform.h | 4 ++++ arch/powerpc/platforms/ps3/repository.c | 19 +++++++++++++++++++ arch/powerpc/platforms/ps3/setup.c | 9 +++++++++ 4 files changed, 38 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h index 7f065e1..9e8c878 100644 --- a/arch/powerpc/include/asm/ps3.h +++ b/arch/powerpc/include/asm/ps3.h @@ -39,6 +39,12 @@ 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_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 d9b4ec0..b912d15 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h @@ -235,4 +235,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 9908d61..06f8801 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c @@ -1038,6 +1038,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..9f23a6d 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) { /* @@ -200,6 +207,8 @@ 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); + ps3_spu_set_platform(); #ifdef CONFIG_SMP