aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2007-10-06 17:35:43 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-09 07:01:57 -0400
commitca94297f0c169710848a095a2fd986195e546cb3 (patch)
treedc13abd138e979569c99ff759cfc2b5ce18ec864 /arch/powerpc
parentd767efe30f42c9e827ac1f452762f55b2d8fbdb3 (diff)
[POWERPC] PS3: Cleanup of os-area.c
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> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index b70e474014f0..ee463d0f87ad 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * PS3 'Other OS' area data. 2 * PS3 flash memory os area.
3 * 3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc. 4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp. 5 * Copyright 2006 Sony Corp.
@@ -29,7 +29,7 @@ enum {
29 OS_AREA_SEGMENT_SIZE = 0X200, 29 OS_AREA_SEGMENT_SIZE = 0X200,
30}; 30};
31 31
32enum { 32enum os_area_ldr_format {
33 HEADER_LDR_FORMAT_RAW = 0, 33 HEADER_LDR_FORMAT_RAW = 0,
34 HEADER_LDR_FORMAT_GZIP = 1, 34 HEADER_LDR_FORMAT_GZIP = 1,
35}; 35};
@@ -50,7 +50,7 @@ enum {
50 */ 50 */
51 51
52struct os_area_header { 52struct os_area_header {
53 s8 magic_num[16]; 53 u8 magic_num[16];
54 u32 hdr_version; 54 u32 hdr_version;
55 u32 os_area_offset; 55 u32 os_area_offset;
56 u32 ldr_area_offset; 56 u32 ldr_area_offset;
@@ -60,12 +60,12 @@ struct os_area_header {
60 u32 _reserved_2[6]; 60 u32 _reserved_2[6];
61}; 61};
62 62
63enum { 63enum os_area_boot_flag {
64 PARAM_BOOT_FLAG_GAME_OS = 0, 64 PARAM_BOOT_FLAG_GAME_OS = 0,
65 PARAM_BOOT_FLAG_OTHER_OS = 1, 65 PARAM_BOOT_FLAG_OTHER_OS = 1,
66}; 66};
67 67
68enum { 68enum os_area_ctrl_button {
69 PARAM_CTRL_BUTTON_O_IS_YES = 0, 69 PARAM_CTRL_BUTTON_O_IS_YES = 0,
70 PARAM_CTRL_BUTTON_X_IS_YES = 1, 70 PARAM_CTRL_BUTTON_X_IS_YES = 1,
71}; 71};
@@ -84,6 +84,9 @@ enum {
84 * @dns_primary: User preference of static primary dns server. 84 * @dns_primary: User preference of static primary dns server.
85 * @dns_secondary: User preference of static secondary dns server. 85 * @dns_secondary: User preference of static secondary dns server.
86 * 86 *
87 * The ps3 rtc maintains a read-only value that approximates seconds since
88 * 2000-01-01 00:00:00 UTC.
89 *
87 * User preference of zero for static_ip_addr means use dhcp. 90 * User preference of zero for static_ip_addr means use dhcp.
88 */ 91 */
89 92
@@ -108,6 +111,8 @@ struct os_area_params {
108 u8 _reserved_5[8]; 111 u8 _reserved_5[8];
109}; 112};
110 113
114#define SECONDS_FROM_1970_TO_2000 946684800LL
115
111/** 116/**
112 * struct saved_params - Static working copies of data from the 'Other OS' area. 117 * struct saved_params - Static working copies of data from the 'Other OS' area.
113 * 118 *
@@ -213,7 +218,8 @@ int __init ps3_os_area_init(void)
213 } 218 }
214 219
215 header = (struct os_area_header *)__va(lpar_addr); 220 header = (struct os_area_header *)__va(lpar_addr);
216 params = (struct os_area_params *)__va(lpar_addr + OS_AREA_SEGMENT_SIZE); 221 params = (struct os_area_params *)__va(lpar_addr
222 + OS_AREA_SEGMENT_SIZE);
217 223
218 result = verify_header(header); 224 result = verify_header(header);
219 225
@@ -238,16 +244,13 @@ int __init ps3_os_area_init(void)
238} 244}
239 245
240/** 246/**
241 * ps3_os_area_rtc_diff - Returns the ps3 rtc diff value. 247 * ps3_os_area_rtc_diff - Returns the rtc diff value.
242 *
243 * The ps3 rtc maintains a value that approximates seconds since
244 * 2000-01-01 00:00:00 UTC. Returns the exact number of seconds from 1970 to
245 * 2000 when saved_params.rtc_diff has not been properly set up.
246 */ 248 */
247 249
248u64 ps3_os_area_rtc_diff(void) 250u64 ps3_os_area_rtc_diff(void)
249{ 251{
250 return saved_params.rtc_diff ? saved_params.rtc_diff : 946684800UL; 252 return saved_params.rtc_diff ? saved_params.rtc_diff
253 : SECONDS_FROM_1970_TO_2000;
251} 254}
252 255
253/** 256/**