[openib-general] Re: mstflint on sparc - things to test
Tom Duffy
tduffy at sun.com
Tue Jan 18 10:40:46 PST 2005
On Mon, 2005-01-17 at 23:05 +0200, Michael S. Tsirkin wrote:
> - run test2 - same as test1 changing the device file to the file under
> /proc/bus/pci
And I had to send the ioctl, but after that, I get:
tat:~# ./mmap-test
value at 0x000f0014 is 0x00a15a44
-tduffy
#define BAR0 0x1ff00100000ull
#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64
#include <sys/mman.h>
#include <sys/pci.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
int fd;
void *ptr;
unsigned value;
unsigned long long offset = BAR0;
fd = open("/proc/bus/pci/0000:81/00.0",O_RDWR | O_SYNC);
if (fd<0) {
perror("open");
return 1;
}
ioctl(fd, PCIIOC_MMAP_IS_MEM);
ptr = mmap(NULL, 0x100000, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, offset);
if ( (! ptr) || (ptr == MAP_FAILED) ) {
perror("map");
return 1;
}
value= *( (unsigned*)(ptr + 0x000f0014) );
printf("value at 0x000f0014 is %#8.8x\n", value);
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050118/0ca91317/attachment.sig>
More information about the general
mailing list