From: Thadeu Lima de Souza Cascardo Date: Sat, 22 May 2010 10:05:48 +0000 (-0400) Subject: How to do I/O. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fkernel%2Fslides%2F.git;a=commitdiff_plain;h=db61ca31b33974b92c426d9278a5e5ffa704035b How to do I/O. --- diff --git a/11io/io b/11io/io new file mode 100644 index 0000000..c8a046f --- /dev/null +++ b/11io/io @@ -0,0 +1,72 @@ +%I/O +%Thadeu Cascardo + +# I/O Ports versus Memory Mapped Devices + +* Separate I/O space in x86 architecture +* Other architectures emulate this I/O space access + +# Resource allocation + +* Different drivers must not conflict when using device resources, like I/O + ports or memory space +* They must request these resources and release them + +# I/O port allocation + +* linux/ioport.h +* request\\_region(port, num, name) +* release\\_region(port, num) +* /proc/ioports + +# I/O ports access + +* asm/io.h +* inb(port) +* outb(data, port) +* inw(port) +* outw(data, port) +* inl(port) +* outl(port) +* String operations +* Pausing I/O +* Platform Issues + +# Memory Region Allocation + +* request\\_mem\\_region(start, len, name) +* release\\_mem\\_region(start, len) + +# Memory Mapping + +* ioremap(phys\\_addr, size) +* iounmap(virt\\_addr) + +# Memory Access + +* ioread8(addr) +* ioread16(addr) +* ioread32(addr) +* iowrite8(val, addr) +* iowrite16(val, addr) +* iowrite32(val, addr) +* memset\\_io(addr, val, cnt) +* memcpy\\_fromio(dst, src, cnt) +* memcpy\\_toio(dst, src, cnt) + +# Mapping I/O Ports to Memory + +* ioport\\_map(port, cnt) +* ioport\\_unmap(addr) + +# Memory Barries + +* linux/kernel.h +* barrier() +* asm/system.h +* rmb() +* wmb() +* mb() +* smp\\_rmb +* smp\\_wmb +* smp\\_mb