LCOV - code coverage report
Current view: top level - core/test - run-flash-subpartition.c (source / functions) Hit Total Coverage
Test: skiboot.info Lines: 14 14 100.0 %
Date: 2024-01-02 21:04:04 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
       2                 :            : /*
       3                 :            :  * Copyright 2013-2016 IBM Corp.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include <skiboot.h>
       7                 :            : #include <opal-api.h>
       8                 :            : #include <stdlib.h>
       9                 :            : 
      10                 :            : #include "../flash-subpartition.c"
      11                 :            : #include <assert.h>
      12                 :            : 
      13                 :            : /* This is a straight dump of the CAPP ucode partition header */
      14                 :            : char capp[4096] = {0x43, 0x41, 0x50, 0x50, 0x00, 0x00, 0x00, 0x01,
      15                 :            :                    0x00, 0x01, 0x00, 0xea, 0x00, 0x00, 0x10, 0x00,
      16                 :            :                    0x00, 0x00, 0x8e, 0x50, 0x00, 0x02, 0x00, 0xea,
      17                 :            :                    0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8e, 0x50,
      18                 :            :                    0x00, 0x02, 0x00, 0xef, 0x00, 0x00, 0x10, 0x00,
      19                 :            :                    0x00, 0x00, 0x8e, 0x50, 0x00, 0x02, 0x01, 0xef,
      20                 :            :                    0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8e, 0x50,
      21                 :            :                    0x00, 0x01, 0x00, 0xd3, 0x00, 0x00, 0x10, 0x00,
      22                 :            :                    0x00, 0x00, 0x8e, 0x50, 0x00, 0x00, 0x00, 0x00 };
      23                 :            : 
      24                 :          1 : int main(void)
      25                 :            : {
      26                 :            :         int rc;
      27                 :            :         uint32_t part_actual;
      28                 :            :         uint32_t offset;
      29                 :            :         uint32_t size;
      30                 :          1 :         uint32_t subids[] = { 0x100ea, 0x200ea, 0x200ef, 0x201ef, 0x100d3 };
      31                 :            : 
      32                 :          6 :         for (int i = 0; i < sizeof(subids)/sizeof(uint32_t); i++) {
      33                 :          5 :                 offset = 0;
      34                 :          5 :                 rc = flash_subpart_info(capp, sizeof(capp), 0x24000,
      35                 :            :                                         &part_actual, subids[i],
      36                 :            :                                         &offset, &size);
      37                 :          5 :                 printf("\nsubid %x\n", subids[i]);
      38                 :          5 :                 printf("part_actual %u\n", part_actual);
      39                 :          5 :                 printf("offset %u\n", offset);
      40                 :          5 :                 printf("size %u\n", size);
      41                 :          5 :                 assert (rc == 0);
      42                 :          5 :                 assert (size == 36432);
      43                 :          5 :                 assert (offset == 4096);
      44                 :          5 :                 assert (part_actual == 40960);
      45                 :            :         }
      46                 :            : 
      47                 :          1 :         return 0;
      48                 :            : }

Generated by: LCOV version 1.14