aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/setup-bus.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-02-23 22:23:30 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-24 11:47:42 -0500
commitb55438fdd5173a367659a7e200acea6c9f77b8cb (patch)
treefbcb4ac2e03abcf6933b18fce56361adbcda84af /drivers/pci/setup-bus.c
parent0c5be0cb0edfe3b5c4b62eac68aa2aa15ec681af (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/pci/setup-bus.c')
-rw-r--r--drivers/pci/setup-bus.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 162edfb356b..219722df68d 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
51int pci_realloc_enable = 0;
52#define pci_realloc_enabled() pci_realloc_enable
53void 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 */
1276enum enable_type {
1277 undefined = -1,
1278 user_disabled,
1279 auto_disabled,
1280 user_enabled,
1281 auto_enabled,
1282};
1283
1284static enum enable_type pci_realloc_enable __initdata = undefined;
1285void __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}
1292static 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