Q1: When we memory map PCI config space we can access it like any other memory address. I recall reading somewhere that, there is a slight difference in MMIO space access and regular memory access. The difference is MMIO access guarantees atomic access whereas accessing regular memory it is the drivers responsibility. I think I am wrong but wanted to make sure.
Q2: I will assume the answer to Q1 is negative. Instead of MMIO I can access PCI config space using the API provided my MS. http://support.microsoft.com/kb/253232. My question is, is this access atomic? if my buffer length were say 100 ULONG am I guaranteed atomicity for the 100 ULONGs I have asked for?
Thanks for any help/advice.
A small snippet enclosed here:
if (ReadOrWrite == 0) {
irpStack->MinorFunction = IRP_MN_READ_CONFIG;
}else {
irpStack->MinorFunction = IRP_MN_WRITE_CONFIG;
}
irpStack->Parameters.ReadWriteConfig.WhichSpace = PCI_WHICHSPACE_CONFIG;
irpStack->Parameters.ReadWriteConfig.Buffer = Buffer;
irpStack->Parameters.ReadWriteConfig.Offset = Offset;
irpStack->Parameters.ReadWriteConfig.Length = Length;
//
// Initialize the status to error in case the bus driver does not
// set it correctly.
//
irp->IoStatus.Status = STATUS_NOT_SUPPORTED ;
status = IoCallDriver( targetObject, irp );
The PCI memory-mapped config region (MMCFG) has undefined behavior if two
processors read from it or write to it at the same time. Consequently, your
access to it may cause completely undefined results, including a machine
crash. Please consider using the functions supplied within Windows. (And
yes, I know they’re not available for Windows XP.)
The answer to your second question is no, there’s no atomicity there.
–
Jake Oshins
Hyper-V I/O Architect
Windows Kernel Group
This post implies no warranties and confers no rights.
wrote in message news:xxxxx@ntdev…
> Q1: When we memory map PCI config space we can access it like any other
> memory address. I recall reading somewhere that, there is a slight
> difference in MMIO space access and regular memory access. The difference
> is MMIO access guarantees atomic access whereas accessing regular memory
> it is the drivers responsibility. I think I am wrong but wanted to make
> sure.
>
> Q2: I will assume the answer to Q1 is negative. Instead of MMIO I can
> access PCI config space using the API provided my MS.
> http://support.microsoft.com/kb/253232. My question is, is this access
> atomic? if my buffer length were say 100 ULONG am I guaranteed atomicity
> for the 100 ULONGs I have asked for?
>
> Thanks for any help/advice.
>
> A small snippet enclosed here:
>
> if (ReadOrWrite == 0) {
> irpStack->MinorFunction = IRP_MN_READ_CONFIG;
> }else {
> irpStack->MinorFunction = IRP_MN_WRITE_CONFIG;
> }
>
> irpStack->Parameters.ReadWriteConfig.WhichSpace =
> PCI_WHICHSPACE_CONFIG;
> irpStack->Parameters.ReadWriteConfig.Buffer = Buffer;
> irpStack->Parameters.ReadWriteConfig.Offset = Offset;
> irpStack->Parameters.ReadWriteConfig.Length = Length;
>
> //
> // Initialize the status to error in case the bus driver does not
> // set it correctly.
> //
>
> irp->IoStatus.Status = STATUS_NOT_SUPPORTED ;
>
> status = IoCallDriver( targetObject, irp );
>
xxxxx@gmail.com wrote:
Q1: When we memory map PCI config space we can access it like any other memory address. I recall reading somewhere that, there is a slight difference in MMIO space access and regular memory access. The difference is MMIO access guarantees atomic access whereas accessing regular memory it is the drivers responsibility. I think I am wrong but wanted to make sure.
You are wrong. The primary difference is that MMIO space is not cached
(usually), whereas regular memory is. In the x86 architecture, that
difference is not important.
Q2: I will assume the answer to Q1 is negative. Instead of MMIO I can access PCI config space using the API provided my MS. http://support.microsoft.com/kb/253232. My question is, is this access atomic? if my buffer length were say 100 ULONG am I guaranteed atomicity for the 100 ULONGs I have asked for?
PCI configuration space is not 400 bytes long, so the question isn’t
really meaningful. Even for MMIO space, however, bursts of memory are
not atomic, but that’s usually not important.
Where are you actually going with this?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.