plat_drtm.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLAT_DRTM_H
  7. #define PLAT_DRTM_H
  8. #include <stdint.h>
  9. #include <lib/xlat_tables/xlat_tables_compat.h>
  10. typedef struct {
  11. uint8_t max_num_mem_prot_regions;
  12. uint8_t dma_protection_support;
  13. } plat_drtm_dma_prot_features_t;
  14. typedef struct {
  15. bool tpm_based_hash_support;
  16. uint16_t firmware_hash_algorithm;
  17. } plat_drtm_tpm_features_t;
  18. typedef struct {
  19. uint64_t region_address;
  20. uint64_t region_size_type;
  21. } __attribute__((packed)) drtm_mem_region_t;
  22. /*
  23. * Memory region descriptor table structure as per DRTM 1.0 section 3.13
  24. * Table 11 MEMORY_REGION_DESCRIPTOR_TABLE
  25. */
  26. typedef struct {
  27. uint16_t revision;
  28. uint16_t reserved;
  29. uint32_t num_regions;
  30. drtm_mem_region_t region[];
  31. } __attribute__((packed)) drtm_memory_region_descriptor_table_t;
  32. /* platform specific address map functions */
  33. const mmap_region_t *plat_get_addr_mmap(void);
  34. /* platform-specific DMA protection functions */
  35. bool plat_has_non_host_platforms(void);
  36. bool plat_has_unmanaged_dma_peripherals(void);
  37. unsigned int plat_get_total_smmus(void);
  38. void plat_enumerate_smmus(const uintptr_t **smmus_out,
  39. size_t *smmu_count_out);
  40. const plat_drtm_dma_prot_features_t *plat_drtm_get_dma_prot_features(void);
  41. uint64_t plat_drtm_dma_prot_get_max_table_bytes(void);
  42. /* platform-specific TPM functions */
  43. const plat_drtm_tpm_features_t *plat_drtm_get_tpm_features(void);
  44. /*
  45. * TODO: Implement these functions as per the platform use case,
  46. * as of now none of the platform uses these functions
  47. */
  48. uint64_t plat_drtm_get_min_size_normal_world_dce(void);
  49. uint64_t plat_drtm_get_tcb_hash_table_size(void);
  50. uint64_t plat_drtm_get_imp_def_dlme_region_size(void);
  51. uint64_t plat_drtm_get_tcb_hash_features(void);
  52. /* DRTM error handling functions */
  53. int plat_set_drtm_error(uint64_t error_code);
  54. int plat_get_drtm_error(uint64_t *error_code);
  55. /*
  56. * Platform-specific function to ensure passed region lies within
  57. * Non-Secure region of DRAM
  58. */
  59. int plat_drtm_validate_ns_region(uintptr_t region_start,
  60. size_t region_size);
  61. #endif /* PLAT_DRTM_H */