Author: hpoussin
Date: Sun Oct 18 20:24:35 2009
New Revision: 43565
URL: 
http://svn.reactos.org/svn/reactos?rev=43565&view=rev
Log:
[freeldr/i386] Read up to 128 sectors at once
Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
    trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
    trunk/reactos/boot/freeldr/freeldr/include/arch.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Oct 18
20:24:35 2009
@@ -467,7 +467,7 @@
 {
     DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
     UCHAR* Ptr = (UCHAR*)Buffer;
-    ULONG i, Length;
+    ULONG i, Length, Sectors;
     BOOLEAN ret;
     *Count = 0;
@@ -475,12 +475,13 @@
     while (N > 0)
     {
         Length = N;
-        if (Length > Context->SectorSize)
-            Length = Context->SectorSize;
+        if (Length > DISKREADBUFFER_SIZE)
+            Length = DISKREADBUFFER_SIZE;
+        Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
         ret = MachDiskReadLogicalSectors(
             Context->DriveNumber,
             Context->SectorNumber + Context->SectorOffset + i,
-            1,
+            Sectors,
             (PVOID)DISKREADBUFFER);
         if (!ret)
             return EIO;
@@ -488,7 +489,7 @@
         Ptr += Length;
         *Count += Length;
         N -= Length;
-        i++;
+        i += Sectors;
     }
     return ESUCCESS;
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Sun Oct 18 20:24:35
2009
@@ -168,7 +168,7 @@
 {
     DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
     UCHAR* Ptr = (UCHAR*)Buffer;
-    ULONG i, Length;
+    ULONG i, Length, Sectors;
     BOOLEAN ret;
     *Count = 0;
@@ -176,12 +176,13 @@
     while (N > 0)
     {
         Length = N;
-        if (Length > Context->SectorSize)
-            Length = Context->SectorSize;
+        if (Length > DISKREADBUFFER_SIZE)
+            Length = DISKREADBUFFER_SIZE;
+        Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
         ret = MachDiskReadLogicalSectors(
             Context->DriveNumber,
             Context->SectorNumber + Context->SectorOffset + i,
-            1,
+            Sectors,
             (PVOID)DISKREADBUFFER);
         if (!ret)
             return EIO;
@@ -189,7 +190,7 @@
         Ptr += Length;
         *Count += Length;
         N -= Length;
-        i++;
+        i += Sectors;
     }
     return ESUCCESS;
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] Sun Oct 18 20:24:35
2009
@@ -46,6 +46,7 @@
 #define BIOSCALLBUFOFFSET      0x0000  /* Buffer to store temporary data for any Int386()
call */
 #define FILESYSBUFFER          0x80000 /* Buffer to store file system data (e.g. cluster
buffer for FAT) */
 #define DISKREADBUFFER         0x90000 /* Buffer to store data read in from the disk via
the BIOS */
+#define DISKREADBUFFER_SIZE 0x10000
 #elif defined(_M_PPC) || defined(_M_MIPS) || defined(_M_ARM)
 #define DISKREADBUFFER             0x80000000
 #define FILESYSBUFFER           0x80000000