Re: kmalloc

Petr Vandrovec Ing. VTEI (VANDROVE@vc.cvut.cz)
Thu, 28 Jan 1999 21:42:27 MET-1


> = Gabriel Paubert <paubert@iram.es>
> > = Linus Torvalds <torvalds@transmeta.com>
> > > = Me <vandrove@vc.cvut.cz>
> > > And I'm not sure, whether
> > > ioremap works correctly on PReP.
> > Entirely possible. You might want to talk to the PPC people.
> It does not work, and I'm trying to fix it among other problems...
Uf, I thought that problem is between keyboard and chair.
> > Drivers that care about endianness should probably do the conversion
> > themselves.
> Yes, and read[bwl]/write[bwl] also add a barrier instruction after each
> access. This may hurt badly, and it is perfectly possible to add barriers
> explicitly in newly written drivers.
I think so...
> > > And at third, in structure pci_device, there is array with addresses
> > > of PCI devices. It should contain CPU view of device address, i.e.
> > > something suitable for ioremap(). It contains PCI bus view... So another
> > > case.
> > No, they should not. The driver should use ioremap().
...
> the following code on the Alpha means (in arch/alpha/kernel/bios32.c,
> but there is something similar in Sparc64):
...
> Obviously, unless the code is needlessly obfuscated, dev->base_address
> will _not_ have the same value as the base register in the PCI
> configuration space. Shouldn't it be the same on PreP, where to access the
> MMIO at address 0x123456, the physical address is 0xC0123456 since the bridge
> subtracts 0xc0000000 from the address appearing on the CPU pins ?
I agree with you, Gabriel. Scheme with bus view of `address' in base_address
works ONLY if all buses in computer uses same translation scheme.
But if you have two buses, one connected (for example) directly to
CPU and another through translating bridge, you must have two different
ioremaps. But if you place `physical' address into base_address, non-bus
mastering devices will work without problems.
And busmastering devices do not know, where is mapped system memory
from bus view, so we lose nothing (yes, we are loosing busmastered
transfers inside one PCI bus... But I think that this can be done
by simple, bridge-specific function
bus_addr_t wheretoDMA(bus* source, bus* destination, bus_addr_t destaddr)).
> I've been trying to solve this problem but never got a clear answer. I had
> come to the conclusion that it should be:
> pci_read_config_dword(dev, PCI_BASE_ADDRESS_n, &base)
> dev->base_address[n] = base+0xc0000000 (adjusted by pcibios_fixup())
> address used in driver = ioremap(dev->base_address[n])
This is fine from my viewpoint. Of course,
pci_read_config_dword(dev, PCI_BASE_ADDRESS_n, &dev->base_address[n]);
/* do nothing in pcibios_fixup() */
address used in driver = ioremap(dev->bus, dev->base_address[n])
so we still have unchanged bus address for busmastering transfers.
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz

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