diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2004-10-06 17:33:54 +0000 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2004-10-06 17:33:54 +0000 |
commit | 02fa3b2743b3f37381b6af4ee4362422b9011c8b (patch) | |
tree | c3bcc53e5ee909406558c116ac331bf05c5b561f /util/resetcf | |
parent | 4fa89208a16e1e2052fff315c76f8f3f07459571 (diff) |
epia-m support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1655 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/resetcf')
-rw-r--r-- | util/resetcf/resetcf.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/util/resetcf/resetcf.c b/util/resetcf/resetcf.c new file mode 100644 index 0000000000..1977f7dbcb --- /dev/null +++ b/util/resetcf/resetcf.c @@ -0,0 +1,42 @@ +#include <stdio.h> +#include <fcntl.h> + +#include <unistd.h> +#include <sys/mman.h> + +main(int argc, char *argv[]) +{ + int i; + volatile unsigned char *cp; + int fd; + void *v; + off_t nvram; + size_t length = 0x1000; + + fd = open("/proc/bus/pci/00/0a.1",O_RDONLY); + lseek(fd,0x10,0); + read(fd,&nvram,sizeof(nvram)); + close(fd); + //printf("Star %x\n",nvram); + + if((fd = open("/dev/mem",O_RDWR)) != -1) + { + v = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED,fd,nvram); + fprintf(stderr, "mmap returns %p\n", v); + + if ( v == (void *) -1) + { + perror("mmap"); + exit(1); + } + } else { + perror("open /dev/mem"); + exit(1); + } + + for( i = 0x836 ; i < 0x840 ; i++){ + *(unsigned char *)(v+i) = 0; + } + + +} |