Messages in this thread | | | Date | Fri, 6 Aug 1999 15:06:45 +0200 (CEST) | From | Geert Uytterhoeven <> | Subject | Re: New resources - pls, explain :-( |
| |
On Thu, 5 Aug 1999, Linus Torvalds wrote: > On Thu, 5 Aug 1999, Petr Vandrovec Ing. VTEI wrote: > > (2) What should I do with this resource? From your code it seems that > > (a) resource is already plugged into resource tree, so no > > {request,release}_resource should be in driver > > (b) start contain base, end end address and flags some ids (maybe > > there should be some additional macros - it is not clear whether > > MMIO region is detected as !(flags & PCI_BASE_ADDRESS_SPACE_IO) or > > by something else. > > Probably IS_PCI_SPACE_IO() & IS_PCI_SPACE_MMIO() should be invented > > (otherwise I'll ignore these flags - hardware manual says, that > > region 0 for my matrox is always MMIO, so why bother with check) > > You don't =have= to do anything with the resource. Many drivers can just > do > > mmio_base = dev->resource[0].start; > > because for those drivers the driver documentation says that it's always > the first aperture, and it's always a memory region. So you don't have to > use the flags if you don't want to. > > There are other drivers where different chip versions have different > apertures (it's actually fairly uncommon, but it happens, and PCI > obviously gives enough information that it can be worked around), and > those drivers might for example search through each of the six resources > to find the one tey are interested in. > > So the code might look something like this: > > int find_io_base(struct pci_dev * dev) > { > for (i = 0; i < 6; i++) { > if (dev->resource[i].flags & PCI_BASE_ADDRESS_SPACE_IO) > return dev->resource[i].start; > } > return -1; > } > > but that's usually not actually needed.
When I look at the 13pre7 patch, I see plenty of places where just (blindly) was done
s/base_address[i]/resource[i].start/g
I.e. the masks with PCI_BASE_ADDRESS_IO_MASK are still there! OK, it will still work, but it's not clean (IMHO).
Greetings,
Geert
-- Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be Wavelets, Linux/{m68k~Amiga,PPC~CHRP} http://www.cs.kuleuven.ac.be/~geert/ Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
- 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/
| |