[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / arch / i386 / i386disk.c
index 3a0874c..beeb15c 100644 (file)
@@ -12,9 +12,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <freeldr.h>
@@ -31,7 +31,7 @@ BOOLEAN DiskResetController(ULONG DriveNumber)
        REGS    RegsIn;
        REGS    RegsOut;
 
-       DbgPrint((DPRINT_DISK, "DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber));
+       DPRINTM(DPRINT_DISK, "DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
 
        // BIOS Int 13h, function 0 - Reset disk system
        // AH = 00h
@@ -54,7 +54,7 @@ BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber)
        REGS    RegsIn;
        REGS    RegsOut;
 
-       DbgPrint((DPRINT_DISK, "DiskInt13ExtensionsSupported()\n"));
+       DPRINTM(DPRINT_DISK, "DiskInt13ExtensionsSupported()\n");
 
        // IBM/MS INT 13 Extensions - INSTALLATION CHECK
        // AH = 41h
@@ -133,7 +133,10 @@ BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT B
        REGS    RegsOut;
        PUSHORT Ptr = (PUSHORT)(BIOSCALLBUFFER);
 
-       DbgPrint((DPRINT_DISK, "DiskGetExtendedDriveParameters()\n"));
+       DPRINTM(DPRINT_DISK, "DiskGetExtendedDriveParameters()\n");
+
+       if (!DiskInt13ExtensionsSupported(DriveNumber))
+            return FALSE;
 
        // Initialize transfer buffer
        *Ptr = BufferSize;
@@ -163,35 +166,37 @@ BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT B
 
        memcpy(Buffer, Ptr, BufferSize);
 
-    DbgPrint((DPRINT_DISK, "size of buffer:                          %x\n", Ptr[0]));
-    DbgPrint((DPRINT_DISK, "information flags:                       %x\n", Ptr[1]));
-    DbgPrint((DPRINT_DISK, "number of physical cylinders on drive:   %u\n", *(PULONG)&Ptr[2]));
-    DbgPrint((DPRINT_DISK, "number of physical heads on drive:       %u\n", *(PULONG)&Ptr[4]));
-    DbgPrint((DPRINT_DISK, "number of physical sectors per track:    %u\n", *(PULONG)&Ptr[6]));
-    DbgPrint((DPRINT_DISK, "total number of sectors on drive:        %I64u\n", *(unsigned long long*)&Ptr[8]));
-    DbgPrint((DPRINT_DISK, "bytes per sector:                        %u\n", Ptr[12]));
+#if DBG
+    DPRINTM(DPRINT_DISK, "size of buffer:                          %x\n", Ptr[0]);
+    DPRINTM(DPRINT_DISK, "information flags:                       %x\n", Ptr[1]);
+    DPRINTM(DPRINT_DISK, "number of physical cylinders on drive:   %u\n", *(PULONG)&Ptr[2]);
+    DPRINTM(DPRINT_DISK, "number of physical heads on drive:       %u\n", *(PULONG)&Ptr[4]);
+    DPRINTM(DPRINT_DISK, "number of physical sectors per track:    %u\n", *(PULONG)&Ptr[6]);
+    DPRINTM(DPRINT_DISK, "total number of sectors on drive:        %I64u\n", *(unsigned long long*)&Ptr[8]);
+    DPRINTM(DPRINT_DISK, "bytes per sector:                        %u\n", Ptr[12]);
     if (Ptr[0] >= 0x1e)
     {
-        DbgPrint((DPRINT_DISK, "EED configuration parameters:            %x:%x\n", Ptr[13], Ptr[14]));
+        DPRINTM(DPRINT_DISK, "EED configuration parameters:            %x:%x\n", Ptr[13], Ptr[14]);
         if (Ptr[13] != 0xffff && Ptr[14] != 0xffff)
         {
            PUCHAR SpecPtr = (PUCHAR)(ULONG_PTR)((Ptr[13] << 4) + Ptr[14]);
-           DbgPrint((DPRINT_DISK, "SpecPtr:                                 %x\n", SpecPtr));
-           DbgPrint((DPRINT_DISK, "physical I/O port base address:          %x\n", *(PUSHORT)&SpecPtr[0]));
-           DbgPrint((DPRINT_DISK, "disk-drive control port address:         %x\n", *(PUSHORT)&SpecPtr[2]));
-           DbgPrint((DPRINT_DISK, "drive flags:                             %x\n", SpecPtr[4]));
-           DbgPrint((DPRINT_DISK, "proprietary information:                 %x\n", SpecPtr[5]));
-           DbgPrint((DPRINT_DISK, "IRQ for drive:                           %u\n", SpecPtr[6]));
-           DbgPrint((DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]));
-           DbgPrint((DPRINT_DISK, "DMA control:                             %x\n", SpecPtr[8]));
-           DbgPrint((DPRINT_DISK, "programmed I/O control:                  %x\n", SpecPtr[9]));
-           DbgPrint((DPRINT_DISK, "drive options:                           %x\n", *(PUSHORT)&SpecPtr[10]));
+           DPRINTM(DPRINT_DISK, "SpecPtr:                                 %x\n", SpecPtr);
+           DPRINTM(DPRINT_DISK, "physical I/O port base address:          %x\n", *(PUSHORT)&SpecPtr[0]);
+           DPRINTM(DPRINT_DISK, "disk-drive control port address:         %x\n", *(PUSHORT)&SpecPtr[2]);
+           DPRINTM(DPRINT_DISK, "drive flags:                             %x\n", SpecPtr[4]);
+           DPRINTM(DPRINT_DISK, "proprietary information:                 %x\n", SpecPtr[5]);
+           DPRINTM(DPRINT_DISK, "IRQ for drive:                           %u\n", SpecPtr[6]);
+           DPRINTM(DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]);
+           DPRINTM(DPRINT_DISK, "DMA control:                             %x\n", SpecPtr[8]);
+           DPRINTM(DPRINT_DISK, "programmed I/O control:                  %x\n", SpecPtr[9]);
+           DPRINTM(DPRINT_DISK, "drive options:                           %x\n", *(PUSHORT)&SpecPtr[10]);
         }
     }
     if (Ptr[0] >= 0x42)
     {
-        DbgPrint((DPRINT_DISK, "signature:                             %x\n", Ptr[15]));
+        DPRINTM(DPRINT_DISK, "signature:                             %x\n", Ptr[15]);
     }
+#endif
 
        return TRUE;
 }