On Fri,  7 Jul 2023 00:39:47 +0300
ValdikSS via Grub-devel <grub-devel@gnu.org> wrote:

> There's no need to obey CHS layout restrictions for LBA reads
> on LBA disks, it only slows down booting process.
> 
> See: https://lists.gnu.org/archive/html/grub-devel/2023-07/msg00001.html

I'd suggest using this link:
  
https://lore.kernel.org/grub-devel/d42a11fa-2a59-b5e7-08b1-d2c60444b...@valdikss.org.ru/

This allows more features for those that might years later be viewing
this link.

> ---
>  grub-core/disk/i386/pc/biosdisk.c | 5 ++++-
>  include/grub/disk.h               | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/grub-core/disk/i386/pc/biosdisk.c 
> b/grub-core/disk/i386/pc/biosdisk.c
> index f9362d17c..1d6788950 100644
> --- a/grub-core/disk/i386/pc/biosdisk.c
> +++ b/grub-core/disk/i386/pc/biosdisk.c
> @@ -471,7 +471,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
>        struct grub_biosdisk_dap *dap;
>  
>        dap = (struct grub_biosdisk_dap *) (GRUB_MEMORY_MACHINE_SCRATCH_ADDR
> -                                       + (data->sectors
> +                                       + (GRUB_DISK_MAX_LBA_SECTORS
>                                            << disk->log_sector_size));
>        dap->length = sizeof (*dap);
>        dap->reserved = 0;
> @@ -561,6 +561,9 @@ get_safe_sectors (grub_disk_t disk, grub_disk_addr_t 
> sector)
>    struct grub_biosdisk_data *data = disk->data;
>    grub_uint32_t sectors = data->sectors;
>  
> +  if (data->flags & GRUB_BIOSDISK_FLAG_LBA)
> +    sectors = GRUB_DISK_MAX_LBA_SECTORS;
> +
>    /* OFFSET = SECTOR % SECTORS */
>    grub_divmod64 (sector, sectors, &offset);
>  
> diff --git a/include/grub/disk.h b/include/grub/disk.h
> index a4b5d13f3..be032a72c 100644
> --- a/include/grub/disk.h
> +++ b/include/grub/disk.h
> @@ -190,6 +190,9 @@ typedef struct grub_disk_memberlist 
> *grub_disk_memberlist_t;
>  
>  #define GRUB_DISK_MAX_MAX_AGGLOMERATE ((1 << (30 - GRUB_DISK_CACHE_BITS - 
> GRUB_DISK_SECTOR_BITS)) - 1)
>  
> +/* Maximum number of sectors to read in LBA mode at once */
> +#define GRUB_DISK_MAX_LBA_SECTORS 63

Why is this set to 63 if we're not obeying CHS restrictions any way?

Glenn

> +
>  /* Return value of grub_disk_native_sectors() in case disk size is unknown. 
> */
>  #define GRUB_DISK_SIZE_UNKNOWN        0xffffffffffffffffULL
>  

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to