1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: architecture/powerpc64/package/.../0035-ps3-partition.patch
5 # Copyright (C) 2019 - 2020 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- a/block/partitions/Kconfig
18 +++ b/block/partitions/Kconfig
19 @@ -262,6 +262,12 @@ config SYSV68_PARTITION
24 + bool "PS3 Partition support"
25 + depends on PARTITION_ADVANCED
27 + Say Y here if you would like to use PS3 hard disks under Linux.
29 config CMDLINE_PARTITION
30 bool "Command line partition support" if PARTITION_ADVANCED
31 select BLK_CMDLINE_PARSER
32 --- a/block/partitions/Makefile
33 +++ b/block/partitions/Makefile
34 @@ -21,3 +21,4 @@ obj-$(CONFIG_IBM_PARTITION) += ibm.o
35 obj-$(CONFIG_EFI_PARTITION) += efi.o
36 obj-$(CONFIG_KARMA_PARTITION) += karma.o
37 obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o
38 +obj-$(CONFIG_PS3_PARTITION) += ps3.o
39 --- a/block/partitions/core.c
40 +++ b/block/partitions/core.c
42 #include <linux/blktrace_api.h>
43 #include <linux/raid/detect.h>
47 static int (*check_part[])(struct parsed_partitions *) = {
49 @@ -81,6 +82,9 @@ static int (*check_part[])(struct parsed_partitions *) = {
51 #ifdef CONFIG_SYSV68_PARTITION
54 +#ifdef CONFIG_PS3_PARTITION
60 +++ b/block/partitions/ps3.c
63 + * fs/partitions/ps3.c
65 + * Copyright (C) 2012 glevand <geoffrey.levand@mail.ru>
71 +#define SECTOR_SIZE 512
72 +#define MAX_ACL_ENTRIES 8
73 +#define MAX_PARTITIONS 8
75 +#define MAGIC1 0x0FACE0FFULL
76 +#define MAGIC2 0xDEADFACEULL
86 + struct p_acl_entry p_acl[MAX_ACL_ENTRIES];
95 + struct d_partition d_partitions[MAX_PARTITIONS];
96 + u8 d_pad[0x600 - MAX_PARTITIONS * sizeof(struct d_partition)- 0x30];
99 +static bool ps3_read_disklabel(struct parsed_partitions *state, struct disklabel *label)
102 + unsigned char *data;
105 + for (i = 0; i < sizeof(struct disklabel) / SECTOR_SIZE; i++) {
106 + data = read_part_sector(state, i, §);
110 + memcpy((unsigned char *) label + i * SECTOR_SIZE, data, SECTOR_SIZE);
112 + put_dev_sector(sect);
118 +int ps3_partition(struct parsed_partitions *state)
120 + struct disklabel *label = NULL;
125 + label = kmalloc(sizeof(struct disklabel), GFP_KERNEL);
129 + if (!ps3_read_disklabel(state, label))
134 + if ((be64_to_cpu(label->d_magic1) != MAGIC1) ||
135 + (be64_to_cpu(label->d_magic2) != MAGIC2))
138 + for (i = 0; i < MAX_PARTITIONS; i++) {
139 + if (label->d_partitions[i].p_start && label->d_partitions[i].p_size) {
140 + put_partition(state, slot,
141 + be64_to_cpu(label->d_partitions[i].p_start),
142 + be64_to_cpu(label->d_partitions[i].p_size));
147 + strlcat(state->pp_buf, "\n", PAGE_SIZE);
161 +++ b/block/partitions/ps3.h
164 + * fs/partitions/ps3.h
167 +int ps3_partition(struct parsed_partitions *state);