Re: New kernel/resource.c

Linus Torvalds (torvalds@transmeta.com)
Fri, 16 Jul 1999 09:12:38 -0700 (PDT)


On Fri, 16 Jul 1999, David Hinds wrote:
> >
> > They ARE PCI specific.
> >
> > What's the problem?
>
> I've still got a laptop on my desk that doesn't have a PCI bus.

Ok.

You want to be a stickler.

If it's the name you object to, then just don't call it PCI. Call it
"peanuts".

You have two kinds of peanuts: low-fat and regular.

The low-fat peanuts you access with "inb/outb", and there are only 65536
of them, so you just number them. The regular ones you access with
"readw/writew" and there are four billion of them (and because you cannot
keep all four billion in your pocket, you have to have an operation you
call "ioremap()" to move part of the regular peanut space into your
pocket.

In any case, they are a resource to you, and they are uniquely identified
with a 16-bit and a 32-bit number to you. They do NOT have any hierarchy:
low-fat peanut #0 is identical to low-fat peanut #9000 as far as the
driver is concerned, so there is NO notion of special kinds of peanuts.

In short, you have a flat address space. Everybody knows that flat address
spaces are better than segmented ones. You have a FLAT resource. You have
one nice resource tree for the low-fat peanuts, and you have one resource
tree for the regular ones.

In particular, you don't have two resource trees for one and the same
resource. Also, you don't try to have a resource tree based on any
electrical hierarchy (ie you do NOT try to follow PCI bridges or whatever
that are largely invisible from a software standpoint).

There is a hierarchical nature to the new resource tree, but that is meant
more to be used for "conceptual" hierarchies - for visualization, and for
showing logical groupings that actually do show on a sw level.

What the peanuts actually are electrically you don't care about, because
you really cannot tell a difference. You might as well call them PCI,
because all the other cases (the ISA peanuts and the PCMCIA peanuts) can
really be seen as just special (often limited) versions of the generic
class of PCI peanuts.

I just think that "PCI" makes for a much better name than "peanut",
wouldnt you agree.

I also think it makes for a hell of a better name than
"pci_or_isa_or_pcmcia_or_proprietary_bus_that_uses_io_and_readb".

No?

> Glancing through the kernel tree, use of inb()/outb() seems to be
> fairly common on platforms that do not have PCI busses. On some
> platforms, addresses obtained from ioremap() are dereferenced without
> using read[bwl] but I don't know if this is kosher or not, as there is
> little documentation of such things.

There is documentation: Dcumentation/IO-mapping.txt.

Accessing a PCI location with a plain C dereference is wrong. It just
happens to work on a x86, but it really doesn't work anywhere else. But
because the x86 is obviously the most popular platform, and because of
historical reasons, many drivers still do it.

> On my PCI-based laptop, there are also a dozen or so devices that
> reside behind a PCI-to-ISA bus bridge. They are accessed using
> inb/outb and readb/writeb. It isn't clear to me where their resources
> should go, if you want separate resource trees for each bus. They are
> not PCI devices, but they clearly occupy the same flat address space
> as real PCI devices.

Exacly. "clearly" is the operative word here. You might as well just
consider them to be a slightly less capable form of PCI, could you not?

And clearly they ARE flat address spaces. Even if the actual hardware has
two completely separate PCI buses (ie I'm NOT talking about a bridge here:
a PCI-PCI bridge makes ONE bus out of two buses), at least an intel CPU
can still only _address_ it as two separate linear regions. So the outside
really doesn't matter - regardless of how complex it is, it is going to
end up being just a linear resource as far as the CPU is concerned.

So instead of using confusing names like "peanut" or "pci_or_isa_or_
pcmcia_or_who_the_hell_cares_what_electrical_bus_is_outside_the_cpu_
as_we_cannot_see_it_anyway" , I'm just calling it "PCI". Fair enough? It's
99% of the interesting market these days.

Linus

-
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/