Subversion Repositories Kolibri OS

Rev

Rev 1628 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #include <ddk.h>
  3. #include <linux/errno.h>
  4. #include <mutex.h>
  5. #include <pci.h>
  6. #include <syscall.h>
  7.  
  8. #include "acpi.h"
  9. #include "acpi_bus.h"
  10.  
  11.  
  12. #define PREFIX "ACPI: "
  13.  
  14.  
  15. static int acpi_pci_unbind(struct acpi_device *device)
  16. {
  17.     struct pci_dev *dev;
  18.  
  19.     dev = acpi_get_pci_dev(device->handle);
  20.     if (!dev)
  21.         goto out;
  22.  
  23. //    device_set_run_wake(&dev->dev, false);
  24. //    pci_acpi_remove_pm_notifier(device);
  25.  
  26.     if (!dev->subordinate)
  27.         goto out;
  28.  
  29. //    acpi_pci_irq_del_prt(dev->subordinate);
  30.  
  31.     device->ops.bind = NULL;
  32.     device->ops.unbind = NULL;
  33.  
  34. out:
  35. //    pci_dev_put(dev);
  36.     return 0;
  37. }
  38.  
  39. static int acpi_pci_bind(struct acpi_device *device)
  40. {
  41.     ACPI_STATUS status;
  42.     ACPI_HANDLE handle;
  43.     struct pci_bus *bus;
  44.     struct pci_dev *dev;
  45.  
  46.     dev = acpi_get_pci_dev(device->handle);
  47.     if (!dev)
  48.         return 0;
  49.  
  50.     device->pci_dev = dev;
  51.  
  52.     dev->acpi_dev = device;
  53.  
  54.     dbgprintf("bind ACPI %s PCI_%x_%x\n", device->pnp.bus_id,
  55.                dev->vendor, dev->device);
  56.  
  57. //    pci_acpi_add_pm_notifier(device, dev);
  58. //    if (device->wakeup.flags.run_wake)
  59. //        device_set_run_wake(&dev->dev, true);
  60.  
  61.     /*
  62.      * Install the 'bind' function to facilitate callbacks for
  63.      * children of the P2P bridge.
  64.      */
  65.     if (dev->subordinate) {
  66.         ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  67.                   "Device %04x:%02x:%02x.%d is a PCI bridge\n",
  68.                   pci_domain_nr(dev->bus), dev->bus->number,
  69.                   PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)));
  70.         device->ops.bind = acpi_pci_bind;
  71.         device->ops.unbind = acpi_pci_unbind;
  72.     }
  73.  
  74.     /*
  75.      * Evaluate and parse _PRT, if exists.  This code allows parsing of
  76.      * _PRT objects within the scope of non-bridge devices.  Note that
  77.      * _PRTs within the scope of a PCI bridge assume the bridge's
  78.      * subordinate bus number.
  79.      *
  80.      * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
  81.      */
  82.     status = AcpiGetHandle(device->handle, METHOD_NAME__PRT, &handle);
  83.     if (ACPI_FAILURE(status))
  84.         goto out;
  85.  
  86.     if (dev->subordinate)
  87.         bus = dev->subordinate;
  88.     else
  89.         bus = dev->bus;
  90.  
  91.     acpi_pci_irq_add_prt(device->handle, bus);
  92.  
  93. out:
  94. //    pci_dev_put(dev);
  95.     return 0;
  96. }
  97.  
  98. int acpi_pci_bind_root(struct acpi_device *device)
  99. {
  100.     device->ops.bind = acpi_pci_bind;
  101.     device->ops.unbind = acpi_pci_unbind;
  102.  
  103.     return 0;
  104. }
  105.  
  106.