Memory map/ioremap question

From: shannon loi (shannon_loi@yahoo.com)
Date: Wed Mar 08 2000 - 17:03:11 EST


I'm learning to write driver for ethernet card. The
card only support memory address and has this PCI
configuration:

Offset
00 DeviceID VendorID
04 PciStatus PciCommand
08 ClassCode RevisionId
0c HeaderType LatencyTimer CacheLineSize
10 MemBaseAddr0
14 MemBaseAddr1 (for 64bit addressing)
18 IOBaseAddr0 (default disabled)

This is MemBaseAddr0 register:
                          3 2 1 0
-------------------------------------
Base Address | 00 | 0 |
-------------------------------------
bit[0] = 0 means memory base addr
[2:1] support all 3 of memory map options
00 anywhere in 32 bit addr space
01 below 2 Meg
10 anywhere in 64 bit addr space
11 Reserved

I did this:
#if (LINUX_VERSION_CODE < 0x02030d)
  dev->base_addr = pdev->base_address[0];
#else
  dev->base_addr = pdev->resource[0].start;
#endif

myADpriv->Hwregs = (struct myHwregs
*)ioremap(dev->base_addr, 0x4000);

readl(&Hwregs->someReg);

when I try to read the hardware registers, I either
get 0 back or the machine stops working (but not hang,
I can telnet). Did I miss something/do something
wrong? what should I try differently?

Thanks.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:14 EST