lkml.org 
[lkml]   [1999]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPCI resource allocation (was Re: Ok, making ready for pre-2.4 and code-freeze..)
Hello,

> Eh why not? Last time I checked it worked.

On the i386, yes. On Alpha, probably not. Allocation of PCI address spaces
is unfortunately not a simple task -- you need to obey various strange alignment
requirements :( Also, the mapping between physical and bus addresses differs
from architecture to architecture even for I/O addresses.

> Anyway, the sonicvibes driver _needs_ to be able to allocate these resources,
> noone else is going to do this for it, as the sonicvibes chip uses
> nonstandard registers for the DDMA address, and no BIOS I've seen knows about
> sonicvibes peculiarity.
>
> Any suggestion?

We should define a PCI layer function (architecture specific) allowing drivers
to ask for assigning of new resources (see the patch below).

DaveM, does this look reasonable? I've noticed pdev_assign_unassigned_resources()
being passed min_io and min_mem arguments, but I think we should just adjust resources
of the parent bus instead.

Have a nice fortnight
--
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"P.C.M.C.I.A. stands for `People Can't Memorize Computer Industry Acronyms'"



--- include/linux/pci.h.mj Mon Dec 20 11:00:44 1999
+++ include/linux/pci.h Mon Dec 20 11:01:43 1999
@@ -413,14 +413,15 @@

void pcibios_init(void);
void pcibios_fixup_bus(struct pci_bus *);
-void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *);
int pcibios_enable_device(struct pci_dev *);
char *pcibios_setup (char *str);

+/* Used only when drivers/pci/setup.c is used */
void pcibios_align_resource(void *, struct resource *, unsigned long);
void pcibios_update_resource(struct pci_dev *, struct resource *,
struct resource *, int);
void pcibios_update_irq(struct pci_dev *, int irq);
+void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *);

/* Backward compatibility, don't use in new code! */

@@ -443,7 +444,7 @@
unsigned short index, unsigned char *bus,
unsigned char *dev_fn);

-/* Generic PCI interface functions */
+/* Generic PCI functions used internally */

void pci_init(void);
struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
@@ -454,6 +455,8 @@
void pci_read_bridge_bases(struct pci_bus *child);
struct resource *pci_find_parent_resource(struct pci_dev *dev, struct resource *res);

+/* Generic PCI functions exported to card drivers */
+
struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
struct pci_dev *pci_find_subsys (unsigned int vendor, unsigned int device,
unsigned int ss_vendor, unsigned int ss_device,
@@ -470,9 +473,11 @@
int pci_write_config_byte(struct pci_dev *dev, int where, u8 val);
int pci_write_config_word(struct pci_dev *dev, int where, u16 val);
int pci_write_config_dword(struct pci_dev *dev, int where, u32 val);
+
int pci_enable_device(struct pci_dev *dev);
void pci_set_master(struct pci_dev *dev);
int pci_set_power_state(struct pci_dev *dev, int state);
+int pci_assign_resource(struct pci_dev *dev, int i);

/* Helper functions for low-level code (drivers/pci/setup.c) */

--- arch/i386/kernel/pci-i386.c.mj Mon Dec 20 10:56:27 1999
+++ arch/i386/kernel/pci-i386.c Mon Dec 20 10:56:27 1999
@@ -102,7 +102,7 @@
* Expects start=0, end=size-1, flags=resource type.
*/

-static int __init pcibios_assign_resource(struct pci_dev *dev, int i)
+int pci_assign_resource(struct pci_dev *dev, int i)
{
struct resource *r = &dev->resource[i];
struct resource *pr = pci_find_parent_resource(dev, r);
@@ -272,7 +272,7 @@
* the BIOS forgot to do so or because we have decided the old
* address was unusable for some reason.
*/
- pcibios_assign_resource(dev, idx);
+ pci_assign_resource(dev, idx);
}
}
if (pci_probe & PCI_ASSIGN_ROMS) {
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans