[coreboot] SuperI/O Access (Kernelspace)

Tom Sylla tsylla at gmail.com
Fri Apr 15 01:51:19 CEST 2011

Your address is in I/O address space, not memory address space. Take a
look at io_rw.c in iotools, you need to be using inb/outb (not just
reading/writing memory).


On Thu, Apr 14, 2011 at 4:12 PM, Jeremy Moles <jeremy at emperorlinux.com> wrote:
> Hey guys, me again. :)
> So, my device is working great now that I can access the GPIO pins via
> userspace (using iotools w/ Tom Sylla's help) and can power on the
> device. However, I'd like to be able to toggle the power on via a kernel
> driver as well, but I'm having trouble accessing the same memory range
> from kernelspace.
> For example:
>        iotools io_read8 0xA00
> Will return the state of the first 5 GPIO pins. I see that iotools calls
> iopl() to be able to access this location from userspace.
> When I try to do the same thing in the kernel:
>        unsigned short  b;
>        unsigned short* ptr = (unsigned short*)(0xA00);
>        if(access_ok(VERIFY_READ, ptr, 8)) {
>                get_user(b, ptr);
> ...I immediately get a segfault. From what I've read and seen in other
> example code, I believe I'm doing this right. However, I may be making
> some wrong assumptions. I was just curious if anyone would be able to
> shed some light on the subject--perhaps I'm missing some virtual memory
> offset functions or similar...
> --
> coreboot mailing list: coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot

More information about the coreboot mailing list