Re: PCI #LOCK assertion

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Fri Jan 25 2002 - 13:43:27 EST


On Fri, 25 Jan 2002, chus Medina wrote:

>
> Hola,
>
> I need to create module to perform atomic transactions through the PCI bus
> between the processor and an IDE hard disk. The PCI bus specifications 2.2
> point to the #LOCK signal to perform such a transaction. Is possible to
> assert the #LOCK signal of the PCI bus using the Linux Kernel? How? I didnt
> see any pointers in include/pci.h or anywhere in the source code.
>
> I will truly appreciate any help/pointers,
>
> Jesus
>

On Intel machines, you precede a memory access with the 'lock'
instruction. With CPUs i486, and later, only the accessed page
is locked at that instant. Earlier CPUs locked the whole bus.

The PCI/Bus controller handles the #LOCK signal itself to guarantee
the atomicity of a transaction. You should never have to do this
yourself. If you think you have to, just precede each PCI/Bus
address-space access with the 'lock' instruction. You just make
your own version of the readl/readw/readb/etc macros that are
provided. You may find that this deadlocks, though, and all bets
are off. You may have just locked the PCI/Bus off the bus when
you needed it most!!

If you are finding something 'strange' in your PCI/Bus accesses,
it is probably because you didn't use 'nocache' when you obtained
address-space for your PCI Device, i.e., ioremap_nocache() instead of
ioremap().

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jan 31 2002 - 21:00:35 EST