mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:55:41 +00:00
-some minor changes to be able to build the driver with PREfast
-use ExAllocatePoolWithTag instead of ExAllocatePool svn path=/trunk/; revision=27433
This commit is contained in:
parent
03c866e842
commit
01b3f0d7cf
2 changed files with 28 additions and 17 deletions
|
@ -8,10 +8,11 @@
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 01-05-2001 CSH Created
|
* 01-05-2001 CSH Created
|
||||||
*/
|
*/
|
||||||
#include <ntddk.h>
|
|
||||||
#include <isapnp.h>
|
#include <isapnp.h>
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,7 +156,7 @@ static VOID WriteUlong(UCHAR Index, ULONG Value)
|
||||||
static __inline VOID SetReadDataPort(ULONG Port)
|
static __inline VOID SetReadDataPort(ULONG Port)
|
||||||
{
|
{
|
||||||
IsaPnPReadPort = (PUCHAR)Port;
|
IsaPnPReadPort = (PUCHAR)Port;
|
||||||
WriteUchar(0x00, Port >> 2);
|
WriteUchar(0x00, (UCHAR) (Port >> 2));
|
||||||
KeStallExecutionProcessor(100);
|
KeStallExecutionProcessor(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +329,7 @@ static ULONG IsolatePnPCards(VOID)
|
||||||
if ((checksum != 0x00) && (checksum == chksum)) {
|
if ((checksum != 0x00) && (checksum == chksum)) {
|
||||||
csn++;
|
csn++;
|
||||||
|
|
||||||
WriteUchar(0x06, csn);
|
WriteUchar(0x06, (UCHAR) csn);
|
||||||
KeStallExecutionProcessor(250);
|
KeStallExecutionProcessor(250);
|
||||||
iteration++;
|
iteration++;
|
||||||
SendWake(0x00);
|
SendWake(0x00);
|
||||||
|
@ -491,7 +492,7 @@ static NTSTATUS AddResourceList(
|
||||||
Priority);
|
Priority);
|
||||||
|
|
||||||
List = (PISAPNP_CONFIGURATION_LIST)
|
List = (PISAPNP_CONFIGURATION_LIST)
|
||||||
ExAllocatePool(PagedPool, sizeof(ISAPNP_CONFIGURATION_LIST));
|
ExAllocatePoolWithTag(PagedPool, sizeof(ISAPNP_CONFIGURATION_LIST), TAG_ISAPNP);
|
||||||
if (!List)
|
if (!List)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
@ -531,13 +532,13 @@ static NTSTATUS AddResourceDescriptor(
|
||||||
LogicalDevice->DescriptorCount);
|
LogicalDevice->DescriptorCount);
|
||||||
|
|
||||||
d = (PISAPNP_DESCRIPTOR)
|
d = (PISAPNP_DESCRIPTOR)
|
||||||
ExAllocatePool(PagedPool, sizeof(ISAPNP_DESCRIPTOR));
|
ExAllocatePoolWithTag(PagedPool, sizeof(ISAPNP_DESCRIPTOR), TAG_ISAPNP);
|
||||||
if (!d)
|
if (!d)
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
RtlZeroMemory(d, sizeof(ISAPNP_DESCRIPTOR));
|
RtlZeroMemory(d, sizeof(ISAPNP_DESCRIPTOR));
|
||||||
|
|
||||||
d->Descriptor.Option = Option;
|
d->Descriptor.Option = (UCHAR) Option;
|
||||||
|
|
||||||
*Descriptor = d;
|
*Descriptor = d;
|
||||||
|
|
||||||
|
@ -907,8 +908,8 @@ static PISAPNP_LOGICAL_DEVICE ParseLogicalDevice(
|
||||||
|
|
||||||
Peek(tmp, Size);
|
Peek(tmp, Size);
|
||||||
|
|
||||||
LogicalDevice = (PISAPNP_LOGICAL_DEVICE)ExAllocatePool(
|
LogicalDevice = (PISAPNP_LOGICAL_DEVICE)ExAllocatePoolWithTag(
|
||||||
PagedPool, sizeof(ISAPNP_LOGICAL_DEVICE));
|
PagedPool, sizeof(ISAPNP_LOGICAL_DEVICE), TAG_ISAPNP);
|
||||||
if (!LogicalDevice)
|
if (!LogicalDevice)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -953,7 +954,7 @@ static BOOLEAN CreateLogicalDevice(PISAPNP_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
||||||
DPRINT("Card %d Size %d\n", Card->CardId, Size);
|
DPRINT("Card %d Size %d\n", Card->CardId, Size);
|
||||||
|
|
||||||
LogicalDevice = ParseLogicalDevice(DeviceExtension, Card, Size, number++);
|
LogicalDevice = ParseLogicalDevice(DeviceExtension, Card, Size, (USHORT) number++);
|
||||||
if (!LogicalDevice)
|
if (!LogicalDevice)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -970,7 +971,7 @@ static BOOLEAN CreateLogicalDevice(PISAPNP_DEVICE_EXTENSION DeviceExtension,
|
||||||
case ISAPNP_SRIN_LDEVICE_ID:
|
case ISAPNP_SRIN_LDEVICE_ID:
|
||||||
if ((Size >= 5) && (Size <= 6)) {
|
if ((Size >= 5) && (Size <= 6)) {
|
||||||
LogicalDevice = ParseLogicalDevice(
|
LogicalDevice = ParseLogicalDevice(
|
||||||
DeviceExtension, Card, Size, number++);
|
DeviceExtension, Card, Size, (USHORT)number++);
|
||||||
if (!LogicalDevice)
|
if (!LogicalDevice)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
@ -1286,8 +1287,8 @@ static NTSTATUS BuildResourceLists(PISAPNP_LOGICAL_DEVICE LogicalDevice)
|
||||||
LogicalDevice->DescriptorCount);
|
LogicalDevice->DescriptorCount);
|
||||||
|
|
||||||
LogicalDevice->ResourceLists =
|
LogicalDevice->ResourceLists =
|
||||||
(PIO_RESOURCE_REQUIREMENTS_LIST)ExAllocatePool(
|
(PIO_RESOURCE_REQUIREMENTS_LIST)ExAllocatePoolWithTag(
|
||||||
PagedPool, ListSize);
|
PagedPool, ListSize, TAG_ISAPNP);
|
||||||
if (!LogicalDevice->ResourceLists)
|
if (!LogicalDevice->ResourceLists)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
@ -1377,7 +1378,7 @@ static NTSTATUS BuildDeviceList(PISAPNP_DEVICE_EXTENSION DeviceExtension)
|
||||||
SendWait();
|
SendWait();
|
||||||
SendKey();
|
SendKey();
|
||||||
for (csn = 1; csn <= 10; csn++) {
|
for (csn = 1; csn <= 10; csn++) {
|
||||||
SendWake(csn);
|
SendWake((UCHAR)csn);
|
||||||
Peek(header, 9);
|
Peek(header, 9);
|
||||||
checksum = Checksum(header);
|
checksum = Checksum(header);
|
||||||
|
|
||||||
|
@ -1388,14 +1389,14 @@ static NTSTATUS BuildDeviceList(PISAPNP_DEVICE_EXTENSION DeviceExtension)
|
||||||
header[0], header[1], header[2], header[3],
|
header[0], header[1], header[2], header[3],
|
||||||
header[4], header[5], header[6], header[7], header[8]);
|
header[4], header[5], header[6], header[7], header[8]);
|
||||||
|
|
||||||
Card = (PISAPNP_CARD)ExAllocatePool(
|
Card = (PISAPNP_CARD)ExAllocatePoolWithTag(
|
||||||
PagedPool, sizeof(ISAPNP_CARD));
|
PagedPool, sizeof(ISAPNP_CARD), TAG_ISAPNP);
|
||||||
if (!Card)
|
if (!Card)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
RtlZeroMemory(Card, sizeof(ISAPNP_CARD));
|
RtlZeroMemory(Card, sizeof(ISAPNP_CARD));
|
||||||
|
|
||||||
Card->CardId = csn;
|
Card->CardId = (USHORT) csn;
|
||||||
Card->VendorId = (header[1] << 8) | header[0];
|
Card->VendorId = (header[1] << 8) | header[0];
|
||||||
Card->DeviceId = (header[3] << 8) | header[2];
|
Card->DeviceId = (header[3] << 8) | header[2];
|
||||||
Card->Serial = (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | header[4];
|
Card->Serial = (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | header[4];
|
||||||
|
@ -1439,7 +1440,7 @@ ISAPNPQueryBusRelations(
|
||||||
|
|
||||||
Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) *
|
Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) *
|
||||||
(DeviceExtension->DeviceListCount - 1);
|
(DeviceExtension->DeviceListCount - 1);
|
||||||
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size);
|
Relations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(PagedPool, Size, TAG_ISAPNP);
|
||||||
if (!Relations)
|
if (!Relations)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
#ifndef __ISAPNP_H
|
#ifndef __ISAPNP_H
|
||||||
#define __ISAPNP_H
|
#define __ISAPNP_H
|
||||||
|
|
||||||
|
#include <ntddk.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define STDCALL
|
||||||
|
#define DDKAPI
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||||
|
#define TAG_ISAPNP TAG('I', 'P', 'N', 'P')
|
||||||
|
|
||||||
#define IO_RESOURCE_REQUIRED 0x00 //ROS Extension
|
#define IO_RESOURCE_REQUIRED 0x00 //ROS Extension
|
||||||
|
|
||||||
#define ISAPNP_ADDRESS_PORT 0x0279 // ADDRESS (W)
|
#define ISAPNP_ADDRESS_PORT 0x0279 // ADDRESS (W)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue