Simon Glass | 77459f4 | 2024-08-07 16:47:27 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * UPL handoff command functions |
| 4 | * |
| 5 | * Copyright 2024 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | */ |
| 8 | |
| 9 | #define LOG_CATEGORY UCLASS_BOOTSTD |
| 10 | |
| 11 | #include <string.h> |
| 12 | #include <upl.h> |
| 13 | |
| 14 | /* Names of bootmodes */ |
| 15 | const char *const bootmode_names[UPLBM_COUNT] = { |
| 16 | [UPLBM_FULL] = "full", |
| 17 | [UPLBM_MINIMAL] = "minimal", |
| 18 | [UPLBM_FAST] = "fast", |
| 19 | [UPLBM_DIAG] = "diag", |
| 20 | [UPLBM_DEFAULT] = "default", |
| 21 | [UPLBM_S2] = "s2", |
| 22 | [UPLBM_S3] = "s3", |
| 23 | [UPLBM_S4] = "s4", |
| 24 | [UPLBM_S5] = "s5", |
| 25 | [UPLBM_FACTORY] = "factory", |
| 26 | [UPLBM_FLASH] = "flash", |
| 27 | [UPLBM_RECOVERY] = "recovery", |
| 28 | }; |
| 29 | |
| 30 | /* Names of memory usages */ |
| 31 | const char *const usage_names[UPLUS_COUNT] = { |
| 32 | [UPLUS_ACPI_RECLAIM] = "acpi-reclaim", |
| 33 | [UPLUS_ACPI_NVS] = "acpi-nvs", |
| 34 | [UPLUS_BOOT_CODE] = "boot-code", |
| 35 | [UPLUS_BOOT_DATA] = "boot-data", |
| 36 | [UPLUS_RUNTIME_CODE] = "runtime-code", |
| 37 | [UPLUS_RUNTIME_DATA] = "runtime-data", |
| 38 | }; |
| 39 | |
| 40 | /* Names of access types */ |
| 41 | const char *const access_types[UPLUS_COUNT] = { |
| 42 | [UPLAT_MMIO] = "mmio", |
| 43 | [UPLAT_IO] = "io", |
| 44 | }; |
| 45 | |
| 46 | /* Names of graphics formats */ |
| 47 | const char *const graphics_formats[UPLUS_COUNT] = { |
| 48 | [UPLGF_ARGB32] = "a8r8g8b8", |
| 49 | [UPLGF_ABGR32] = "a8b8g8r8", |
| 50 | [UPLGF_ABGR64] = "a16b16g16r16", |
| 51 | }; |
| 52 | |
| 53 | void upl_init(struct upl *upl) |
| 54 | { |
| 55 | memset(upl, '\0', sizeof(struct upl)); |
| 56 | alist_init_struct(&upl->image, struct upl_image); |
| 57 | alist_init_struct(&upl->mem, struct upl_mem); |
| 58 | alist_init_struct(&upl->memmap, struct upl_memmap); |
| 59 | alist_init_struct(&upl->memres, struct upl_memres); |
| 60 | } |