Skip to contentSkip to conversation

tenth post about PCI code, need help

DISCUSSION Ray Lee 3 participants 6 messages Jan 8, 2003

lore
Share & tools
lore

Ray Lee

author
#0 lore raw
Quoted 1 line

1. which device is at port address 0xCFB? (please note, NOT 0xCF8)

0xcfb ('bee') is the fourth byte of the 32 bit register that sits/starts at 0xcf8 ('eight'). Note the difference in the code between the outb and outl calls.

To answer your other questions, I think you'd have better luck reading the spec for the x86 pc-style PCI bridge chip, rather than the (generic) PCI v2.0 spec itself. The spec for the actual chip is always the final authority for what's going on. (Unless, of course, it's wrong...)

Ray

#1 lore raw
Quoted 6 lines · Ray Lee
Quoted 1 line

1. which device is at port address 0xCFB? (please note, NOT 0xCF8)

0xcfb ('bee') is the fourth byte of the 32 bit register that sits/starts at 0xcf8 ('eight'). Note the difference in the code between the outb and outl calls.

Quoted 7 lines

To answer your other questions, I think you'd have better luck reading the spec for the x86 pc-style PCI bridge chip, rather than the (generic) PCI v2.0 spec itself. The spec for the actual chip is always the final authority for what's going on. (Unless, of course, it's wrong...)

Ray

The problem is that he's discovered something that's not supposed to be in the code. Only 32-bit accesses are supposed to be made to the PCI controller ports. He has discovered that somebody has made some 8-bit accesses that will not become configuration 'transactions' because they are not 32 bits. According to the spec, such accesses become direct I/O to some underlying device. So, if some underlying device shares the same I/O address space as the PCI device, that machine is broken.

FYI, the mechanism by which ix86 hardware determines if the PCI port access is a configuration read or configuration write is the 32-bit access. Any other access cannot be interpreted by the hardware as a configuration transaction. (Page 321., "Into to configuration Mechanisms", PCI System Architecture, ISBN 0-201-30974-2)

It is possible that somebody had a bad board and found that writing some junk to this port 'fixed' something. If this is so, then the code needs some comments. Otherwise, the non-32bit accesses should be removed.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

author
#2 lore raw
Quoted 3 lines · Richard B. Johnson

The problem is that he's discovered something that's not supposed to be in the code. Only 32-bit accesses are supposed to be made to the PCI controller ports.

<shrug> Okay, I withdraw my interpretation. Since I had to rewrite arch/ppc/kernel/qspan_pci.c recently, I felt mildly qualified to offer an opinion, but obviously I was wrong :-).

Ray

#3 lore raw
In reply to Richard B. Johnson
Followup to:  <[email protected]>
By author:    "Richard B. Johnson" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 7 lines

The problem is that he's discovered something that's not supposed to be in the code. Only 32-bit accesses are supposed to be made to the PCI controller ports. He has discovered that somebody has made some 8-bit accesses that will not become configuration 'transactions' because they are not 32 bits.

Right. That's what the code is checking for.

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<[email protected]>
#4 lore raw
Quoted 11 lines · H. Peter Anvin
Followup to:  <[email protected]>
By author:    "Richard B. Johnson" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 7 lines

The problem is that he's discovered something that's not supposed to be in the code. Only 32-bit accesses are supposed to be made to the PCI controller ports. He has discovered that somebody has made some 8-bit accesses that will not become configuration 'transactions' because they are not 32 bits.

Quoted 3 lines

Right. That's what the code is checking for.

-hpa

Somebody is very lucky the designer of the bus interface state-machine let him get away with it. This is a borderline "insane instruction" that could, on some (future?) machine, require a power-off to recover. This is NotGood(tm). It's like testing a fuse by shorting out a circuit. If it works, the circuit no longer works. If I doesn't, the circuit no longer works. Some things should not be tested.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

#5 lore raw
Quoted 16 lines · Richard B. Johnson
Quoted 13 lines · H. Peter Anvin
Followup to:  <[email protected]>
By author:    "Richard B. Johnson" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 6 lines

The problem is that he's discovered something that's not supposed to be in the code. Only 32-bit accesses are supposed to be made to the PCI controller ports. He has discovered that somebody has made some 8-bit accesses that will not become configuration 'transactions' because they are not 32 bits.

Right. That's what the code is checking for.

Quoted 9 lines
Quoted 1 line

-hpa

Somebody is very lucky the designer of the bus interface state-machine let him get away with it. This is a borderline "insane instruction" that could, on some (future?) machine, require a power-off to recover. This is NotGood(tm). It's like testing a fuse by shorting out a circuit. If it works, the circuit no longer works. If I doesn't, the circuit no longer works. Some things should not be tested.

If so, we will get an bug report rather than mysterious strange behaviour. This is a good thing. (Amusingly enough, exactly this code in the Linux kernel actually found a bug in one of the very early versions of the Transmeta northbridge. It was fixed in firmware.)

-hpa