.. _SD.Bootloader.SdramConfig:

.. include:: /content/swdocs.rsts

.. spelling::
   cfg
   mem
   MC
   EMC
   SDRAM
   sdram
   McVideoProtectBom
   DTS
   dts
   GSC
   McVideoProtectBomHi
   McVideoProtectSizeMb
   BCT
   NVDEC
   WPR1
   WPR2
   TSECA
   TSECB
   BPMP
   APE
   SCE
   SPE
   APR
   TZRAM
   IPC_SE_TSEC
   RCE
   DMCE
   SE
   SC7
   CPUTZ
   VM
   ENCRYPT1
   NS 
   IPC
   CV
   ENCRYPT2
   SMMU
   PFSD
   MSS


SDRAM Configuration
!!!!!!!!!!!!!!!!!!!

Here is the DTS format for the SDRAM configuration:

.. code-block:: none

   /{
     sdram {
       mem_cfg_<N>: mem-cfg@<N> {
         <parameter> = <value>;
       };
     };
  };

  &mem_cfg_<N> {
    #include "\<mem_override_dts\>"
  };

where

  - ``<N>`` is number starting from 0 representing different memory configurations
  - ``<parameter>`` is the SDRAM parameter. Usually, this corresponds to the MC/EMC register.
  - ``<value>`` is the 32-bit value of the corresponding register.
  - ``<mem_override_dts>`` is override file for SDRAM parameters which will be applied to all the configurations.
  
The format of the override dts will be:

  .. code-block:: none
  
     <parameter> = <value>; // example McVideoProtectBom = <0x00000000>;
	 
The Memory/MSS HW team will use a tool provided by SW to convert the legacy configuration format to the new DTS format.

Carveouts
#########

The following types of hardware carveouts:

- GSC carveouts
- Non-GSC carveouts

The following table lists the important carveout fields in BCT cfg.

.. list-table::
     :widths: auto
     :header-rows: 1

     * - Field
       - Description
     * - McGeneralizedCarveout<N>Bom GeneralizedCarveout<N>BomHi (where N is the GSC#)
       - Preferred base address of the GSC carveout. The recommended value is 0, and this field allows MB1 to allocate on its own.
     * - McGeneralizedCarveout<N>Size128kb, where N is the GSC#.
       - Here are the values:
          - 31:27: Size of the generalized security carveout region with 4kb granularity.
          - 11:0: Size of the generalized security carveout region with 128kb granularity size = (MC_SECURITY_CARVEOUT1_SIZE_RAN←GE_128KB << 17) | (MC_SECURITY_CARVEOUT1_SIZE_RANGE_4KB << 12).
     * - McGeneralizedCarveout<N>Access[0-5], where N is the GSC#.
       - Client Access Register for Generalized Carveout. For the bit description details refer to TRM.
     * - McVideoProtectBom and McVideoProtectBomHi
       - Preferred base address of VPR carveout. The recommended value is 0, and this field allows MB1 to allocate on its own.
     * - McVideoProtectSizeMb
       - Specifies VPR carveout size (in MB). Refer to ``enable_vpr_resize`` in :ref:`Miscellaneous Configuration<SD.Bootloader.MiscConfig>` for more information.
	   
GSC Carveouts
#############

The following list gives a mapping between Carveout names and its corresponding GSC numbers:

.. list-table::
     :widths: auto
     :header-rows: 1

     * - Carveout #
       - Carveout Name
     * - 1
       - NVDEC
     * - 2
       - WPR1
     * - 3
       - WPR2
     * - 4
       - TSECA
     * - 5
       - TSECB
     * - 6
       - BPMP
     * - 7
       - APE
     * - 8
       - SPE
     * - 9
       - SCE
     * - 10
       - APR
     * - 11
       - TZRAM
     * - 12
       - IPC_SE_TSEC
     * - 13
       - BPMP_RCE
     * - 14
       - BPMP_DMCE
     * - 15
       - SE_SC7
     * - 16
       - BPMP_SPE
     * - 17
       - RCE
     * - 18
       - CPUTZ_BPMP
     * - 19
       - VM_ENCRYPT1
     * - 20
       - CPU_NS_BPMP
     * - 21
       - OEM_SC7
     * - 22
       - IPC_SE_SPE_SCE_BPMP
     * - 23
       - SC7_RF
     * - 24
       - CAMERA_TASK
     * - 25
       - SCE_BPMP
     * - 26
       - CV
     * - 27
       - VM_ENCRYPT2
     * - 28
       - HYPERVISOR
     * - 29
       - SMMU
     * - 30
       - PFSD
     * - 31
       - Unused
	   
Non-GSC Carveouts
#################
	   
.. list-table::
     :widths: auto
     :header-rows: 1

     * - 32
       - MTS
     * - 33
       - VPR