On 23.07.2011 15:11, David Kuehling wrote:
>>>>>> "Vladimir" == Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> 
>>>>>> writes:
>>> sudo grub-mkimage --config=/boot/grub.elf.conf \
>>> --output=/boot/grub3.elf --format=mipsel-fuloong-elf --verbose \ ata
>>> part_msdos ext2 reboot halt lspci ohci usbtest usbms linux \ fat xfs
>>> part_gpt multiboot2 minicmd configfile gcry_md5 hashsum
>>>
>> ata was renamed to pata.
> Just recreated my grub.elf with ata in the grub.elf.conf replaced by
> pata, plus 'pata' module added to the grub-mkimage command line.
>
> Now the grub blanks the screen and hangs when loaded from pmon.
>
I've fixed 2 regressions in trunk.
> Maybe I should add that I'm using a 750GB hard-disk with 4k sectors in
> my Fuloong.  Could that be a problem?  It's neigher a problem for pmon
> nor for linux, though.
I'm attaching a patch which should add the support for 4K sectors with ATA.
> cheers,
>
> David
>
>
> _______________________________________________
> Grub-devel mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

=== modified file 'grub-core/disk/ata.c'
--- grub-core/disk/ata.c	2011-07-07 19:46:25 +0000
+++ grub-core/disk/ata.c	2011-07-23 16:17:06 +0000
@@ -57,6 +57,7 @@
     {
       grub_dprintf ("ata", "Addressing: %d\n", dev->addr);
       grub_dprintf ("ata", "Sectors: %lld\n", (unsigned long long) dev->size);
+      grub_dprintf ("ata", "Sector size: %u\n", 1U << dev->log_sector_size);
     }
 }
 
@@ -170,6 +171,21 @@
   else
     dev->size = grub_le_to_cpu64(*((grub_uint64_t *) &info16[100]));
 
+  if (info16[106] & (1 << 12))
+    {
+      grub_uint32_t secsize;
+      secsize = grub_le_to_cpu32 (*((grub_uint32_t *) &info16[117]));
+      if (secsize & (secsize - 1) || !secsize
+	  || secsize > 1048576)
+	secsize = 256;
+      for (dev->log_sector_size = 0;
+	   (1U << dev->log_sector_size) < secsize;
+	   dev->log_sector_size++);
+      dev->log_sector_size++;
+    }
+  else
+    dev->log_sector_size = 9;
+
   /* Read CHS information.  */
   dev->cylinders = info16[1];
   dev->heads = info16[3];
@@ -314,7 +330,7 @@
       grub_ata_setaddress (ata, &parms, sector, batch, addressing);
       parms.taskfile.cmd = (! rw ? cmd : cmd_write);
       parms.buffer = buf;
-      parms.size = batch * GRUB_DISK_SECTOR_SIZE;
+      parms.size = batch << ata->log_sector_size;
       parms.write = rw;
       if (ata->dma)
 	parms.dma = 1;
@@ -322,9 +338,9 @@
       err = ata->dev->readwrite (ata, &parms, 0);
       if (err)
 	return err;
-      if (parms.size != batch * GRUB_DISK_SECTOR_SIZE)
+      if (parms.size != batch << ata->log_sector_size)
 	return grub_error (GRUB_ERR_READ_ERROR, "incomplete read");
-      buf += GRUB_DISK_SECTOR_SIZE * batch;
+      buf += batch << ata->log_sector_size;
       sector += batch;
       nsectors += batch;
     }
@@ -433,6 +449,7 @@
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
 
   disk->total_sectors = ata->size;
+  disk->log_sector_size = ata->log_sector_size;
 
   disk->id = grub_make_scsi_id (id, bus, 0);
 

=== modified file 'include/grub/ata.h'
--- include/grub/ata.h	2011-07-07 10:21:53 +0000
+++ include/grub/ata.h	2011-07-23 15:38:46 +0000
@@ -170,6 +170,7 @@
 
   /* Sector count.  */
   grub_uint64_t size;
+  grub_uint32_t log_sector_size;
 
   /* CHS maximums.  */
   grub_uint16_t cylinders;

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to