[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[1951] 2009-01-19 Christian Franke <address@hidden>
From: |
Christian Franke |
Subject: |
[1951] 2009-01-19 Christian Franke <address@hidden> |
Date: |
Mon, 19 Jan 2009 20:27:54 +0000 |
Revision: 1951
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1951
Author: chrfranke
Date: 2009-01-19 20:27:54 +0000 (Mon, 19 Jan 2009)
Log Message:
-----------
2009-01-19 Christian Franke <address@hidden>
* disk/scsi.c (grub_scsi_read10): Use scsi->blocksize instead
of 512 to calculate data size.
(grub_scsi_read12): Likewise.
(grub_scsi_write10): Likewise.
(grub_scsi_write12): Likewise.
(grub_scsi_read): Adjust size according to blocksize.
Add checks for invalid blocksize and unaligned transfer.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/disk/scsi.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-01-19 17:09:53 UTC (rev 1950)
+++ trunk/grub2/ChangeLog 2009-01-19 20:27:54 UTC (rev 1951)
@@ -1,3 +1,13 @@
+2009-01-19 Christian Franke <address@hidden>
+
+ * disk/scsi.c (grub_scsi_read10): Use scsi->blocksize instead
+ of 512 to calculate data size.
+ (grub_scsi_read12): Likewise.
+ (grub_scsi_write10): Likewise.
+ (grub_scsi_write12): Likewise.
+ (grub_scsi_read): Adjust size according to blocksize.
+ Add checks for invalid blocksize and unaligned transfer.
+
2009-01-19 Vesa Jääskeläinen <address@hidden>
* font/font.c (grub_font_loader_init): Re-position unknown glyph.
Modified: trunk/grub2/disk/scsi.c
===================================================================
--- trunk/grub2/disk/scsi.c 2009-01-19 17:09:53 UTC (rev 1950)
+++ trunk/grub2/disk/scsi.c 2009-01-19 20:27:54 UTC (rev 1951)
@@ -119,7 +119,7 @@
rd.reserved2 = 0;
rd.pad = 0;
- return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * 512, buf);
+ return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size *
scsi->blocksize, buf);
}
/* Send a SCSI request for DISK: read SIZE sectors starting with
@@ -140,7 +140,7 @@
rd.reserved = 0;
rd.control = 0;
- return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * 512, buf);
+ return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size *
scsi->blocksize, buf);
}
#if 0
@@ -163,7 +163,7 @@
wr.reserved2 = 0;
wr.pad = 0;
- return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * 512, buf);
+ return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size *
scsi->blocksize, buf);
}
/* Send a SCSI request for DISK: write the data stored in BUF to SIZE
@@ -184,7 +184,7 @@
wr.reserved = 0;
wr.pad = 0;
- return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * 512, buf);
+ return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size *
scsi->blocksize, buf);
}
#endif
@@ -325,9 +325,23 @@
/* SCSI sectors are variable in size. GRUB uses 512 byte
sectors. */
- sector = grub_divmod64 (sector, scsi->blocksize >> GRUB_DISK_SECTOR_BITS,
- NULL);
+ if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE)
+ {
+ unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
+ if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "Unsupported SCSI block size");
+ grub_int32_t sector_mod = 0;
+ sector = grub_divmod64 (sector, spb, §or_mod);
+
+ if (! (sector_mod == 0 && size % spb == 0))
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "Unaligned SCSI read not supported");
+
+ size /= spb;
+ }
+
/* Depending on the type, select a read function. */
switch (scsi->devtype)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [1951] 2009-01-19 Christian Franke <address@hidden>,
Christian Franke <=