mirror of
https://github.com/ps5-linux/ps5-linux-patches.git
synced 2026-07-16 06:00:40 +00:00
linux: adjust last_lba for m2
This commit is contained in:
25
linux.patch
25
linux.patch
@@ -348,19 +348,34 @@ index 000000000000..731fed163a83
|
||||
+ legacy_pic = &null_legacy_pic;
|
||||
+}
|
||||
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
|
||||
index 75474fb3848e..ff38f20bddc2 100644
|
||||
index 75474fb3848e..38acd29520e5 100644
|
||||
--- a/block/partitions/efi.c
|
||||
+++ b/block/partitions/efi.c
|
||||
@@ -90,6 +90,8 @@
|
||||
@@ -90,6 +90,9 @@
|
||||
#include "check.h"
|
||||
#include "efi.h"
|
||||
|
||||
+#define PS5_M2_PART44_LBA_OFFSET 34224
|
||||
+#define PS5_M2_MBR_LBA 65536
|
||||
+
|
||||
/* This allows a kernel command line option 'gpt' to override
|
||||
* the test for invalid PMBR. Not __initdata because reloading
|
||||
* the partition tables happens after init too.
|
||||
@@ -143,8 +145,14 @@ static inline int pmbr_part_valid(gpt_mbr_record *part)
|
||||
@@ -133,8 +136,13 @@ efi_crc32(const void *buf, unsigned long len)
|
||||
*/
|
||||
static u64 last_lba(struct gendisk *disk)
|
||||
{
|
||||
+#ifdef CONFIG_X86_PS5
|
||||
+ return div_u64(bdev_nr_bytes(disk->part0),
|
||||
+ queue_logical_block_size(disk->queue)) - 1ULL - PS5_M2_PART44_LBA_OFFSET;
|
||||
+#else
|
||||
return div_u64(bdev_nr_bytes(disk->part0),
|
||||
queue_logical_block_size(disk->queue)) - 1ULL;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline int pmbr_part_valid(gpt_mbr_record *part)
|
||||
@@ -143,8 +151,14 @@ static inline int pmbr_part_valid(gpt_mbr_record *part)
|
||||
goto invalid;
|
||||
|
||||
/* set to 0x00000001 (i.e., the LBA of the GPT Partition Header) */
|
||||
@@ -375,7 +390,7 @@ index 75474fb3848e..ff38f20bddc2 100644
|
||||
|
||||
return GPT_MBR_PROTECTIVE;
|
||||
invalid:
|
||||
@@ -599,6 +607,11 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
@@ -599,6 +613,11 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
if (!legacymbr)
|
||||
goto fail;
|
||||
|
||||
@@ -387,7 +402,7 @@ index 75474fb3848e..ff38f20bddc2 100644
|
||||
read_lba(state, 0, (u8 *)legacymbr, sizeof(*legacymbr));
|
||||
good_pmbr = is_pmbr_valid(legacymbr, total_sectors);
|
||||
kfree(legacymbr);
|
||||
@@ -611,6 +624,12 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
@@ -611,6 +630,12 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
"protective" : "hybrid");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user