pcmcia port i/o, XP SP1

I’ve got a custom PCMCIA card that primarily uses Port I/O as its
communication mechanism. My problem is basic - port i/o never appears at
the card. Here are the details.

My card doesn’t maintain configuration information on-board so there is an
override statement in the INF.
[Xyz_LogConfigOverride]
ConfigPriority = NORMAL
IOConfig = 10@0009-0389%ffffff80(3ff)
PcCardConfig = 0(B A M8 XI0 S0)

My START_DEVICE handler recieves the requested resources. I get one
resource of type CmResourceTypePort which does not require mapping. This
info matches what is reported by device manager. Usually, port range 0280-028F.
irpStack = IoGetCurrentIrpStackLocation(Irp);

if ((irpStack->Parameters.StartDevice.AllocatedResources != NULL) &&
(irpStack->Parameters.StartDevice.AllocatedResourcesTranslated !=
NULL))
{
partialResourceList =

&irpStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
resource = &partialResourceList->PartialDescriptors[0];

partialResourceListTranslated =

&irpStack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList;
resourceTrans = &partialResourceListTranslated->PartialDescriptors[0];

portCount = 0;
for (ii = 0;
ii < partialResourceList->Count;
++ii, ++resource, ++resourceTrans)
{

switch (resource->Type)
{
case CmResourceTypePort:
XyzDebugPrint(DBG_PNP, DBG_INFO, “Resource Type Port”);
XyzDebugPrint(DBG_PNP, DBG_INFO, “Port.Start %I64x”,
resource->u.Port.Start.QuadPart);
XyzDebugPrint(DBG_PNP, DBG_INFO, “Port.Length %x”,
resource->u.Port.Length);

switch (portCount)
{
case 0:
if (resourceTrans->Type == CmResourceTypePort)
{
DeviceExtension->bPortResource0IsIo = TRUE;

DeviceExtension->PortResource0Length =
resourceTrans->u.Port.Length;
DeviceExtension->bPortResource0Mapped =
(resourceTrans->Flags & CM_RESOURCE_PORT_IO) == 0;
if (DeviceExtension->bPortResource0Mapped)
{
DeviceExtension->PortResource0Base =
(PUCHAR)MmMapIoSpace(

resourceTrans->u.Port.Start,

resourceTrans->u.Port.Length,

MmNonCached
);
}
else
{
DeviceExtension->PortResource0Base =
(PUCHAR)resourceTrans->u.Port.Start.QuadPart;
}
}
else
{
ASSERT(resourceTrans->Type == CmResourceTypeMemory);

DeviceExtension->bPortResource0IsIo = FALSE;
DeviceExtension->bPortResource0Mapped = TRUE;

DeviceExtension->PortResource0Length =
resourceTrans->u.Memory.Length;
DeviceExtension->PortResource0Base =
(PUCHAR)MmMapIoSpace(

resourceTrans->u.Memory.Start,

resourceTrans->u.Memory.Length,
MmNonCached
);
}
break;
default:
XyzDebugPrint(DBG_PNP, DBG_INFO, “Extra Port”);
break;
}

++portCount;
break;
case CmResourceTypeMemory:
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Resource Type Memory”);
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Memory.Start %I64x”,
resource->u.Memory.Start.QuadPart);
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Memory.Length %x”,
resource->u.Memory.Length);
break;
case CmResourceTypeInterrupt:
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Resource Type Interrupt”);
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Interrupt.Level %x”,
resourceTrans->u.Interrupt.Level);
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Interrupt.Vector %x”,
resourceTrans->u.Interrupt.Vector);
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Interrupt.Affinity
%x\n”, resourceTrans->u.Interrupt.Affinity);
break;
default:
XyzDebugPrint(DBG_PNP, DBG_TRACE, “Unknown Resource Type
%x”, resourceTrans->Type);
break;
}
}
}

This info also matches that which is dumped out by the checked version of
PCMCIA.SYS. So, everybody is on the same page with respect to what I/O goes
to my card.
Pcmcia PNP: pdo 81e1f368 irp 8186de48 –> IRP_MN_START_DEVICE
Pcmcia RES: DevicePrivate received, Data= 00010000 38000000 38000000
Pcmcia RES: Pccard config resource
Pcmcia RES: Index 0
Pcmcia RES: PcCardConfig IO0 - Width:0, Wait16:0, Source16:0, ZeroWait8:0
Pcmcia RES: PcCardConfig IO1 - Width:0, Wait16:0, Source16:0, ZeroWait8:0
Pcmcia RES: PcCardConfig MEM0 - Width:0, Wait:3, IsAttr:1, CardBase:0
Pcmcia RES: PcCardConfig MEM1 - Width:0, Wait:3, IsAttr:1, CardBase:0
Pcmcia SKT: skt 823f28f0 request power
Pcmcia CFG: pdo 81e1f368 ConfigurePcCard entered
Pcmcia CFG: pdo 81e1f368 config worker - CW_InitialState
Pcmcia CFG: pdo 81e1f368 config worker - CW_ResetCard
Pcmcia CFG: pdo 81e1f368 config worker delay type Wait, 100 usec
Pcmcia CFG: pdo 81e1f368 config worker - CW_ResetCard
Pcmcia CFG: pdo 81e1f368 config worker delay type Wait, 70000 usec
Pcmcia CFG: pdo 81e1f368 config worker - CW_ResetCard
Pcmcia CNT: PcicPCCardReady: 0
Pcmcia CFG: pdo 81e1f368 config worker - CW_Phase1
Pcmcia CFG: pdo 81e1f368 config registers ccr 200
Pcmcia CFG: socket 823f28f0 config MemIo
Pcmcia CFG: port range: 0x280-0x28f
Pcmcia CFG: pdo 81e1f368 config worker - CW_Phase2
Pcmcia CFG: pdo 81e1f368 config worker - CW_Phase3
Pcmcia CFG: skt 823f28f0 irq=0x0
Pcmcia CFG: pdo 81e1f368 config worker - CW_Exit
Pcmcia CFG: pdo 81e1f368 config worker exit 00000000
Pcmcia CFG: pdo 81e1f368 ConfigurePcCard returning 00000000
Pcmcia PNP: pdo 81e1f368 irp 8186de48 comp STATUS_SUCCESS 00000000

Later in my driver, I write to an address in the port range.
WRITE_PORT_UCHAR (DeviceExtension->PortResource0Base + 5, ucData);

My card never sees this write. There is a card extender in my machine so
that my hardware engineer could hook up a scope to monitor the port lines
coming into the card. The scope never shows activity on the port address
lines when this command is issued. I know the scope is working since it
correctly sees activity when we set it monitor the attribute memory lines
and I write to attribute memory. I also know the card is 100% working since
it works fine under Windows 98.

Any ideas anyone? Since the scope doesn’t see activity on the port lines,
seems to me the problem is somewhere in how the OS transfers the
WRITE_PORT_UCHAR to the card. I’m stumped!

Thanks,
Judy