Author: hpoussin Date: Mon May 19 15:34:04 2008 New Revision: 33602
URL: http://svn.reactos.org/svn/reactos?rev=33602&view=rev Log: Use dynamic traces
Modified: trunk/reactos/drivers/storage/floppy/csqrtns.c trunk/reactos/drivers/storage/floppy/floppy.c trunk/reactos/drivers/storage/floppy/hardware.c trunk/reactos/drivers/storage/floppy/ioctl.c trunk/reactos/drivers/storage/floppy/readwrite.c
Modified: trunk/reactos/drivers/storage/floppy/csqrtns.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/csqr... ============================================================================== --- trunk/reactos/drivers/storage/floppy/csqrtns.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/floppy/csqrtns.c [iso-8859-1] Mon May 19 15:34:04 2008 @@ -39,7 +39,6 @@ */
#include <ntddk.h> -#define NDEBUG #include <debug.h>
#include "floppy.h" @@ -70,7 +69,7 @@ */ { UNREFERENCED_PARAMETER(UnusedCsq); - DPRINT("CSQ: Removing IRP 0x%p\n", Irp); + TRACE_(FLOPPY, "CSQ: Removing IRP 0x%p\n", Irp); RemoveEntryList(&Irp->Tail.Overlay.ListEntry); }
@@ -93,7 +92,7 @@ { UNREFERENCED_PARAMETER(UnusedCsq); UNREFERENCED_PARAMETER(PeekContext); - DPRINT(("CSQ: Peeking for next IRP\n")); + TRACE_(FLOPPY, "CSQ: Peeking for next IRP\n");
if(Irp) return CONTAINING_RECORD(&Irp->Tail.Overlay.ListEntry.Flink, IRP, Tail.Overlay.ListEntry); @@ -115,7 +114,7 @@ */ { UNREFERENCED_PARAMETER(UnusedCsq); - DPRINT(("CSQ: Acquiring spin lock\n")); + INFO_(FLOPPY, "CSQ: Acquiring spin lock\n"); KeAcquireSpinLock(&IrpQueueLock, Irql); }
@@ -130,7 +129,7 @@ */ { UNREFERENCED_PARAMETER(UnusedCsq); - DPRINT(("CSQ: Releasing spin lock\n")); + INFO_(FLOPPY, "CSQ: Releasing spin lock\n"); KeReleaseSpinLock(&IrpQueueLock, Irql); }
@@ -148,7 +147,7 @@ */ { UNREFERENCED_PARAMETER(UnusedCsq); - DPRINT("CSQ: Canceling irp 0x%p\n", Irp); + TRACE_(FLOPPY, "CSQ: Canceling irp 0x%p\n", Irp); Irp->IoStatus.Status = STATUS_CANCELLED; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -173,7 +172,7 @@ */ { UNREFERENCED_PARAMETER(UnusedCsq); - DPRINT("CSQ: Inserting IRP 0x%p\n", Irp); + TRACE_(FLOPPY, "CSQ: Inserting IRP 0x%p\n", Irp); InsertTailList(&IrpQueue, &Irp->Tail.Overlay.ListEntry); KeReleaseSemaphore(&QueueSemaphore, 0, 1, FALSE); }
Modified: trunk/reactos/drivers/storage/floppy/floppy.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/flop... ============================================================================== --- trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] Mon May 19 15:34:04 2008 @@ -41,7 +41,6 @@ */
#include <ntddk.h> -#define NDEBUG #include <debug.h>
#include "floppy.h" @@ -88,7 +87,7 @@ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); ASSERT(ControllerInfo);
- DPRINT("floppy: MotorStopDpcFunc called\n"); + TRACE_(FLOPPY, "MotorStopDpcFunc called\n");
HwTurnOffMotor(ControllerInfo); ControllerInfo->StopDpcQueued = FALSE; @@ -115,21 +114,21 @@ PAGED_CODE(); ASSERT(DriveInfo);
- DPRINT("floppy: StartMotor called\n"); + TRACE_(FLOPPY, "StartMotor called\n");
if(DriveInfo->ControllerInfo->StopDpcQueued && !KeCancelTimer(&DriveInfo->ControllerInfo->MotorTimer)) { /* Motor turner-offer is already running; wait for it to finish */ - DPRINT("floppy: StartMotor: motor turner-offer is already running; waiting for it\n"); + INFO_(FLOPPY, "StartMotor: motor turner-offer is already running; waiting for it\n"); KeWaitForSingleObject(&DriveInfo->ControllerInfo->MotorStoppedEvent, Executive, KernelMode, FALSE, NULL); - DPRINT("floppy: StartMotor: wait satisfied\n"); + INFO_(FLOPPY, "StartMotor: wait satisfied\n"); }
DriveInfo->ControllerInfo->StopDpcQueued = FALSE;
if(HwTurnOnMotor(DriveInfo) != STATUS_SUCCESS) { - DPRINT("floppy: StartMotor(): warning: HwTurnOnMotor failed\n"); + WARN_(FLOPPY, "StartMotor(): warning: HwTurnOnMotor failed\n"); } }
@@ -149,7 +148,7 @@
ASSERT(ControllerInfo);
- DPRINT("floppy: StopMotor called\n"); + TRACE_(FLOPPY, "StopMotor called\n");
/* one relative second, in 100-ns units */ StopTime.QuadPart = 10000000; @@ -202,7 +201,7 @@ { UNREFERENCED_PARAMETER(DeviceObject);
- DPRINT("floppy: CreateClose called\n"); + TRACE_(FLOPPY, "CreateClose called\n");
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = FILE_OPENED; @@ -237,10 +236,10 @@ StartMotor(DriveInfo);
/* set the data rate */ - DPRINT("floppy: FIXME: UN-HARDCODE DATA RATE\n"); + WARN_(FLOPPY, "FIXME: UN-HARDCODE DATA RATE\n"); if(HwSetDataRate(DriveInfo->ControllerInfo, 0) != STATUS_SUCCESS) { - DPRINT("floppy: Recalibrate: HwSetDataRate failed\n"); + WARN_(FLOPPY, "Recalibrate: HwSetDataRate failed\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -258,7 +257,7 @@ Status = HwRecalibrate(DriveInfo); if(Status != STATUS_SUCCESS) { - DPRINT("floppy: Recalibrate: HwRecalibrate returned error\n"); + WARN_(FLOPPY, "Recalibrate: HwRecalibrate returned error\n"); continue; }
@@ -268,7 +267,7 @@ Status = HwRecalibrateResult(DriveInfo->ControllerInfo); if(Status != STATUS_SUCCESS) { - DPRINT("floppy: Recalibrate: HwRecalibrateResult returned error\n"); + WARN_(FLOPPY, "Recalibrate: HwRecalibrateResult returned error\n"); break; } } @@ -303,7 +302,7 @@ PAGED_CODE(); ASSERT(DriveInfo);
- DPRINT("floppy: ResetChangeFlag called\n"); + TRACE_(FLOPPY, "ResetChangeFlag called\n");
/* Try to recalibrate. We don't care if it works. */ Recalibrate(DriveInfo); @@ -317,7 +316,7 @@ /* Seek to 1 */ if(HwSeek(DriveInfo, 1) != STATUS_SUCCESS) { - DPRINT("floppy: ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n"); + WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -326,7 +325,7 @@
if(HwSenseInterruptStatus(DriveInfo->ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: ResetChangeFlag(): HwSenseInterruptStatus failed; bailing out\n"); + WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus failed; bailing out\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -334,7 +333,7 @@ /* Seek back to 0 */ if(HwSeek(DriveInfo, 0) != STATUS_SUCCESS) { - DPRINT("floppy: ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n"); + WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -343,7 +342,7 @@
if(HwSenseInterruptStatus(DriveInfo->ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: ResetChangeFlag(): HwSenseInterruptStatus #2 failed; bailing\n"); + WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus #2 failed; bailing\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -351,7 +350,7 @@ /* Check the change bit */ if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS) { - DPRINT("floppy: ResetChangeFlag(): HwDiskChagned failed; returning STATUS_IO_DEVICE_ERROR\n"); + WARN_(FLOPPY, "ResetChangeFlag(): HwDiskChanged failed; returning STATUS_IO_DEVICE_ERROR\n"); StopMotor(DriveInfo->ControllerInfo); return STATUS_IO_DEVICE_ERROR; } @@ -379,7 +378,7 @@ PAGED_CODE(); UNREFERENCED_PARAMETER(DriverObject);
- DPRINT("floppy: unloading\n"); + TRACE_(FLOPPY, "unloading\n");
KeSetEvent(&QueueThreadTerminate, 0, FALSE); KeWaitForSingleObject(QueueThreadObject, Executive, KernelMode, FALSE, 0); @@ -414,7 +413,7 @@ /* Power down the controller */ if(HwPowerOff(&gControllerInfo[i]) != STATUS_SUCCESS) { - DPRINT("floppy: unload: warning: HwPowerOff failed\n"); + WARN_(FLOPPY, "unload: warning: HwPowerOff failed\n"); } } } @@ -483,7 +482,7 @@ UNREFERENCED_PARAMETER(PathName);
- DPRINT("floppy: ConfigCallback called with ControllerNumber %d\n", ControllerNumber); + TRACE_(FLOPPY, "ConfigCallback called with ControllerNumber %d\n", ControllerNumber);
gControllerInfo[gNumberOfControllers].ControllerNumber = ControllerNumber; gControllerInfo[gNumberOfControllers].InterfaceType = BusType; @@ -514,7 +513,7 @@
if(!HalTranslateBusAddress(BusType, BusNumber, PartialDescriptor->u.Port.Start, &AddressSpace, &TranslatedAddress)) { - DPRINT("floppy: HalTranslateBusAddress failed; returning\n"); + WARN_(FLOPPY, "HalTranslateBusAddress failed; returning\n"); return STATUS_IO_DEVICE_ERROR; }
@@ -606,7 +605,7 @@
ASSERT(ControllerInfo);
- DPRINT("floppy: ISR called\n"); + TRACE_(FLOPPY, "ISR called\n");
/* * Due to the stupidity of the drive/controller relationship on the floppy drive, only one device object @@ -650,7 +649,7 @@
ASSERT(ControllerInfo);
- DPRINT("floppy: DpcForIsr called\n"); + TRACE_(FLOPPY, "DpcForIsr called\n");
KeSetEvent(&ControllerInfo->SynchEvent, EVENT_INCREMENT, FALSE); } @@ -674,45 +673,45 @@ PAGED_CODE(); ASSERT(ControllerInfo);
- DPRINT("floppy: InitController called with Controller 0x%p\n", ControllerInfo); + TRACE_(FLOPPY, "InitController called with Controller 0x%p\n", ControllerInfo);
KeClearEvent(&ControllerInfo->SynchEvent);
- DPRINT("floppy: InitController: resetting the controller\n"); + INFO_(FLOPPY, "InitController: resetting the controller\n");
/* Reset the controller */ if(HwReset(ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: unable to reset controller\n"); + WARN_(FLOPPY, "InitController: unable to reset controller\n"); return STATUS_IO_DEVICE_ERROR; }
/* Check if floppy drive exists */ if(HwSenseInterruptStatus(ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: Floppy drive not detected! Returning STATUS_IO_DEVICE_ERROR\n"); + WARN_(FLOPPY, "Floppy drive not detected! Returning STATUS_IO_DEVICE_ERROR\n"); return STATUS_IO_DEVICE_ERROR; }
-DPRINT("floppy: InitController: resetting the controller after floppy detection\n"); + INFO_(FLOPPY, "InitController: resetting the controller after floppy detection\n");
/* Reset the controller */ if(HwReset(ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: unable to reset controller\n"); + WARN_(FLOPPY, "InitController: unable to reset controller\n"); return STATUS_IO_DEVICE_ERROR; }
- DPRINT("floppy: InitController: setting data rate\n"); + INFO_(FLOPPY, "InitController: setting data rate\n");
/* Set data rate */ if(HwSetDataRate(ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: unable to set data rate\n"); + WARN_(FLOPPY, "InitController: unable to set data rate\n"); return STATUS_IO_DEVICE_ERROR; }
- DPRINT("floppy: InitController: waiting for initial interrupt\n"); + INFO_(FLOPPY, "InitController: waiting for initial interrupt\n");
/* Wait for an interrupt */ WaitForControllerInterrupt(ControllerInfo); @@ -720,16 +719,16 @@ /* Reset means you have to clear each of the four interrupts (one per drive) */ for(i = 0; i < MAX_DRIVES_PER_CONTROLLER; i++) { - DPRINT("floppy: InitController: Sensing interrupt %d\n", i); + INFO_(FLOPPY, "InitController: Sensing interrupt %d\n", i);
if(HwSenseInterruptStatus(ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: Unable to clear interrupt 0x%x\n", i); + WARN_(FLOPPY, "InitController: Unable to clear interrupt 0x%x\n", i); return STATUS_IO_DEVICE_ERROR; } }
- DPRINT("floppy: InitController: done sensing interrupts\n"); + INFO_(FLOPPY, "InitController: done sensing interrupts\n");
/* Next, see if we have the right version to do implied seek */ if(HwGetVersion(ControllerInfo) == VERSION_ENHANCED) @@ -737,12 +736,12 @@ /* If so, set that up -- all defaults below except first TRUE for EIS */ if(HwConfigure(ControllerInfo, TRUE, TRUE, FALSE, 0, 0) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: unable to set up implied seek\n"); + WARN_(FLOPPY, "InitController: unable to set up implied seek\n"); ControllerInfo->ImpliedSeeks = FALSE; } else { - DPRINT("floppy: InitController: implied seeks set!\n"); + INFO_(FLOPPY, "InitController: implied seeks set!\n"); ControllerInfo->ImpliedSeeks = TRUE; }
@@ -769,23 +768,23 @@ } else { - DPRINT("floppy: InitController: enhanced version not supported; disabling implied seeks\n"); + INFO_(FLOPPY, "InitController: enhanced version not supported; disabling implied seeks\n"); ControllerInfo->ImpliedSeeks = FALSE; ControllerInfo->Model30 = FALSE; }
/* Specify */ - DPRINT("FLOPPY: FIXME: Figure out speed\n"); + WARN_(FLOPPY, "FIXME: Figure out speed\n"); HeadLoadTime = SPECIFY_HLT_500K; HeadUnloadTime = SPECIFY_HUT_500K; StepRateTime = SPECIFY_SRT_500K;
- DPRINT("floppy: InitController: issuing specify command to controller\n"); + INFO_(FLOPPY, "InitController: issuing specify command to controller\n");
/* Don't disable DMA --> enable dma (dumb & confusing) */ if(HwSpecify(ControllerInfo, HeadLoadTime, HeadUnloadTime, StepRateTime, FALSE) != STATUS_SUCCESS) { - DPRINT("floppy: InitController: unable to specify options\n"); + WARN_(FLOPPY, "InitController: unable to specify options\n"); return STATUS_IO_DEVICE_ERROR; }
@@ -801,11 +800,11 @@ */ for(i = 0; i < ControllerInfo->NumberOfDrives; i++) { - DPRINT("floppy: InitController: recalibrating drive 0x%x on controller 0x%p\n", i, ControllerInfo); + INFO_(FLOPPY, "InitController: recalibrating drive 0x%x on controller 0x%p\n", i, ControllerInfo); Recalibrate(&ControllerInfo->DriveInfo[i]); }
- DPRINT("floppy: InitController: done initializing; returning STATUS_SUCCESS\n"); + INFO_(FLOPPY, "InitController: done initializing; returning STATUS_SUCCESS\n");
return STATUS_SUCCESS; } @@ -847,7 +846,7 @@ */ if(!gControllerInfo[0].Populated) { - DPRINT("floppy: AddControllers: failed to get controller info from registry\n"); + WARN_(FLOPPY, "AddControllers: failed to get controller info from registry\n"); return FALSE; }
@@ -865,7 +864,7 @@ /* Must set up the DPC before we connect the interrupt */ KeInitializeDpc(&gControllerInfo[i].Dpc, DpcForIsr, &gControllerInfo[i]);
- DPRINT("floppy: Connecting interrupt %d to controller%d (object 0x%p)\n", gControllerInfo[i].MappedVector, + INFO_(FLOPPY, "Connecting interrupt %d to controller%d (object 0x%p)\n", gControllerInfo[i].MappedVector, i, &gControllerInfo[i]);
/* NOTE: We cannot share our interrupt, even on level-triggered buses. See Isr() for details. */ @@ -873,7 +872,7 @@ gControllerInfo[i].MappedLevel, gControllerInfo[i].MappedLevel, gControllerInfo[i].InterruptMode, FALSE, Affinity, 0) != STATUS_SUCCESS) { - DPRINT("floppy: AddControllers: unable to connect interrupt\n"); + WARN_(FLOPPY, "AddControllers: unable to connect interrupt\n"); continue; }
@@ -892,7 +891,7 @@
if(!gControllerInfo[i].AdapterObject) { - DPRINT("floppy: AddControllers: unable to allocate an adapter object\n"); + WARN_(FLOPPY, "AddControllers: unable to allocate an adapter object\n"); IoDisconnectInterrupt(gControllerInfo[i].InterruptObject); continue; } @@ -900,7 +899,7 @@ /* 2b: Initialize the new controller */ if(InitController(&gControllerInfo[i]) != STATUS_SUCCESS) { - DPRINT("floppy: AddControllers():Unable to set up controller %d - initialization failed\n", i); + WARN_(FLOPPY, "AddControllers(): Unable to set up controller %d - initialization failed\n", i); IoDisconnectInterrupt(gControllerInfo[i].InterruptObject); continue; } @@ -917,7 +916,7 @@ UNICODE_STRING ArcPath; UCHAR DriveNumber;
- DPRINT("floppy: AddControllers(): Configuring drive %d on controller %d\n", i, j); + INFO_(FLOPPY, "AddControllers(): Configuring drive %d on controller %d\n", i, j);
/* * 3a: create a device object for the drive @@ -943,12 +942,12 @@ FILE_DEVICE_DISK, FILE_REMOVABLE_MEDIA | FILE_FLOPPY_DISKETTE, FALSE, &gControllerInfo[i].DriveInfo[j].DeviceObject) != STATUS_SUCCESS) { - DPRINT("floppy: AddControllers: unable to register a Device object\n"); + WARN_(FLOPPY, "AddControllers: unable to register a Device object\n"); IoDisconnectInterrupt(gControllerInfo[i].InterruptObject); continue; /* continue on to next drive */ }
- DPRINT("floppy: AddControllers: New device: %S (0x%p)\n", DeviceNameBuf, gControllerInfo[i].DriveInfo[j].DeviceObject); + INFO_(FLOPPY, "AddControllers: New device: %S (0x%p)\n", DeviceNameBuf, gControllerInfo[i].DriveInfo[j].DeviceObject);
/* 3b.5: Create an ARC path in case we're booting from this drive */ swprintf(gControllerInfo[i].DriveInfo[j].ArcPathBuffer, @@ -965,7 +964,7 @@ RtlInitUnicodeString(&LinkName, gControllerInfo[i].DriveInfo[j].SymLinkBuffer); if(IoCreateSymbolicLink(&LinkName, &DeviceName) != STATUS_SUCCESS) { - DPRINT("floppy: AddControllers: Unable to create a symlink for drive %d\n", DriveNumber); + WARN_(FLOPPY, "AddControllers: Unable to create a symlink for drive %d\n", DriveNumber); IoDisconnectInterrupt(gControllerInfo[i].InterruptObject); IoDeassignArcName(&ArcPath); continue; /* continue to next drive */ @@ -988,7 +987,7 @@ } }
- DPRINT("floppy: AddControllers: --------------------------------------------> finished adding controllers\n"); + INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
return TRUE; } @@ -1009,7 +1008,7 @@ { PDRIVE_INFO DriveInfo = DeviceObject->DeviceExtension;
- DPRINT("floppy: SignalMediaChanged called\n"); + TRACE_(FLOPPY, "SignalMediaChanged called\n");
DriveInfo->DiskChangeCount++;
@@ -1062,18 +1061,18 @@
if(KeReadStateEvent(&QueueThreadTerminate)) { - DPRINT("floppy: QueueThread terminating\n"); + INFO_(FLOPPY, "QueueThread terminating\n"); return; }
- DPRINT("floppy: QueueThread: servicing an IRP\n"); + INFO_(FLOPPY, "QueueThread: servicing an IRP\n");
Irp = IoCsqRemoveNextIrp(&Csq, 0);
/* we won't get an irp if it was canceled */ if(!Irp) { - DPRINT("floppy: QueueThread: IRP queue empty\n"); + INFO_(FLOPPY, "QueueThread: IRP queue empty\n"); continue; }
@@ -1096,7 +1095,7 @@ break;
default: - DPRINT("floppy: QueueThread(): Unrecognized irp: mj: 0x%x\n", Stack->MajorFunction); + WARN_(FLOPPY, "QueueThread(): Unrecognized irp: mj: 0x%x\n", Stack->MajorFunction); Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -1173,13 +1172,13 @@ */ if(PsCreateSystemThread(&ThreadHandle, THREAD_ALL_ACCESS, 0, 0, 0, QueueThread, 0) != STATUS_SUCCESS) { - DPRINT("floppy: Unable to create system thread; failing init\n"); + WARN_(FLOPPY, "Unable to create system thread; failing init\n"); return STATUS_INSUFFICIENT_RESOURCES; }
if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL, KernelMode, &QueueThreadObject, NULL) != STATUS_SUCCESS) { - DPRINT("floppy: Unable to reference returned thread handle; failing init\n"); + WARN_(FLOPPY, "Unable to reference returned thread handle; failing init\n"); return STATUS_UNSUCCESSFUL; }
Modified: trunk/reactos/drivers/storage/floppy/hardware.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/hard... ============================================================================== --- trunk/reactos/drivers/storage/floppy/hardware.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/floppy/hardware.c [iso-8859-1] Mon May 19 15:34:04 2008 @@ -49,7 +49,6 @@ */
#include <ntddk.h> -#define NDEBUG #include <debug.h>
#include "floppy.h" @@ -183,7 +182,7 @@ return STATUS_SUCCESS; }
- DPRINT("floppy: Send_Byte: timed out trying to write\n"); + INFO_(FLOPPY, "Send_Byte: timed out trying to write\n"); HwDumpRegisters(ControllerInfo); return STATUS_UNSUCCESSFUL; } @@ -252,7 +251,7 @@ return STATUS_SUCCESS; }
- DPRINT("floppy: Get_Byte: timed out trying to read\n"); + WARN_(FLOPPY, "Get_Byte: timed out trying to read\n"); HwDumpRegisters(ControllerInfo); return STATUS_UNSUCCESSFUL; } @@ -269,7 +268,7 @@ * STATUS_SUCCESS */ { - DPRINT("floppy: HwSetDataRate called; writing rate code 0x%x to offset 0x%x\n", DataRate, DATA_RATE_SELECT_REGISTER); + TRACE_(FLOPPY, "HwSetDataRate called; writing rate code 0x%x to offset 0x%x\n", DataRate, DATA_RATE_SELECT_REGISTER);
WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DATA_RATE_SELECT_REGISTER, DataRate);
@@ -290,7 +289,7 @@ * - Called at DISPATCH_LEVEL */ { - DPRINT("floppy: HwTurnOffMotor: writing byte 0x%x to offset 0x%x\n", DOR_FDC_ENABLE|DOR_DMA_IO_INTERFACE_ENABLE, DIGITAL_OUTPUT_REGISTER); + TRACE_(FLOPPY, "HwTurnOffMotor: writing byte 0x%x to offset 0x%x\n", DOR_FDC_ENABLE|DOR_DMA_IO_INTERFACE_ENABLE, DIGITAL_OUTPUT_REGISTER);
WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER, DOR_FDC_ENABLE|DOR_DMA_IO_INTERFACE_ENABLE);
@@ -332,7 +331,7 @@ else if (Unit == 3) Buffer |= DOR_FLOPPY_MOTOR_ON_D;
- DPRINT("floppy: HwTurnOnMotor: writing byte 0x%x to offset 0x%x\n", Buffer, DIGITAL_OUTPUT_REGISTER); + TRACE_(FLOPPY, "HwTurnOnMotor: writing byte 0x%x to offset 0x%x\n", Buffer, DIGITAL_OUTPUT_REGISTER); WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER, Buffer);
return STATUS_SUCCESS; @@ -357,7 +356,7 @@
PAGED_CODE();
- DPRINT("floppy: HwSenseDriveStatus called\n"); + TRACE_(FLOPPY, "HwSenseDriveStatus called\n");
Buffer[0] = COMMAND_SENSE_DRIVE_STATUS; Buffer[1] = DriveInfo->UnitNumber; /* hard-wired to head 0 for now */ @@ -365,7 +364,7 @@ for(i = 0; i < 2; i++) if(Send_Byte(DriveInfo->ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwSenseDriveStatus: failed to write FIFO\n"); + WARN_(FLOPPY, "HwSenseDriveStatus: failed to write FIFO\n"); return STATUS_UNSUCCESSFUL; }
@@ -431,11 +430,11 @@ /* Send the command */ for(i = 0; i < 9; i++) { - DPRINT("floppy: HwReadWriteData: Sending a command byte to the FIFO: 0x%x\n", Buffer[i]); + INFO_(FLOPPY, "HwReadWriteData: Sending a command byte to the FIFO: 0x%x\n", Buffer[i]);
if(Send_Byte(ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("HwReadWriteData: Unable to write to the FIFO\n"); + WARN_(FLOPPY, "HwReadWriteData: Unable to write to the FIFO\n"); return STATUS_UNSUCCESSFUL; } } @@ -467,19 +466,19 @@
if(Send_Byte(ControllerInfo, COMMAND_SENSE_INTERRUPT_STATUS) != STATUS_SUCCESS) { - DPRINT("floppy: HwRecalibrateResult: Unable to write the controller\n"); + WARN_(FLOPPY, "HwRecalibrateResult: Unable to write the controller\n"); return STATUS_UNSUCCESSFUL; }
for(i = 0; i < 2; i++) if(Get_Byte(ControllerInfo, &Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwRecalibrateResult: unable to read FIFO\n"); + WARN_(FLOPPY, "HwRecalibrateResult: unable to read FIFO\n"); return STATUS_UNSUCCESSFUL; }
/* Validate that it did what we told it to */ - DPRINT("floppy: HwRecalibrateResult results: ST0: 0x%x PCN: 0x%x\n", Buffer[0], Buffer[1]); + INFO_(FLOPPY, "HwRecalibrateResult results: ST0: 0x%x PCN: 0x%x\n", Buffer[0], Buffer[1]);
/* * Buffer[0] = ST0 @@ -489,20 +488,20 @@ /* Is the PCN 0? */ if(Buffer[1] != 0) { - DPRINT("floppy: HwRecalibrateResult: PCN not 0\n"); + WARN_(FLOPPY, "HwRecalibrateResult: PCN not 0\n"); return STATUS_UNSUCCESSFUL; }
/* test seek complete */ if((Buffer[0] & SR0_SEEK_COMPLETE) != SR0_SEEK_COMPLETE) { - DPRINT("floppy: HwRecalibrateResult: Failed to complete the seek\n"); + WARN_(FLOPPY, "HwRecalibrateResult: Failed to complete the seek\n"); return STATUS_UNSUCCESSFUL; }
/* Is the equipment check flag set? Could be no disk in drive... */ if((Buffer[0] & SR0_EQUIPMENT_CHECK) == SR0_EQUIPMENT_CHECK) - DPRINT("floppy: HwRecalibrateResult: Seeked to track 0 successfully, but EC is set; returning STATUS_SUCCESS anyway\n"); + INFO_(FLOPPY, "HwRecalibrateResult: Seeked to track 0 successfully, but EC is set; returning STATUS_SUCCESS anyway\n");
return STATUS_SUCCESS; } @@ -532,12 +531,12 @@ for(i = 0; i < 7; i++) if(Get_Byte(ControllerInfo, &Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwReadWriteResult: unable to read fifo\n"); + WARN_(FLOPPY, "HwReadWriteResult: unable to read fifo\n"); return STATUS_UNSUCCESSFUL; }
/* Validate that it did what we told it to */ - DPRINT("floppy: HwReadWriteResult results: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Buffer[0], Buffer[1], Buffer[2], Buffer[3], + INFO_(FLOPPY, "HwReadWriteResult results: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Buffer[0], Buffer[1], Buffer[2], Buffer[3], Buffer[4], Buffer[5], Buffer[6]);
/* Last command successful? */ @@ -565,7 +564,7 @@ UCHAR Buffer[2]; int i;
- DPRINT("floppy: HwRecalibrate called\n"); + TRACE_(FLOPPY, "HwRecalibrate called\n");
PAGED_CODE();
@@ -575,7 +574,7 @@ for(i = 0; i < 2; i++) if(Send_Byte(ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwRecalibrate: unable to write FIFO\n"); + WARN_(FLOPPY, "HwRecalibrate: unable to write FIFO\n"); return STATUS_UNSUCCESSFUL; }
@@ -600,7 +599,7 @@
if(Send_Byte(ControllerInfo, COMMAND_SENSE_INTERRUPT_STATUS) != STATUS_SUCCESS) { - DPRINT("floppy: HwSenseInterruptStatus: failed to write controller\n"); + WARN_(FLOPPY, "HwSenseInterruptStatus: failed to write controller\n"); return STATUS_UNSUCCESSFUL; }
@@ -608,12 +607,12 @@ { if(Get_Byte(ControllerInfo, &Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwSenseInterruptStatus: failed to read controller\n"); + WARN_(FLOPPY, "HwSenseInterruptStatus: failed to read controller\n"); return STATUS_UNSUCCESSFUL; } }
- DPRINT("floppy: HwSenseInterruptStatus returned 0x%x 0x%x\n", Buffer[0], Buffer[1]); + INFO_(FLOPPY, "HwSenseInterruptStatus returned 0x%x 0x%x\n", Buffer[0], Buffer[1]);
return STATUS_SUCCESS; } @@ -635,7 +634,7 @@ UCHAR Buffer[2]; int i;
- DPRINT("floppy: HwReadId called\n"); + TRACE_(FLOPPY, "HwReadId called\n");
PAGED_CODE();
@@ -645,7 +644,7 @@ for(i = 0; i < 2; i++) if(Send_Byte(DriveInfo->ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwReadId: unable to send bytes to fifo\n"); + WARN_(FLOPPY, "HwReadId: unable to send bytes to fifo\n"); return STATUS_UNSUCCESSFUL; }
@@ -678,7 +677,7 @@ UCHAR Buffer[6]; int i;
- DPRINT("floppy: HwFormatTrack called\n"); + TRACE_(FLOPPY, "HwFormatTrack called\n");
PAGED_CODE();
@@ -692,7 +691,7 @@ for(i = 0; i < 6; i++) if(Send_Byte(ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwFormatTrack: unable to send bytes to floppy\n"); + WARN_(FLOPPY, "HwFormatTrack: unable to send bytes to floppy\n"); return STATUS_UNSUCCESSFUL; }
@@ -718,7 +717,7 @@ UCHAR Buffer[3]; int i;
- DPRINT("floppy: HwSeek called for cyl 0x%x\n", Cylinder); + TRACE_(FLOPPY, "HwSeek called for cyl 0x%x\n", Cylinder);
PAGED_CODE();
@@ -729,7 +728,7 @@ for(i = 0; i < 3; i++) if(Send_Byte(DriveInfo->ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwSeek: failed to write fifo\n"); + WARN_(FLOPPY, "HwSeek: failed to write fifo\n"); return STATUS_UNSUCCESSFUL; }
@@ -769,7 +768,7 @@ UCHAR Buffer[4]; int i;
- DPRINT("floppy: HwConfigure called\n"); + TRACE_(FLOPPY, "HwConfigure called\n");
PAGED_CODE();
@@ -781,7 +780,7 @@ for(i = 0; i < 4; i++) if(Send_Byte(ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwConfigure: failed to write the fifo\n"); + WARN_(FLOPPY, "HwConfigure: failed to write the fifo\n"); return STATUS_UNSUCCESSFUL; }
@@ -809,17 +808,17 @@
if(Send_Byte(ControllerInfo, COMMAND_VERSION) != STATUS_SUCCESS) { - DPRINT("floppy: HwGetVersion: unable to write fifo\n"); + WARN_(FLOPPY, "HwGetVersion: unable to write fifo\n"); return STATUS_UNSUCCESSFUL; }
if(Get_Byte(ControllerInfo, &Buffer) != STATUS_SUCCESS) { - DPRINT("floppy: HwGetVersion: unable to write fifo\n"); + WARN_(FLOPPY, "HwGetVersion: unable to write fifo\n"); return STATUS_UNSUCCESSFUL; }
- DPRINT("floppy: HwGetVersion returning version 0x%x\n", Buffer); + INFO_(FLOPPY, "HwGetVersion returning version 0x%x\n", Buffer);
return Buffer; } @@ -843,18 +842,18 @@
Buffer = READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_INPUT_REGISTER);
- DPRINT("floppy: HwDiskChanged: read 0x%x from DIR\n", Buffer); + TRACE_(FLOPPY, "HwDiskChanged: read 0x%x from DIR\n", Buffer);
if(ControllerInfo->Model30) { if(!(Buffer & DIR_DISKETTE_CHANGE)) { - DPRINT("floppy: HdDiskChanged - Model30 - returning TRUE\n"); + INFO_(FLOPPY, "HdDiskChanged - Model30 - returning TRUE\n"); *DiskChanged = TRUE; } else { - DPRINT("floppy: HdDiskChanged - Model30 - returning FALSE\n"); + INFO_(FLOPPY, "HdDiskChanged - Model30 - returning FALSE\n"); *DiskChanged = FALSE; } } @@ -862,12 +861,12 @@ { if(Buffer & DIR_DISKETTE_CHANGE) { - DPRINT("floppy: HdDiskChanged - PS2 - returning TRUE\n"); + INFO_(FLOPPY, "HdDiskChanged - PS2 - returning TRUE\n"); *DiskChanged = TRUE; } else { - DPRINT("floppy: HdDiskChanged - PS2 - returning FALSE\n"); + INFO_(FLOPPY, "HdDiskChanged - PS2 - returning FALSE\n"); *DiskChanged = FALSE; } } @@ -893,11 +892,11 @@
if(Get_Byte(ControllerInfo, Status) != STATUS_SUCCESS) { - DPRINT("floppy: HwSenseDriveStatus: unable to read fifo\n"); + WARN_(FLOPPY, "HwSenseDriveStatus: unable to read fifo\n"); return STATUS_UNSUCCESSFUL; }
- DPRINT("floppy: HwSenseDriveStatusResult: ST3: 0x%x\n", *Status); + TRACE_(FLOPPY, "HwSenseDriveStatusResult: ST3: 0x%x\n", *Status);
return STATUS_SUCCESS; } @@ -931,25 +930,25 @@ for(i = 0; i < 7; i++) if(Get_Byte(ControllerInfo, &Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: ReadIdResult(): can't read from the controller\n"); + WARN_(FLOPPY, "ReadIdResult(): can't read from the controller\n"); return STATUS_UNSUCCESSFUL; }
/* Validate that it did what we told it to */ - DPRINT("floppy: ReadId results: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Buffer[0], Buffer[1], Buffer[2], Buffer[3], + INFO_(FLOPPY, "ReadId results: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Buffer[0], Buffer[1], Buffer[2], Buffer[3], Buffer[4], Buffer[5], Buffer[6]);
/* Last command successful? */ if((Buffer[0] & SR0_LAST_COMMAND_STATUS) != SR0_LCS_SUCCESS) { - DPRINT("floppy: ReadId didn't return last command success\n"); + WARN_(FLOPPY, "ReadId didn't return last command success\n"); return STATUS_UNSUCCESSFUL; }
/* ID mark found? */ if(Buffer[1] & SR1_CANNOT_FIND_ID_ADDRESS) { - DPRINT("floppy: ReadId didn't find an address mark\n"); + WARN_(FLOPPY, "ReadId didn't find an address mark\n"); return STATUS_UNSUCCESSFUL; }
@@ -996,13 +995,13 @@ Buffer[1] = 0xdf; Buffer[2] = 0x2;
- //DPRINT("HwSpecify: sending 0x%x 0x%x 0x%x to FIFO\n", Buffer[0], Buffer[1], Buffer[2]); - DPRINT("FLOPPY: HWSPECIFY: FIXME - sending 0x3 0xd1 0x2 to FIFO\n"); + //INFO_(FLOPPY, "HwSpecify: sending 0x%x 0x%x 0x%x to FIFO\n", Buffer[0], Buffer[1], Buffer[2]); + WARN_(FLOPPY, "HWSPECIFY: FIXME - sending 0x3 0xd1 0x2 to FIFO\n");
for(i = 0; i < 3; i++) if(Send_Byte(ControllerInfo, Buffer[i]) != STATUS_SUCCESS) { - DPRINT("floppy: HwSpecify: unable to write to controller\n"); + WARN_(FLOPPY, "HwSpecify: unable to write to controller\n"); return STATUS_UNSUCCESSFUL; }
@@ -1021,7 +1020,7 @@ * - Generates an interrupt that must be serviced four times (one per drive) */ { - DPRINT("floppy: HwReset called\n"); + TRACE_(FLOPPY, "HwReset called\n");
/* Write the reset bit in the DRSR */ WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DATA_RATE_SELECT_REGISTER, DRSR_SW_RESET); @@ -1030,13 +1029,13 @@ if(!(READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER) & DOR_RESET)) { HwDumpRegisters(ControllerInfo); - DPRINT("floppy: HwReset: Setting Enable bit\n"); + INFO_(FLOPPY, "HwReset: Setting Enable bit\n"); WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER, DOR_DMA_IO_INTERFACE_ENABLE|DOR_RESET); HwDumpRegisters(ControllerInfo);
if(!(READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER) & DOR_RESET)) { - DPRINT("floppy: HwReset: failed to set the DOR enable bit!\n"); + WARN_(FLOPPY, "HwReset: failed to set the DOR enable bit!\n"); HwDumpRegisters(ControllerInfo); return STATUS_UNSUCCESSFUL; } @@ -1057,7 +1056,7 @@ * - Wake up with a hardware reset */ { - DPRINT("floppy: HwPowerOff called on controller 0x%p\n", ControllerInfo); + TRACE_(FLOPPY, "HwPowerOff called on controller 0x%p\n", ControllerInfo);
WRITE_PORT_UCHAR(ControllerInfo->BaseAddress + DATA_RATE_SELECT_REGISTER, DRSR_POWER_DOWN);
@@ -1073,11 +1072,11 @@ { UNREFERENCED_PARAMETER(ControllerInfo);
- DPRINT("floppy: STATUS: "); - DPRINT("STATUS_REGISTER_A = 0x%x ", READ_PORT_UCHAR(ControllerInfo->BaseAddress + STATUS_REGISTER_A)); - DPRINT("STATUS_REGISTER_B = 0x%x ", READ_PORT_UCHAR(ControllerInfo->BaseAddress + STATUS_REGISTER_B)); - DPRINT("DIGITAL_OUTPUT_REGISTER = 0x%x ", READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER)); - DPRINT("MAIN_STATUS_REGISTER =0x%x ", READ_PORT_UCHAR(ControllerInfo->BaseAddress + MAIN_STATUS_REGISTER)); - DPRINT("DIGITAL_INPUT_REGISTER = 0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_INPUT_REGISTER)); -} - + INFO_(FLOPPY, "STATUS:\n"); + INFO_(FLOPPY, "STATUS_REGISTER_A = 0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + STATUS_REGISTER_A)); + INFO_(FLOPPY, "STATUS_REGISTER_B = 0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + STATUS_REGISTER_B)); + INFO_(FLOPPY, "DIGITAL_OUTPUT_REGISTER = 0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_OUTPUT_REGISTER)); + INFO_(FLOPPY, "MAIN_STATUS_REGISTER =0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + MAIN_STATUS_REGISTER)); + INFO_(FLOPPY, "DIGITAL_INPUT_REGISTER = 0x%x\n", READ_PORT_UCHAR(ControllerInfo->BaseAddress + DIGITAL_INPUT_REGISTER)); +} +
Modified: trunk/reactos/drivers/storage/floppy/ioctl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/ioct... ============================================================================== --- trunk/reactos/drivers/storage/floppy/ioctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/floppy/ioctl.c [iso-8859-1] Mon May 19 15:34:04 2008 @@ -32,7 +32,6 @@ */
#include <ntddk.h> -#define NDEBUG #include <debug.h>
#include "floppy.h" @@ -81,7 +80,7 @@ ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode; BOOLEAN DiskChanged;
- DPRINT("floppy: DeviceIoctl called\n"); + TRACE_(FLOPPY, "DeviceIoctl called\n"); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0;
@@ -91,11 +90,11 @@ if(Code == IOCTL_DISK_GET_MEDIA_TYPES) { PDISK_GEOMETRY Geometry = OutputBuffer; - DPRINT("floppy: IOCTL_DISK_GET_MEDIA_TYPES Called\n"); + INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES Called\n");
if(OutputLength < sizeof(DISK_GEOMETRY)) { - DPRINT("floppy: IOCTL_DISK_GET_MEDIA_TYPES: insufficient buffer; returning STATUS_INVALID_PARAMETER\n"); + INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES: insufficient buffer; returning STATUS_INVALID_PARAMETER\n"); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; IoCompleteRequest(Irp, IO_NO_INCREMENT); return; @@ -112,7 +111,7 @@
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = sizeof(DISK_GEOMETRY); - DPRINT("floppy: Ioctl: completing with STATUS_SUCCESS\n"); + INFO_(FLOPPY, "Ioctl: completing with STATUS_SUCCESS\n"); IoCompleteRequest(Irp, IO_NO_INCREMENT);
return; @@ -129,7 +128,7 @@ */ if(DriveInfo->DeviceObject->Flags & DO_VERIFY_VOLUME && !(DriveInfo->DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME)) { - DPRINT("floppy: DeviceIoctl(): completing with STATUS_VERIFY_REQUIRED\n"); + INFO_(FLOPPY, "DeviceIoctl(): completing with STATUS_VERIFY_REQUIRED\n"); Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -146,7 +145,7 @@ */ if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS) { - DPRINT("floppy: DeviceIoctl(): unable to sense disk change; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "DeviceIoctl(): unable to sense disk change; completing with STATUS_UNSUCCESSFUL\n"); Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -156,7 +155,7 @@
if(DiskChanged) { - DPRINT("floppy: DeviceIoctl(): detected disk changed; signalling media change and completing\n"); + INFO_(FLOPPY, "DeviceIoctl(): detected disk changed; signalling media change and completing\n"); SignalMediaChanged(DriveInfo->DeviceObject, Irp);
/* @@ -179,14 +178,14 @@ { UCHAR Status;
- DPRINT("floppy: IOCTL_DISK_IS_WRITABLE Called\n"); + INFO_(FLOPPY, "IOCTL_DISK_IS_WRITABLE Called\n");
/* This IRP always has 0 information */ Irp->IoStatus.Information = 0;
if(HwSenseDriveStatus(DriveInfo) != STATUS_SUCCESS) { - DPRINT("floppy: IoctlDiskIsWritable(): unable to sense drive status\n"); + WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to sense drive status\n"); Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR; break; } @@ -194,7 +193,7 @@ /* Now, read the drive's status back */ if(HwSenseDriveStatusResult(DriveInfo->ControllerInfo, &Status) != STATUS_SUCCESS) { - DPRINT("floppy: IoctlDiskIsWritable(): unable to read drive status result\n"); + WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to read drive status result\n"); Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR; break; } @@ -202,7 +201,7 @@ /* Check to see if the write flag is set. */ if(Status & SR3_WRITE_PROTECT_STATUS_SIGNAL) { - DPRINT("floppy: IOCTL_DISK_IS_WRITABLE: disk is write protected\n"); + INFO_(FLOPPY, "IOCTL_DISK_IS_WRITABLE: disk is write protected\n"); Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED; } else @@ -211,7 +210,7 @@ break;
case IOCTL_DISK_CHECK_VERIFY: - DPRINT("floppy: IOCTL_DISK_CHECK_VERIFY called\n"); + INFO_(FLOPPY, "IOCTL_DISK_CHECK_VERIFY called\n"); if (OutputLength != 0) { if (OutputLength < sizeof(ULONG)) @@ -235,7 +234,7 @@
case IOCTL_DISK_GET_DRIVE_GEOMETRY: { - DPRINT("floppy: IOCTL_DISK_GET_DRIVE_GEOMETRY Called\n"); + INFO_(FLOPPY, "IOCTL_DISK_GET_DRIVE_GEOMETRY Called\n"); if(OutputLength < sizeof(DISK_GEOMETRY)) { Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; @@ -250,23 +249,23 @@
case IOCTL_DISK_FORMAT_TRACKS: case IOCTL_DISK_FORMAT_TRACKS_EX: - DPRINT("floppy: Format called; not supported yet\n"); + ERR_(FLOPPY, "Format called; not supported yet\n"); break;
case IOCTL_DISK_GET_PARTITION_INFO: - DPRINT("floppy: IOCTL_DISK_GET_PARTITION_INFO Called; not supported\n"); + INFO_(FLOPPY, "IOCTL_DISK_GET_PARTITION_INFO Called; not supported\n"); Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = 0; break;
default: - DPRINT("floppy: UNKNOWN IOCTL CODE: 0x%x\n", Code); + ERR_(FLOPPY, "UNKNOWN IOCTL CODE: 0x%x\n", Code); Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = 0; break; }
- DPRINT("floppy: ioctl: completing with status 0x%x\n", Irp->IoStatus.Status); + INFO_(FLOPPY, "ioctl: completing with status 0x%x\n", Irp->IoStatus.Status); IoCompleteRequest(Irp, IO_NO_INCREMENT);
StopMotor(DriveInfo->ControllerInfo);
Modified: trunk/reactos/drivers/storage/floppy/readwrite.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/read... ============================================================================== --- trunk/reactos/drivers/storage/floppy/readwrite.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/floppy/readwrite.c [iso-8859-1] Mon May 19 15:34:04 2008 @@ -53,7 +53,6 @@ */
#include <ntddk.h> -#define NDEBUG #include <debug.h>
#include "floppy.h" @@ -82,7 +81,7 @@ UNREFERENCED_PARAMETER(DeviceObject); UNREFERENCED_PARAMETER(Irp);
- DPRINT("floppy: MapRegisterCallback Called\n"); + TRACE_(FLOPPY, "MapRegisterCallback Called\n");
ControllerInfo->MapRegisterBase = MapRegisterBase; KeSetEvent(&ControllerInfo->SynchEvent, 0, FALSE); @@ -108,14 +107,14 @@ * it onto the irp queue */ { - DPRINT("floppy: ReadWrite called\n"); + TRACE_(FLOPPY, "ReadWrite called\n");
ASSERT(DeviceObject); ASSERT(Irp);
if(!Irp->MdlAddress) { - DPRINT("floppy: ReadWrite(): MDL not found in IRP - Completing with STATUS_INVALID_PARAMETER\n"); + WARN_(FLOPPY, "ReadWrite(): MDL not found in IRP - Completing with STATUS_INVALID_PARAMETER\n"); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -176,7 +175,7 @@
PAGED_CODE();
- DPRINT("floppy: RWDetermineMediaType called\n"); + TRACE_(FLOPPY, "RWDetermineMediaType called\n");
/* * This algorithm assumes that a 1.44MB floppy is in the drive. If it's not, @@ -191,7 +190,7 @@ /* Program data rate */ if(HwSetDataRate(DriveInfo->ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS) { - DPRINT("floppy: RWDetermineMediaType(): unable to set data rate\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): unable to set data rate\n"); return STATUS_UNSUCCESSFUL; }
@@ -203,7 +202,7 @@ /* Don't disable DMA --> enable dma (dumb & confusing) */ if(HwSpecify(DriveInfo->ControllerInfo, HeadLoadTime, HeadUnloadTime, StepRateTime, FALSE) != STATUS_SUCCESS) { - DPRINT("floppy: RWDetermineMediaType(): specify failed\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): specify failed\n"); return STATUS_UNSUCCESSFUL; }
@@ -217,7 +216,7 @@
if(HwRecalibrate(DriveInfo) != STATUS_SUCCESS) { - DPRINT("floppy: RWDetermineMediaType(): Recalibrate failed\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): Recalibrate failed\n"); return STATUS_UNSUCCESSFUL; }
@@ -231,7 +230,7 @@
if(i == 1) /* failed for 2nd time */ { - DPRINT("floppy: RWDetermineMediaType(): RecalibrateResult failed\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): RecalibrateResult failed\n"); return STATUS_UNSUCCESSFUL; } } @@ -242,7 +241,7 @@ /* Try to read an ID */ if(HwReadId(DriveInfo, 0) != STATUS_SUCCESS) /* read the first ID we find, from head 0 */ { - DPRINT("floppy: RWDetermineMediaType(): ReadId failed\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): ReadId failed\n"); return STATUS_UNSUCCESSFUL; /* if we can't even write to the controller, it's hopeless */ }
@@ -251,13 +250,13 @@
if(HwReadIdResult(DriveInfo->ControllerInfo, NULL, NULL) != STATUS_SUCCESS) { - DPRINT("floppy: RWDetermineMediaType(): ReadIdResult failed; continuing\n"); + WARN_(FLOPPY, "RWDetermineMediaType(): ReadIdResult failed; continuing\n"); continue; }
/* Found the media; populate the geometry now */ - DPRINT("FIXME: Hardcoded media type!\n"); - DPRINT("floppy: RWDetermineMediaType(): Found 1.44 media; returning success\n"); + WARN_(FLOPPY, "Hardcoded media type!\n"); + INFO_(FLOPPY, "RWDetermineMediaType(): Found 1.44 media; returning success\n"); DriveInfo->DiskGeometry.MediaType = GEOMETRY_144_MEDIATYPE; DriveInfo->DiskGeometry.Cylinders.QuadPart = GEOMETRY_144_CYLINDERS; DriveInfo->DiskGeometry.TracksPerCylinder = GEOMETRY_144_TRACKSPERCYLINDER; @@ -268,7 +267,7 @@ } while(FALSE);
- DPRINT("floppy: RWDetermineMediaType(): failed to find media\n"); + TRACE_(FLOPPY, "RWDetermineMediaType(): failed to find media\n"); return STATUS_UNRECOGNIZED_MEDIA; }
@@ -291,7 +290,7 @@
PAGED_CODE();
- DPRINT("floppy: RWSeekToCylinder called drive 0x%p cylinder %d\n", DriveInfo, Cylinder); + TRACE_(FLOPPY, "RWSeekToCylinder called drive 0x%p cylinder %d\n", DriveInfo, Cylinder);
/* Clear any spurious interrupts */ KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent); @@ -299,7 +298,7 @@ /* queue seek command */ if(HwSeek(DriveInfo, Cylinder) != STATUS_SUCCESS) { - DPRINT("floppy: RWSeekToTrack(): unable to seek\n"); + WARN_(FLOPPY, "RWSeekToTrack(): unable to seek\n"); return STATUS_UNSUCCESSFUL; }
@@ -307,14 +306,14 @@
if(HwSenseInterruptStatus(DriveInfo->ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: RWSeekToTrack(): unable to get seek results\n"); + WARN_(FLOPPY, "RWSeekToTrack(): unable to get seek results\n"); return STATUS_UNSUCCESSFUL; }
/* read ID mark from head 0 to verify */ if(HwReadId(DriveInfo, 0) != STATUS_SUCCESS) { - DPRINT("floppy: RWSeekToTrack(): unable to queue ReadId\n"); + WARN_(FLOPPY, "RWSeekToTrack(): unable to queue ReadId\n"); return STATUS_UNSUCCESSFUL; }
@@ -322,17 +321,17 @@
if(HwReadIdResult(DriveInfo->ControllerInfo, &CurCylinder, NULL) != STATUS_SUCCESS) { - DPRINT("floppy: RWSeekToTrack(): unable to get ReadId result\n"); + WARN_(FLOPPY, "RWSeekToTrack(): unable to get ReadId result\n"); return STATUS_UNSUCCESSFUL; }
if(CurCylinder != Cylinder) { - DPRINT("floppy: RWSeekToTrack(): Seeek to track failed; current cylinder is 0x%x\n", CurCylinder); + WARN_(FLOPPY, "RWSeekToTrack(): Seeek to track failed; current cylinder is 0x%x\n", CurCylinder); return STATUS_UNSUCCESSFUL; }
- DPRINT("floppy: RWSeekToCylinder: returning successfully, now on cyl %d\n", Cylinder); + INFO_(FLOPPY, "RWSeekToCylinder: returning successfully, now on cyl %d\n", Cylinder);
return STATUS_SUCCESS; } @@ -363,7 +362,7 @@ ULONG AbsoluteSector; UCHAR SectorsPerCylinder = (UCHAR)DriveInfo->DiskGeometry.SectorsPerTrack * (UCHAR)DriveInfo->DiskGeometry.TracksPerCylinder;
- DPRINT("floppy: RWComputeCHS: Called with offset 0x%x\n", DiskByteOffset); + TRACE_(FLOPPY, "RWComputeCHS: Called with offset 0x%x\n", DiskByteOffset);
/* First calculate the 1-based "absolute sector" based on the byte offset */ ASSERT(!(DiskByteOffset % DriveInfo->DiskGeometry.BytesPerSector)); /* FIXME: Only handle full sector transfers atm */ @@ -383,7 +382,7 @@ */ *Sector = ((UCHAR)(AbsoluteSector % SectorsPerCylinder) + 1) - ((*Head) * (UCHAR)DriveInfo->DiskGeometry.SectorsPerTrack);
- DPRINT("floppy: RWComputeCHS: offset 0x%x is c:0x%x h:0x%x s:0x%x\n", DiskByteOffset, *Cylinder, *Head, *Sector); + INFO_(FLOPPY, "RWComputeCHS: offset 0x%x is c:0x%x h:0x%x s:0x%x\n", DiskByteOffset, *Cylinder, *Head, *Sector);
/* Sanity checking */ ASSERT(*Cylinder <= DriveInfo->DiskGeometry.Cylinders.QuadPart); @@ -437,7 +436,7 @@
PAGED_CODE();
- DPRINT("floppy: ReadWritePassive called to %s 0x%x bytes from offset 0x%x\n", + TRACE_(FLOPPY, "ReadWritePassive called to %s 0x%x bytes from offset 0x%x\n", (Stack->MajorFunction == IRP_MJ_READ ? "read" : "write"), (Stack->MajorFunction == IRP_MJ_READ ? Stack->Parameters.Read.Length : Stack->Parameters.Write.Length), (Stack->MajorFunction == IRP_MJ_READ ? Stack->Parameters.Read.ByteOffset.u.LowPart : @@ -453,7 +452,7 @@ */ if(DeviceObject->Flags & DO_VERIFY_VOLUME && !(DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME)) { - DPRINT("floppy: ReadWritePassive(): DO_VERIFY_VOLUME set; Completing with STATUS_VERIFY_REQUIRED\n"); + INFO_(FLOPPY, "ReadWritePassive(): DO_VERIFY_VOLUME set; Completing with STATUS_VERIFY_REQUIRED\n"); Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED; IoCompleteRequest(Irp, IO_NO_INCREMENT); return; @@ -465,7 +464,7 @@ StartMotor(DriveInfo); if(HwDiskChanged(DeviceObject->DeviceExtension, &DiskChanged) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): unable to detect disk change; Completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): unable to detect disk change; Completing with STATUS_UNSUCCESSFUL\n"); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); return; @@ -473,7 +472,7 @@
if(DiskChanged) { - DPRINT("floppy: ReadWritePhase1(): signalling media changed; Completing with STATUS_MEDIA_CHANGED\n"); + INFO_(FLOPPY, "ReadWritePhase1(): signalling media changed; Completing with STATUS_MEDIA_CHANGED\n");
/* The following call sets IoStatus.Status and IoStatus.Information */ SignalMediaChanged(DeviceObject, Irp); @@ -496,7 +495,7 @@ { if(RWDetermineMediaType(DriveInfo) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): unable to determine media type; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): unable to determine media type; completing with STATUS_UNSUCCESSFUL\n"); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); return; @@ -504,7 +503,7 @@
if(DriveInfo->DiskGeometry.MediaType == Unknown) { - DPRINT("floppy: ReadWritePassive(): Unknown media in drive; completing with STATUS_UNRECOGNIZED_MEDIA\n"); + WARN_(FLOPPY, "ReadWritePassive(): Unknown media in drive; completing with STATUS_UNRECOGNIZED_MEDIA\n"); Irp->IoStatus.Status = STATUS_UNRECOGNIZED_MEDIA; IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); @@ -604,7 +603,7 @@
if(Status != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): unable allocate an adapter channel; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): unable allocate an adapter channel; completing with STATUS_UNSUCCESSFUL\n"); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); return ; @@ -626,7 +625,7 @@ ULONG CurrentTransferBytes; UCHAR CurrentTransferSectors;
- DPRINT("floppy: ReadWritePassive(): iterating in while (TransferByteOffset = 0x%x of 0x%x total) - allocating %d registers\n", + INFO_(FLOPPY, "ReadWritePassive(): iterating in while (TransferByteOffset = 0x%x of 0x%x total) - allocating %d registers\n", TransferByteOffset, Length, DriveInfo->ControllerInfo->MapRegisters);
KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent); @@ -636,7 +635,7 @@ */ if(RWComputeCHS(DriveInfo, DiskByteOffset+TransferByteOffset, &Cylinder, &Head, &StartSector) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): unable to compute CHS; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): unable to compute CHS; completing with STATUS_UNSUCCESSFUL\n"); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); @@ -650,7 +649,7 @@ { if(RWSeekToCylinder(DriveInfo, Cylinder) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): unable to seek; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): unable to seek; completing with STATUS_UNSUCCESSFUL\n"); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); @@ -664,7 +663,7 @@ * We can only ask for a transfer up to the end of the track. Then we have to re-seek and do more. * TODO: Support the MT bit */ - DPRINT("floppy: ReadWritePassive(): computing number of sectors to transfer (StartSector 0x%x): ", StartSector); + INFO_(FLOPPY, "ReadWritePassive(): computing number of sectors to transfer (StartSector 0x%x): ", StartSector);
/* 1-based sector number */ if( (((DriveInfo->DiskGeometry.TracksPerCylinder - Head) * DriveInfo->DiskGeometry.SectorsPerTrack - StartSector) + 1 ) < @@ -677,7 +676,7 @@ CurrentTransferSectors = (UCHAR)((Length - TransferByteOffset) / DriveInfo->DiskGeometry.BytesPerSector); }
- DPRINT("0x%x\n", CurrentTransferSectors); + INFO_(FLOPPY, "0x%x\n", CurrentTransferSectors);
CurrentTransferBytes = CurrentTransferSectors * DriveInfo->DiskGeometry.BytesPerSector;
@@ -685,7 +684,7 @@ * Adjust to map registers * BUG: Does this take into account page crossings? */ - DPRINT("floppy: ReadWritePassive(): Trying to transfer 0x%x bytes\n", CurrentTransferBytes); + INFO_(FLOPPY, "ReadWritePassive(): Trying to transfer 0x%x bytes\n", CurrentTransferBytes);
ASSERT(CurrentTransferBytes);
@@ -696,7 +695,7 @@
CurrentTransferBytes = CurrentTransferSectors * DriveInfo->DiskGeometry.BytesPerSector;
- DPRINT("floppy: ReadWritePassive: limiting transfer to 0x%x bytes (0x%x sectors) due to map registers\n", + INFO_(FLOPPY, "ReadWritePassive: limiting transfer to 0x%x bytes (0x%x sectors) due to map registers\n", CurrentTransferBytes, CurrentTransferSectors); }
@@ -718,14 +717,14 @@ if(HwReadWriteData(DriveInfo->ControllerInfo, !WriteToDevice, DriveInfo->UnitNumber, Cylinder, Head, StartSector, DriveInfo->BytesPerSectorCode, DriveInfo->DiskGeometry.SectorsPerTrack, Gap, 0xff) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n"); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject); IoCompleteRequest(Irp, IO_NO_INCREMENT); StopMotor(DriveInfo->ControllerInfo); return ; }
- DPRINT("floppy: ReadWritePassive(): HwReadWriteData returned -- waiting on event\n"); + INFO_(FLOPPY, "ReadWritePassive(): HwReadWriteData returned -- waiting on event\n");
/* * At this point, we block and wait for an interrupt @@ -742,7 +741,7 @@ /* Read the results from the drive */ if(HwReadWriteResult(DriveInfo->ControllerInfo) != STATUS_SUCCESS) { - DPRINT("floppy: ReadWritePassive(): HwReadWriteResult returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n"); + WARN_(FLOPPY, "ReadWritePassive(): HwReadWriteResult returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n"); HwDumpRegisters(DriveInfo->ControllerInfo); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject); IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -756,7 +755,7 @@ RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject);
/* That's all folks! */ - DPRINT("floppy: ReadWritePassive(): success; Completing with STATUS_SUCCESS\n"); + INFO_(FLOPPY, "ReadWritePassive(): success; Completing with STATUS_SUCCESS\n"); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = Length; IoCompleteRequest(Irp, IO_NO_INCREMENT);