mirror of
https://github.com/ps5-linux/ps5-linux-patches.git
synced 2026-07-16 01:50:38 +00:00
linux: only apply last_lba patch to nvme
This commit is contained in:
21
linux.patch
21
linux.patch
@@ -348,7 +348,7 @@ index 000000000000..731fed163a83
|
||||
+ legacy_pic = &null_legacy_pic;
|
||||
+}
|
||||
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
|
||||
index 75474fb3848e..38acd29520e5 100644
|
||||
index 75474fb3848e..44a0744533a0 100644
|
||||
--- a/block/partitions/efi.c
|
||||
+++ b/block/partitions/efi.c
|
||||
@@ -90,6 +90,9 @@
|
||||
@@ -361,21 +361,20 @@ index 75474fb3848e..38acd29520e5 100644
|
||||
/* 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.
|
||||
@@ -133,8 +136,13 @@ efi_crc32(const void *buf, unsigned long len)
|
||||
@@ -133,6 +136,12 @@ 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
|
||||
+ if (strncmp(disk->disk_name, "nvme", 4) == 0) {
|
||||
+ return div_u64(bdev_nr_bytes(disk->part0),
|
||||
+ queue_logical_block_size(disk->queue)) - 1ULL - PS5_M2_PART44_LBA_OFFSET;
|
||||
+ } else
|
||||
+#endif
|
||||
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)
|
||||
@@ -143,8 +152,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) */
|
||||
@@ -390,7 +389,7 @@ index 75474fb3848e..38acd29520e5 100644
|
||||
|
||||
return GPT_MBR_PROTECTIVE;
|
||||
invalid:
|
||||
@@ -599,6 +613,11 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
@@ -599,6 +614,11 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
if (!legacymbr)
|
||||
goto fail;
|
||||
|
||||
@@ -402,7 +401,7 @@ index 75474fb3848e..38acd29520e5 100644
|
||||
read_lba(state, 0, (u8 *)legacymbr, sizeof(*legacymbr));
|
||||
good_pmbr = is_pmbr_valid(legacymbr, total_sectors);
|
||||
kfree(legacymbr);
|
||||
@@ -611,6 +630,12 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
@@ -611,6 +631,12 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
"protective" : "hybrid");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user