diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/skiboot/core/test/run-flash-subpartition.c | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/skiboot/core/test/run-flash-subpartition.c')
-rw-r--r-- | roms/skiboot/core/test/run-flash-subpartition.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/roms/skiboot/core/test/run-flash-subpartition.c b/roms/skiboot/core/test/run-flash-subpartition.c new file mode 100644 index 000000000..5b6df87f2 --- /dev/null +++ b/roms/skiboot/core/test/run-flash-subpartition.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +/* + * Copyright 2013-2016 IBM Corp. + */ + +#include <skiboot.h> +#include <opal-api.h> +#include <stdlib.h> + +#include "../flash-subpartition.c" +#include <assert.h> + +/* This is a straight dump of the CAPP ucode partition header */ +char capp[4096] = {0x43, 0x41, 0x50, 0x50, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x01, 0x00, 0xea, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x8e, 0x50, 0x00, 0x02, 0x00, 0xea, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8e, 0x50, + 0x00, 0x02, 0x00, 0xef, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x8e, 0x50, 0x00, 0x02, 0x01, 0xef, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8e, 0x50, + 0x00, 0x01, 0x00, 0xd3, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x8e, 0x50, 0x00, 0x00, 0x00, 0x00 }; + +int main(void) +{ + int rc; + uint32_t part_actual; + uint32_t offset; + uint32_t size; + uint32_t subids[] = { 0x100ea, 0x200ea, 0x200ef, 0x201ef, 0x100d3 }; + + for (int i = 0; i < sizeof(subids)/sizeof(uint32_t); i++) { + offset = 0; + rc = flash_subpart_info(capp, sizeof(capp), 0x24000, + &part_actual, subids[i], + &offset, &size); + printf("\nsubid %x\n", subids[i]); + printf("part_actual %u\n", part_actual); + printf("offset %u\n", offset); + printf("size %u\n", size); + assert (rc == 0); + assert (size == 36432); + assert (offset == 4096); + assert (part_actual == 40960); + } + + return 0; +} |