diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-13 01:43:25 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-13 01:43:25 -0500 |
commit | d9bc125caf592b7d081021f32ce5b717efdf70c8 (patch) | |
tree | 263b7066ba22ddce21db610c0300f6eaac6f2064 /arch/ia64/sn/kernel | |
parent | 43d78ef2ba5bec26d0315859e8324bfc0be23766 (diff) | |
parent | ec2f9d1331f658433411c58077871e1eef4ee1b4 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts:
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/gss_spkm3_token.c
net/sunrpc/clnt.c
Merge with mainline and fix conflicts.
Diffstat (limited to 'arch/ia64/sn/kernel')
-rw-r--r-- | arch/ia64/sn/kernel/huberror.c | 16 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_acpi_init.c | 314 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_common.c | 90 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 54 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/iomv.c | 5 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/msi_sn.c | 20 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/sn2/sn2_smp.c | 2 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_hwperf.c | 2 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_proc_fs.c | 105 |
9 files changed, 457 insertions, 151 deletions
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c index abca6bd7962f..fcf7f93c4b61 100644 --- a/arch/ia64/sn/kernel/huberror.c +++ b/arch/ia64/sn/kernel/huberror.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 1992 - 1997, 2000,2002-2005 Silicon Graphics, Inc. All rights reserved. | 6 | * Copyright (C) 1992 - 1997, 2000,2002-2007 Silicon Graphics, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
@@ -38,12 +38,20 @@ static irqreturn_t hub_eint_handler(int irq, void *arg) | |||
38 | (u64) nasid, 0, 0, 0, 0, 0, 0); | 38 | (u64) nasid, 0, 0, 0, 0, 0, 0); |
39 | 39 | ||
40 | if ((int)ret_stuff.v0) | 40 | if ((int)ret_stuff.v0) |
41 | panic("hubii_eint_handler(): Fatal TIO Error"); | 41 | panic("%s: Fatal %s Error", __FUNCTION__, |
42 | ((nasid & 1) ? "TIO" : "HUBII")); | ||
42 | 43 | ||
43 | if (!(nasid & 1)) /* Not a TIO, handle CRB errors */ | 44 | if (!(nasid & 1)) /* Not a TIO, handle CRB errors */ |
44 | (void)hubiio_crb_error_handler(hubdev_info); | 45 | (void)hubiio_crb_error_handler(hubdev_info); |
45 | } else | 46 | } else |
46 | bte_error_handler((unsigned long)NODEPDA(nasid_to_cnodeid(nasid))); | 47 | if (nasid & 1) { /* TIO errors */ |
48 | SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT, | ||
49 | (u64) nasid, 0, 0, 0, 0, 0, 0); | ||
50 | |||
51 | if ((int)ret_stuff.v0) | ||
52 | panic("%s: Fatal TIO Error", __FUNCTION__); | ||
53 | } else | ||
54 | bte_error_handler((unsigned long)NODEPDA(nasid_to_cnodeid(nasid))); | ||
47 | 55 | ||
48 | return IRQ_HANDLED; | 56 | return IRQ_HANDLED; |
49 | } | 57 | } |
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c index cb96b4ea7df6..8c331ca6e5c9 100644 --- a/arch/ia64/sn/kernel/io_acpi_init.c +++ b/arch/ia64/sn/kernel/io_acpi_init.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/sn/sn_sal.h> | 13 | #include <asm/sn/sn_sal.h> |
14 | #include "xtalk/hubdev.h" | 14 | #include "xtalk/hubdev.h" |
15 | #include <linux/acpi.h> | 15 | #include <linux/acpi.h> |
16 | #include <acpi/acnamesp.h> | ||
16 | 17 | ||
17 | 18 | ||
18 | /* | 19 | /* |
@@ -31,6 +32,12 @@ struct acpi_vendor_uuid sn_uuid = { | |||
31 | 0xa2, 0x7c, 0x08, 0x00, 0x69, 0x13, 0xea, 0x51 }, | 32 | 0xa2, 0x7c, 0x08, 0x00, 0x69, 0x13, 0xea, 0x51 }, |
32 | }; | 33 | }; |
33 | 34 | ||
35 | struct sn_pcidev_match { | ||
36 | u8 bus; | ||
37 | unsigned int devfn; | ||
38 | acpi_handle handle; | ||
39 | }; | ||
40 | |||
34 | /* | 41 | /* |
35 | * Perform the early IO init in PROM. | 42 | * Perform the early IO init in PROM. |
36 | */ | 43 | */ |
@@ -119,9 +126,11 @@ sn_get_bussoft_ptr(struct pci_bus *bus) | |||
119 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, | 126 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, |
120 | &sn_uuid, &buffer); | 127 | &sn_uuid, &buffer); |
121 | if (ACPI_FAILURE(status)) { | 128 | if (ACPI_FAILURE(status)) { |
122 | printk(KERN_ERR "get_acpi_pcibus_ptr: " | 129 | printk(KERN_ERR "%s: " |
123 | "get_acpi_bussoft_info() failed: %d\n", | 130 | "acpi_get_vendor_resource() failed (0x%x) for: ", |
124 | status); | 131 | __FUNCTION__, status); |
132 | acpi_ns_print_node_pathname(handle, NULL); | ||
133 | printk("\n"); | ||
125 | return NULL; | 134 | return NULL; |
126 | } | 135 | } |
127 | resource = buffer.pointer; | 136 | resource = buffer.pointer; |
@@ -130,8 +139,8 @@ sn_get_bussoft_ptr(struct pci_bus *bus) | |||
130 | if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != | 139 | if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != |
131 | sizeof(struct pcibus_bussoft *)) { | 140 | sizeof(struct pcibus_bussoft *)) { |
132 | printk(KERN_ERR | 141 | printk(KERN_ERR |
133 | "get_acpi_bussoft_ptr: Invalid vendor data " | 142 | "%s: Invalid vendor data length %d\n", |
134 | "length %d\n", vendor->byte_length); | 143 | __FUNCTION__, vendor->byte_length); |
135 | kfree(buffer.pointer); | 144 | kfree(buffer.pointer); |
136 | return NULL; | 145 | return NULL; |
137 | } | 146 | } |
@@ -143,34 +152,254 @@ sn_get_bussoft_ptr(struct pci_bus *bus) | |||
143 | } | 152 | } |
144 | 153 | ||
145 | /* | 154 | /* |
146 | * sn_acpi_bus_fixup | 155 | * sn_extract_device_info - Extract the pcidev_info and the sn_irq_info |
156 | * pointers from the vendor resource using the | ||
157 | * provided acpi handle, and copy the structures | ||
158 | * into the argument buffers. | ||
147 | */ | 159 | */ |
148 | void | 160 | static int |
149 | sn_acpi_bus_fixup(struct pci_bus *bus) | 161 | sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info, |
162 | struct sn_irq_info **sn_irq_info) | ||
150 | { | 163 | { |
151 | struct pci_dev *pci_dev = NULL; | 164 | u64 addr; |
152 | struct pcibus_bussoft *prom_bussoft_ptr; | 165 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
153 | extern void sn_common_bus_fixup(struct pci_bus *, | 166 | struct sn_irq_info *irq_info, *irq_info_prom; |
154 | struct pcibus_bussoft *); | 167 | struct pcidev_info *pcidev_ptr, *pcidev_prom_ptr; |
168 | struct acpi_resource *resource; | ||
169 | int ret = 0; | ||
170 | acpi_status status; | ||
171 | struct acpi_resource_vendor_typed *vendor; | ||
155 | 172 | ||
156 | if (!bus->parent) { /* If root bus */ | 173 | /* |
157 | prom_bussoft_ptr = sn_get_bussoft_ptr(bus); | 174 | * The pointer to this device's pcidev_info structure in |
158 | if (prom_bussoft_ptr == NULL) { | 175 | * the PROM, is in the vendor resource. |
176 | */ | ||
177 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, | ||
178 | &sn_uuid, &buffer); | ||
179 | if (ACPI_FAILURE(status)) { | ||
180 | printk(KERN_ERR | ||
181 | "%s: acpi_get_vendor_resource() failed (0x%x) for: ", | ||
182 | __FUNCTION__, status); | ||
183 | acpi_ns_print_node_pathname(handle, NULL); | ||
184 | printk("\n"); | ||
185 | return 1; | ||
186 | } | ||
187 | |||
188 | resource = buffer.pointer; | ||
189 | vendor = &resource->data.vendor_typed; | ||
190 | if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != | ||
191 | sizeof(struct pci_devdev_info *)) { | ||
192 | printk(KERN_ERR | ||
193 | "%s: Invalid vendor data length: %d for: ", | ||
194 | __FUNCTION__, vendor->byte_length); | ||
195 | acpi_ns_print_node_pathname(handle, NULL); | ||
196 | printk("\n"); | ||
197 | ret = 1; | ||
198 | goto exit; | ||
199 | } | ||
200 | |||
201 | pcidev_ptr = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); | ||
202 | if (!pcidev_ptr) | ||
203 | panic("%s: Unable to alloc memory for pcidev_info", __FUNCTION__); | ||
204 | |||
205 | memcpy(&addr, vendor->byte_data, sizeof(struct pcidev_info *)); | ||
206 | pcidev_prom_ptr = __va(addr); | ||
207 | memcpy(pcidev_ptr, pcidev_prom_ptr, sizeof(struct pcidev_info)); | ||
208 | |||
209 | /* Get the IRQ info */ | ||
210 | irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | ||
211 | if (!irq_info) | ||
212 | panic("%s: Unable to alloc memory for sn_irq_info", __FUNCTION__); | ||
213 | |||
214 | if (pcidev_ptr->pdi_sn_irq_info) { | ||
215 | irq_info_prom = __va(pcidev_ptr->pdi_sn_irq_info); | ||
216 | memcpy(irq_info, irq_info_prom, sizeof(struct sn_irq_info)); | ||
217 | } | ||
218 | |||
219 | *pcidev_info = pcidev_ptr; | ||
220 | *sn_irq_info = irq_info; | ||
221 | |||
222 | exit: | ||
223 | kfree(buffer.pointer); | ||
224 | return ret; | ||
225 | } | ||
226 | |||
227 | static unsigned int | ||
228 | get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle) | ||
229 | { | ||
230 | unsigned long adr; | ||
231 | acpi_handle child; | ||
232 | unsigned int devfn; | ||
233 | int function; | ||
234 | acpi_handle parent; | ||
235 | int slot; | ||
236 | acpi_status status; | ||
237 | |||
238 | /* | ||
239 | * Do an upward search to find the root bus device, and | ||
240 | * obtain the host devfn from the previous child device. | ||
241 | */ | ||
242 | child = device_handle; | ||
243 | while (child) { | ||
244 | status = acpi_get_parent(child, &parent); | ||
245 | if (ACPI_FAILURE(status)) { | ||
246 | printk(KERN_ERR "%s: acpi_get_parent() failed " | ||
247 | "(0x%x) for: ", __FUNCTION__, status); | ||
248 | acpi_ns_print_node_pathname(child, NULL); | ||
249 | printk("\n"); | ||
250 | panic("%s: Unable to find host devfn\n", __FUNCTION__); | ||
251 | } | ||
252 | if (parent == rootbus_handle) | ||
253 | break; | ||
254 | child = parent; | ||
255 | } | ||
256 | if (!child) { | ||
257 | printk(KERN_ERR "%s: Unable to find root bus for: ", | ||
258 | __FUNCTION__); | ||
259 | acpi_ns_print_node_pathname(device_handle, NULL); | ||
260 | printk("\n"); | ||
261 | BUG(); | ||
262 | } | ||
263 | |||
264 | status = acpi_evaluate_integer(child, METHOD_NAME__ADR, NULL, &adr); | ||
265 | if (ACPI_FAILURE(status)) { | ||
266 | printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: ", | ||
267 | __FUNCTION__, status); | ||
268 | acpi_ns_print_node_pathname(child, NULL); | ||
269 | printk("\n"); | ||
270 | panic("%s: Unable to find host devfn\n", __FUNCTION__); | ||
271 | } | ||
272 | |||
273 | slot = (adr >> 16) & 0xffff; | ||
274 | function = adr & 0xffff; | ||
275 | devfn = PCI_DEVFN(slot, function); | ||
276 | return devfn; | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * find_matching_device - Callback routine to find the ACPI device | ||
281 | * that matches up with our pci_dev device. | ||
282 | * Matching is done on bus number and devfn. | ||
283 | * To find the bus number for a particular | ||
284 | * ACPI device, we must look at the _BBN method | ||
285 | * of its parent. | ||
286 | */ | ||
287 | static acpi_status | ||
288 | find_matching_device(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
289 | { | ||
290 | unsigned long bbn = -1; | ||
291 | unsigned long adr; | ||
292 | acpi_handle parent = NULL; | ||
293 | acpi_status status; | ||
294 | unsigned int devfn; | ||
295 | int function; | ||
296 | int slot; | ||
297 | struct sn_pcidev_match *info = context; | ||
298 | |||
299 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, | ||
300 | &adr); | ||
301 | if (ACPI_SUCCESS(status)) { | ||
302 | status = acpi_get_parent(handle, &parent); | ||
303 | if (ACPI_FAILURE(status)) { | ||
159 | printk(KERN_ERR | 304 | printk(KERN_ERR |
160 | "sn_pci_fixup_bus: 0x%04x:0x%02x Unable to " | 305 | "%s: acpi_get_parent() failed (0x%x) for: ", |
161 | "obtain prom_bussoft_ptr\n", | 306 | __FUNCTION__, status); |
162 | pci_domain_nr(bus), bus->number); | 307 | acpi_ns_print_node_pathname(handle, NULL); |
163 | return; | 308 | printk("\n"); |
309 | return AE_OK; | ||
310 | } | ||
311 | status = acpi_evaluate_integer(parent, METHOD_NAME__BBN, | ||
312 | NULL, &bbn); | ||
313 | if (ACPI_FAILURE(status)) { | ||
314 | printk(KERN_ERR | ||
315 | "%s: Failed to find _BBN in parent of: ", | ||
316 | __FUNCTION__); | ||
317 | acpi_ns_print_node_pathname(handle, NULL); | ||
318 | printk("\n"); | ||
319 | return AE_OK; | ||
320 | } | ||
321 | |||
322 | slot = (adr >> 16) & 0xffff; | ||
323 | function = adr & 0xffff; | ||
324 | devfn = PCI_DEVFN(slot, function); | ||
325 | if ((info->devfn == devfn) && (info->bus == bbn)) { | ||
326 | /* We have a match! */ | ||
327 | info->handle = handle; | ||
328 | return 1; | ||
164 | } | 329 | } |
165 | sn_common_bus_fixup(bus, prom_bussoft_ptr); | ||
166 | } | 330 | } |
167 | list_for_each_entry(pci_dev, &bus->devices, bus_list) { | 331 | return AE_OK; |
168 | sn_pci_fixup_slot(pci_dev); | 332 | } |
333 | |||
334 | /* | ||
335 | * sn_acpi_get_pcidev_info - Search ACPI namespace for the acpi | ||
336 | * device matching the specified pci_dev, | ||
337 | * and return the pcidev info and irq info. | ||
338 | */ | ||
339 | int | ||
340 | sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, | ||
341 | struct sn_irq_info **sn_irq_info) | ||
342 | { | ||
343 | unsigned int host_devfn; | ||
344 | struct sn_pcidev_match pcidev_match; | ||
345 | acpi_handle rootbus_handle; | ||
346 | unsigned long segment; | ||
347 | acpi_status status; | ||
348 | |||
349 | rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle; | ||
350 | status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, | ||
351 | &segment); | ||
352 | if (ACPI_SUCCESS(status)) { | ||
353 | if (segment != pci_domain_nr(dev)) { | ||
354 | printk(KERN_ERR | ||
355 | "%s: Segment number mismatch, 0x%lx vs 0x%x for: ", | ||
356 | __FUNCTION__, segment, pci_domain_nr(dev)); | ||
357 | acpi_ns_print_node_pathname(rootbus_handle, NULL); | ||
358 | printk("\n"); | ||
359 | return 1; | ||
360 | } | ||
361 | } else { | ||
362 | printk(KERN_ERR "%s: Unable to get __SEG from: ", | ||
363 | __FUNCTION__); | ||
364 | acpi_ns_print_node_pathname(rootbus_handle, NULL); | ||
365 | printk("\n"); | ||
366 | return 1; | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | * We want to search all devices in this segment/domain | ||
371 | * of the ACPI namespace for the matching ACPI device, | ||
372 | * which holds the pcidev_info pointer in its vendor resource. | ||
373 | */ | ||
374 | pcidev_match.bus = dev->bus->number; | ||
375 | pcidev_match.devfn = dev->devfn; | ||
376 | pcidev_match.handle = NULL; | ||
377 | |||
378 | acpi_walk_namespace(ACPI_TYPE_DEVICE, rootbus_handle, ACPI_UINT32_MAX, | ||
379 | find_matching_device, &pcidev_match, NULL); | ||
380 | |||
381 | if (!pcidev_match.handle) { | ||
382 | printk(KERN_ERR | ||
383 | "%s: Could not find matching ACPI device for %s.\n", | ||
384 | __FUNCTION__, pci_name(dev)); | ||
385 | return 1; | ||
169 | } | 386 | } |
387 | |||
388 | if (sn_extract_device_info(pcidev_match.handle, pcidev_info, sn_irq_info)) | ||
389 | return 1; | ||
390 | |||
391 | /* Build up the pcidev_info.pdi_slot_host_handle */ | ||
392 | host_devfn = get_host_devfn(pcidev_match.handle, rootbus_handle); | ||
393 | (*pcidev_info)->pdi_slot_host_handle = | ||
394 | ((unsigned long) pci_domain_nr(dev) << 40) | | ||
395 | /* bus == 0 */ | ||
396 | host_devfn; | ||
397 | return 0; | ||
170 | } | 398 | } |
171 | 399 | ||
172 | /* | 400 | /* |
173 | * sn_acpi_slot_fixup - Perform any SN specific slot fixup. | 401 | * sn_acpi_slot_fixup - Obtain the pcidev_info and sn_irq_info. |
402 | * Perform any SN specific slot fixup. | ||
174 | * At present there does not appear to be | 403 | * At present there does not appear to be |
175 | * any generic way to handle a ROM image | 404 | * any generic way to handle a ROM image |
176 | * that has been shadowed by the PROM, so | 405 | * that has been shadowed by the PROM, so |
@@ -179,11 +408,18 @@ sn_acpi_bus_fixup(struct pci_bus *bus) | |||
179 | */ | 408 | */ |
180 | 409 | ||
181 | void | 410 | void |
182 | sn_acpi_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) | 411 | sn_acpi_slot_fixup(struct pci_dev *dev) |
183 | { | 412 | { |
184 | void __iomem *addr; | 413 | void __iomem *addr; |
414 | struct pcidev_info *pcidev_info = NULL; | ||
415 | struct sn_irq_info *sn_irq_info = NULL; | ||
185 | size_t size; | 416 | size_t size; |
186 | 417 | ||
418 | if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { | ||
419 | panic("%s: Failure obtaining pcidev_info for %s\n", | ||
420 | __FUNCTION__, pci_name(dev)); | ||
421 | } | ||
422 | |||
187 | if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) { | 423 | if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) { |
188 | /* | 424 | /* |
189 | * A valid ROM image exists and has been shadowed by the | 425 | * A valid ROM image exists and has been shadowed by the |
@@ -200,8 +436,11 @@ sn_acpi_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) | |||
200 | (unsigned long) addr + size; | 436 | (unsigned long) addr + size; |
201 | dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; | 437 | dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; |
202 | } | 438 | } |
439 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | ||
203 | } | 440 | } |
204 | 441 | ||
442 | EXPORT_SYMBOL(sn_acpi_slot_fixup); | ||
443 | |||
205 | static struct acpi_driver acpi_sn_hubdev_driver = { | 444 | static struct acpi_driver acpi_sn_hubdev_driver = { |
206 | .name = "SGI HUBDEV Driver", | 445 | .name = "SGI HUBDEV Driver", |
207 | .ids = "SGIHUB,SGITIO", | 446 | .ids = "SGIHUB,SGITIO", |
@@ -212,6 +451,33 @@ static struct acpi_driver acpi_sn_hubdev_driver = { | |||
212 | 451 | ||
213 | 452 | ||
214 | /* | 453 | /* |
454 | * sn_acpi_bus_fixup - Perform SN specific setup of software structs | ||
455 | * (pcibus_bussoft, pcidev_info) and hardware | ||
456 | * registers, for the specified bus and devices under it. | ||
457 | */ | ||
458 | void | ||
459 | sn_acpi_bus_fixup(struct pci_bus *bus) | ||
460 | { | ||
461 | struct pci_dev *pci_dev = NULL; | ||
462 | struct pcibus_bussoft *prom_bussoft_ptr; | ||
463 | |||
464 | if (!bus->parent) { /* If root bus */ | ||
465 | prom_bussoft_ptr = sn_get_bussoft_ptr(bus); | ||
466 | if (prom_bussoft_ptr == NULL) { | ||
467 | printk(KERN_ERR | ||
468 | "%s: 0x%04x:0x%02x Unable to " | ||
469 | "obtain prom_bussoft_ptr\n", | ||
470 | __FUNCTION__, pci_domain_nr(bus), bus->number); | ||
471 | return; | ||
472 | } | ||
473 | sn_common_bus_fixup(bus, prom_bussoft_ptr); | ||
474 | } | ||
475 | list_for_each_entry(pci_dev, &bus->devices, bus_list) { | ||
476 | sn_acpi_slot_fixup(pci_dev); | ||
477 | } | ||
478 | } | ||
479 | |||
480 | /* | ||
215 | * sn_io_acpi_init - PROM has ACPI support for IO, defining at a minimum the | 481 | * sn_io_acpi_init - PROM has ACPI support for IO, defining at a minimum the |
216 | * nodes and root buses in the DSDT. As a result, bus scanning | 482 | * nodes and root buses in the DSDT. As a result, bus scanning |
217 | * will be initiated by the Linux ACPI code. | 483 | * will be initiated by the Linux ACPI code. |
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c index d4dd8f4b6b8d..d48bcd83253c 100644 --- a/arch/ia64/sn/kernel/io_common.c +++ b/arch/ia64/sn/kernel/io_common.c | |||
@@ -26,14 +26,10 @@ | |||
26 | #include <linux/acpi.h> | 26 | #include <linux/acpi.h> |
27 | #include <asm/sn/sn2/sn_hwperf.h> | 27 | #include <asm/sn/sn2/sn_hwperf.h> |
28 | #include <asm/sn/acpi.h> | 28 | #include <asm/sn/acpi.h> |
29 | #include "acpi/acglobal.h" | ||
29 | 30 | ||
30 | extern void sn_init_cpei_timer(void); | 31 | extern void sn_init_cpei_timer(void); |
31 | extern void register_sn_procfs(void); | 32 | extern void register_sn_procfs(void); |
32 | extern void sn_acpi_bus_fixup(struct pci_bus *); | ||
33 | extern void sn_bus_fixup(struct pci_bus *); | ||
34 | extern void sn_acpi_slot_fixup(struct pci_dev *, struct pcidev_info *); | ||
35 | extern void sn_more_slot_fixup(struct pci_dev *, struct pcidev_info *); | ||
36 | extern void sn_legacy_pci_window_fixup(struct pci_controller *, u64, u64); | ||
37 | extern void sn_io_acpi_init(void); | 33 | extern void sn_io_acpi_init(void); |
38 | extern void sn_io_init(void); | 34 | extern void sn_io_init(void); |
39 | 35 | ||
@@ -48,6 +44,9 @@ struct sysdata_el { | |||
48 | 44 | ||
49 | int sn_ioif_inited; /* SN I/O infrastructure initialized? */ | 45 | int sn_ioif_inited; /* SN I/O infrastructure initialized? */ |
50 | 46 | ||
47 | int sn_acpi_rev; /* SN ACPI revision */ | ||
48 | EXPORT_SYMBOL_GPL(sn_acpi_rev); | ||
49 | |||
51 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ | 50 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ |
52 | 51 | ||
53 | /* | 52 | /* |
@@ -99,25 +98,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, | |||
99 | } | 98 | } |
100 | 99 | ||
101 | /* | 100 | /* |
102 | * Retrieve the pci device information given the bus and device|function number. | ||
103 | */ | ||
104 | static inline u64 | ||
105 | sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, | ||
106 | u64 sn_irq_info) | ||
107 | { | ||
108 | struct ia64_sal_retval ret_stuff; | ||
109 | ret_stuff.status = 0; | ||
110 | ret_stuff.v0 = 0; | ||
111 | |||
112 | SAL_CALL_NOLOCK(ret_stuff, | ||
113 | (u64) SN_SAL_IOIF_GET_PCIDEV_INFO, | ||
114 | (u64) segment, (u64) bus_number, (u64) devfn, | ||
115 | (u64) pci_dev, | ||
116 | sn_irq_info, 0, 0); | ||
117 | return ret_stuff.v0; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified | 101 | * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified |
122 | * device. | 102 | * device. |
123 | */ | 103 | */ |
@@ -249,50 +229,25 @@ void sn_pci_unfixup_slot(struct pci_dev *dev) | |||
249 | } | 229 | } |
250 | 230 | ||
251 | /* | 231 | /* |
252 | * sn_pci_fixup_slot() - This routine sets up a slot's resources consistent | 232 | * sn_pci_fixup_slot() |
253 | * with the Linux PCI abstraction layer. Resources | ||
254 | * acquired from our PCI provider include PIO maps | ||
255 | * to BAR space and interrupt objects. | ||
256 | */ | 233 | */ |
257 | void sn_pci_fixup_slot(struct pci_dev *dev) | 234 | void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info, |
235 | struct sn_irq_info *sn_irq_info) | ||
258 | { | 236 | { |
259 | int segment = pci_domain_nr(dev->bus); | 237 | int segment = pci_domain_nr(dev->bus); |
260 | int status = 0; | ||
261 | struct pcibus_bussoft *bs; | 238 | struct pcibus_bussoft *bs; |
262 | struct pci_bus *host_pci_bus; | 239 | struct pci_bus *host_pci_bus; |
263 | struct pci_dev *host_pci_dev; | 240 | struct pci_dev *host_pci_dev; |
264 | struct pcidev_info *pcidev_info; | 241 | unsigned int bus_no, devfn; |
265 | struct sn_irq_info *sn_irq_info; | ||
266 | unsigned int bus_no, devfn; | ||
267 | 242 | ||
268 | pci_dev_get(dev); /* for the sysdata pointer */ | 243 | pci_dev_get(dev); /* for the sysdata pointer */ |
269 | pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); | ||
270 | if (!pcidev_info) | ||
271 | BUG(); /* Cannot afford to run out of memory */ | ||
272 | |||
273 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | ||
274 | if (!sn_irq_info) | ||
275 | BUG(); /* Cannot afford to run out of memory */ | ||
276 | |||
277 | /* Call to retrieve pci device information needed by kernel. */ | ||
278 | status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, | ||
279 | dev->devfn, | ||
280 | (u64) __pa(pcidev_info), | ||
281 | (u64) __pa(sn_irq_info)); | ||
282 | if (status) | ||
283 | BUG(); /* Cannot get platform pci device information */ | ||
284 | 244 | ||
285 | /* Add pcidev_info to list in pci_controller.platform_data */ | 245 | /* Add pcidev_info to list in pci_controller.platform_data */ |
286 | list_add_tail(&pcidev_info->pdi_list, | 246 | list_add_tail(&pcidev_info->pdi_list, |
287 | &(SN_PLATFORM_DATA(dev->bus)->pcidev_info)); | 247 | &(SN_PLATFORM_DATA(dev->bus)->pcidev_info)); |
288 | |||
289 | if (SN_ACPI_BASE_SUPPORT()) | ||
290 | sn_acpi_slot_fixup(dev, pcidev_info); | ||
291 | else | ||
292 | sn_more_slot_fixup(dev, pcidev_info); | ||
293 | /* | 248 | /* |
294 | * Using the PROMs values for the PCI host bus, get the Linux | 249 | * Using the PROMs values for the PCI host bus, get the Linux |
295 | * PCI host_pci_dev struct and set up host bus linkages | 250 | * PCI host_pci_dev struct and set up host bus linkages |
296 | */ | 251 | */ |
297 | 252 | ||
298 | bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; | 253 | bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; |
@@ -489,11 +444,6 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address) | |||
489 | sprintf(address, "%s^%d", address, geo_slot(geoid)); | 444 | sprintf(address, "%s^%d", address, geo_slot(geoid)); |
490 | } | 445 | } |
491 | 446 | ||
492 | /* | ||
493 | * sn_pci_fixup_bus() - Perform SN specific setup of software structs | ||
494 | * (pcibus_bussoft, pcidev_info) and hardware | ||
495 | * registers, for the specified bus and devices under it. | ||
496 | */ | ||
497 | void __devinit | 447 | void __devinit |
498 | sn_pci_fixup_bus(struct pci_bus *bus) | 448 | sn_pci_fixup_bus(struct pci_bus *bus) |
499 | { | 449 | { |
@@ -519,6 +469,15 @@ sn_io_early_init(void) | |||
519 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) | 469 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) |
520 | return 0; | 470 | return 0; |
521 | 471 | ||
472 | /* we set the acpi revision to that of the DSDT table OEM rev. */ | ||
473 | { | ||
474 | struct acpi_table_header *header = NULL; | ||
475 | |||
476 | acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); | ||
477 | BUG_ON(header == NULL); | ||
478 | sn_acpi_rev = header->oem_revision; | ||
479 | } | ||
480 | |||
522 | /* | 481 | /* |
523 | * prime sn_pci_provider[]. Individial provider init routines will | 482 | * prime sn_pci_provider[]. Individial provider init routines will |
524 | * override their respective default entries. | 483 | * override their respective default entries. |
@@ -544,8 +503,12 @@ sn_io_early_init(void) | |||
544 | register_sn_procfs(); | 503 | register_sn_procfs(); |
545 | #endif | 504 | #endif |
546 | 505 | ||
547 | printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", | 506 | { |
548 | acpi_gbl_DSDT->oem_revision); | 507 | struct acpi_table_header *header; |
508 | (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); | ||
509 | printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", | ||
510 | header->oem_revision); | ||
511 | } | ||
549 | if (SN_ACPI_BASE_SUPPORT()) | 512 | if (SN_ACPI_BASE_SUPPORT()) |
550 | sn_io_acpi_init(); | 513 | sn_io_acpi_init(); |
551 | else | 514 | else |
@@ -605,7 +568,6 @@ sn_io_late_init(void) | |||
605 | 568 | ||
606 | fs_initcall(sn_io_late_init); | 569 | fs_initcall(sn_io_late_init); |
607 | 570 | ||
608 | EXPORT_SYMBOL(sn_pci_fixup_slot); | ||
609 | EXPORT_SYMBOL(sn_pci_unfixup_slot); | 571 | EXPORT_SYMBOL(sn_pci_unfixup_slot); |
610 | EXPORT_SYMBOL(sn_bus_store_sysdata); | 572 | EXPORT_SYMBOL(sn_bus_store_sysdata); |
611 | EXPORT_SYMBOL(sn_bus_free_sysdata); | 573 | EXPORT_SYMBOL(sn_bus_free_sysdata); |
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 9ad843e0383b..600be3ebae05 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -56,6 +56,25 @@ static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) | |||
56 | return ret_stuff.v0; | 56 | return ret_stuff.v0; |
57 | } | 57 | } |
58 | 58 | ||
59 | /* | ||
60 | * Retrieve the pci device information given the bus and device|function number. | ||
61 | */ | ||
62 | static inline u64 | ||
63 | sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, | ||
64 | u64 sn_irq_info) | ||
65 | { | ||
66 | struct ia64_sal_retval ret_stuff; | ||
67 | ret_stuff.status = 0; | ||
68 | ret_stuff.v0 = 0; | ||
69 | |||
70 | SAL_CALL_NOLOCK(ret_stuff, | ||
71 | (u64) SN_SAL_IOIF_GET_PCIDEV_INFO, | ||
72 | (u64) segment, (u64) bus_number, (u64) devfn, | ||
73 | (u64) pci_dev, | ||
74 | sn_irq_info, 0, 0); | ||
75 | return ret_stuff.v0; | ||
76 | } | ||
77 | |||
59 | 78 | ||
60 | /* | 79 | /* |
61 | * sn_fixup_ionodes() - This routine initializes the HUB data structure for | 80 | * sn_fixup_ionodes() - This routine initializes the HUB data structure for |
@@ -172,18 +191,40 @@ sn_pci_window_fixup(struct pci_dev *dev, unsigned int count, | |||
172 | } | 191 | } |
173 | 192 | ||
174 | /* | 193 | /* |
175 | * sn_more_slot_fixup() - We are not running with an ACPI capable PROM, | 194 | * sn_io_slot_fixup() - We are not running with an ACPI capable PROM, |
176 | * and need to convert the pci_dev->resource | 195 | * and need to convert the pci_dev->resource |
177 | * 'start' and 'end' addresses to mapped addresses, | 196 | * 'start' and 'end' addresses to mapped addresses, |
178 | * and setup the pci_controller->window array entries. | 197 | * and setup the pci_controller->window array entries. |
179 | */ | 198 | */ |
180 | void | 199 | void |
181 | sn_more_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) | 200 | sn_io_slot_fixup(struct pci_dev *dev) |
182 | { | 201 | { |
183 | unsigned int count = 0; | 202 | unsigned int count = 0; |
184 | int idx; | 203 | int idx; |
185 | s64 pci_addrs[PCI_ROM_RESOURCE + 1]; | 204 | s64 pci_addrs[PCI_ROM_RESOURCE + 1]; |
186 | unsigned long addr, end, size, start; | 205 | unsigned long addr, end, size, start; |
206 | struct pcidev_info *pcidev_info; | ||
207 | struct sn_irq_info *sn_irq_info; | ||
208 | int status; | ||
209 | |||
210 | pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); | ||
211 | if (!pcidev_info) | ||
212 | panic("%s: Unable to alloc memory for pcidev_info", __FUNCTION__); | ||
213 | |||
214 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | ||
215 | if (!sn_irq_info) | ||
216 | panic("%s: Unable to alloc memory for sn_irq_info", __FUNCTION__); | ||
217 | |||
218 | /* Call to retrieve pci device information needed by kernel. */ | ||
219 | status = sal_get_pcidev_info((u64) pci_domain_nr(dev), | ||
220 | (u64) dev->bus->number, | ||
221 | dev->devfn, | ||
222 | (u64) __pa(pcidev_info), | ||
223 | (u64) __pa(sn_irq_info)); | ||
224 | |||
225 | if (status) | ||
226 | BUG(); /* Cannot get platform pci device information */ | ||
227 | |||
187 | 228 | ||
188 | /* Copy over PIO Mapped Addresses */ | 229 | /* Copy over PIO Mapped Addresses */ |
189 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { | 230 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { |
@@ -219,8 +260,12 @@ sn_more_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) | |||
219 | */ | 260 | */ |
220 | if (count > 0) | 261 | if (count > 0) |
221 | sn_pci_window_fixup(dev, count, pci_addrs); | 262 | sn_pci_window_fixup(dev, count, pci_addrs); |
263 | |||
264 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | ||
222 | } | 265 | } |
223 | 266 | ||
267 | EXPORT_SYMBOL(sn_io_slot_fixup); | ||
268 | |||
224 | /* | 269 | /* |
225 | * sn_pci_controller_fixup() - This routine sets up a bus's resources | 270 | * sn_pci_controller_fixup() - This routine sets up a bus's resources |
226 | * consistent with the Linux PCI abstraction layer. | 271 | * consistent with the Linux PCI abstraction layer. |
@@ -272,9 +317,6 @@ sn_bus_fixup(struct pci_bus *bus) | |||
272 | { | 317 | { |
273 | struct pci_dev *pci_dev = NULL; | 318 | struct pci_dev *pci_dev = NULL; |
274 | struct pcibus_bussoft *prom_bussoft_ptr; | 319 | struct pcibus_bussoft *prom_bussoft_ptr; |
275 | extern void sn_common_bus_fixup(struct pci_bus *, | ||
276 | struct pcibus_bussoft *); | ||
277 | |||
278 | 320 | ||
279 | if (!bus->parent) { /* If root bus */ | 321 | if (!bus->parent) { /* If root bus */ |
280 | prom_bussoft_ptr = PCI_CONTROLLER(bus)->platform_data; | 322 | prom_bussoft_ptr = PCI_CONTROLLER(bus)->platform_data; |
@@ -291,7 +333,7 @@ sn_bus_fixup(struct pci_bus *bus) | |||
291 | prom_bussoft_ptr->bs_legacy_mem); | 333 | prom_bussoft_ptr->bs_legacy_mem); |
292 | } | 334 | } |
293 | list_for_each_entry(pci_dev, &bus->devices, bus_list) { | 335 | list_for_each_entry(pci_dev, &bus->devices, bus_list) { |
294 | sn_pci_fixup_slot(pci_dev); | 336 | sn_io_slot_fixup(pci_dev); |
295 | } | 337 | } |
296 | 338 | ||
297 | } | 339 | } |
diff --git a/arch/ia64/sn/kernel/iomv.c b/arch/ia64/sn/kernel/iomv.c index 4aa4f301d56d..ab7e2fd40798 100644 --- a/arch/ia64/sn/kernel/iomv.c +++ b/arch/ia64/sn/kernel/iomv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * This file is subject to the terms and conditions of the GNU General Public |
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
@@ -26,9 +26,10 @@ | |||
26 | * @port: port to convert | 26 | * @port: port to convert |
27 | * | 27 | * |
28 | * Legacy in/out instructions are converted to ld/st instructions | 28 | * Legacy in/out instructions are converted to ld/st instructions |
29 | * on IA64. This routine will convert a port number into a valid | 29 | * on IA64. This routine will convert a port number into a valid |
30 | * SN i/o address. Used by sn_in*() and sn_out*(). | 30 | * SN i/o address. Used by sn_in*() and sn_out*(). |
31 | */ | 31 | */ |
32 | |||
32 | void *sn_io_addr(unsigned long port) | 33 | void *sn_io_addr(unsigned long port) |
33 | { | 34 | { |
34 | if (!IS_RUNNING_ON_SIMULATOR()) { | 35 | if (!IS_RUNNING_ON_SIMULATOR()) { |
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c index b3a435fd70fb..ea3dc38d73fd 100644 --- a/arch/ia64/sn/kernel/msi_sn.c +++ b/arch/ia64/sn/kernel/msi_sn.c | |||
@@ -59,13 +59,12 @@ void sn_teardown_msi_irq(unsigned int irq) | |||
59 | sn_intr_free(nasid, widget, sn_irq_info); | 59 | sn_intr_free(nasid, widget, sn_irq_info); |
60 | sn_msi_info[irq].sn_irq_info = NULL; | 60 | sn_msi_info[irq].sn_irq_info = NULL; |
61 | 61 | ||
62 | return; | 62 | destroy_irq(irq); |
63 | } | 63 | } |
64 | 64 | ||
65 | int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | 65 | int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry) |
66 | { | 66 | { |
67 | struct msi_msg msg; | 67 | struct msi_msg msg; |
68 | struct msi_desc *entry; | ||
69 | int widget; | 68 | int widget; |
70 | int status; | 69 | int status; |
71 | nasid_t nasid; | 70 | nasid_t nasid; |
@@ -73,8 +72,8 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | |||
73 | struct sn_irq_info *sn_irq_info; | 72 | struct sn_irq_info *sn_irq_info; |
74 | struct pcibus_bussoft *bussoft = SN_PCIDEV_BUSSOFT(pdev); | 73 | struct pcibus_bussoft *bussoft = SN_PCIDEV_BUSSOFT(pdev); |
75 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); | 74 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); |
75 | int irq; | ||
76 | 76 | ||
77 | entry = get_irq_data(irq); | ||
78 | if (!entry->msi_attrib.is_64) | 77 | if (!entry->msi_attrib.is_64) |
79 | return -EINVAL; | 78 | return -EINVAL; |
80 | 79 | ||
@@ -84,6 +83,11 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | |||
84 | if (provider == NULL || provider->dma_map_consistent == NULL) | 83 | if (provider == NULL || provider->dma_map_consistent == NULL) |
85 | return -EINVAL; | 84 | return -EINVAL; |
86 | 85 | ||
86 | irq = create_irq(); | ||
87 | if (irq < 0) | ||
88 | return irq; | ||
89 | |||
90 | set_irq_msi(irq, entry); | ||
87 | /* | 91 | /* |
88 | * Set up the vector plumbing. Let the prom (via sn_intr_alloc) | 92 | * Set up the vector plumbing. Let the prom (via sn_intr_alloc) |
89 | * decide which cpu to direct this msi at by default. | 93 | * decide which cpu to direct this msi at by default. |
@@ -95,12 +99,15 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | |||
95 | SWIN_WIDGETNUM(bussoft->bs_base); | 99 | SWIN_WIDGETNUM(bussoft->bs_base); |
96 | 100 | ||
97 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | 101 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); |
98 | if (! sn_irq_info) | 102 | if (! sn_irq_info) { |
103 | destroy_irq(irq); | ||
99 | return -ENOMEM; | 104 | return -ENOMEM; |
105 | } | ||
100 | 106 | ||
101 | status = sn_intr_alloc(nasid, widget, sn_irq_info, irq, -1, -1); | 107 | status = sn_intr_alloc(nasid, widget, sn_irq_info, irq, -1, -1); |
102 | if (status) { | 108 | if (status) { |
103 | kfree(sn_irq_info); | 109 | kfree(sn_irq_info); |
110 | destroy_irq(irq); | ||
104 | return -ENOMEM; | 111 | return -ENOMEM; |
105 | } | 112 | } |
106 | 113 | ||
@@ -121,6 +128,7 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | |||
121 | if (! bus_addr) { | 128 | if (! bus_addr) { |
122 | sn_intr_free(nasid, widget, sn_irq_info); | 129 | sn_intr_free(nasid, widget, sn_irq_info); |
123 | kfree(sn_irq_info); | 130 | kfree(sn_irq_info); |
131 | destroy_irq(irq); | ||
124 | return -ENOMEM; | 132 | return -ENOMEM; |
125 | } | 133 | } |
126 | 134 | ||
@@ -139,7 +147,7 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) | |||
139 | write_msi_msg(irq, &msg); | 147 | write_msi_msg(irq, &msg); |
140 | set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); | 148 | set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); |
141 | 149 | ||
142 | return 0; | 150 | return irq; |
143 | } | 151 | } |
144 | 152 | ||
145 | #ifdef CONFIG_SMP | 153 | #ifdef CONFIG_SMP |
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c index d9d306c79f2d..601747b1e22a 100644 --- a/arch/ia64/sn/kernel/sn2/sn2_smp.c +++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c | |||
@@ -455,7 +455,7 @@ static int sn2_ptc_proc_open(struct inode *inode, struct file *file) | |||
455 | return seq_open(file, &sn2_ptc_seq_ops); | 455 | return seq_open(file, &sn2_ptc_seq_ops); |
456 | } | 456 | } |
457 | 457 | ||
458 | static struct file_operations proc_sn2_ptc_operations = { | 458 | static const struct file_operations proc_sn2_ptc_operations = { |
459 | .open = sn2_ptc_proc_open, | 459 | .open = sn2_ptc_proc_open, |
460 | .read = seq_read, | 460 | .read = seq_read, |
461 | .llseek = seq_lseek, | 461 | .llseek = seq_lseek, |
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c index 33367996d72d..6da9854751cd 100644 --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c | |||
@@ -865,7 +865,7 @@ error: | |||
865 | return r; | 865 | return r; |
866 | } | 866 | } |
867 | 867 | ||
868 | static struct file_operations sn_hwperf_fops = { | 868 | static const struct file_operations sn_hwperf_fops = { |
869 | .ioctl = sn_hwperf_ioctl, | 869 | .ioctl = sn_hwperf_ioctl, |
870 | }; | 870 | }; |
871 | 871 | ||
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c index 43ddc2eccb96..62b3e9a496ac 100644 --- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c +++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c | |||
@@ -89,61 +89,80 @@ static int coherence_id_open(struct inode *inode, struct file *file) | |||
89 | return single_open(file, coherence_id_show, NULL); | 89 | return single_open(file, coherence_id_show, NULL); |
90 | } | 90 | } |
91 | 91 | ||
92 | static struct proc_dir_entry | ||
93 | *sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, | ||
94 | int (*openfunc)(struct inode *, struct file *), | ||
95 | int (*releasefunc)(struct inode *, struct file *), | ||
96 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *)) | ||
97 | { | ||
98 | struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); | ||
99 | |||
100 | if (e) { | ||
101 | struct file_operations *f; | ||
102 | |||
103 | f = kzalloc(sizeof(*f), GFP_KERNEL); | ||
104 | if (f) { | ||
105 | f->open = openfunc; | ||
106 | f->read = seq_read; | ||
107 | f->llseek = seq_lseek; | ||
108 | f->release = releasefunc; | ||
109 | f->write = write; | ||
110 | e->proc_fops = f; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | return e; | ||
115 | } | ||
116 | |||
117 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ | 92 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ |
118 | extern int sn_topology_open(struct inode *, struct file *); | 93 | extern int sn_topology_open(struct inode *, struct file *); |
119 | extern int sn_topology_release(struct inode *, struct file *); | 94 | extern int sn_topology_release(struct inode *, struct file *); |
120 | 95 | ||
96 | static const struct file_operations proc_partition_id_fops = { | ||
97 | .open = partition_id_open, | ||
98 | .read = seq_read, | ||
99 | .llseek = seq_lseek, | ||
100 | .release = single_release, | ||
101 | }; | ||
102 | |||
103 | static const struct file_operations proc_system_sn_fops = { | ||
104 | .open = system_serial_number_open, | ||
105 | .read = seq_read, | ||
106 | .llseek = seq_lseek, | ||
107 | .release = single_release, | ||
108 | }; | ||
109 | |||
110 | static const struct file_operations proc_license_id_fops = { | ||
111 | .open = licenseID_open, | ||
112 | .read = seq_read, | ||
113 | .llseek = seq_lseek, | ||
114 | .release = single_release, | ||
115 | }; | ||
116 | |||
117 | static const struct file_operations proc_sn_force_intr_fops = { | ||
118 | .open = sn_force_interrupt_open, | ||
119 | .read = seq_read, | ||
120 | .write = sn_force_interrupt_write_proc, | ||
121 | .llseek = seq_lseek, | ||
122 | .release = single_release, | ||
123 | }; | ||
124 | |||
125 | static const struct file_operations proc_coherence_id_fops = { | ||
126 | .open = coherence_id_open, | ||
127 | .read = seq_read, | ||
128 | .llseek = seq_lseek, | ||
129 | .release = single_release, | ||
130 | }; | ||
131 | |||
132 | static const struct file_operations proc_sn_topo_fops = { | ||
133 | .open = sn_topology_open, | ||
134 | .read = seq_read, | ||
135 | .llseek = seq_lseek, | ||
136 | .release = sn_topology_release, | ||
137 | }; | ||
138 | |||
121 | void register_sn_procfs(void) | 139 | void register_sn_procfs(void) |
122 | { | 140 | { |
123 | static struct proc_dir_entry *sgi_proc_dir = NULL; | 141 | static struct proc_dir_entry *sgi_proc_dir = NULL; |
142 | struct proc_dir_entry *pde; | ||
124 | 143 | ||
125 | BUG_ON(sgi_proc_dir != NULL); | 144 | BUG_ON(sgi_proc_dir != NULL); |
126 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) | 145 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) |
127 | return; | 146 | return; |
128 | 147 | ||
129 | sn_procfs_create_entry("partition_id", sgi_proc_dir, | 148 | pde = create_proc_entry("partition_id", 0444, sgi_proc_dir); |
130 | partition_id_open, single_release, NULL); | 149 | if (pde) |
131 | 150 | pde->proc_fops = &proc_partition_id_fops; | |
132 | sn_procfs_create_entry("system_serial_number", sgi_proc_dir, | 151 | pde = create_proc_entry("system_serial_number", 0444, sgi_proc_dir); |
133 | system_serial_number_open, single_release, NULL); | 152 | if (pde) |
134 | 153 | pde->proc_fops = &proc_system_sn_fops; | |
135 | sn_procfs_create_entry("licenseID", sgi_proc_dir, | 154 | pde = create_proc_entry("licenseID", 0444, sgi_proc_dir); |
136 | licenseID_open, single_release, NULL); | 155 | if (pde) |
137 | 156 | pde->proc_fops = &proc_license_id_fops; | |
138 | sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, | 157 | pde = create_proc_entry("sn_force_interrupt", 0644, sgi_proc_dir); |
139 | sn_force_interrupt_open, single_release, | 158 | if (pde) |
140 | sn_force_interrupt_write_proc); | 159 | pde->proc_fops = &proc_sn_force_intr_fops; |
141 | 160 | pde = create_proc_entry("coherence_id", 0444, sgi_proc_dir); | |
142 | sn_procfs_create_entry("coherence_id", sgi_proc_dir, | 161 | if (pde) |
143 | coherence_id_open, single_release, NULL); | 162 | pde->proc_fops = &proc_coherence_id_fops; |
144 | 163 | pde = create_proc_entry("sn_topology", 0444, sgi_proc_dir); | |
145 | sn_procfs_create_entry("sn_topology", sgi_proc_dir, | 164 | if (pde) |
146 | sn_topology_open, sn_topology_release, NULL); | 165 | pde->proc_fops = &proc_sn_topo_fops; |
147 | } | 166 | } |
148 | 167 | ||
149 | #endif /* CONFIG_PROC_FS */ | 168 | #endif /* CONFIG_PROC_FS */ |