Subversion Repositories Kolibri OS

Rev

Go to most recent revision | 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. //    pci_acpi_add_pm_notifier(device, dev);
  51. //    if (device->wakeup.flags.run_wake)
  52. //        device_set_run_wake(&dev->dev, true);
  53.  
  54.     /*
  55.      * Install the 'bind' function to facilitate callbacks for
  56.      * children of the P2P bridge.
  57.      */
  58.     if (dev->subordinate) {
  59.         ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  60.                   "Device %04x:%02x:%02x.%d is a PCI bridge\n",
  61.                   pci_domain_nr(dev->bus), dev->bus->number,
  62.                   PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)));
  63.         device->ops.bind = acpi_pci_bind;
  64.         device->ops.unbind = acpi_pci_unbind;
  65.     }
  66.  
  67.     /*
  68.      * Evaluate and parse _PRT, if exists.  This code allows parsing of
  69.      * _PRT objects within the scope of non-bridge devices.  Note that
  70.      * _PRTs within the scope of a PCI bridge assume the bridge's
  71.      * subordinate bus number.
  72.      *
  73.      * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
  74.      */
  75.     status = AcpiGetHandle(device->handle, METHOD_NAME__PRT, &handle);
  76.     if (ACPI_FAILURE(status))
  77.         goto out;
  78.  
  79.     if (dev->subordinate)
  80.         bus = dev->subordinate;
  81.     else
  82.         bus = dev->bus;
  83.  
  84.     acpi_pci_irq_add_prt(device->handle, bus);
  85.  
  86. out:
  87. //    pci_dev_put(dev);
  88.     return 0;
  89. }
  90.  
  91. int acpi_pci_bind_root(struct acpi_device *device)
  92. {
  93.     device->ops.bind = acpi_pci_bind;
  94.     device->ops.unbind = acpi_pci_unbind;
  95.  
  96.     return 0;
  97. }
  98.  
  99.