<?xml version="1.0" encoding="UTF-8"?>
<!--
===============================================================================

  Copyright (c) 2013-2017 Qualcomm Technologies, Inc.
  All Rights Reserved.
  Confidential and Proprietary - Qualcomm Technologies, Inc.

===============================================================================
-->

<tns:parsegen xmlns:tns="http://www.qualcomm.com/parsegen"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.qualcomm.com/parsegen ./parsegen.xsd">

    <!--
        Contains a list of 'image_type' blocks that associate an id to an
        image configuration. These blocks contain the information needed to
        correctly parse the corresponding file type.
    -->
    <image_types_list>

        <!--
            This block contains configuration for an elf file containing a
            hash table and a License Manager NOTE segment.
        -->
        <image_type id='elf_has_ht_licmngr'>
            <file_type>elf</file_type>
            <elf_properties>
                <has_hash_table>true</has_hash_table>
                <has_license_manager_segment>true</has_license_manager_segment>
                <image_type>0</image_type>
            </elf_properties>
        </image_type>

        <!--
            This block contains configuration for a bin file.
        -->
        <image_type id='bin'>
            <file_type>bin</file_type>
        </image_type>

        <!--
            This block contains configuration for a hash file.
        -->
        <image_type id='hash_to_sign'>
            <file_type>hash_to_sign</file_type>
        </image_type>

        <!--
            This block contains configuration for a bin file.
        -->
        <image_type id='cass_bin'>
            <file_type>bin_to_sign</file_type>
        </image_type>

        <!--
            This block contains configuration for a mbn file with a 40 byte
            header and no preamble.
        -->
        <image_type id='mbn_40b'>
            <file_type>mbn</file_type>
            <mbn_properties>
                <header_size>40</header_size>
            </mbn_properties>
        </image_type>

        <!--
            This block contains configuration for a mbn file with a 40 byte
            header and no preamble.
        -->
        <image_type id='mbn_40b_bin'>
            <file_type>mbn_bin</file_type>
            <mbn_properties>
                <header_size>40</header_size>
            </mbn_properties>
        </image_type>

        <!--
            Contains the config data needed to correctly parse an image.
            This block contains configuration for a mbn file with a 80 byte
            header and no preamble.

            id: ID for this particular block. This id should be unique.
        -->
        <image_type id='mbn_80b'>
            <!-- Type of file format -->
            <file_type>mbn</file_type>

            <!--
                Configuration specific to the mbn format

                header_size: Size of the mbn header (in bytes).
            -->
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
        </image_type>

        <!--
            Contains the config data needed to correctly parse an image.
            This block contains configuration for a mbn file with a 80 byte
            header and no preamble.

            id: ID for this particular block. This id should be unique.
        -->
        <image_type id='mbn_80b_bin'>
            <!-- Type of file format -->
            <file_type>mbn_bin</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
        </image_type>

        <!--
            This block contains configuration for a mbn file with a 80 byte
            header, 10k preamble, magic number and ota enabled.
        -->
        <image_type id='mbn_80b_pbl_ota'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>false</ota_enabled>
                <page_size>0</page_size>
                <num_of_pages>0</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <!--
            This block contains configuration for an elf file
        -->
        <image_type id='elf'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
            </elf_properties>
        </image_type>

        <image_type id='elf_vir_addr'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <validate_ph_addrs>false</validate_ph_addrs>
                <validate_vir_addrs>true</validate_vir_addrs>
            </elf_properties>
        </image_type>

        <image_type id='elf_ph_addr'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <validate_ph_addrs>true</validate_ph_addrs>
                <validate_vir_addrs>false</validate_vir_addrs>
            </elf_properties>
        </image_type>

        <image_type id='elf_both_addr'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <validate_ph_addrs>true</validate_ph_addrs>
                <validate_vir_addrs>true</validate_vir_addrs>
            </elf_properties>
        </image_type>

        <image_type id='elf_neither_addr'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <validate_ph_addrs>false</validate_ph_addrs>
                <validate_vir_addrs>false</validate_vir_addrs>
            </elf_properties>
        </image_type>

        <!-- Places the hash segment right after the elf header.
        Places the LOAD segment at the 4k aligned offset from the hash segment offset.

        Eg: NULL 0x0000
            NULL 0x0158
            LOAD 0x2158
        -->
        <image_type id='elf_post_phdr'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <hash_seg_placement>POST_PHDR</hash_seg_placement>
            </elf_properties>
        </image_type>

        <!-- Places the hash segment right after the elf header.
        Places the next LOAD segment at the next 4k aligned offset.

        Eg: NULL 0x0000
            NULL 0x0158
            LOAD 0x3000
        -->
        <image_type id='elf_post_phdr_load_aligned'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <hash_seg_placement>POST_PHDR_LOAD_ALIGNED</hash_seg_placement>
            </elf_properties>
        </image_type>

        <!-- Places the hash segment at the 4k aligned offset after the elf header.
        Places the LOAD segment at the 4k aligned offset from the hash segment offset.

        Eg: NULL 0x0000
            NULL 0x1000
            LOAD 0x3000
        -->
        <image_type id='elf_post_phdr_aligned'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <hash_seg_placement>POST_PHDR_ALIGNED</hash_seg_placement>
            </elf_properties>
        </image_type>

        <!-- Places the hash segment at the end of the file at a 64 byte alignment.
        See spec for details.
        -->
        <image_type id='elf_end_64b_aligned'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <hash_seg_placement>END_64B_ALIGNED</hash_seg_placement>
            </elf_properties>
        </image_type>

        <!-- Places the hash segment at the end of the file at a 128 byte alignment.
        See spec for details.
        -->
        <image_type id='elf_end_128b_aligned'>
            <file_type>elf</file_type>
            <elf_properties>
                <image_type>0</image_type>
                <hash_seg_placement>END_128B_ALIGNED</hash_seg_placement>
            </elf_properties>
        </image_type>

        <!--
            This block contains configuration for an elf file not containing
            any hash table.
        -->
        <image_type id='elf_no_ht'>
            <file_type>elf</file_type>
            <elf_properties>
                <has_hash_table>false</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>
        </image_type>

        <!--
            This block contains configuration for an elf file containing a
            hash table.
        -->
        <image_type id='elf_has_ht'>
            <!-- Type of file format -->
            <file_type>elf</file_type>

            <!--
                Configuration specific to the elf format

                has_hash_table: Flag whether the elf contains a hash table.
                image_type: ID for the image type.
                serial_num (optional): Serial number to be inserted in the
                    elf image. If the elf should not embed the serial
                    number, skip this value.
            -->
            <elf_properties>
                <has_hash_table>true</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>
        </image_type>

        <!--
            This block contains configuration for an elf file containing a
            hash table.
        -->
        <image_type id='elf_as_bin'>
            <!-- Type of file format -->
            <file_type>elf_bin</file_type>

            <!--
                Configuration specific to the elf format

                has_hash_table: Flag whether the elf contains a hash table.
                image_type: ID for the image type.
                serial_num (optional): Serial number to be inserted in the
                    elf image. If the elf should not embed the serial
                    number, skip this value.
            -->
            <elf_properties>
                <has_hash_table>true</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>
        </image_type>

        <image_type id='elf_preamble'>
            <!-- Type of file format -->
            <file_type>elf_pmbl</file_type>

            <elf_properties>
                   <has_hash_table>true</has_hash_table>
                   <image_type>0</image_type>
            </elf_properties>

            <pmbl_properties>
                   <preamble_size>10</preamble_size>
                   <has_magic_num>true</has_magic_num>
                   <ota_enabled>false</ota_enabled>
                   <page_size>0</page_size>
                   <num_of_pages>0</num_of_pages>
                   <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='elf_preamble_end_128b_aligned'>
            <!-- Type of file format -->
            <file_type>elf_pmbl</file_type>

            <elf_properties>
                <has_hash_table>true</has_hash_table>
                <image_type>0</image_type>
                <hash_seg_placement>END_128B_ALIGNED</hash_seg_placement>
            </elf_properties>

            <pmbl_properties>
                   <preamble_size>10</preamble_size>
                   <has_magic_num>true</has_magic_num>
                   <ota_enabled>false</ota_enabled>
                   <page_size>0</page_size>
                   <num_of_pages>0</num_of_pages>
                   <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <!--
            This block contains configuration for an elf wrapped mbn (ewm).
        -->
        <image_type id='elf_wrapped_mbn'>
            <!-- Type of file format -->
            <file_type>ewm</file_type>

            <!--
            Configuration specific to the ewm format

            image_entry: Entry for the image.
            relocatable: Allows PIL to relocate the segment in the heap instead
                of loading the segment at the compiled-in physical address.
            header_size: Size of the mbn header (in bytes).
            -->
            <ewm_properties>
                <image_entry>0x0D100000</image_entry>
                <relocatable>true</relocatable>
            </ewm_properties>

            <elf_properties>
                <has_hash_table>false</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>

            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
        </image_type>

        <!--
            This block contains configuration for an elf wrapped mbn (ewm).
        -->
        <image_type id='double_signing'>
            <!-- Type of file format -->
            <file_type>ds_ewm</file_type>

            <!--
            Configuration specific to the ewm format

            image_entry: Entry for the image.
            relocatable: Allows PIL to relocate the segment in the heap instead
                of loading the segment at the compiled-in physical address.
            header_size: Size of the mbn header (in bytes).
            -->
            <ewm_properties>
                <image_entry>0x0D100000</image_entry>
                <relocatable>true</relocatable>
            </ewm_properties>

            <elf_properties>
                <has_hash_table>false</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>

            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
        </image_type>

        <!--
            This block contains configuration for an elf wrapped mbn (ewm).
        -->
        <image_type id='elf_wrapped_mbn_9x35'>
            <!-- Type of file format -->
            <file_type>ewm</file_type>

            <!--
            Configuration specific to the ewm format

            image_entry: Entry for the image.
            relocatable: Allows PIL to relocate the segment in the heap instead
                of loading the segment at the compiled-in physical address.
            header_size: Size of the mbn header (in bytes).
            -->
            <ewm_properties>
                <image_entry>0x01200000</image_entry>
                <relocatable>false</relocatable>
            </ewm_properties>

            <elf_properties>
                <has_hash_table>false</has_hash_table>
                <image_type>0</image_type>
            </elf_properties>

            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
        </image_type>

        <!--
            This block contains configuration for a mbn file with a 80 byte
            header, 10k preamble, magic number and ota enabled.
        -->
        <image_type id='sbl1_ota_disabled'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>false</ota_enabled>
                <page_size>0</page_size>
                <num_of_pages>0</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='sbl1_ota_min_256'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>0</page_size>
                <num_of_pages>0</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='sbl1_ota_min_512'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>0</page_size>
                <num_of_pages>0</num_of_pages>
                <min_size_with_pad>512</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='sbl1_ota_2k_128_256'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>2</page_size>
                <num_of_pages>128</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='sbl1_ota_4k_64_256'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>4</page_size>
                <num_of_pages>64</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>


        <image_type id='sbl1_ota_4k_128_256'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>4</page_size>
                <num_of_pages>128</num_of_pages>
                <min_size_with_pad>256</min_size_with_pad>
            </pmbl_properties>
        </image_type>

        <image_type id='sbl1_ota_4k_64_512'>
            <file_type>mbn_pmbl</file_type>
            <mbn_properties>
                <header_size>80</header_size>
            </mbn_properties>
            <pmbl_properties>
                <preamble_size>10</preamble_size>
                <has_magic_num>true</has_magic_num>
                <ota_enabled>true</ota_enabled>
                <page_size>4</page_size>
                <num_of_pages>64</num_of_pages>
                <min_size_with_pad>512</min_size_with_pad>
            </pmbl_properties>
        </image_type>

    </image_types_list>

</tns:parsegen>
