:: commit ed238b7ccf82486228c10b06897a175be6a2db41

mintsuki <mintsuki@protonmail.com> — 2022-10-13 20:20

parents: 0aa3bc05e2

disk: On UEFI, improve optical vs non-optical detection

diff --git a/common/drivers/disk.s2.c b/common/drivers/disk.s2.c
index 55c82a69..9f27bb7c 100644
--- a/common/drivers/disk.s2.c
+++ b/common/drivers/disk.s2.c
@@ -555,6 +555,8 @@ fail:
         if (drive->Media->LogicalPartition)
             continue;
 
+        drive->Media->WriteCaching = false;
+
         uint64_t orig;
         if (disk_io != NULL) {
             status = disk_io->ReadDisk(disk_io, drive->Media->MediaId, 0, sizeof(uint64_t), &orig);
@@ -573,7 +575,7 @@ fail:
 
         struct volume *block = ext_mem_alloc(sizeof(struct volume));
 
-        if (status) {
+        if (status || drive->Media->ReadOnly) {
             block->index = optical_indices++;
             block->is_optical = true;
         } else {
tab: 248 wrap: offon