public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: geoffrey.levand@am•sony.com
To: paulus@samba•org
Cc: linuxppc-dev@ozlabs•org
Subject: [patch 1/6] PS3: Cleanup of os-area.c
Date: Sat, 06 Oct 2007 14:35:43 -0700	[thread overview]
Message-ID: <20071006213542.509952005@am.sony.com> (raw)
In-Reply-To: 20071006213542.311447584@am.sony.com

Minor cleanup of the PS3 file os-area.c:
 o Correct file text header.
 o Add type names enum os_area_ldr_format, enum os_area_boot_flag,
   enum os_area_ctrl_button.
 o Change struct os_area_header.magic_num type to u8.
 o Add preprocessor macro SECONDS_FROM_1970_TO_2000.

Signed-off-by: Geoff Levand <geoffrey.levand@am•sony.com>
---
 arch/powerpc/platforms/ps3/os-area.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -1,5 +1,5 @@
 /*
- *  PS3 'Other OS' area data.
+ *  PS3 flash memory os area.
  *
  *  Copyright (C) 2006 Sony Computer Entertainment Inc.
  *  Copyright 2006 Sony Corp.
@@ -29,7 +29,7 @@ enum {
 	OS_AREA_SEGMENT_SIZE = 0X200,
 };
 
-enum {
+enum os_area_ldr_format {
 	HEADER_LDR_FORMAT_RAW = 0,
 	HEADER_LDR_FORMAT_GZIP = 1,
 };
@@ -50,7 +50,7 @@ enum {
  */
 
 struct os_area_header {
-	s8 magic_num[16];
+	u8 magic_num[16];
 	u32 hdr_version;
 	u32 os_area_offset;
 	u32 ldr_area_offset;
@@ -60,12 +60,12 @@ struct os_area_header {
 	u32 _reserved_2[6];
 };
 
-enum {
+enum os_area_boot_flag {
 	PARAM_BOOT_FLAG_GAME_OS = 0,
 	PARAM_BOOT_FLAG_OTHER_OS = 1,
 };
 
-enum {
+enum os_area_ctrl_button {
 	PARAM_CTRL_BUTTON_O_IS_YES = 0,
 	PARAM_CTRL_BUTTON_X_IS_YES = 1,
 };
@@ -84,6 +84,9 @@ enum {
  * @dns_primary: User preference of static primary dns server.
  * @dns_secondary: User preference of static secondary dns server.
  *
+ * The ps3 rtc maintains a read-only value that approximates seconds since
+ * 2000-01-01 00:00:00 UTC.
+ *
  * User preference of zero for static_ip_addr means use dhcp.
  */
 
@@ -108,6 +111,8 @@ struct os_area_params {
 	u8 _reserved_5[8];
 };
 
+#define SECONDS_FROM_1970_TO_2000 946684800LL
+
 /**
  * struct saved_params - Static working copies of data from the 'Other OS' area.
  *
@@ -213,7 +218,8 @@ int __init ps3_os_area_init(void)
 	}
 
 	header = (struct os_area_header *)__va(lpar_addr);
-	params = (struct os_area_params *)__va(lpar_addr + OS_AREA_SEGMENT_SIZE);
+	params = (struct os_area_params *)__va(lpar_addr
+		+ OS_AREA_SEGMENT_SIZE);
 
 	result = verify_header(header);
 
@@ -238,16 +244,13 @@ int __init ps3_os_area_init(void)
 }
 
 /**
- * ps3_os_area_rtc_diff - Returns the ps3 rtc diff value.
- *
- * The ps3 rtc maintains a value that approximates seconds since
- * 2000-01-01 00:00:00 UTC.  Returns the exact number of seconds from 1970 to
- * 2000 when saved_params.rtc_diff has not been properly set up.
+ * ps3_os_area_rtc_diff - Returns the rtc diff value.
  */
 
 u64 ps3_os_area_rtc_diff(void)
 {
-	return saved_params.rtc_diff ? saved_params.rtc_diff : 946684800UL;
+	return saved_params.rtc_diff ? saved_params.rtc_diff
+		: SECONDS_FROM_1970_TO_2000;
 }
 
 /**

-- 

  reply	other threads:[~2007-10-06 21:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-06 21:35 [patch 0/6] PS3 os area patches for 2.6.24 geoffrey.levand
2007-10-06 21:35 ` geoffrey.levand [this message]
2007-10-06 21:35 ` [patch 2/6] PS3: Remove unused os-area params geoffrey.levand
2007-10-08 14:00   ` Ranulf Doswell
2007-10-08 17:53     ` Geoff Levand
2007-10-08 22:38       ` Ranulf Doswell
2007-10-08 22:50         ` Geoff Levand
2007-10-06 21:35 ` [patch 3/6] PS3: os-area workqueue processing geoffrey.levand
2007-10-06 21:35 ` [patch 4/6] PS3: Add os-area rtc_diff set/get routines geoffrey.levand
2007-10-06 21:35 ` [patch 5/6] PS3: Save os-area params to device tree geoffrey.levand
2007-10-06 21:35 ` [patch 6/6] PS3: Add os-area database routines geoffrey.levand
2007-10-08  8:27   ` Geert Uytterhoeven
2007-10-09  1:08     ` Geoff Levand
2007-10-08 12:16   ` Geert Uytterhoeven
2007-10-09  1:12     ` Geoff Levand
2007-10-08 13:48   ` Ranulf Doswell
2007-10-08 17:52     ` Geoff Levand
2007-10-08 22:59       ` Ranulf Doswell
2007-10-08 23:36         ` Geoff Levand
2007-10-09  9:35         ` Geert Uytterhoeven
2007-10-09 12:23           ` Ranulf Doswell
2007-10-09  1:07   ` [patch v2] " Geoff Levand
2007-10-09 11:38     ` Geert Uytterhoeven
2007-10-09 17:15     ` Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071006213542.509952005@am.sony.com \
    --to=geoffrey.levand@am$(echo .)sony.com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox