Skip to content

Commit

Permalink
kboot/isp: Pass ctrr_size to FDT
Browse files Browse the repository at this point in the history
Still needed to fill out the fw bootargs.

Signed-off-by: Eileen Yoon <[email protected]>
  • Loading branch information
eiln committed Sep 10, 2023
1 parent 4511899 commit b5c2fcb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/isp.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ static void isp_ctrr_init_t6000(u64 base, const struct dart_tunables *config, u3
static bool isp_initialized = false;
static u64 heap_phys, heap_iova, heap_size, heap_top;

int isp_get_heap(u64 *phys, u64 *iova, u64 *size)
int isp_get_heap(u64 *phys, u64 *iova, u64 *size, u64 *top)
{
if (!isp_initialized)
return -1;

*phys = heap_phys;
*iova = heap_iova;
*size = heap_size;
*top = heap_top;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#include "types.h"

int isp_init(void);
int isp_get_heap(u64 *phys, u64 *iova, u64 *size);
int isp_get_heap(u64 *phys, u64 *iova, u64 *size, u64 *top);

#endif
10 changes: 8 additions & 2 deletions src/kboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,15 +1795,15 @@ static int dt_set_isp_fwdata(void)
const char *fdt_path = "isp";
int ret = 0;

u64 phys, iova, size;
u64 phys, iova, size, top;

int fdt_node = fdt_path_offset(dt, fdt_path);
if (fdt_node < 0) {
printf("FDT: '%s' not found\n", fdt_path);
return 0;
}

if (isp_get_heap(&phys, &iova, &size)) {
if (isp_get_heap(&phys, &iova, &size, &top)) {
const char *status = fdt_getprop(dt, fdt_node, "status", NULL);

if (!status || strcmp(status, "disabled")) {
Expand Down Expand Up @@ -1843,6 +1843,12 @@ static int dt_set_isp_fwdata(void)
if (ret < 0)
bail("FDT: couldn't add 'isp-heap' reserved mem: %d\n", ret);

fdt_node = fdt_path_offset(dt, fdt_path);
if (fdt_node < 0)
return fdt_node;
if (fdt_appendprop_u64(dt, fdt_node, "apple,isp-ctrr-size", top))
bail("FDT: couldn't append to 'apple,isp-ctrr-size'\n");

return 0;
}

Expand Down

0 comments on commit b5c2fcb

Please sign in to comment.