Broadcom MMIO base address

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Broadcom MMIO base address

Post by kemosparc »

Hi,

I am trying to configure the Broadcom Netxtream II 57xx network card on an IBM x3650 M2.

The problem I have is in detecting the Memory base address of the card.

When I read the PCI device header I have the following:

Device ID: 0x164C
Vendor ID: 0x14E4
Header: 0x0
BAR0: 0xce0d -> 0b1100111000001101
Memory Space Indicator: I/O
Type: Anywhere in 64-bit Address (How ??)
Prefetchable: Enabled
BAR1: 0xf000ff54: 0b11110000000000001111111101010100
Memory Space Indicator: Memory
Type: Anywhere in 64-bit Address
Prefetchable: Enabled
Intr: 0xB


The values in the BAR does not work with me, the card does not respond to the drivers command when I issue them to the memory space I detected in BAR1.

I did something sneaky; I started up Linux on the same machine and issued lspci -vvv and I got the memory base address to be 0xce000000.

I hard wired this value into my code and I loaded my OS and the card started responding to the driver.

My problem is that I don't know how Linux got the 0xce000000 address.

Bar0 looks close to the address but it is 32-bit.

The same PCI header code works with the Intel e1000/e network cards with no problems, and detect the addresses correctly.

Any ideas ?

Thanks,
Karim.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Broadcom MMIO base address

Post by Combuster »

BAR1: 0xf000ff54: 0b11110000000000001111111101010100
This reads as if you were dereferencing a null pointer (looks like IVT contents).
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Broadcom MMIO base address

Post by kemosparc »

I don't understand your reply !
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Broadcom MMIO base address

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Broadcom MMIO base address

Post by Candy »

Your results smell like you're reading regular memory space (ie, by using mov or reading from a pointer) rather than PCI config space (using port 0xCFC / 0xCF8).

Please read the Wiki on PCI and reading config space.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Broadcom MMIO base address

Post by iansjack »

Candy wrote:Your results smell like you're reading regular memory space (ie, by using mov or reading from a pointer) rather than PCI config space (using port 0xCFC / 0xCF8).

Please read the Wiki on PCI and reading config space.
So how come the Vendor and Device Ids are correctly read?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Broadcom MMIO base address

Post by Candy »

iansjack wrote:So how come the Vendor and Device Ids are correctly read?
No idea.

Also, given that I can't see any pci config space reading code, I have no way to find out either. This leaves Combuster and myself to use only our GlassBall (tm) method of debugging that while usually quite OK, may be off in some cases.

0xF000FF54 is too familiar though - that's what my own null pointers also read.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Broadcom MMIO base address

Post by SpyderTL »

Double check your BAR1 code (and const values). Or you can post your code and we'll take a look.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Broadcom MMIO base address

Post by iansjack »

Candy wrote:
iansjack wrote:So how come the Vendor and Device Ids are correctly read?
No idea.

Also, given that I can't see any pci config space reading code, I have no way to find out either. This leaves Combuster and myself to use only our GlassBall (tm) method of debugging that while usually quite OK, may be off in some cases.

0xF000FF54 is too familiar though - that's what my own null pointers also read.
It was something of a rhetorical question. The coincidence of both Ids being correct if totally the wrong method of reading them was being used is too great to be countenanced. I don't think you need to invoke a crystal ball to see that. And the OP states that he has been successful with an E1000 driver, so it's reasonable to suppose that he has some idea of what he is doing.

I'm sure it is true that a null pointer is being read somewhere, but let's stick to the realms of the possible.
Post Reply