diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-02-23 22:23:30 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-24 11:47:42 -0500 |
commit | b55438fdd5173a367659a7e200acea6c9f77b8cb (patch) | |
tree | fbcb4ac2e03abcf6933b18fce56361adbcda84af /drivers | |
parent | 0c5be0cb0edfe3b5c4b62eac68aa2aa15ec681af (diff) |
PCI: prepare pci=realloc for multiple options
Let the user could enable and disable with pci=realloc=on or pci=realloc=off
Also
1. move variable and functions near the place they are used.
2. change macro to function
3. change related functions and variable to static and _init
4. update parameter description accordingly.
This will let us add a config option to control default behavior, and
still allow the user to turn off automatic reallocation if it fails on
their platform until a permanent solution is found.
-v2: still honor pci=realloc, and treat it as pci=realloc=on
also use enum instead of ...
-v3: update kernel-paramenters.txt according to Jesse.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pci.c | 4 | ||||
-rw-r--r-- | drivers/pci/pci.h | 2 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 34 |
3 files changed, 31 insertions, 9 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 8f30736dbf3f..e9f9dc183cfc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3772,8 +3772,10 @@ static int __init pci_setup(char *str) | |||
3772 | pci_no_msi(); | 3772 | pci_no_msi(); |
3773 | } else if (!strcmp(str, "noaer")) { | 3773 | } else if (!strcmp(str, "noaer")) { |
3774 | pci_no_aer(); | 3774 | pci_no_aer(); |
3775 | } else if (!strncmp(str, "realloc=", 8)) { | ||
3776 | pci_realloc_get_opt(str + 8); | ||
3775 | } else if (!strncmp(str, "realloc", 7)) { | 3777 | } else if (!strncmp(str, "realloc", 7)) { |
3776 | pci_realloc(); | 3778 | pci_realloc_get_opt("on"); |
3777 | } else if (!strcmp(str, "nodomains")) { | 3779 | } else if (!strcmp(str, "nodomains")) { |
3778 | pci_no_domains(); | 3780 | pci_no_domains(); |
3779 | } else if (!strncmp(str, "cbiosize=", 9)) { | 3781 | } else if (!strncmp(str, "cbiosize=", 9)) { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 586ac9b097e4..1fc63b39f83f 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -149,7 +149,7 @@ static inline void pci_no_msi(void) { } | |||
149 | static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } | 149 | static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | extern void pci_realloc(void); | 152 | void pci_realloc_get_opt(char *); |
153 | 153 | ||
154 | static inline int pci_no_d1d2(struct pci_dev *dev) | 154 | static inline int pci_no_d1d2(struct pci_dev *dev) |
155 | { | 155 | { |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 162edfb356b6..219722df68d6 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -48,13 +48,6 @@ static void free_list(struct list_head *head) | |||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | int pci_realloc_enable = 0; | ||
52 | #define pci_realloc_enabled() pci_realloc_enable | ||
53 | void pci_realloc(void) | ||
54 | { | ||
55 | pci_realloc_enable = 1; | ||
56 | } | ||
57 | |||
58 | /** | 51 | /** |
59 | * add_to_list() - add a new resource tracker to the list | 52 | * add_to_list() - add a new resource tracker to the list |
60 | * @head: Head of the list | 53 | * @head: Head of the list |
@@ -1273,6 +1266,33 @@ static int __init pci_get_max_depth(void) | |||
1273 | return depth; | 1266 | return depth; |
1274 | } | 1267 | } |
1275 | 1268 | ||
1269 | /* | ||
1270 | * -1: undefined, will auto detect later | ||
1271 | * 0: disabled by user | ||
1272 | * 1: disabled by auto detect | ||
1273 | * 2: enabled by user | ||
1274 | * 3: enabled by auto detect | ||
1275 | */ | ||
1276 | enum enable_type { | ||
1277 | undefined = -1, | ||
1278 | user_disabled, | ||
1279 | auto_disabled, | ||
1280 | user_enabled, | ||
1281 | auto_enabled, | ||
1282 | }; | ||
1283 | |||
1284 | static enum enable_type pci_realloc_enable __initdata = undefined; | ||
1285 | void __init pci_realloc_get_opt(char *str) | ||
1286 | { | ||
1287 | if (!strncmp(str, "off", 3)) | ||
1288 | pci_realloc_enable = user_disabled; | ||
1289 | else if (!strncmp(str, "on", 2)) | ||
1290 | pci_realloc_enable = user_enabled; | ||
1291 | } | ||
1292 | static bool __init pci_realloc_enabled(void) | ||
1293 | { | ||
1294 | return pci_realloc_enable >= user_enabled; | ||
1295 | } | ||
1276 | 1296 | ||
1277 | /* | 1297 | /* |
1278 | * first try will not touch pci bridge res | 1298 | * first try will not touch pci bridge res |