[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1507261121110.21427@nippy.intranet>
Date: Sun, 26 Jul 2015 11:37:20 +1000 (AEST)
From: Finn Thain <fthain@...egraphics.com.au>
To: Michael Ellerman <mpe@...erman.id.au>
cc: "Christian T. Steigies" <cts@...ian.org>,
Michael Schmitz <schmitzmic@...il.com>,
Linux/m68k <linux-m68k@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Development <linux-kernel@...r.kernel.org>,
Andreas Schwab <schwab@...ux-m68k.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of
drivers/char/nvram.c
On Sat, 25 Jul 2015, Michael Ellerman wrote:
> On Sat, 2015-07-25 at 10:35 +1000, Finn Thain wrote:
> >
> > ... These are rudimentary tests but combined with my own testing on
> > m68k, ppc32 and x86, coverage is quite good. Some testing on ppc64 is
> > still lacking though.
Here's some code I wrote some time ago to help me test these patches,
maybe it will help others (though independent results may be more
valuable...)
-- -- 8< -- --
#!/bin/sh
set -e -u -x
temp=`mktemp /root/nvram.XXXX`
test -f "$temp"
cat /proc/version
if ! test -e /dev/nvram ; then
mknod /dev/nvram c 10 144
fi
ls -l /dev/nvram
if test -c /dev/nvram ; then
cp /dev/nvram "$temp"
hexdump -C "$temp"
cp /dev/zero /dev/nvram || true
hexdump -C /dev/nvram
cp "$temp" /dev/nvram
hexdump -C /dev/nvram
fi
-- -- 8< -- --
#include <stdio.h>
#include <sys/ioctl.h>
#include <errno.h>
#if defined(__powerpc__)
#include <asm/nvram.h>
#elif defined(__i386__) || defined(__mc68020__)
#include <linux/nvram.h>
#endif
int main(void) {
int result, i;
FILE *f;
f = fopen("/dev/nvram", "r+");
if (!f) {
perror("fopen");
return 1;
}
#if defined(__powerpc__)
result = ioctl(fileno(f), IOC_NVRAM_SYNC);
fprintf(stderr, "ioctl IOC_NVRAM_SYNC: result %d, errno %m\n", result);
for (i = 0; i <= 8; ++i) {
int arg = i;
result = ioctl(fileno(f), IOC_NVRAM_GET_OFFSET, (long)&arg);
fprintf(stderr, "ioctl IOC_NVRAM_GET_OFFSET: i %d, result %d, offset %d, errno %m\n", i, result, arg);
}
#elif defined(__i386__) || defined(__mc68020__)
result = ioctl(fileno(f), NVRAM_INIT);
fprintf(stderr, "ioctl NVRAM_INIT: result %d, errno %m\n", result);
result = ioctl(fileno(f), NVRAM_SETCKS);
fprintf(stderr, "ioctl NVRAM_SETCKS: result %d, errno %m\n", result);
#endif
return 0;
}
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists