mirror of
https://xff.cz/git/u-boot/
synced 2025-09-06 11:12:05 +02:00
efi: Improve logging in efi_disk
When this fails it can be time-consuming to debug. Add some debugging to help with this. Also try to return error codes instead of just using -1. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -424,13 +424,16 @@ static efi_status_t efi_disk_add_dev(
|
|||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
ret = EFI_OUT_OF_RESOURCES;
|
ret = EFI_OUT_OF_RESOURCES;
|
||||||
|
log_debug("no node\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parent must expose EFI_BLOCK_IO_PROTOCOL */
|
/* Parent must expose EFI_BLOCK_IO_PROTOCOL */
|
||||||
ret = efi_search_protocol(parent, &efi_block_io_guid, &handler);
|
ret = efi_search_protocol(parent, &efi_block_io_guid, &handler);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS) {
|
||||||
|
log_debug("search failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Link the partition (child controller) to the block device
|
* Link the partition (child controller) to the block device
|
||||||
@@ -439,8 +442,10 @@ static efi_status_t efi_disk_add_dev(
|
|||||||
ret = efi_protocol_open(handler, &protocol_interface, NULL,
|
ret = efi_protocol_open(handler, &protocol_interface, NULL,
|
||||||
&diskobj->header,
|
&diskobj->header,
|
||||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER);
|
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS) {
|
||||||
goto error;
|
log_debug("prot open failed\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
diskobj->dp = efi_dp_append_node(dp_parent, node);
|
diskobj->dp = efi_dp_append_node(dp_parent, node);
|
||||||
efi_free_pool(node);
|
efi_free_pool(node);
|
||||||
@@ -471,8 +476,10 @@ static efi_status_t efi_disk_add_dev(
|
|||||||
*/
|
*/
|
||||||
esp_guid, NULL,
|
esp_guid, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS) {
|
||||||
|
log_debug("install failed %lx\n", ret);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On partitions or whole disks without partitions install the
|
* On partitions or whole disks without partitions install the
|
||||||
@@ -485,8 +492,10 @@ static efi_status_t efi_disk_add_dev(
|
|||||||
ret = efi_add_protocol(&diskobj->header,
|
ret = efi_add_protocol(&diskobj->header,
|
||||||
&efi_simple_file_system_protocol_guid,
|
&efi_simple_file_system_protocol_guid,
|
||||||
diskobj->volume);
|
diskobj->volume);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS) {
|
||||||
|
log_debug("simple FS failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
diskobj->ops = block_io_disk_template;
|
diskobj->ops = block_io_disk_template;
|
||||||
diskobj->dev_index = dev_index;
|
diskobj->dev_index = dev_index;
|
||||||
@@ -556,18 +565,21 @@ static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
|
|||||||
ret = efi_disk_add_dev(NULL, NULL, desc,
|
ret = efi_disk_add_dev(NULL, NULL, desc,
|
||||||
diskid, NULL, 0, &disk, agent_handle);
|
diskid, NULL, 0, &disk, agent_handle);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
if (ret == EFI_NOT_READY)
|
if (ret == EFI_NOT_READY) {
|
||||||
log_notice("Disk %s not ready\n", dev->name);
|
log_notice("Disk %s not ready\n", dev->name);
|
||||||
else
|
ret = -EBUSY;
|
||||||
|
} else {
|
||||||
log_err("Adding disk for %s failed (err=%ld/%#lx)\n", dev->name, ret, ret);
|
log_err("Adding disk for %s failed (err=%ld/%#lx)\n", dev->name, ret, ret);
|
||||||
|
ret = -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return ret;
|
||||||
}
|
}
|
||||||
if (efi_link_dev(&disk->header, dev)) {
|
if (efi_link_dev(&disk->header, dev)) {
|
||||||
efi_free_pool(disk->dp);
|
efi_free_pool(disk->dp);
|
||||||
efi_delete_handle(&disk->header);
|
efi_delete_handle(&disk->header);
|
||||||
|
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user