sparc64: Add blocklist GPT support for SPARC
PATCH v2 1/1 sparc64: Add blocklist GPT support for SPARC
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
---
Changes in v2:
Do all GPT offset calculations in setup
--- util/setup.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-)
util/setup.c +23 -3
@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif grub_uint16_t last_length;grub_disk_addr_t first_sector; };
@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,struct grub_boot_blocklist *prev = bl->block +1 ;grub_uint64_t seclen; +#ifdef GRUB_SETUP_SPARC64 + sector -= bl->gpt_offset; +#endif +grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG",%u,%u>" , (unsigned long long ) sector, offset, length);
@@ -662,6 +669,16 @@ unable_to_embed: bl.block = bl.first_block; +#ifdef GRUB_SETUP_SPARC64 + { +grub_partition_t container = root_dev->disk->partition; + bl.gpt_offset =0 ; + +if (grub_strstr (container->partmap->name,"gpt" )) + bl.gpt_offset =grub_partition_get_start (container); + } +#endif +grub_install_get_blocklist (root_dev, core_path, core_img, core_size, save_blocklists, &bl);
@@ -721,15 +738,18 @@ unable_to_embed: {char *buf, *ptr = core_img;size_t len = core_size; -grub_uint64_t blk; +grub_uint64_t blk, offset =0 ;grub_partition_t container = core_dev->disk->partition;grub_err_t err; core_dev->disk->partition =0 ; +#ifdef GRUB_SETUP_SPARC64 + offset = bl.gpt_offset; +#endif buf =xmalloc (core_size); blk = bl.first_sector; - err =grub_disk_read (core_dev->disk, blk,0 ,GRUB_DISK_SECTOR_SIZE , buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 ,GRUB_DISK_SECTOR_SIZE , buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg);
@@ -748,7 +768,7 @@ unable_to_embed:if (cur > len) cur = len; - err =grub_disk_read (core_dev->disk, blk,0 , cur, buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 , cur, buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg);
Signature · 1 line
1.7.1
Quoted 25 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup--- util/setup.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-)util/setup.c +0
-0
util/setup.c struct blocklists · line 143
Quoted 6 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif
This does not seem to be used below...
Daniel
Quoted 69 lines
util/setup.c +20
-4grub_uint16_t last_length;grub_disk_addr_t first_sector; };@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,struct grub_boot_blocklist *prev = bl->block +1 ;grub_uint64_t seclen; +#ifdef GRUB_SETUP_SPARC64 + sector -= bl->gpt_offset; +#endif +grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG",%u,%u>" , (unsigned long long ) sector, offset, length);@@ -662,6 +669,16 @@ unable_to_embed: bl.block = bl.first_block; +#ifdef GRUB_SETUP_SPARC64 + { +grub_partition_t container = root_dev->disk->partition; + bl.gpt_offset =0 ; + +if (grub_strstr (container->partmap->name,"gpt" )) + bl.gpt_offset =grub_partition_get_start (container); + } +#endif +grub_install_get_blocklist (root_dev, core_path, core_img, core_size, save_blocklists, &bl);@@ -721,15 +738,18 @@ unable_to_embed: {char *buf, *ptr = core_img;size_t len = core_size; -grub_uint64_t blk; +grub_uint64_t blk, offset =0 ;grub_partition_t container = core_dev->disk->partition;grub_err_t err; core_dev->disk->partition =0 ; +#ifdef GRUB_SETUP_SPARC64 + offset = bl.gpt_offset; +#endif buf =xmalloc (core_size); blk = bl.first_sector; - err =grub_disk_read (core_dev->disk, blk,0 ,GRUB_DISK_SECTOR_SIZE , buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 ,GRUB_DISK_SECTOR_SIZE , buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg);@@ -748,7 +768,7 @@ unable_to_embed:if (cur > len) cur = len; - err =grub_disk_read (core_dev->disk, blk,0 , cur, buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 , cur, buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg); --1.7.1
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 24 lines · Daniel Kiper
Quoted 20 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)
Quoted 14 lines
util/setup.c struct blocklists · line 143
Quoted 11 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below…
I think that is left over from V1, I’ll remove it and send out a new patch.
Quoted 24 lines · Daniel Kiper
Quoted 20 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)
Quoted 13 lines
util/setup.c struct blocklists · line 143
Quoted 11 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below…
After looking into this further, I don’t see a problem...
Quoted 10 lines
util/setup.c save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length, · line 158
Quoted 10 lines
util/setup.c +2
-0grub_uint16_t last_length;grub_disk_addr_t first_sector; };@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,struct grub_boot_blocklist *prev = bl->block +1 ;grub_uint64_t seclen; +#ifdef GRUB_SETUP_SPARC64 + sector -= bl->gpt_offset;
It is used here
Quoted 5 lines
Quoted 5 lines
util/setup.c +2
-0+#endif +grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG",%u,%u>" , (unsigned long long ) sector, offset, length);
Quoted 8 lines
util/setup.c unable_to_embed: · line 675
Quoted 8 lines
util/setup.c +4
-0@@ -662,6 +669,16 @@ unable_to_embed: bl.block = bl.first_block; +#ifdef GRUB_SETUP_SPARC64 + { +grub_partition_t container = root_dev->disk->partition; + bl.gpt_offset =0 ;
here
Quoted 3 lines
util/setup.c unable_to_embed: · line 678
Quoted 3 lines
util/setup.c +3
-0+ +if (grub_strstr (container->partmap->name,"gpt" )) + bl.gpt_offset =grub_partition_get_start (container);
here
Quoted 15 lines
Quoted 15 lines
util/setup.c +4
-1+ } +#endif +grub_install_get_blocklist (root_dev, core_path, core_img, core_size, save_blocklists, &bl);@@ -721,15 +738,18 @@ unable_to_embed: {char *buf, *ptr = core_img;size_t len = core_size; -grub_uint64_t blk; +grub_uint64_t blk, offset =0 ;grub_partition_t container = core_dev->disk->partition;grub_err_t err;
Quoted 3 lines
util/setup.c unable_to_embed: · line 747
Quoted 3 lines
util/setup.c +2
-0core_dev->disk->partition =0 ; +#ifdef GRUB_SETUP_SPARC64 + offset = bl.gpt_offset;
and here.
Quoted 26 lines
Quoted 26 lines
util/setup.c +3
-3+#endif buf =xmalloc (core_size); blk = bl.first_sector; - err =grub_disk_read (core_dev->disk, blk,0 ,GRUB_DISK_SECTOR_SIZE , buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 ,GRUB_DISK_SECTOR_SIZE , buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg);@@ -748,7 +768,7 @@ unable_to_embed:if (cur > len) cur = len; - err =grub_disk_read (core_dev->disk, blk,0 , cur, buf); + err =grub_disk_read (core_dev->disk, blk + offset,0 , cur, buf);if (err)grub_util_error (_ ("cannot read `%s': %s" ), core_dev->disk->name, grub_errmsg); --1.7.1
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 36 lines · Eric Snowberg
Quoted 22 lines · Daniel Kiper
Quoted 20 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)Quoted 13 lines
util/setup.c struct blocklists · line 143
Quoted 11 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below???
Quoted 1 line
After looking into this further, I don???t see a problem...
Sorry, it is a problem. It declares the gpt_offset variable here...
Quoted 11 lines
Quoted 9 lines
util/setup.c save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length, · line 158
Quoted 9 lines
util/setup.c +2
-0grub_uint16_t last_length;grub_disk_addr_t first_sector; };@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,struct grub_boot_blocklist *prev = bl->block +1 ;grub_uint64_t seclen; +#ifdef GRUB_SETUP_SPARC64 + sector -= bl->gpt_offset;It is used here
...and you reference here and below struct member using the same name. So, it is different thing. Hence, we do not need declaration above.
Daniel
Quoted 40 lines · Daniel Kiper
Quoted 36 lines · Eric Snowberg
Quoted 35 lines · Daniel Kiper
Quoted 25 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)util/setup.c +0
-0util/setup.c struct blocklists · line 143
Quoted 6 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below???
Quoted 3 lines
Quoted 1 line
After looking into this further, I don???t see a problem...
Sorry, it is a problem. It declares the
gpt_offsetvariable here…
No, it is not declaring a variable here. It is adding a member to a structure, the same way x86 does with current_segment.
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
util/setup.c +0
-0grub_uint16_t last_length;grub_disk_addr_t first_sector; };@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,struct grub_boot_blocklist *prev = bl->block +1 ;grub_uint64_t seclen;Quoted 4 lines
Quoted 2 lines
util/setup.c save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length, · line 158
Quoted 2 lines
util/setup.c +2
-0+#ifdef GRUB_SETUP_SPARC64 + sector -= bl->gpt_offset;It is used here
...and you reference here and below struct member using the same name. So, it is different thing. Hence, we do not need declaration above.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 38 lines · Eric Snowberg
Quoted 38 lines · Daniel Kiper
Quoted 36 lines · Eric Snowberg
Quoted 35 lines · Daniel Kiper
Quoted 25 lines · Eric Snowberg
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)util/setup.c +0
-0util/setup.c struct blocklists · line 143
Quoted 6 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below???
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
After looking into this further, I don???t see a problem...
Sorry, it is a problem. It declares the
gpt_offsetvariable here???No, it is not declaring a variable here. It is adding a member to a structure, the same way x86 does with
current_segment.
Ugh... Sorry, you are right. Patch is formated in a bit unfortunate way and I have to look at original file to spot it. So, in this situation LGTM. If there are no objections then I will apply it in a week or so.
Daniel
Quoted 48 lines · On Thu, Oct 12, 2017, 14:00 Daniel Kiper <[email protected]> wrote:
Quoted 3 lines · Eric Snowberg
Quoted 3 lines · Daniel Kiper
Quoted 1 line · Eric Snowberg
Quoted 1 line
On Oct 6, 2017, at 8:04 AM, Daniel Kiper <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Eric Snowberg
Quoted 1 line
Add block-list GPT support for SPARC. The OBP "load" and "boot"
methods
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
are partition aware and neither command can see the partition
table. Also
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
neither command can address the entire physical disk. When the
install
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
happens, grub generates the block-list entries based on the
beginning of the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
physical disk, not the beginning of the parition. This patch fixes
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
block-list entries so they match what OBP expects during boot for a
GPT
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 14 lines
Quoted 14 lines
disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)Quoted 13 lines
util/setup.c struct blocklists · line 143
Quoted 11 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below???
After looking into this further, I don???t see a problem...
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Sorry, it is a problem. It declares the
gpt_offsetvariable here???No, it is not declaring a variable here. It is adding a member to a structure, the same way x86 does with
current_segment.Ugh... Sorry, you are right. Patch is formated in a bit unfortunate way and I have to look at original file to spot it. So, in this situation LGTM. If there are no objections then I will apply it in a week or so.
I'd like to review this particular patch first
Quoted 3 lines
Daniel
Quoted 52 lines · Vladimir 'phcoder' Serbinenko
Quoted 50 lines · On Thu, Oct 12, 2017, 14:00 Daniel Kiper <[email protected]> wrote:
Quoted 3 lines · Eric Snowberg
Quoted 3 lines · Daniel Kiper
Quoted 1 line · Eric Snowberg
Quoted 1 line
On Oct 6, 2017, at 8:04 AM, Daniel Kiper <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Eric Snowberg
Quoted 1 line
Add block-list GPT support for SPARC. The OBP "load" and "boot"
methods
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
are partition aware and neither command can see the partition
table. Also
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
neither command can address the entire physical disk. When the
install
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
happens, grub generates the block-list entries based on the
beginning of the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
physical disk, not the beginning of the parition. This patch fixes
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
block-list entries so they match what OBP expects during boot for a
GPT
Quoted 32 lines
Quoted 31 lines
Quoted 28 lines
Quoted 14 lines
Quoted 14 lines
disk.
T5 and above now supports GPT as well as VTOC.
This patch has been tested on T5-2 and newer SPARC systems.
Signed-off-by Eric Snowberg <[email protected]>---
Changes in v2:
Do all GPT offset calculations in setup
---util/setup.c| 26 +++++++++++++++++++++++---1 files changed, 23 insertions(+), 3 deletions(-)Quoted 13 lines
util/setup.c struct blocklists · line 143
Quoted 11 lines
util/setup.c +3
-0@@ -138,6 +138,9 @@ struct blocklists#ifdef GRUB_SETUP_BIOS grub_uint16_t current_segment;#endif +#ifdef GRUB_SETUP_SPARC64 +grub_uint64_t gpt_offset; +#endif This does not seem to be used below???
Quoted 1 line
After looking into this further, I don???t see a problem...
Sorry, it is a problem. It declares the
gpt_offsetvariable here???
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
No, it is not declaring a variable here. It is adding a member to a structure, the same way x86 does with
current_segment.Ugh... Sorry, you are right. Patch is formated in a bit unfortunate way and I have to look at original file to spot it. So, in this situation LGTM. If there are no objections then I will apply it in a week or so.
I'd like to review this particular patch first
Vladimir, are you OK with that patch? I am going to apply this by the end of this week.
Daniel