lkml.org 
[lkml]   [1998]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: S3 High Speed text font support in vgacon.c [patch 2.1.112]
Hi,

> I've been thinking about adding code for that to the kernel, but it's not
> trivial: how do you find out which devices have been assigned PCI resources
> already? Is this the correct way?
>
> oldaddr = pci_read(PCI_BASE_ADDRESS_i);
> pci_write(PCI_BASE_ADDRESS_i, -1);
> newaddr = pci_read(PCI_BASE_ADDRESS_i);
> if (oldaddr == newaddr) {
> /* not assigned */
> newaddr = pci_alloc(newaddr);
> pci_write(PCI_BASE_ADDRESS_i, newaddr);
> } else {
> /* assigned */
> pci_write(PCI_BASE_ADDRESS_i, oldaddr);
> }
>
> OK, this is a bit simplistic. I need two passes to prealloc the already
> assigned stuff. I cannot reassign new adresses to already assigned stuff since
> those adresses may be in the Open Firmware device tree properties, and thus
> can't be changed.

You should disable PCI_COMMAND_IO and PCI_COMMAND_MEMORY before writing
to the base address registers and enable it afterwards (but don't enable IO
where there are no I/O ports and the same holds for enabling memory).

The real problem is that you can't write a simple pci_alloc function since
you need to handle PCI-to-PCI bridges. You also need to do some fixup for early
S3 cards which errorneously report 16M address space instead of 32M (see XFree86
probing routines for an work-around).

I plan to include address allocation in the generic PCI subsystem for 2.3
(calling arch-dependent functions for address space management, but handling
bridges and buggy devices itself), since it's needed for proper support of
hot-pluggable devices (CardBus etc.) and we will finally get rid of the ugly
IDE address assignment hacks, too.

Have a nice fortnight
--
Martin `MJ' Mares <mj@ucw.cz> http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Lisp Users: Due to the holiday, there will be no garbage collection on Monday."

-
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.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.067 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site