Jump to content

ACPIFindPCIDevice: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 16: Line 16:
==Example==
==Example==
<PRE>
<PRE>
    temp2 = temp3 = 0;
temp2 = temp3 = 0;
    rc = ACPIFindPCIDevice( (ULONG)busNr,                       // Bus
rc = ACPIFindPCIDevice( (ULONG)busNr,                   // Bus
                            (ULONG)devNr,                       // Dev
                        (ULONG)devNr,                   // Dev
                            (ULONG)(pcidev->devfn >> 8) & 7,     // Function
                        (ULONG)(pcidev->devfn >> 8) & 7, // Function
                            &temp1,                             // PIC IRQ
                        &temp1,                         // PIC IRQ
                            &temp3,                             // APIC IRQ
                        &temp3,                         // APIC IRQ
                            NULL,                               // ACPI handle to finding device
                        NULL,                           // ACPI handle to finding device
                            "Uniaud32");                         // Name for acpi log
                        "Uniaud32");                 // Name for acpi log
      if (!rc)
if (!rc)
      {
  {
          // Check APIC IRQ, if we have /SMP /APIC, must be set
    // Check APIC IRQ, if we have /SMP /APIC, must be set
          if (temp3)
    if (temp3)
              temp = (temp & (~0xff)) | (temp3 & 0xff);
      temp = (temp & (~0xff)) | (temp3 & 0xff);
              // Check PIC IRQ
      // Check PIC IRQ
          else if (temp1)
    else if (temp1)
                  temp = (temp & (~0xff)) | (temp1 & 0xff);
      temp = (temp & (~0xff)) | (temp1 & 0xff);
          dprintf(("pci_query_device: IRQs ACPI PIC%d APIC%d set:0x%x", temp1, temp3,temp));
      dprintf(("pci_query_device: IRQs ACPI PIC%d APIC%d set:0x%x", temp1, temp3,temp));
      }
  }
</PRE>
</PRE>


==Links==
[[Category:ACPI32]]
* [http://www2.ecomstation.ru/doku.php/en:acpi ACPI Toolkit Web Site]
 
[[Category:ACPI]]

Latest revision as of 09:13, 29 May 2025

Find PCI device by Bus:Dev:Fun

Syntax

APIRET APIENTRY ACPIFindPCIDevice(UINT32 Bus, UINT32 Dev, UINT32 Fun, UINT32 *PicIRQ, UINT32 *ApicIRQ, ACPI_HANDLE *Hdl, char *Component)

Parameters

Bus
PCI Bus
Dev
PCI Device
Fun
PCI Finction
Component
Name of caller for acpica$ log
Hdl
Finding handle for device
PicIRQ
IRQ in PIC mode or boot stage
ApicIRQ
IRQ in APIC mode or zero if problem or PIC mode

Example

 temp2 = temp3 = 0;
 rc = ACPIFindPCIDevice( (ULONG)busNr,                    // Bus
                         (ULONG)devNr,                    // Dev
                         (ULONG)(pcidev->devfn >> 8) & 7, // Function
                         &temp1,                          // PIC IRQ
                         &temp3,                          // APIC IRQ
                         NULL,                            // ACPI handle to finding device
                         "Uniaud32");                 // Name for acpi log
 if (!rc)
   {
    // Check APIC IRQ, if we have /SMP /APIC, must be set
     if (temp3)
       temp = (temp & (~0xff)) | (temp3 & 0xff);
       // Check PIC IRQ
     else if (temp1)
       temp = (temp & (~0xff)) | (temp1 & 0xff);
       dprintf(("pci_query_device: IRQs ACPI PIC%d APIC%d set:0x%x", temp1, temp3,temp));
   }