diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/motherboard.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/motherboard.c')
-rw-r--r-- | drivers/acpi/motherboard.c | 108 |
1 files changed, 56 insertions, 52 deletions
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 2934475d67d6..e10fb4f842b1 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -30,12 +30,11 @@ | |||
30 | #include <acpi/acpi_drivers.h> | 30 | #include <acpi/acpi_drivers.h> |
31 | 31 | ||
32 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 32 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
33 | ACPI_MODULE_NAME ("acpi_motherboard") | 33 | ACPI_MODULE_NAME("acpi_motherboard") |
34 | 34 | ||
35 | /* Dell use PNP0C01 instead of PNP0C02 */ | 35 | /* Dell use PNP0C01 instead of PNP0C02 */ |
36 | #define ACPI_MB_HID1 "PNP0C01" | 36 | #define ACPI_MB_HID1 "PNP0C01" |
37 | #define ACPI_MB_HID2 "PNP0C02" | 37 | #define ACPI_MB_HID2 "PNP0C02" |
38 | |||
39 | /** | 38 | /** |
40 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved | 39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved |
41 | * Doesn't care about the failure of 'request_region', since other may reserve | 40 | * Doesn't care about the failure of 'request_region', since other may reserve |
@@ -44,15 +43,12 @@ ACPI_MODULE_NAME ("acpi_motherboard") | |||
44 | #define IS_RESERVED_ADDR(base, len) \ | 43 | #define IS_RESERVED_ADDR(base, len) \ |
45 | (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ | 44 | (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ |
46 | && ((base) + (len) > 0x1000)) | 45 | && ((base) + (len) > 0x1000)) |
47 | |||
48 | /* | 46 | /* |
49 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use | 47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use |
50 | * the io ports if they really know they can use it, while | 48 | * the io ports if they really know they can use it, while |
51 | * still preventing hotplug PCI devices from using it. | 49 | * still preventing hotplug PCI devices from using it. |
52 | */ | 50 | */ |
53 | 51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) | |
54 | static acpi_status | ||
55 | acpi_reserve_io_ranges (struct acpi_resource *res, void *data) | ||
56 | { | 52 | { |
57 | struct resource *requested_res = NULL; | 53 | struct resource *requested_res = NULL; |
58 | 54 | ||
@@ -63,22 +59,32 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data) | |||
63 | 59 | ||
64 | if (io_res->min_base_address != io_res->max_base_address) | 60 | if (io_res->min_base_address != io_res->max_base_address) |
65 | return_VALUE(AE_OK); | 61 | return_VALUE(AE_OK); |
66 | if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) { | 62 | if (IS_RESERVED_ADDR |
67 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", | 63 | (io_res->min_base_address, io_res->range_length)) { |
68 | io_res->min_base_address, | 64 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
69 | io_res->min_base_address + io_res->range_length)); | 65 | "Motherboard resources 0x%08x - 0x%08x\n", |
70 | requested_res = request_region(io_res->min_base_address, | 66 | io_res->min_base_address, |
71 | io_res->range_length, "motherboard"); | 67 | io_res->min_base_address + |
68 | io_res->range_length)); | ||
69 | requested_res = | ||
70 | request_region(io_res->min_base_address, | ||
71 | io_res->range_length, "motherboard"); | ||
72 | } | 72 | } |
73 | } else if (res->id == ACPI_RSTYPE_FIXED_IO) { | 73 | } else if (res->id == ACPI_RSTYPE_FIXED_IO) { |
74 | struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; | 74 | struct acpi_resource_fixed_io *fixed_io_res = |
75 | 75 | &res->data.fixed_io; | |
76 | if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) { | 76 | |
77 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", | 77 | if (IS_RESERVED_ADDR |
78 | fixed_io_res->base_address, | 78 | (fixed_io_res->base_address, fixed_io_res->range_length)) { |
79 | fixed_io_res->base_address + fixed_io_res->range_length)); | 79 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
80 | requested_res = request_region(fixed_io_res->base_address, | 80 | "Motherboard resources 0x%08x - 0x%08x\n", |
81 | fixed_io_res->range_length, "motherboard"); | 81 | fixed_io_res->base_address, |
82 | fixed_io_res->base_address + | ||
83 | fixed_io_res->range_length)); | ||
84 | requested_res = | ||
85 | request_region(fixed_io_res->base_address, | ||
86 | fixed_io_res->range_length, | ||
87 | "motherboard"); | ||
82 | } | 88 | } |
83 | } else { | 89 | } else { |
84 | /* Memory mapped IO? */ | 90 | /* Memory mapped IO? */ |
@@ -89,72 +95,70 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data) | |||
89 | return_VALUE(AE_OK); | 95 | return_VALUE(AE_OK); |
90 | } | 96 | } |
91 | 97 | ||
92 | static int acpi_motherboard_add (struct acpi_device *device) | 98 | static int acpi_motherboard_add(struct acpi_device *device) |
93 | { | 99 | { |
94 | if (!device) | 100 | if (!device) |
95 | return -EINVAL; | 101 | return -EINVAL; |
96 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, | 102 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, |
97 | acpi_reserve_io_ranges, NULL); | 103 | acpi_reserve_io_ranges, NULL); |
98 | 104 | ||
99 | return 0; | 105 | return 0; |
100 | } | 106 | } |
101 | 107 | ||
102 | static struct acpi_driver acpi_motherboard_driver1 = { | 108 | static struct acpi_driver acpi_motherboard_driver1 = { |
103 | .name = "motherboard", | 109 | .name = "motherboard", |
104 | .class = "", | 110 | .class = "", |
105 | .ids = ACPI_MB_HID1, | 111 | .ids = ACPI_MB_HID1, |
106 | .ops = { | 112 | .ops = { |
107 | .add = acpi_motherboard_add, | 113 | .add = acpi_motherboard_add, |
108 | }, | 114 | }, |
109 | }; | 115 | }; |
110 | 116 | ||
111 | static struct acpi_driver acpi_motherboard_driver2 = { | 117 | static struct acpi_driver acpi_motherboard_driver2 = { |
112 | .name = "motherboard", | 118 | .name = "motherboard", |
113 | .class = "", | 119 | .class = "", |
114 | .ids = ACPI_MB_HID2, | 120 | .ids = ACPI_MB_HID2, |
115 | .ops = { | 121 | .ops = { |
116 | .add = acpi_motherboard_add, | 122 | .add = acpi_motherboard_add, |
117 | }, | 123 | }, |
118 | }; | 124 | }; |
119 | 125 | ||
120 | static void __init | 126 | static void __init acpi_reserve_resources(void) |
121 | acpi_reserve_resources (void) | ||
122 | { | 127 | { |
123 | if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 128 | if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) |
124 | request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, | 129 | request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, |
125 | acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); | 130 | acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); |
126 | 131 | ||
127 | if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 132 | if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) |
128 | request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, | 133 | request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, |
129 | acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); | 134 | acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); |
130 | 135 | ||
131 | if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 136 | if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) |
132 | request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, | 137 | request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, |
133 | acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); | 138 | acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); |
134 | 139 | ||
135 | if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 140 | if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) |
136 | request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, | 141 | request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, |
137 | acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); | 142 | acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); |
138 | 143 | ||
139 | if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) | 144 | if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) |
140 | request_region(acpi_gbl_FADT->xpm_tmr_blk.address, | 145 | request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); |
141 | 4, "PM_TMR"); | ||
142 | 146 | ||
143 | if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) | 147 | if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) |
144 | request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, | 148 | request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, |
145 | acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); | 149 | acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); |
146 | 150 | ||
147 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | 151 | /* Length of GPE blocks must be a non-negative multiple of 2 */ |
148 | 152 | ||
149 | if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && | 153 | if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && |
150 | !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) | 154 | !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) |
151 | request_region(acpi_gbl_FADT->xgpe0_blk.address, | 155 | request_region(acpi_gbl_FADT->xgpe0_blk.address, |
152 | acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); | 156 | acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); |
153 | 157 | ||
154 | if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && | 158 | if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && |
155 | !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) | 159 | !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) |
156 | request_region(acpi_gbl_FADT->xgpe1_blk.address, | 160 | request_region(acpi_gbl_FADT->xgpe1_blk.address, |
157 | acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); | 161 | acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); |
158 | } | 162 | } |
159 | 163 | ||
160 | static int __init acpi_motherboard_init(void) | 164 | static int __init acpi_motherboard_init(void) |
@@ -166,7 +170,7 @@ static int __init acpi_motherboard_init(void) | |||
166 | * This module must run after scan.c | 170 | * This module must run after scan.c |
167 | */ | 171 | */ |
168 | if (!acpi_disabled) | 172 | if (!acpi_disabled) |
169 | acpi_reserve_resources (); | 173 | acpi_reserve_resources(); |
170 | return 0; | 174 | return 0; |
171 | } | 175 | } |
172 | 176 | ||