Cache the result from fdtbus_get_data() in fdt_memory_remove_reserved
NFCI.
This commit is contained in:
parent
1377ad26ec
commit
13ecc471ce
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $ */
|
||||
/* $NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -32,7 +32,7 @@
|
|||
#include "opt_fdt.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
|
@ -110,15 +110,16 @@ fdt_memory_remove_reserved(uint64_t min_addr, uint64_t max_addr)
|
|||
{
|
||||
uint64_t lstart = 0, lend = 0;
|
||||
int index, error, phandle, child;
|
||||
const void *fdt_data = fdtbus_get_data();
|
||||
const int num = fdt_num_mem_rsv(fdt_data);
|
||||
|
||||
const int num = fdt_num_mem_rsv(fdtbus_get_data());
|
||||
for (index = 0; index <= num; index++) {
|
||||
uint64_t addr, size;
|
||||
|
||||
error = fdt_get_mem_rsv(fdtbus_get_data(), index,
|
||||
&addr, &size);
|
||||
error = fdt_get_mem_rsv(fdt_data, index, &addr, &size);
|
||||
if (error != 0)
|
||||
continue;
|
||||
|
||||
if (lstart <= addr && addr <= lend) {
|
||||
size -= (lend - addr);
|
||||
addr = lend;
|
||||
|
|
Loading…
Reference in New Issue