mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Added some minor error checking to gpt.c.
This commit is contained in:
parent
ab00ea5a5c
commit
a8b9e7776b
@ -38,9 +38,26 @@ int gpt_load_partitions() {
|
|||||||
partition_entries_t *opensbi = (partition_entries_t *)(lba2_buf + 128);
|
partition_entries_t *opensbi = (partition_entries_t *)(lba2_buf + 128);
|
||||||
partition_entries_t *kernel = (partition_entries_t *)(lba2_buf + 256);
|
partition_entries_t *kernel = (partition_entries_t *)(lba2_buf + 256);
|
||||||
|
|
||||||
|
// Load device tree
|
||||||
ret = disk_read((BYTE *)FDT_ADDRESS, fdt->first_lba, fdt->last_lba - fdt->first_lba + 1);
|
ret = disk_read((BYTE *)FDT_ADDRESS, fdt->first_lba, fdt->last_lba - fdt->first_lba + 1);
|
||||||
|
if (ret < 0) {
|
||||||
|
print_uart("Failed to load device tree!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load OpenSBI
|
||||||
ret = disk_read((BYTE *)OPENSBI_ADDRESS, opensbi->first_lba, opensbi->last_lba - opensbi->first_lba + 1);
|
ret = disk_read((BYTE *)OPENSBI_ADDRESS, opensbi->first_lba, opensbi->last_lba - opensbi->first_lba + 1);
|
||||||
|
if (ret < 0) {
|
||||||
|
print_uart("Failed to load OpenSBI!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Linux
|
||||||
ret = disk_read((BYTE *)KERNEL_ADDRESS, kernel->first_lba,kernel->last_lba - kernel->first_lba + 1);
|
ret = disk_read((BYTE *)KERNEL_ADDRESS, kernel->first_lba,kernel->last_lba - kernel->first_lba + 1);
|
||||||
|
if (ret < 0) {
|
||||||
|
print_uart("Failed to load Linux!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user