Changes

Jump to navigation Jump to search
486 bytes removed ,  00:32, 10 December 2019
no edit summary
Line 1: Line 1: −
= Secure Monitor Calls =
+
= Secure Monitor calls =
 
   
The secure monitor provides two top level handlers of which each provides a range of sub handlers.
 
The secure monitor provides two top level handlers of which each provides a range of sub handlers.
   −
Secure Monitor Calls follow the ARM SMC calling convention up to a small change:
+
Secure Monitor calls follow the ARM SMC calling convention up to a small change:
 
{| class=wikitable
 
{| class=wikitable
 
! Bit number || Bit mask || Description
 
! Bit number || Bit mask || Description
Line 24: Line 23:  
SMC arguments are passed using registers X0-X7 with X0 always sending the call sub-id and returning the result of the call.
 
SMC arguments are passed using registers X0-X7 with X0 always sending the call sub-id and returning the result of the call.
   −
== ID 0 ==
+
== FunctionId0 ==
 
Functions exposed to user-mode processes using [[SVC|svcCallSecureMonitor]]. SMCs should be called from CPUID 3 (where SPL runs).
 
Functions exposed to user-mode processes using [[SVC|svcCallSecureMonitor]]. SMCs should be called from CPUID 3 (where SPL runs).
    
{| class=wikitable
 
{| class=wikitable
! Sub-ID || Name || In || Out
+
! Value || Name
 
|-
 
|-
| 0xC3000401 || SetConfig || ||
+
| 0xC3000401 || SetConfig
 
|-
 
|-
| 0xC3000002 || GetConfig (Same as ID 1, Sub-ID 4) || ||
+
| 0xC3000002 || [[#GetConfig]] (same as in [[#FunctionId1]])
 
|-
 
|-
| 0xC3000003 || GetResult || ||
+
| 0xC3000003 || GetResult
 
|-
 
|-
| 0xC3000404 || GetResultData || ||
+
| 0xC3000404 || GetResultData
 
|-
 
|-
| 0xC3000E05 || ExpMod || ||
+
| 0xC3000E05 || ExpMod
 
|-
 
|-
| 0xC3000006 || GenerateRandomBytes (Same as ID 1, Sub-ID 5) || ||
+
| 0xC3000006 || [[#GenerateRandomBytes]] (same as in [[#FunctionId1]])
 
|-
 
|-
| 0xC3000007 || [[#GenerateAesKek]] || ||
+
| 0xC3000007 || [[#GenerateAesKek]]
 
|-
 
|-
| 0xC3000008 || [[#LoadAesKey]] || ||
+
| 0xC3000008 || [[#LoadAesKey]]
 
|-
 
|-
| 0xC3000009 || [[#ComputeAes]] || ||
+
| 0xC3000009 || [[#ComputeAes]]
 
|-
 
|-
| 0xC300000A || [[#GenerateSpecificAesKey]] || ||
+
| 0xC300000A || [[#GenerateSpecificAesKey]]
 
|-
 
|-
| 0xC300040B || [[#ComputeCmac]] || ||
+
| 0xC300040B || [[#ComputeCmac]]
 
|-
 
|-
| [1.0.0-4.1.0] 0xC300100C || [[#ImportEsKey]] || ||
+
| [1.0.0-4.1.0] 0xC300100C || [[#ImportEsKey]]
 
|-
 
|-
| [5.0.0+] 0xC300D60C || [[#ReEncryptRsaPrivateKey]] || ||
+
| [5.0.0+] 0xC300D60C || [[#ReEncryptRsaPrivateKey]]
 
|-
 
|-
| [1.0.0-4.1.0] 0xC300100D || [[#DecryptRsaPrivateKey]] || ||
+
| [1.0.0-4.1.0] 0xC300100D || [[#DecryptRsaPrivateKey]]
 
|-
 
|-
| [5.0.0+] 0xC300100D || [[#DecryptOrImportRsaPrivateKey]] || ||
+
| [5.0.0+] 0xC300100D || [[#DecryptOrImportRsaPrivateKey]]
 
|-
 
|-
| [1.0.0-4.1.0] 0xC300100E || [[#ImportLotusKey]] || ||
+
| [1.0.0-4.1.0] 0xC300100E || [[#ImportLotusKey]]
 
|-
 
|-
| 0xC300060F || [[#StorageExpMod]] || ||
+
| 0xC300060F || [[#StorageExpMod]]
 
|-
 
|-
| 0xC3000610 || [[#UnwrapTitleKey]] || ||
+
| 0xC3000610 || [[#UnwrapTitleKey]]
 
|-
 
|-
| 0xC3000011 || [[#LoadTitleKey]] || ||
+
| 0xC3000011 || [[#LoadTitleKey]]
 
|-
 
|-
| 0xC3000012 || [2.0.0+] [[#UnwrapCommonTitleKey]] || ||
+
| 0xC3000012 || [2.0.0+] [[#UnwrapCommonTitleKey]]
 
|}
 
|}
   Line 82: Line 81:     
=== GenerateAesKek ===
 
=== GenerateAesKek ===
Takes an "access key" as input, an [[#enum_CryptoUsecase]].
+
Takes an "access key" as input, an [[#CryptoUsecase]].
    
Returns a session-unique kek for said usecase.
 
Returns a session-unique kek for said usecase.
Line 89: Line 88:  
Takes a session kek created with [[#GenerateAesKek]], and a wrapped AES key.
 
Takes a session kek created with [[#GenerateAesKek]], and a wrapped AES key.
   −
The session kek must have been created with [[#enum_CryptoUsecase|CryptoUsecase_Aes]].
+
The session kek must have been created with [[#CryptoUsecase|CryptoUsecase Aes]].
    
=== ComputeAes ===
 
=== ComputeAes ===
Encrypts/decrypts using AES (CTR and CBC). Takes an [[#enum_CipherMode]].
+
Encrypts/decrypts using AES (CTR and CBC). Takes an [[#CipherMode]].
    
Key must be set prior using one of the [[#LoadAesKey]] or [[#GenerateSpecificAesKey]] commands.
 
Key must be set prior using one of the [[#LoadAesKey]] or [[#GenerateSpecificAesKey]] commands.
Line 105: Line 104:  
Takes a session kek created with [[#GenerateAesKek]], a wrapped AES key, and a wrapped RSA private key.
 
Takes a session kek created with [[#GenerateAesKek]], a wrapped AES key, and a wrapped RSA private key.
   −
The session kek must have been created with [[#enum_CryptoUsecase|CryptoUsecase_TitleKey]].
+
The session kek must have been created with [[#CryptoUsecase|CryptoUsecase TitleKey]].
    
[5.0.0] This function was removed and replaced with [[#ReEncryptRsaPrivateKey]].
 
[5.0.0] This function was removed and replaced with [[#ReEncryptRsaPrivateKey]].
Line 119: Line 118:  
Takes a session kek created with [[#GenerateAesKek]], a wrapped AES key, an enum member, and a wrapped RSA private key.
 
Takes a session kek created with [[#GenerateAesKek]], a wrapped AES key, an enum member, and a wrapped RSA private key.
   −
The session kek must have been created with [[#enum_CryptoUsecase|CryptoUsecase_RsaPrivate]].
+
The session kek must have been created with [[#CryptoUsecase|CryptoUsecase RsaPrivate]].
   −
[4.0.0+] The SMC handler when certain conditions pass and SMC_ID==0xC300100D now returns error 0x6 instead of calling the handler funcptr.
+
[4.0.0+] The SMC handler when certain conditions pass and FunctionId0==0xC300100D now returns error 0x6 instead of calling the handler funcptr.
    
[5.0.0+] This function was replaced by [[#DecryptOrImportRsaPrivateKey]].
 
[5.0.0+] This function was replaced by [[#DecryptOrImportRsaPrivateKey]].
    
=== DecryptOrImportRsaPrivateKey ===
 
=== DecryptOrImportRsaPrivateKey ===
This function replaced [[#DecryptRsaPrivateKey]] in [[5.0.0]], adding an additional [[#enum_DecryptOrImportMode]].
+
This function replaced [[#DecryptRsaPrivateKey]] in [[5.0.0]], adding an additional [[#DecryptOrImportMode]].
    
This SMC extends DecryptRsaPrivateKey's original functionality to enable importing private keys into the security engine instead of decrypting them, when certain enum members are passed.
 
This SMC extends DecryptRsaPrivateKey's original functionality to enable importing private keys into the security engine instead of decrypting them, when certain enum members are passed.
Line 133: Line 132:  
Takes a session kek created with [[#GenerateAesKek]], and a wrapped RSA key.
 
Takes a session kek created with [[#GenerateAesKek]], and a wrapped RSA key.
   −
The session kek must have been created with [[#enum_CryptoUsecase|CryptoUsecase_RsaSecureExpMod]].
+
The session kek must have been created with [[#CryptoUsecase|CryptoUsecase RsaSecureExpMod]].
    
[5.0.0] This function was removed.
 
[5.0.0] This function was removed.
Line 140: Line 139:  
Performs an ExpMod operation using an exponent previously loaded with the [[#ImportLotusKey]] command.
 
Performs an ExpMod operation using an exponent previously loaded with the [[#ImportLotusKey]] command.
   −
[5.0.0+] This now uses any exponent previously loaded with [[#DecryptOrImportRsaPrivateKey]] and takes an [[#enum_SecureExpModMode]].
+
[5.0.0+] This now uses any exponent previously loaded with [[#DecryptOrImportRsaPrivateKey]] and takes an [[#SecureExpModMode]].
    
=== UnwrapTitleKey ===
 
=== UnwrapTitleKey ===
Line 157: Line 156:  
Takes an AES-wrapped TitleKey and returns a sealed AES key.
 
Takes an AES-wrapped TitleKey and returns a sealed AES key.
   −
=== enum CryptoUsecase ===
+
== FunctionId1 ==
{| class=wikitable
+
Functions exposed to the kernel internally.
! Value || Name
  −
|-
  −
| 0 || CryptoUsecase_Aes
  −
|-
  −
| 1 || CryptoUsecase_RsaPrivate
  −
|-
  −
| 2 || CryptoUsecase_RsaSecureExpMod
  −
|-
  −
| 3 || CryptoUsecase_TitleKey
  −
|}
  −
 
  −
Note:
  −
The [[#enum_CryptoUsecase|CryptoUsecase_TitleKey]] represents a RSA wrapped AES key.
     −
=== enum CipherMode ===
   
{| class=wikitable
 
{| class=wikitable
 
! Value || Name
 
! Value || Name
 
|-
 
|-
| 0 || CipherMode_CbcEncrypt
+
| 0xC4000001 || [[#CpuSuspend]]
 
|-
 
|-
| 1 || CipherMode_CbcDecrypt
+
| 0x84000002 || [[#CpuOff]]
 
|-
 
|-
| 2 || CipherMode_Ctr
+
| 0xC4000003 || [[#CpuOn]]
|}
  −
 
  −
=== enum DecryptOrImportMode ===
  −
{| class=wikitable
  −
! Value || Name
   
|-
 
|-
| 0 || DecryptOrImportMode_DecryptRsaPrivateKey
+
| 0xC3000004 || [[#GetConfig]] (same as in [[#FunctionId0]])
 
|-
 
|-
| 1 || DecryptOrImportMode_ImportLotusKey
+
| 0xC3000005 || [[#GenerateRandomBytes]] (same as in [[#FunctionId0]])
 
|-
 
|-
| 2 || DecryptOrImportMode_ImportEsKey
+
| 0xC3000006 || [[#Panic]]
 
|-
 
|-
| 3 || DecryptOrImportMode_ImportSslKey
+
| 0xC3000007 || [2.0.0+] [[#ConfigureCarveout]]
 
|-
 
|-
| 4 || DecryptOrImportMode_ImportDrmKey
+
| 0xC3000008 || [2.0.0+] [[#ReadWriteRegister]]
 
|}
 
|}
   −
=== enum SecureExpModMode ===
+
=== CpuSuspend ===
{| class=wikitable
+
Takes an u64 '''PowerState''', an u64 '''EntrypointAddr''' and an u64 '''ContextId'''. No output.
! Value || Name
  −
|-
  −
| 0 || SecureExpModMode_Lotus
  −
|-
  −
| 1 || SecureExpModMode_Ssl
  −
|-
  −
| 2 || SecureExpModMode_Drm
  −
|}
     −
== ID 1 ==
+
Suspends the CPU (CPU0).
Functions exposed to the kernel internally.
     −
{| class=wikitable
+
The kernel calls this SMC on shutdown with '''PowerState''' set to 0x0201001B (power level: 0x02==system; power type: 0x01==powerdown; ID: 0x1B).
! Sub-ID || Name || In || Out
  −
|-
  −
| 0xC4000001 || [[#CpuSuspend]] || X1=power_state, X2=entrypoint_addr, X3=context_id || None
  −
|-
  −
| 0x84000002 || [[#CpuOff]] || None || None
  −
|-
  −
| 0xC4000003 || [[#CpuOn]] || X1=target_cpu, X2=entrypoint_addr, X3=context_id, X4,X5,X6,X7=0 || X0=result
  −
|-
  −
| 0xC3000004 || [[#GetConfig]] (Same as ID 0, Sub-ID 2) || W1=config_item, X2,X3,X4,X5,X6,X7=0 || X0=result, X1,X2,X3,X4=config_val
  −
|-
  −
| 0xC3000005 || [[#GenerateRandomBytes]] (Same as ID 0, Sub-ID 6) || X1=size, X2,X3,X4,X5,X6,X7=0 || X0=result, X1,X2,X3,X4,X5,X6,X7=rand_bytes
  −
|-
  −
| 0xC3000006 || [[#Panic]] || W1=panic_color, X2,X3,X4,X5,X6,X7=0 || X0=result
  −
|-
  −
| 0xC3000007 || [2.0.0+] [[#ConfigureCarveout]] || X1=carveout_index, X2=region_phys_addr, X3=region_size, X4,X5,X6,X7=0 || X0=result
  −
|-
  −
| 0xC3000008 || [2.0.0+] [[#ReadWriteRegister]] || X1=reg_addr, W2=rw_mask, W3=in_val, X4,X5,X6,X7=0 || X0=result, W1=out_val
  −
|}
     −
=== CpuSuspend ===
+
=== CpuOff ===
Standard ARM PCSI SMC. Suspends the CPU (CPU0).
+
No input/output.
   −
The kernel calls this SMC on shutdown with '''power_state''' set to 0x0201001B (power level: 0x02==system; power type: 0x01==powerdown; ID: 0x1B).
+
Turns off the CPU (CPU1, CPU2 or CPU3).
   −
=== CpuOff ===
+
=== CpuOn ===
Standard ARM PCSI SMC. Turns off the CPU (CPU1, CPU2 or CPU3).
+
Takes an u64 '''TargetCpu''', an u64 '''EntrypointAddr''' and an u64 '''ContextId'''. Returns [[#Result]].
   −
=== CpuOn ===
+
Turns on the CPU (CPU1, CPU2 or CPU3).
Standard ARM PCSI SMC. Turns on the CPU (CPU1, CPU2 or CPU3).
      
=== GetConfig ===
 
=== GetConfig ===
Takes a '''config_item''' and returns an associated '''config_val'''.
+
Takes a [[#ConfigItem]]. Returns [[#Result]] and a '''ConfigVal'''.
    +
==== ConfigItem ====
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! ConfigItem || Name
+
! Value || Name
 
|-
 
|-
 
| 1 || [[#DisableProgramVerification]]
 
| 1 || [[#DisableProgramVerification]]
Line 286: Line 239:  
|}
 
|}
   −
==== DisableProgramVerification ====
+
===== DisableProgramVerification =====
 
[[Process Manager services|PM]] checks this item and if non-zero, calls fsp-pr SetEnabledProgramVerification(false).
 
[[Process Manager services|PM]] checks this item and if non-zero, calls fsp-pr SetEnabledProgramVerification(false).
   −
==== DramId ====
+
===== DramId =====
This is extracted directly from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]].
  −
 
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Value
+
! Value
! Description
+
! Description
 
|-
 
|-
| 0
+
| 0
| DramId_EristaIcosaSamsung4gb
+
| EristaIcosaSamsung4gb
 
|-
 
|-
| 1
+
| 1
| DramId_EristaIcosaHynix4gb
+
| EristaIcosaHynix4gb
 
|-
 
|-
| 2
+
| 2
| DramId_EristaIcosaMicron4gb
+
| EristaIcosaMicron4gb
 
|-
 
|-
| 3
+
| 3
| Reserved
+
| Reserved
 
|-
 
|-
| 4
+
| 4
| DramId_EristaIcosaSamsung6gb
+
| EristaIcosaSamsung6gb
 
|-
 
|-
| 5
+
| 5
| [4.0.0+] Reserved
+
| [4.0.0+] Reserved
 
|-
 
|-
| 6
+
| 6
| [4.0.0+] Reserved
+
| [4.0.0+] Reserved
 
|-
 
|-
| 7
+
| 7
| [5.0.0+] DramId_MarikoIowax1x2Samsung4gb ([4.0.0-4.1.0] Reserved)
+
| [5.0.0+] MarikoIowax1x2Samsung4gb ([4.0.0-4.1.0] Reserved)
 
|-
 
|-
| 8
+
| 8
| [5.0.0+] DramId_MarikoIowaSamsung4gb
+
| [5.0.0+] MarikoIowaSamsung4gb
 
|-
 
|-
| 9
+
| 9
| [5.0.0+] DramId_MarikoIowaSamsung8gb
+
| [5.0.0+] MarikoIowaSamsung8gb
 
|-
 
|-
| 10
+
| 10
| [6.0.0+] DramId_MarikoIowaHynix4gb ([5.0.0-5.1.0] Reserved)
+
| [6.0.0+] MarikoIowaHynix4gb ([5.0.0-5.1.0] Reserved)
 
|-
 
|-
| 11
+
| 11
| [7.0.0+] DramId_MarikoIowaMicron4gb ([5.0.0-6.2.0] Reserved)
+
| [7.0.0+] MarikoIowaMicron4gb ([5.0.0-6.2.0] Reserved)
 
|-
 
|-
| 12
+
| 12
| [5.0.0+] DramId_MarikoHoagSamsung4gb
+
| [5.0.0+] MarikoHoagSamsung4gb
 
|-
 
|-
| 13
+
| 13
| [5.0.0+] DramId_MarikoHoagSamsung8gb
+
| [5.0.0+] MarikoHoagSamsung8gb
 
|-
 
|-
| 14
+
| 14
| [7.0.0+] DramId_MarikoHoagHynix4gb ([5.0.0-6.2.0] Reserved)
+
| [7.0.0+] MarikoHoagHynix4gb ([5.0.0-6.2.0] Reserved)
 
|-
 
|-
| 15
+
| 15
| [7.0.0+] DramId_MarikoHoagMicron4gb ([5.0.0-6.2.0] Reserved)
+
| [7.0.0+] MarikoHoagMicron4gb ([5.0.0-6.2.0] Reserved)
 
|-
 
|-
| 16
+
| 16
| [8.0.0+] DramId_MarikoIowaSamsung4gbY
+
| [8.0.0+] MarikoIowaSamsung4gbY
 
|-
 
|-
| 17
+
| 17
| [9.0.0+] DramId_MarikoIowaSamsung1y4gbX
+
| [9.0.0+] MarikoIowaSamsung1y4gbX
 
|-
 
|-
| 18
+
| 18
| [9.0.0+] DramId_MarikoIowaSamsung1y8gbX
+
| [9.0.0+] MarikoIowaSamsung1y8gbX
 
|-
 
|-
| 19
+
| 19
| [9.0.0+] DramId_MarikoHoagSamsung1y4gbX
+
| [9.0.0+] MarikoHoagSamsung1y4gbX
 
|-
 
|-
| 20
+
| 20
| [9.0.0+] DramId_MarikoIowaSamsung1y4gbY
+
| [9.0.0+] MarikoIowaSamsung1y4gbY
 
|-
 
|-
| 21
+
| 21
| [9.0.0+] DramId_MarikoIowaSamsung1y8gbY
+
| [9.0.0+] MarikoIowaSamsung1y8gbY
 
|-
 
|-
| 22
+
| 22
| [9.0.0+] DramId_MarikoIowaSamsung1y4gbA
+
| [9.0.0+] MarikoIowaSamsung1y4gbA
 
|}
 
|}
 +
 +
This is extracted directly from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]].
    
[[PCV_services|PCV]] selects memory training tables based on DramId.
 
[[PCV_services|PCV]] selects memory training tables based on DramId.
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! SoC
+
! SoC
! Platform
+
! Platform
! DramId
+
! DramId
! Revision
+
! Revision
! DVFS version
+
! DVFS version
 
|-
 
|-
| T210
+
| T210
| jetson-tx1
+
| jetson-tx1
| N/A
+
| N/A
| 0x07
+
| 0x07
 
|
 
|
 
  11_40800_01_V9.8.3_V1.6
 
  11_40800_01_V9.8.3_V1.6
Line 392: Line 345:  
  11_1600000_02_V9.8.3_V1.6
 
  11_1600000_02_V9.8.3_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abcb
+
| nx-abcb
| EristaIcosaSamsung4gb
+
| EristaIcosaSamsung4gb
| 0x07
+
| 0x07
 
|
 
|
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
Line 408: Line 361:  
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abcb
+
| nx-abcb
| EristaIcosaMicron4gb
+
| EristaIcosaMicron4gb
| 0x07
+
| 0x07
 
|
 
|
 
  10_40800_NoCfgVersion_V9.8.4_V1.6
 
  10_40800_NoCfgVersion_V9.8.4_V1.6
Line 424: Line 377:  
  10_1600000_NoCfgVersion_V9.8.4_V1.6
 
  10_1600000_NoCfgVersion_V9.8.4_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abcb
+
| nx-abcb
| EristaIcosaHynix4gb
+
| EristaIcosaHynix4gb
| 0x07
+
| 0x07
 
|
 
|
 
  10_40800_NoCfgVersion_V9.8.4_V1.6
 
  10_40800_NoCfgVersion_V9.8.4_V1.6
Line 440: Line 393:  
  10_1600000_NoCfgVersion_V9.8.4_V1.6
 
  10_1600000_NoCfgVersion_V9.8.4_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abca2
+
| nx-abca2
| EristaIcosaSamsung4gb, EristaIcosaMicron4gb
+
| EristaIcosaSamsung4gb, EristaIcosaMicron4gb
| 0x07
+
| 0x07
 
|  
 
|  
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
Line 456: Line 409:  
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abca2
+
| nx-abca2
| EristaIcosaHynix4gb
+
| EristaIcosaHynix4gb
| 0x07
+
| 0x07
 
|
 
|
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
Line 472: Line 425:  
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
|-
 
|-
| T210
+
| T210
| nx-abca2
+
| nx-abca2
| EristaIcosaSamsung6gb
+
| EristaIcosaSamsung6gb
| 0x07
+
| 0x07
 
|
 
|
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
 
  10_40800_NoCfgVersion_V9.8.7_V1.6
Line 488: Line 441:  
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
  10_1600000_NoCfgVersion_V9.8.7_V1.6
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| MarikoIowax1x2Samsung4gb
+
| MarikoIowax1x2Samsung4gb
| 0x03
+
| 0x03
 
|
 
|
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
Line 497: Line 450:  
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| MarikoIowaSamsung4gb, MarikoHoagSamsung4gb
+
| MarikoIowaSamsung4gb, MarikoHoagSamsung4gb
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
Line 506: Line 459:  
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| MarikoIowaSamsung8gb, MarikoHoagSamsung8gb
+
| MarikoIowaSamsung8gb, MarikoHoagSamsung8gb
| 0x03
+
| 0x03
 
|
 
|
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 515: Line 468:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| MarikoIowaHynix4gb, MarikoHoagHynix4gb
+
| MarikoIowaHynix4gb, MarikoHoagHynix4gb
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
 
  01_204000_NoCfgVersion_V0.3.1_V2.0
Line 524: Line 477:  
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
  01_1600000_NoCfgVersion_V0.3.1_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| MarikoIowaMicron4gb, MarikoHoagMicron4gb
+
| MarikoIowaMicron4gb, MarikoHoagMicron4gb
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 533: Line 486:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung4gbY
+
| MarikoIowaSamsung4gbY
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 542: Line 495:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung1y4gbX
+
| MarikoIowaSamsung1y4gbX
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 551: Line 504:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung1y8gbX
+
| MarikoIowaSamsung1y8gbX
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 560: Line 513:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoHoagSamsung1y4gbX
+
| MarikoHoagSamsung1y4gbX
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 569: Line 522:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung1y4gbY
+
| MarikoIowaSamsung1y4gbY
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 578: Line 531:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung1y8gbY
+
| MarikoIowaSamsung1y8gbY
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
 
  01_204000_NoCfgVersion_V0.4.2_V2.0
Line 587: Line 540:  
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
  01_1600000_NoCfgVersion_V0.4.2_V2.0
 
|-
 
|-
| T214
+
| T214
| nx-abca2, nx-abcb, nx-abcc
+
| nx-abca2, nx-abcb, nx-abcc
| DramId_MarikoIowaSamsung1y4gbA
+
| MarikoIowaSamsung1y4gbA
| 0x03
+
| 0x03
 
|   
 
|   
 
  01_204000_NoCfgVersion_V0.4.5_V2.0
 
  01_204000_NoCfgVersion_V0.4.5_V2.0
Line 605: Line 558:  
'''Erista''' memory is LPDDR4, while '''Mariko''' memory is LPDDR4X.
 
'''Erista''' memory is LPDDR4, while '''Mariko''' memory is LPDDR4X.
   −
==== SecurityEngineIrqNumber ====
+
===== SecurityEngineIrqNumber =====
 
SPL uses this for setting up the security engine IRQ.
 
SPL uses this for setting up the security engine IRQ.
   −
==== Version ====
+
===== Version =====
 
The current [[Package2#Versions|Package1 Maxver Constant]] - 1.
 
The current [[Package2#Versions|Package1 Maxver Constant]] - 1.
   −
==== HardwareType ====
+
===== HardwareType =====
 
[1.0.0+] This item is obtained by checking bits 8 and 2 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]]. It can be:
 
[1.0.0+] This item is obtained by checking bits 8 and 2 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]]. It can be:
 
* 0 ('''Icosa'''; Erista retail and EDEV), if development flag (bit 8) is '''Retail''' and production flag (bit 2) is '''Production'''.
 
* 0 ('''Icosa'''; Erista retail and EDEV), if development flag (bit 8) is '''Retail''' and production flag (bit 2) is '''Production'''.
Line 639: Line 592:  
It is still only 0 (Icosa) or 0xF (Invalid) in retail units.
 
It is still only 0 (Icosa) or 0xF (Invalid) in retail units.
   −
==== IsRetail ====
+
===== IsRetail =====
 
This item is obtained by checking bits 9 and 0-1 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]]. It can be 0 (Debug), 1 (Retail) or 2 (Invalid).
 
This item is obtained by checking bits 9 and 0-1 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]]. It can be 0 (Debug), 1 (Retail) or 2 (Invalid).
   −
==== IsRecoveryBoot ====
+
===== IsRecoveryBoot =====
 
Used to determine if the system is booting from SafeMode firmware.
 
Used to determine if the system is booting from SafeMode firmware.
    
Under normal circumstances, this just returns bit 0 of the active [[BCT#bootloader0_info|bootloader info]]'s attribute field.
 
Under normal circumstances, this just returns bit 0 of the active [[BCT#bootloader0_info|bootloader info]]'s attribute field.
   −
==== DeviceId ====
+
===== DeviceId =====
 
[[NIM_services|NIM]] checks if this item matches the [[Settings_services|set:cal]] DeviceId with byte7 cleared. If they don't match, a panic is thrown.
 
[[NIM_services|NIM]] checks if this item matches the [[Settings_services|set:cal]] DeviceId with byte7 cleared. If they don't match, a panic is thrown.
   −
==== BootReason ====
+
===== BootReason =====
Used to determine how the system booted.
  −
 
   
{| class=wikitable
 
{| class=wikitable
 
! Value || Description
 
! Value || Description
Line 667: Line 618:  
|}
 
|}
   −
==== MemoryArrange ====
+
Used to determine how the system booted.
[[Process Manager services|PM]] uses this item for selecting the appropriate size for each [[SVC#LimitableResource|LimitableResource_Memory]].
+
 
 +
===== MemoryMode =====
 +
{| class="wikitable" border="1"
 +
|-
 +
! Bits
 +
! Description
 +
|-
 +
| 0-3
 +
| Purpose (0 = None, 1 = ForStandard, 2 = ForAppletDev, 3 = ForSystemDev)
 +
|-
 +
| 4-7
 +
| Size (0 = 4GB, 1 = 6GB, 2 = 8GB)
 +
|}
 +
 
 +
[[Process Manager services|PM]] and the kernel decide memory arrangement based on MemoryMode.
 +
{| class="wikitable" border="1"
 +
|-
 +
! MemoryArrange
 +
! MemoryMode
 +
! Description
 +
|-
 +
| 0
 +
| 0x01
 +
| Standard
 +
|-
 +
| 1
 +
| 0x02
 +
| StandardForAppletDev
 +
|-
 +
| 2
 +
| 0x03
 +
| StandardForSystemDev
 +
|-
 +
| 3
 +
| 0x11
 +
| Expanded
 +
|-
 +
| 4
 +
| 0x12
 +
| ExpandedForAppletDev
 +
|-
 +
| 5
 +
| 0x21
 +
| ExpandedForMarikoDev
 +
|}
   −
==== IsDebugMode ====
+
===== IsDebugMode =====
 
Kernel uses this to determine behavior of svcBreak positive arguments. It will break instead of just force-exiting the process which is what happens on retail.
 
Kernel uses this to determine behavior of svcBreak positive arguments. It will break instead of just force-exiting the process which is what happens on retail.
   Line 679: Line 674:  
The value of this field is loaded from [[BootConfig]] unsigned-config+0x10 u8 bit1.
 
The value of this field is loaded from [[BootConfig]] unsigned-config+0x10 u8 bit1.
   −
==== KernelConfiguration ====
+
===== KernelConfiguration =====
 
Kernel reads this when setting up memory-related code.  
 
Kernel reads this when setting up memory-related code.  
   Line 694: Line 689:  
Bits 16-17 determine how much memory is available. 00/03 = 4 GB, 01 = 6 GB, 02 = 8 GB.
 
Bits 16-17 determine how much memory is available. 00/03 = 4 GB, 01 = 6 GB, 02 = 8 GB.
   −
==== IsChargerHiZModeEnabled ====
+
===== IsChargerHiZModeEnabled =====
 
This tells if the TI Charger (bq24192) is active.
 
This tells if the TI Charger (bq24192) is active.
   −
==== KeyGeneration ====
+
===== KeyGeneration =====
 
This item is obtained from [[Fuse_registers#FUSE_RESERVED_ODM2|FUSE_RESERVED_ODM2]] if bit 11 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]] is set, [[Fuse_registers#FUSE_RESERVED_ODM0|FUSE_RESERVED_ODM0]] matches 0x8E61ECAE and [[Fuse_registers#FUSE_RESERVED_ODM1|FUSE_RESERVED_ODM1]] matches 0xF2BA3BB2.
 
This item is obtained from [[Fuse_registers#FUSE_RESERVED_ODM2|FUSE_RESERVED_ODM2]] if bit 11 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]] is set, [[Fuse_registers#FUSE_RESERVED_ODM0|FUSE_RESERVED_ODM0]] matches 0x8E61ECAE and [[Fuse_registers#FUSE_RESERVED_ODM1|FUSE_RESERVED_ODM1]] matches 0xF2BA3BB2.
    
[5.0.0+] [[Filesystem services|FS]] can now use this value for the '''KeyGeneration''' parameter when calling [[#GenerateAesKek|GenerateAesKek]] during "GetBisEncryptionKey".
 
[5.0.0+] [[Filesystem services|FS]] can now use this value for the '''KeyGeneration''' parameter when calling [[#GenerateAesKek|GenerateAesKek]] during "GetBisEncryptionKey".
   −
==== IsKiosk ====
+
===== IsKiosk =====
 
This item is bit 10 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]].
 
This item is bit 10 from [[Fuse_registers#FUSE_RESERVED_ODM4|FUSE_RESERVED_ODM4]].
    
[4.0.0+] [[Settings_services|Settings]] uses this value to overwrite the quest flag from [[Settings_services#set:sys|GetQuestFlag]]. This is used to detect if a Switch is a kiosk unit for display at retail stores.
 
[4.0.0+] [[Settings_services|Settings]] uses this value to overwrite the quest flag from [[Settings_services#set:sys|GetQuestFlag]]. This is used to detect if a Switch is a kiosk unit for display at retail stores.
   −
==== RegulatorType ====
+
===== RegulatorType =====
This item is currently hardcoded to 0.
  −
 
  −
[5.0.0+] [[PCV_services|PCV]] uses this value in combination with [[#HardwareType|HardwareType]] to configure power blocks and memory tables for different hardware.
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Value
+
! Value
! SoC
+
! SoC
! GPU
+
! GPU
! Power Blocks
+
! Power Blocks
 
|-
 
|-
| 0
+
| 0
| T210
+
| T210
| GM20B (0x12B)
+
| GM20B (0x12B)
| max77620_sd0, max77621_cpu and max77621_gpu
+
| max77620_sd0, max77621_cpu and max77621_gpu
 
|-
 
|-
| 1
+
| 1
| T214
+
| T214
| GM20B_B (0x12E)
+
| GM20B_B (0x12E)
| max77620_sd0, max77812_cpu and max77812_gpu
+
| max77620_sd0, max77812_cpu and max77812_gpu
 
|-
 
|-
| 2
+
| 2
| T214
+
| T214
| GM20B_B (0x12E)
+
| GM20B_B (0x12E)
| max77620_sd0, max77812_cpu and max77812_gpu
+
| max77620_sd0, max77812_cpu and max77812_gpu
 
|}
 
|}
   −
==== Package2Hash ====
+
This item is currently hardcoded to 0.
 +
 
 +
[5.0.0+] [[PCV_services|PCV]] uses this value in combination with [[#HardwareType|HardwareType]] to configure power blocks and memory tables for different hardware.
 +
 
 +
===== Package2Hash =====
 
This is a SHA-256 hash calculated over the [[Package2|package2]] image. Since the hash calculation is an optional step in pkg2ldr, this item is only valid in recovery mode. Otherwise, an error is returned instead.
 
This is a SHA-256 hash calculated over the [[Package2|package2]] image. Since the hash calculation is an optional step in pkg2ldr, this item is only valid in recovery mode. Otherwise, an error is returned instead.
    
=== GenerateRandomBytes ===
 
=== GenerateRandomBytes ===
Takes a '''size''' and returns '''rand_bytes'''.
+
Takes an u64 '''RndSize'''. Returns [[#Result]] and '''RndData'''.
   −
The kernel limits '''size''' to 0x38 (for fitting in return registers).
+
The kernel limits '''RndSize''' to 0x38 (for fitting in return registers).
    
=== Panic ===
 
=== Panic ===
Issues a system panic.
+
Takes an u32 '''PanicColor''' and issues a system panic.
   −
The kernel always calls this with '''panic_color''' set to 0xF00.
+
The kernel always calls this with '''PanicColor''' set to 0xF00.
    
=== ConfigureCarveout ===
 
=== ConfigureCarveout ===
Configures memory controller carveout regions.
+
Takes an u64 '''CarveoutIdx''', an u64 '''CarveoutAddr''' and an u64 '''CarveoutSize'''. Returns [[#Result]].
   −
If '''carveout_index''' is 0, '''region_phys_addr''' and '''region_size''' are used to configure '''MC_SECURITY_CARVEOUT4'''.
+
If '''CarveoutIdx''' is 0, '''CarveoutAddr''' and '''CarveoutSize''' are used to configure '''MC_SECURITY_CARVEOUT4'''.
If '''carveout_index''' is 1, '''region_phys_addr''' and '''region_size''' are used to configure '''MC_SECURITY_CARVEOUT5'''.
+
If '''CarveoutIdx''' is 1, '''CarveoutAddr''' and '''CarveoutSize''' are used to configure '''MC_SECURITY_CARVEOUT5'''.
Any other '''carveout_index''' values are invalid.
+
Any other '''CarveoutIdx''' values are invalid.
   −
The kernel calls this with '''carveout_index''' set to 0, '''region_phys_addr''' set to 0x80060000 and '''region_size''' set to a dynamically calculated size which covers all the kernel and built-in sysmodules' DRAM regions.
+
The kernel calls this with '''CarveoutIdx''' set to 0, '''CarveoutAddr''' set to 0x80060000 and '''CarveoutSize''' set to a dynamically calculated size which covers all the kernel and built-in sysmodules' DRAM regions.
    
=== ReadWriteRegister ===
 
=== ReadWriteRegister ===
 +
Takes an u64 '''RegAddr''', an u32 '''RwMask''' and an u32 '''InValue'''. Returns [[#Result]] and an u32 '''OutValue'''.
 +
 
Relays [[SVC#svcReadWriteRegister|svcReadWriteRegister]] to the Secure Monitor.
 
Relays [[SVC#svcReadWriteRegister|svcReadWriteRegister]] to the Secure Monitor.
   −
= Errors =
+
= CryptoUsecase =
 +
{| class=wikitable
 +
! Value || Name
 +
|-
 +
| 0 || Aes
 +
|-
 +
| 1 || RsaPrivate
 +
|-
 +
| 2 || RsaSecureExpMod
 +
|-
 +
| 3 || TitleKey
 +
|}
 +
 
 +
TitleKey represents a RSA wrapped AES key.
 +
 
 +
= CipherMode =
 +
{| class=wikitable
 +
! Value || Name
 +
|-
 +
| 0 || CbcEncrypt
 +
|-
 +
| 1 || CbcDecrypt
 +
|-
 +
| 2 || Ctr
 +
|}
 +
 
 +
= DecryptOrImportMode =
 +
{| class=wikitable
 +
! Value || Name
 +
|-
 +
| 0 || DecryptRsaPrivateKey
 +
|-
 +
| 1 || ImportLotusKey
 +
|-
 +
| 2 || ImportEsKey
 +
|-
 +
| 3 || ImportSslKey
 +
|-
 +
| 4 || ImportDrmKey
 +
|}
 +
 
 +
= SecureExpModMode =
 +
{| class=wikitable
 +
! Value || Name
 +
|-
 +
| 0 || Lotus
 +
|-
 +
| 1 || Ssl
 +
|-
 +
| 2 || Drm
 +
|}
 +
 
 +
= Result =
 
{| class=wikitable
 
{| class=wikitable
 
! Value || Description
 
! Value || Description
Line 775: Line 825:  
| 5 || Invalid async operation
 
| 5 || Invalid async operation
 
|-
 
|-
| [8.0.0+] 6 || Blacklisted
+
| [8.0.0+] 6 || Not permitted
 
|}
 
|}

Navigation menu