Talk:SC Communication: Difference between revisions
Line 427: | Line 427: | ||
Credits to [[User:Zer0Tolerance|ZeroTolerance]] for the info | Credits to [[User:Zer0Tolerance|ZeroTolerance]] for the info | ||
=== Log === | |||
[pre] | |||
create_auth1_cmd() | |||
Total time elapsed : 822 us | |||
setup_packet() | |||
Total time elapsed : 1007 us | |||
sc_put() | |||
Total time elapsed : 3141 us | |||
sc_get() | |||
Total time elapsed : 2003358 us | |||
validate_auth1_cmd() | |||
Total time elapsed : 2003444 us | |||
create_auth2_cmd() | |||
Total time elapsed : 2003477 us | |||
setup_packet() | |||
Total time elapsed : 2003482 us | |||
sc_put() | |||
Total time elapsed : 2005603 us | |||
sc_get() | |||
Total time elapsed : 4005793 us | |||
validate_auth2_cmd() | |||
Total time elapsed : 4005867 us | |||
create_read_data_cmd() | |||
Total time elapsed : 4005919 us | |||
setup_packet() | |||
Total time elapsed : 4005924 us | |||
sc_put() | |||
Total time elapsed : 4008113 us | |||
sc_get() | |||
Total time elapsed : 6008311 us | |||
validate_read_data_cmd() | |||
Total time elapsed : 6008490 us | |||
end | |||
Total time elapsed : 6008544 us[/pre] | |||
* KickStart Value (packet 0): 1.8480055 seconds | |||
* KickEnd Value : (packet 69): 5.8694735 seconds | |||
* Diff : 4.021468 seconds |
Revision as of 21:33, 25 May 2015
Syscon packets
Device Access Service (0x03)
EEPROM write
Purpose: Write block of data to EEPROM.
struct __attribute__ ((packed)) dev_access_request_t { uint8_t cmd; // 0x01 uint8_t padding[3]; uint32_t offset; uint32_t size; uint8_t data[0]; }; struct __attribute__ ((packed)) dev_access_response_t { uint8_t status; // 0x00:OK, 0x03:Wrong offset, 0x04:Wrong size, 0xFF:Error uint8_t data[0]; };
- Although this service is not used on Slim and some Phat consoles anymore, it is working.
- It seems it have the same restrictions as NVS service.
EEPROM read
Purpose: Read block of data from EEPROM.
struct __attribute__ ((packed)) dev_access_request_t { uint8_t cmd; // 0x00 uint8_t padding[3]; uint32_t offset; uint32_t size; }; struct __attribute__ ((packed)) dev_access_response_t { uint8_t status; // 0x00:OK, 0x03:Wrong offset, 0x04:Wrong size, 0xFF:Error uint8_t data[0]; };
- Although this service is not used on Slim and some Phat consoles anymore, it is working.
- It seems it have the same restrictions as NVS service.
Thermal Service (0x11)
Get temperature alert?
Purpose: Used to get current temperature alert?.
struct __attribute__ ((packed)) get_thermal_alert_request_t { uint8_t cmd; // 0x20 uint8_t param; // 0xFF }; struct __attribute__ ((packed)) get_thermal_alert_response_t { uint8_t unk1; // status? uint8_t unk2; // status? uint8_t data[32]; };
Get temperature
Purpose: Used to get current temperature.
struct __attribute__ ((packed)) get_temperature_request_t { uint8_t cmd; // 0x00 uint8_t tzone; // 0x00:CELL, 0x01:RSX }; struct __attribute__ ((packed)) get_temperature_response_t { uint8_t status; int8_t temperature_hi; int8_t temperature_lo; };
- Temperature in celsius: sprintf("%d.%d", temperature_hi, (temperature_lo * 100) / 256);
Configuration Service (0x12)
Get XDR configuration
Purpose: Used at bootloader during initialization.
struct __attribute__ ((packed)) get_xdr_config_request_t { uint8_t cmd; // 0x00 uint8_t param; // 0x00 }; struct __attribute__ ((packed)) get_xdr_config_response_t { uint8_t cmd; uint8_t padding[3]; uint8_t data[128]; };
struct __attribute__ ((packed)) get_xdr_config2_request_t { uint8_t cmd; // 0x01 uint8_t param; // 0x00 }; struct __attribute__ ((packed)) get_xdr_config2_response_t { uint8_t cmd; uint8_t data_size?; uint8_t padding[2]; uint8_t data[256]; };
- get_xdr_config2 returns more data (maybe different config?)
Get IDlog information
Purpose: Can be used to get CID/eCID information.
struct __attribute__ ((packed)) get_idlog_info_request_t { uint8_t cmd; // 0x03 uint8_t param; // 0x01 }; struct __attribute__ ((packed)) get_idlog_info_response_t { uint8_t cmd; uint8_t padding[3]; uint8_t ecid[16]; uint8_t cid[6]; };
Get reference clock
Purpose: Used to calculate an initial value of timebase register.
struct __attribute__ ((packed)) get_reference_clock_request_t { uint8_t cmd; // 0x03 uint8_t param; // 0x10 }; struct __attribute__ ((packed)) get_reference_clock_response_t { uint8_t cmd; uint8_t padding[3]; uint32_t ref_clock_value; uint32_t unk; };
Get core clock multiplier
Purpose: Used together with reference clock to calculate clock frequency.
struct __attribute__ ((packed)) get_core_clock_multiplier_request_t { uint8_t cmd; // 0x03 uint8_t param; // 0x00 }; struct __attribute__ ((packed)) get_core_clock_multiplier_response_t { uint8_t cmd; uint8_t padding[3]; uint8_t id; // 00:2, 01:4, 03: 8, 04:10, 05:12, 06:16, 07:20 };
- Clock frequency = core clock multiplier table[id] * reference clock.
- For example, if you have id=3 and reference clock=400000000, then your clock frequency will be: 400000000*8=3200000000 (3.2 Ghz)
Get platform ID
Purpose: Used to get platform ID (Cytology, Cookie, etc).
struct __attribute__ ((packed)) get_platform_id_request_t { uint8_t cmd; // 0x20 uint8_t param; // 0x10 }; struct __attribute__ ((packed)) get_platform_id_response_t { uint8_t cmd; uint8_t padding[3]; uint8_t platform_id[8]; // ASCII-string };
Get hardware configuration
Purpose: Used to get hardware configuration (PS2 emulation compatibility, card support, WLAN interface, etc).
struct __attribute__ ((packed)) get_hw_config_request_t { uint8_t cmd; // 0x22 }; struct __attribute__ ((packed)) get_hw_config_response_t { uint8_t cmd; uint8_t padding[3]; uint8_t data[12]; };
Get BE counters
Purpose: Used to get several BE counters.
struct __attribute__ ((packed)) get_be_counters_request_t { uint8_t cmd; // 0x41 }; struct __attribute__ ((packed)) get_be_counters_response_t { uint8_t cmd; uint32_t total_operation_time; uint32_t power_on_counter; uint32_t power_off_counter; };
Power Service (0x13)
Shutdown
Purpose: Shutdown console.
struct __attribute__ ((packed)) shutdown_request_t { uint8_t cmd; // 0x00 };
Reboot
Purpose: Reboot console.
struct __attribute__ ((packed)) reboot_request_t { uint8_t cmd; // 0x01 };
Query system power up cause
Purpose: Get information about system power up cause.
struct __attribute__ ((packed)) query_system_power_up_cause_request_t { uint8_t cmd; // 0x10 }; struct __attribute__ ((packed)) query_system_power_up_cause_response_t { uint8_t cmd; uint8_t padding1[3]; uint32_t wake_source; uint8_t requested_os_context; uint8_t current_os_context; uint8_t requested_gr_context; uint8_t current_gr_context; uint8_t last_shutdown_cause; uint8_t padding2[3]; };
Get realtime clock
Purpose: Get current value of realtime clock.
struct __attribute__ ((packed)) get_rtc_request_t { uint8_t cmd; // 0x33 }; struct __attribute__ ((packed)) get_rtc_response_t { uint8_t cmd; uint8_t padding[3]; uint32_t rtc; };
NVS Service (0x14)
EEPROM write
Purpose: Write block of data to EEPROM.
struct __attribute__ ((packed)) nvs_access_request_t { uint8_t cmd; // 0x10 uint8_t index; uint8_t offset; uint8_t size; // 0x00 for full block uint8_t data[0]; }; struct __attribute__ ((packed)) nvs_access_response_t { uint8_t status; // 0x00:OK, 0x02:Invalid block index, 0x03:Invalid offset/size uint8_t index; uint8_t offset; uint8_t size; uint8_t data[0]; };
EEPROM read
Purpose: Read block of data from EEPROM.
struct __attribute__ ((packed)) nvs_access_request_t { uint8_t cmd; // 0x20 uint8_t index; uint8_t offset; uint8_t size; // 0x00 for full block }; struct __attribute__ ((packed)) nvs_access_response_t { uint8_t status; // 0x00:OK, 0x02:Invalid block index, 0x03:Invalid offset/size uint8_t index; uint8_t offset; uint8_t size; uint8_t data[0]; };
Livelock Service (0x18)
Get service version
Purpose: Get information about service version.
struct __attribute__ ((packed)) get_service_version_request_t { uint8_t cmd; // 0x01 uint8_t service_id; }; struct __attribute__ ((packed)) get_service_version_response_t { uint8_t status; uint8_t service_id; uint8_t major_version; uint8_t minor_version; };
Get syscon version
Purpose: Get information about syscon version.
struct __attribute__ ((packed)) get_sc_version_request_t { uint8_t cmd; // 0x12/0x14 }; struct __attribute__ ((packed)) get_sc_version_response_t { uint8_t cmd; uint8_t padding[3]; uint16_t version; };
A/V Service (0x30)
Get monitor information
Purpose: Get monitor information (EDID).
struct __attribute__ ((packed)) get_monitor_info_request_t { uint8_t cmd; // 0x0D uint8_t av_port; // 0x00 uint8_t unk1; // 0x00 uint8_t unk2; // 0x00 (garbage) }; struct __attribute__ ((packed)) get_monitor_info_response_t { uint8_t status; uint8_t unk1; uint8_t unk2; uint8_t unk3; uint8_t data[256]; };
Sample responses when HDMI inserted (personal info removed):
000c000: 3001 0000 0000 8031 8000 0000 0104 0104 0......1........ 000c010: 2000 0282 00ff ffff ffff ff00 0469 fa22 ............i." 000c020: 0101 0101 2c15 0103 8030 1b78 eec4 f5a3 ....,....0.x.... 000c030: 574a 9c23 1150 54bf ef00 714f 8180 8140 WJ.#.PT...qO...@ 000c040: 9500 a940 b300 d1c0 0101 023a 8018 7138 ...@.......:..q8 000c050: 2d40 582c 4500 132b 2100 001e 0000 00fd -@X,E..+!....... 000c060: 0032 4c1e 5311 000a 2020 2020 2020 0000 .2L.S... .. 000c070: 00fc 0056 4532 3238 0a20 2020 2020 2020 ...VE228. 000c080: 0000 00ff 00XX XXXX XXXX XXXX XXXX XXXX .....EDIDSERIALN 000c090: XX0a 0188 0203 1ef1 4b90 0504 0302 0111 M.......K....... 000c0a0: 1213 141f 2309 0707 8301 0000 6503 0c00 ....#.......e... 000c0b0: 1000 1a36 80a0 7038 1e40 3020 3500 132b ...6..p8.@0 5..+ 000c0c0: 2100 001a 6621 56aa 5100 1e30 468f 3300 !...f!V.Q..0F.3. 000c0d0: 132b 2100 001e 011d 0072 51d0 1e20 6e28 .+!......rQ.. n( 000c0e0: 5500 132b 2100 001e 8c0a d08a 20e0 2d10 U..+!....... .-. 000c0f0: 103e 9600 132b 2100 0018 011d 8018 711c .>...+!.......q. 000c100: 1620 582c 2500 132b 2100 009f 0000 0000 . X,%..+!.......
0000h: 00 FF FF FF FF FF FF 00 XX XX XX XX XX XX XX XX .яяяяяя......... 0010h: 26 17 01 03 80 3C 22 78 2E 2F A5 A5 54 50 9E 27 &...Ђ<"x./ҐҐTPћ' 0020h: 10 50 54 A5 6B 80 D1 C0 61 C0 81 00 81 C0 81 40 .PTҐkЂСАaАЃ.ЃАЃ@ 0030h: 81 80 A9 C0 B3 00 02 3A 80 18 71 38 2D 40 58 2C ЃЂ©Аі..:Ђ.q8-@X, 0040h: 45 00 56 50 21 00 00 1E 00 00 00 FF 00 41 39 44 E.VP!......я.A9D 0050h: 30 30 36 31 30 53 4C 30 0A 20 00 00 00 FD 00 32 00610SL0. ...э.2 0060h: 4C 1E 53 15 00 0A 20 20 20 20 20 20 00 00 00 FC L.S... ...ь 0070h: 00 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX ................ 0080h: 02 03 24 F1 4F 01 02 03 04 05 06 07 10 11 12 13 ..$сO........... 0090h: 14 15 16 1F 23 09 07 07 83 01 00 00 67 03 0C 00 ....#...ѓ...g... 00A0h: 10 00 00 2D 02 3A 80 18 71 38 2D 40 58 2C 45 00 ...-.:Ђ.q8-@X,E. 00B0h: 56 50 21 00 00 1F 01 1D 80 18 71 1C 16 20 58 2C VP!.....Ђ.q.. X, 00C0h: 25 00 56 50 21 00 00 9F 01 1D 00 72 51 D0 1E 20 %.VP!..џ...rQР. 00D0h: 6E 28 55 00 56 50 21 00 00 1E 8C 0A D0 8A 20 E0 n(U.VP!...Њ.РЉ а 00E0h: 2D 10 10 3E 96 00 56 50 21 00 00 18 00 00 00 00 -..>–.VP!....... 00F0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 96 ...............–
Get HDMI KSV
Purpose: Get HDMI key selection vector.
struct __attribute__ ((packed)) get_hdmi_ksv_request_t { uint8_t cmd; // 0x11 }; struct __attribute__ ((packed)) get_hdmi_ksv_response_t { uint8_t result; uint8_t padding[3]; uint8_t ksv[5]; };
Tools
- SysCommParser by TizzyT http://tizzyt-archive.blogspot.com.es/2015/02/syscommparser.html
Log Info
Each of the times a request is made that involves Auth1+Auth2,there is a communication made to eeprom for read/write. It goes like this (case for backup_srh):
- Read initial 16 bytes of eeprom once (packet 0) (0x10)
- Read 32 bytes following 20 times (packets 1-21) (0x280)
- Auth1 established
- Repeat steps 1 2
- Auth2 established
- Repeat steps 1 2 for finding key?/validation?
- Validation/Finding Key established
- Final Packet(s): Read EEPROM Location/Write to EEPROM Location/Do Other Tasks
Notes:
- Initial bytes are constant and never change from phat to phat
- Following bytes are perconsole (EID1 most likely)
- Steps that don't involve sc auth1 auth2 such as reading eeprom using nvs service or checking syscon status (probably stored in RAM, because true value is in EEPROM encrypted) have no packet activity
- initial bytes value: 99 D9 66 2B B3 D7 61 54 6B 9C 3F 9E D1 40 ED B0
- we haven't tested bootldr init yet, but we think it might be different from the others...
Credits to ZeroTolerance for the info
Log
[pre] create_auth1_cmd() Total time elapsed : 822 us setup_packet() Total time elapsed : 1007 us sc_put() Total time elapsed : 3141 us sc_get() Total time elapsed : 2003358 us validate_auth1_cmd() Total time elapsed : 2003444 us create_auth2_cmd() Total time elapsed : 2003477 us setup_packet() Total time elapsed : 2003482 us sc_put() Total time elapsed : 2005603 us sc_get() Total time elapsed : 4005793 us validate_auth2_cmd() Total time elapsed : 4005867 us create_read_data_cmd() Total time elapsed : 4005919 us setup_packet() Total time elapsed : 4005924 us sc_put() Total time elapsed : 4008113 us sc_get() Total time elapsed : 6008311 us validate_read_data_cmd() Total time elapsed : 6008490 us end Total time elapsed : 6008544 us[/pre]
- KickStart Value (packet 0): 1.8480055 seconds
- KickEnd Value : (packet 69): 5.8694735 seconds
- Diff : 4.021468 seconds