Deleted Added
full compact
acpi_pcib.c (102447) acpi_pcib.c (102977)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/acpica/acpi_pcib.c 102447 2002-08-26 18:30:27Z jhb $
27 * $FreeBSD: head/sys/dev/acpica/acpi_pcib.c 102977 2002-09-05 17:08:35Z jhb $
28 */
29#include "opt_acpi.h"
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/malloc.h>
33#include <sys/kernel.h>
34
35#include "acpi.h"

--- 213 unchanged lines hidden (view full) ---

249 * If there's only one interrupt, and it's not zero, then we're already routed.
250 *
251 * Note that we could also check the 'decoding' bit in _STA, but can't depend on
252 * it since it's not part of the spec.
253 *
254 * XXX check ASL examples to see if this is an acceptable set of tests
255 */
256 if ((crsres->Data.Irq.NumberOfInterrupts == 1) && (crsres->Data.Irq.Interrupts[0] != 0)) {
28 */
29#include "opt_acpi.h"
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/malloc.h>
33#include <sys/kernel.h>
34
35#include "acpi.h"

--- 213 unchanged lines hidden (view full) ---

249 * If there's only one interrupt, and it's not zero, then we're already routed.
250 *
251 * Note that we could also check the 'decoding' bit in _STA, but can't depend on
252 * it since it's not part of the spec.
253 *
254 * XXX check ASL examples to see if this is an acceptable set of tests
255 */
256 if ((crsres->Data.Irq.NumberOfInterrupts == 1) && (crsres->Data.Irq.Interrupts[0] != 0)) {
257 device_printf(pcib, "device is routed to IRQ %d\n",
258 crsres->Data.Irq.Interrupts[0]);
257 device_printf(pcib, "slot %d INT%c is routed to irq %d\n",
258 pci_get_slot(dev), 'A' + pin, crsres->Data.Irq.Interrupts[0]);
259 interrupt = crsres->Data.Irq.Interrupts[0];
260 goto out;
261 }
262
263 /*
264 * There isn't an interrupt, so we have to look at _PRS to get one.
265 * Get the set of allowed interrupts from the _PRS resource indexed by SourceIndex.
266 */

--- 39 unchanged lines hidden (view full) ---

306 AcpiOsFree(crsbuf.Pointer);
307 crsbuf.Pointer = NULL;
308 resbuf.Id = ACPI_RSTYPE_IRQ;
309 resbuf.Length = ACPI_SIZEOF_RESOURCE(ACPI_RESOURCE_IRQ);
310 resbuf.Data.Irq = prsres->Data.Irq; /* structure copy other fields */
311 resbuf.Data.Irq.NumberOfInterrupts = 1;
312 resbuf.Data.Irq.Interrupts[0] = prsres->Data.Irq.Interrupts[0]; /* just take first... */
313 if (ACPI_FAILURE(status = acpi_AppendBufferResource(&crsbuf, &resbuf))) {
259 interrupt = crsres->Data.Irq.Interrupts[0];
260 goto out;
261 }
262
263 /*
264 * There isn't an interrupt, so we have to look at _PRS to get one.
265 * Get the set of allowed interrupts from the _PRS resource indexed by SourceIndex.
266 */

--- 39 unchanged lines hidden (view full) ---

306 AcpiOsFree(crsbuf.Pointer);
307 crsbuf.Pointer = NULL;
308 resbuf.Id = ACPI_RSTYPE_IRQ;
309 resbuf.Length = ACPI_SIZEOF_RESOURCE(ACPI_RESOURCE_IRQ);
310 resbuf.Data.Irq = prsres->Data.Irq; /* structure copy other fields */
311 resbuf.Data.Irq.NumberOfInterrupts = 1;
312 resbuf.Data.Irq.Interrupts[0] = prsres->Data.Irq.Interrupts[0]; /* just take first... */
313 if (ACPI_FAILURE(status = acpi_AppendBufferResource(&crsbuf, &resbuf))) {
314 device_printf(pcib, "couldn't route interrupt %d via %s, interupt resource build failed - %s\n",
314 device_printf(pcib, "couldn't route interrupt %d via %s, interrupt resource build failed - %s\n",
315 prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
316 goto out;
317 }
318 if (ACPI_FAILURE(status = AcpiSetCurrentResources(lnkdev, &crsbuf))) {
319 device_printf(pcib, "couldn't route interrupt %d via %s - %s\n",
320 prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
321 goto out;
322 }
323
324 /* successful, return the interrupt we just routed */
315 prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
316 goto out;
317 }
318 if (ACPI_FAILURE(status = AcpiSetCurrentResources(lnkdev, &crsbuf))) {
319 device_printf(pcib, "couldn't route interrupt %d via %s - %s\n",
320 prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
321 goto out;
322 }
323
324 /* successful, return the interrupt we just routed */
325 device_printf(pcib, "routed interrupt %d via %s\n",
326 prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev));
325 device_printf(pcib, "slot %d INT%c routed to irq %d via %s\n",
326 pci_get_slot(dev), 'A' + pin, prsres->Data.Irq.Interrupts[0],
327 acpi_name(lnkdev));
327 interrupt = prsres->Data.Irq.Interrupts[0];
328
329 out:
330 if (crsbuf.Pointer != NULL)
331 AcpiOsFree(crsbuf.Pointer);
332 if (prsbuf.Pointer != NULL)
333 AcpiOsFree(prsbuf.Pointer);
334
335 /* XXX APIC_IO interrupt mapping? */
336 return_VALUE(interrupt);
337}
338
328 interrupt = prsres->Data.Irq.Interrupts[0];
329
330 out:
331 if (crsbuf.Pointer != NULL)
332 AcpiOsFree(crsbuf.Pointer);
333 if (prsbuf.Pointer != NULL)
334 AcpiOsFree(prsbuf.Pointer);
335
336 /* XXX APIC_IO interrupt mapping? */
337 return_VALUE(interrupt);
338}
339