Re: New topic (PowerPC Linux PCI HELL)

2000-09-18 Thread Michel Lanners

On  18 Sep, this message from GĂ©rard Roudier echoed through cyberspace:
>> > All I wanted was a function that allows the driver to decide that which
>> > needs to be enabled.
>> >
>> > pci_enable_device(struct pci_dev *dev, byte enable_mask)
>> >
>> > This would allow drivers to enable that which it needs and not weird out
>> > the hardware that does not like all of this extra fluff.
>>
>> Sounds not too daft
>>
>> static inline int pci_enable_device(struct pci_device *dev)
>> {
>>  return pci_enable_device_features(USE_IO|USE_MM);
>> }
(snip)
> And what about other features ?
> I mean:
> - Bus Master
> - Memory Write and Invalidate
> - Parity Error response

This should probably be handled in arch-dependant code. So make a
pci_enable_device() per arch. The point beeing that only this code has a
chance to know some of the details of the PCI implementation on this
platform/arch. Bus master and MemWI don't hurt, but I guess enabling
parity can halt the bus. So you want to be careful... So:

static inline int pci_enable_device(struct pci_device *dev)
{
return pci_enable_device_features(~ENABLE_NONE);
}

and let pci_enable_device_features() chose which features make sense/are
safe.

Michel

-
Michel Lanners |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes|Ask Questions.  Make Mistakes.
L-1710 Luxembourg  |
email   [EMAIL PROTECTED]|
http://www.cpu.lu/~mlan| Learn Always. "

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: In Search of "Michel Lanners" (Re:(PowerPC Linux PCI HELL))

2000-09-14 Thread Michel Lanners

I'm here ;-)

On  13 Sep, this message from Andre Hedrick echoed through cyberspace:
> Bogus Patch :-(

Not my patch :-))

> This is what I did also but more brut force with verification of IO's and
> it still craps out..

I have added device enabling in PPC PCI fixup code for PowerMacs. But
Martin and Geert tought me that that's not the 'right way' to do it.
Anyway, see below...

> On Wed, 13 Sep 2000, Daniel Jacobowitz wrote:
>> > My new PPC G3 (7600/132) toy is not allowing IO's on PCI cards to come
>> > alive.

Hehe. Exactly my machine ;-)

>> > Basically I can not get the IO's active, regardless of BIOS on the card.

The explanation is that PowerMac firmware (OpenFirmware, that is) will
not enable any PCI device it doesn't know. Resources get assigned ok,
but that's it.

>> I'm going to bet you need to look at Michel Lanners' (did I spell that
>> right this time?) PCI patches.

Yes, spelled right. Thanks ;-)

>> diff -ur merging-bk/drivers/block/ide-pci.c work-bk/drivers/block/ide-pci.c
>> --- merging-bk/drivers/block/ide-pci.c   Tue Apr  4 22:19:16 2000
>> +++ work-bk/drivers/block/ide-pci.c  Thu Mar  9 15:33:25 2000
>> @@ -468,6 +468,15 @@
>>  printk("%s: error accessing PCI regs\n", d->name);
>>  return;
>>  }
>> +#ifdef __powerpc__
>> +if (!(pcicmd & PCI_COMMAND_IO)) {   /* is device disabled? */
>> +pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO);
>> +if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) {
>> +printk("%s: error accessing PCI regs\n", d->name);
>> +return;
>> +}
>> +}
>> +#endif

This patch should basically be correct. In essence, that's what's done
elsewhere as well, be it in my patches or with pci_enable_device().

Oh, wait... you've got problems accessing _IO_ space? That's a different
matter altogether. Let me explain: On PowerPC, there's no such thing as
an IO space, or dedicated IO instructions. The memory model is flat.
Now, in order to support IO space on the PCI bus, that IO space is
simply mapped to a memory region by the bus bridge, which also takes
care of generating IO cycles on the bus.

This mapping of IO space to the regular memory space is not transparent,
i.e. adresses are translated. That's what the _IO_BASE is for. Now, I
don't remember exactly, but in order to get the Promise going in my box,
I got rid of _IO_BASE, and rather fixed the struct pci_dev of the
Promise to point its IO regions at the translated space. Again, I'm not
sure what the exact problem was when not doing that, or whether with
recent 2.4 PPC kernels, that's still necessary.

Anyway, either look for yourself in the direction of IO space
remappings, or have a look at the PCI patches on my site, which include
the IO space stuff:

http://www.cpu.lu/~mlan/linux/dev/pci.html

Have fun!

Michel

-
Michel Lanners |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes|Ask Questions.  Make Mistakes.
L-1710 Luxembourg  |
email   [EMAIL PROTECTED]|
http://www.cpu.lu/~mlan| Learn Always. "

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/