Don't include useless files

xboxvmp.c: use functions provided by videoprt instead of hal ones
xboxvmp.c: replace DPRINT(1) by VideoPortDebugPrint

svn path=/trunk/; revision=20057
This commit is contained in:
Hervé Poussineau 2005-12-11 08:27:35 +00:00
parent 5eb9a955e7
commit dea3952cfc
5 changed files with 34 additions and 42 deletions

View file

@ -26,7 +26,6 @@
#include <ntddk.h> #include <ntddk.h>
#include <miniport.h> #include <miniport.h>
#include <video.h> #include <video.h>
#include <ntddvdeo.h>
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24)) #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#define TAG_VBE TAG('V', 'B', 'E', ' ') #define TAG_VBE TAG('V', 'B', 'E', ' ')

View file

@ -26,7 +26,6 @@
#include <ntddk.h> #include <ntddk.h>
#include <miniport.h> #include <miniport.h>
#include <video.h> #include <video.h>
#include <ntddvdeo.h>
#define UNIMPLEMENTED \ #define UNIMPLEMENTED \
VideoPortDebugPrint(Error, "WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__); VideoPortDebugPrint(Error, "WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);

View file

@ -72,7 +72,7 @@ XboxVmpFindAdapter(
VIDEO_ACCESS_RANGE AccessRanges[3]; VIDEO_ACCESS_RANGE AccessRanges[3];
VP_STATUS Status; VP_STATUS Status;
DPRINT("XboxVmpFindAdapter\n"); VideoPortDebugPrint(Trace, "XboxVmpFindAdapter\n");
XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension; XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension;
Status = VideoPortGetAccessRanges(HwDeviceExtension, 0, NULL, 3, AccessRanges, Status = VideoPortGetAccessRanges(HwDeviceExtension, 0, NULL, 3, AccessRanges,
@ -102,7 +102,7 @@ XboxVmpInitialize(PVOID HwDeviceExtension)
ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY; ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
ULONG Length; ULONG Length;
DPRINT("XboxVmpInitialize\n"); VideoPortDebugPrint(Trace, "XboxVmpInitialize\n");
XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension; XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension;
@ -113,10 +113,10 @@ XboxVmpInitialize(PVOID HwDeviceExtension)
&Length, &inIoSpace, &Length, &inIoSpace,
&XboxVmpDeviceExtension->VirtControlStart)) &XboxVmpDeviceExtension->VirtControlStart))
{ {
DPRINT1("Failed to map control memory\n"); VideoPortDebugPrint(Error, "Failed to map control memory\n");
return FALSE; return FALSE;
} }
DPRINT("Mapped 0x%x bytes of control mem at 0x%x to virt addr 0x%x\n", VideoPortDebugPrint(Info, "Mapped 0x%x bytes of control mem at 0x%x to virt addr 0x%x\n",
XboxVmpDeviceExtension->ControlLength, XboxVmpDeviceExtension->ControlLength,
XboxVmpDeviceExtension->PhysControlStart.u.LowPart, XboxVmpDeviceExtension->PhysControlStart.u.LowPart,
XboxVmpDeviceExtension->VirtControlStart); XboxVmpDeviceExtension->VirtControlStart);
@ -142,7 +142,7 @@ XboxVmpStartIO(
switch (RequestPacket->IoControlCode) switch (RequestPacket->IoControlCode)
{ {
case IOCTL_VIDEO_SET_CURRENT_MODE: case IOCTL_VIDEO_SET_CURRENT_MODE:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_SET_CURRENT_MODE\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_SET_CURRENT_MODE\n");
if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE)) if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE))
{ {
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
@ -155,14 +155,14 @@ XboxVmpStartIO(
break; break;
case IOCTL_VIDEO_RESET_DEVICE: case IOCTL_VIDEO_RESET_DEVICE:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_RESET_DEVICE\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_RESET_DEVICE\n");
Result = XboxVmpResetDevice( Result = XboxVmpResetDevice(
(PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension, (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
RequestPacket->StatusBlock); RequestPacket->StatusBlock);
break; break;
case IOCTL_VIDEO_MAP_VIDEO_MEMORY: case IOCTL_VIDEO_MAP_VIDEO_MEMORY:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_MAP_VIDEO_MEMORY\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_MAP_VIDEO_MEMORY\n");
if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) || if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) ||
RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
{ {
@ -177,7 +177,7 @@ XboxVmpStartIO(
break; break;
case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY: case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_UNMAP_VIDEO_MEMORY\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_UNMAP_VIDEO_MEMORY\n");
if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
{ {
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
@ -190,7 +190,7 @@ XboxVmpStartIO(
break; break;
case IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES: case IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES\n");
if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES)) if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES))
{ {
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
@ -203,7 +203,7 @@ XboxVmpStartIO(
break; break;
case IOCTL_VIDEO_QUERY_AVAIL_MODES: case IOCTL_VIDEO_QUERY_AVAIL_MODES:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_QUERY_AVAIL_MODES\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_AVAIL_MODES\n");
if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION)) if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
{ {
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
@ -216,7 +216,7 @@ XboxVmpStartIO(
break; break;
case IOCTL_VIDEO_QUERY_CURRENT_MODE: case IOCTL_VIDEO_QUERY_CURRENT_MODE:
DPRINT("XboxVmpStartIO IOCTL_VIDEO_QUERY_CURRENT_MODE\n"); VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_CURRENT_MODE\n");
if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION)) if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
{ {
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
@ -229,7 +229,7 @@ XboxVmpStartIO(
break; break;
default: default:
DPRINT("XboxVmpStartIO 0x%x not implemented\n"); VideoPortDebugPrint(Warn, "XboxVmpStartIO 0x%x not implemented\n");
RequestPacket->StatusBlock->Status = STATUS_NOT_IMPLEMENTED; RequestPacket->StatusBlock->Status = STATUS_NOT_IMPLEMENTED;
return FALSE; return FALSE;
} }
@ -254,7 +254,7 @@ XboxVmpResetHw(
ULONG Columns, ULONG Columns,
ULONG Rows) ULONG Rows)
{ {
DPRINT("XboxVmpResetHw\n"); VideoPortDebugPrint(Trace, "XboxVmpResetHw\n");
if (! XboxVmpResetDevice((PXBOXVMP_DEVICE_EXTENSION) DeviceExtension, NULL)) if (! XboxVmpResetDevice((PXBOXVMP_DEVICE_EXTENSION) DeviceExtension, NULL))
{ {
@ -276,7 +276,7 @@ XboxVmpGetPowerState(
ULONG HwId, ULONG HwId,
PVIDEO_POWER_MANAGEMENT VideoPowerControl) PVIDEO_POWER_MANAGEMENT VideoPowerControl)
{ {
DPRINT1("XboxVmpGetPowerState is not supported\n"); VideoPortDebugPrint(Error, "XboxVmpGetPowerState is not supported\n");
return ERROR_NOT_SUPPORTED; return ERROR_NOT_SUPPORTED;
} }
@ -293,7 +293,7 @@ XboxVmpSetPowerState(
ULONG HwId, ULONG HwId,
PVIDEO_POWER_MANAGEMENT VideoPowerControl) PVIDEO_POWER_MANAGEMENT VideoPowerControl)
{ {
DPRINT1("XboxVmpSetPowerState not supported\n"); VideoPortDebugPrint(Error, "XboxVmpSetPowerState not supported\n");
return ERROR_NOT_SUPPORTED; return ERROR_NOT_SUPPORTED;
} }
@ -368,7 +368,7 @@ XboxVmpMapVideoMemory(
} }
else else
{ {
DPRINT1("ZwQueryBasicInformation failed, assuming 64MB total memory\n"); VideoPortDebugPrint(Error, "ZwQueryBasicInformation failed, assuming 64MB total memory\n");
FrameBuffer.u.LowPart = 60 * 1024 * 1024; FrameBuffer.u.LowPart = 60 * 1024 * 1024;
} }
@ -385,7 +385,7 @@ XboxVmpMapVideoMemory(
/* Tell the nVidia controller about the framebuffer */ /* Tell the nVidia controller about the framebuffer */
*((PULONG)((char *) DeviceExtension->VirtControlStart + CONTROL_FRAMEBUFFER_ADDRESS_OFFSET)) = FrameBuffer.u.LowPart; *((PULONG)((char *) DeviceExtension->VirtControlStart + CONTROL_FRAMEBUFFER_ADDRESS_OFFSET)) = FrameBuffer.u.LowPart;
DPRINT("Mapped 0x%x bytes of phys mem at 0x%x to virt addr 0x%x\n", VideoPortDebugPrint(Info, "Mapped 0x%x bytes of phys mem at 0x%lx to virt addr 0x%p\n",
MapInformation->VideoRamLength, FrameBuffer.u.LowPart, MapInformation->VideoRamBase); MapInformation->VideoRamLength, FrameBuffer.u.LowPart, MapInformation->VideoRamBase);
return TRUE; return TRUE;
@ -435,7 +435,7 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
{ {
int nRetriesToLive=50; int nRetriesToLive=50;
while (0 != (READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800)) while (0 != (VideoPortReadPortUshort((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800))
{ {
; /* Franz's spin while bus busy with any master traffic */ ; /* Franz's spin while bus busy with any master traffic */
} }
@ -445,22 +445,22 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
UCHAR b; UCHAR b;
int temp; int temp;
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 1); VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 1);
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 8), bRegister); VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 8), bRegister);
temp = READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0)); temp = VideoPortReadPortUshort((PUSHORT) (I2C_IO_BASE + 0));
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0), temp); /* clear down all preexisting errors */ VideoPortWritePortUshort((PUSHORT) (I2C_IO_BASE + 0), temp); /* clear down all preexisting errors */
switch (Size) switch (Size)
{ {
case 4: case 4:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0d); /* DWORD modus ? */ VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0d); /* DWORD modus ? */
break; break;
case 2: case 2:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0b); /* WORD modus */ VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0b); /* WORD modus */
break; break;
default: default:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0a); // BYTE VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0a); // BYTE
break; break;
} }
@ -468,7 +468,7 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
while (0 == (b & 0x36)) while (0 == (b & 0x36))
{ {
b = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 0)); b = VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 0));
} }
if (0 != (b & 0x24)) if (0 != (b & 0x24))
@ -485,17 +485,17 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
switch (Size) switch (Size)
{ {
case 4: case 4:
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6)); VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 6));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9)); VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9)); VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9)); VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9)); VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
break; break;
case 2: case 2:
*Data_to_smbus = READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 6)); *Data_to_smbus = VideoPortReadPortUshort((PUSHORT) (I2C_IO_BASE + 6));
break; break;
default: default:
*Data_to_smbus = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6)); *Data_to_smbus = VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 6));
break; break;
} }

View file

@ -28,11 +28,7 @@
#include <ntddk.h> #include <ntddk.h>
#include <miniport.h> #include <miniport.h>
#include <video.h> #include <video.h>
#include <ntddvdeo.h> #include <ndk/exfuncs.h>
#include <ndk/ntndk.h>
#define NDEBUG
#include <debug.h>
typedef struct typedef struct
{ {

View file

@ -1,9 +1,7 @@
<module name="xboxvmp" type="kernelmodedriver"> <module name="xboxvmp" type="kernelmodedriver">
<include base="xboxvmp">.</include> <include base="xboxvmp">.</include>
<include base="ntoskrnl">include</include>
<define name="__USE_W32API" /> <define name="__USE_W32API" />
<library>ntoskrnl</library> <library>ntoskrnl</library>
<library>hal</library>
<library>videoprt</library> <library>videoprt</library>
<file>xboxvmp.c</file> <file>xboxvmp.c</file>
<file>xboxvmp.rc</file> <file>xboxvmp.rc</file>