* @v max_len Maximum device tree length
* @ret rc Return status code
*/
-int fdt_parse ( struct fdt *fdt, const struct fdt_header *hdr,
- size_t max_len ) {
+int fdt_parse ( struct fdt *fdt, struct fdt_header *hdr, size_t max_len ) {
const uint8_t *end;
/* Sanity check */
/** Tree data */
union {
/** Tree header */
- const struct fdt_header *hdr;
+ struct fdt_header *hdr;
/** Raw data */
- const void *raw;
+ void *raw;
};
/** Length of tree */
size_t len;
uint64_t *value );
extern int fdt_mac ( struct fdt *fdt, unsigned int offset,
struct net_device *netdev );
-extern int fdt_parse ( struct fdt *fdt, const struct fdt_header *hdr,
+extern int fdt_parse ( struct fdt *fdt, struct fdt_header *hdr,
size_t max_len );
#endif /* _IPXE_FDT_H */
*
*/
static void efi_fdt_init ( void ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ EFI_STATUS efirc;
int rc;
/* Do nothing if no configuration table is present */
strerror ( rc ) );
return;
}
+
+ /* Create copy, since table may be removed at any time */
+ if ( ( efirc = bs->AllocatePool ( EfiBootServicesData, sysfdt.len,
+ &sysfdt.raw ) ) != 0 ) {
+ DBGC ( &efi_fdt, "EFIFDT could not create copy\n" );
+ sysfdt.len = 0;
+ return;
+ }
+ memcpy ( sysfdt.raw, efi_fdt, sysfdt.len );
}
/** EFI Flattened Device Tree initialisation function */