Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  PCI: conditional resource-reallocation through kernel parameter pci=realloc
  • Loading branch information
Linus Torvalds committed Jul 10, 2011
2 parents 7fc7693 + f483d39 commit 2169ce9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
the default.
off: Turn ECRC off
on: Turn ECRC on.
realloc reallocate PCI resources if allocations done by BIOS
are erroneous.

pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power
Management.
Expand Down
2 changes: 2 additions & 0 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3483,6 +3483,8 @@ static int __init pci_setup(char *str)
pci_no_msi();
} else if (!strcmp(str, "noaer")) {
pci_no_aer();
} else if (!strncmp(str, "realloc", 7)) {
pci_realloc();
} else if (!strcmp(str, "nodomains")) {
pci_no_domains();
} else if (!strncmp(str, "cbiosize=", 9)) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ static inline void pci_no_msi(void) { }
static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
#endif

extern void pci_realloc(void);

static inline int pci_no_d1d2(struct pci_dev *dev)
{
unsigned int parent_dstates = 0;
Expand Down
15 changes: 15 additions & 0 deletions drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ struct resource_list_x {
(head)->next = NULL; \
} while (0)

int pci_realloc_enable = 0;
#define pci_realloc_enabled() pci_realloc_enable
void pci_realloc(void)
{
pci_realloc_enable = 1;
}

/**
* add_to_list() - add a new resource tracker to the list
* @head: Head of the list
Expand Down Expand Up @@ -1025,6 +1032,7 @@ static int __init pci_get_max_depth(void)
return depth;
}


/*
* first try will not touch pci bridge res
* second and later try will clear small leaf bridge res
Expand Down Expand Up @@ -1068,6 +1076,13 @@ pci_assign_unassigned_resources(void)
/* any device complain? */
if (!head.next)
goto enable_and_dump;

/* don't realloc if asked to do so */
if (!pci_realloc_enabled()) {
free_list(resource_list_x, &head);
goto enable_and_dump;
}

failed_type = 0;
for (list = head.next; list;) {
failed_type |= list->flags;
Expand Down

0 comments on commit 2169ce9

Please sign in to comment.