Subversion Repositories Kolibri OS

Rev

Rev 1627 | Rev 1631 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. struct acpi_device;
  3.  
  4.  
  5. /*
  6.  * ACPI Driver
  7.  * -----------
  8.  */
  9.  
  10. typedef int (*acpi_op_add) (struct acpi_device * device);
  11. typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
  12. typedef int (*acpi_op_start) (struct acpi_device * device);
  13. //typedef int (*acpi_op_suspend) (struct acpi_device * device,
  14. //                pm_message_t state);
  15. typedef int (*acpi_op_resume) (struct acpi_device * device);
  16. typedef int (*acpi_op_bind) (struct acpi_device * device);
  17. typedef int (*acpi_op_unbind) (struct acpi_device * device);
  18. typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
  19.  
  20. struct acpi_bus_ops {
  21.     u32 acpi_op_add:1;
  22.     u32 acpi_op_start:1;
  23. };
  24.  
  25. struct acpi_device_ops {
  26.     acpi_op_add add;
  27.     acpi_op_remove remove;
  28.     acpi_op_start start;
  29. //    acpi_op_suspend suspend;
  30.     acpi_op_resume resume;
  31.     acpi_op_bind bind;
  32.     acpi_op_unbind unbind;
  33.     acpi_op_notify notify;
  34. };
  35.  
  36. struct resource_list {
  37.     struct resource_list *next;
  38.     struct resource *res;
  39. //    struct pci_dev *dev;
  40. };
  41.  
  42. enum acpi_bus_device_type {
  43.     ACPI_BUS_TYPE_DEVICE = 0,
  44.     ACPI_BUS_TYPE_POWER,
  45.     ACPI_BUS_TYPE_PROCESSOR,
  46.     ACPI_BUS_TYPE_THERMAL,
  47.     ACPI_BUS_TYPE_POWER_BUTTON,
  48.     ACPI_BUS_TYPE_SLEEP_BUTTON,
  49.     ACPI_BUS_DEVICE_TYPE_COUNT
  50. };
  51.  
  52. /*
  53.  * _HID definitions
  54.  * HIDs must conform to ACPI spec(6.1.4)
  55.  * KolibriOS specific HIDs do not apply to this and begin with KOS:
  56.  */
  57.  
  58.  
  59. #define ACPI_POWER_HID              "KLBPOWER"
  60. #define ACPI_PROCESSOR_OBJECT_HID   "KLBCPU"
  61. #define ACPI_SYSTEM_HID             "KLBSYSTM"
  62. #define ACPI_THERMAL_HID            "KLBTHERM"
  63. #define ACPI_BUTTON_HID_POWERF      "KLBPWRBN"
  64. #define ACPI_BUTTON_HID_SLEEPF      "KLBSLPBN"
  65. #define ACPI_VIDEO_HID              "KLBVIDEO"
  66. #define ACPI_BAY_HID                "KLBIOBAY"
  67. #define ACPI_DOCK_HID               "KLBDOCK"
  68. /* Quirk for broken IBM BIOSes */
  69. #define ACPI_SMBUS_IBM_HID      "SMBUSIBM"
  70.  
  71.  
  72.  
  73. #define ACPI_ID_LEN     16 /* only 9 bytes needed here, 16 bytes are used */
  74.                            /* to workaround crosscompile issues */
  75.  
  76. struct acpi_device_ids
  77. {
  78.     u8  id[ACPI_ID_LEN];
  79.     u32 driver_data;
  80. };
  81.  
  82. struct acpi_device_flags {
  83.     u32 dynamic_status:1;
  84.     u32 bus_address:1;
  85.     u32 removable:1;
  86.     u32 ejectable:1;
  87.     u32 lockable:1;
  88.     u32 suprise_removal_ok:1;
  89.     u32 power_manageable:1;
  90.     u32 performance_manageable:1;
  91.     u32 wake_capable:1; /* Wakeup(_PRW) supported? */
  92.     u32 force_power_state:1;
  93.     u32 reserved:22;
  94. };
  95.  
  96. struct acpi_device_status {
  97.     u32 present:1;
  98.     u32 enabled:1;
  99.     u32 show_in_ui:1;
  100.     u32 functional:1;
  101.     u32 battery_present:1;
  102.     u32 reserved:27;
  103. };
  104. typedef char acpi_bus_id[8];
  105. typedef unsigned long acpi_bus_address;
  106. typedef char acpi_device_name[40];
  107. typedef char acpi_device_class[20];
  108.  
  109.  
  110. struct acpi_device_pnp
  111. {
  112.     acpi_bus_id       bus_id;       /* Object name */
  113.     acpi_bus_address  bus_address;  /* _ADR */
  114.     char *unique_id;                /* _UID */
  115.     struct list_head  ids;          /* _HID and _CIDs */
  116.     acpi_device_name  device_name;  /* Driver-determined */
  117.     acpi_device_class device_class; /*        "          */
  118. };
  119.  
  120.  
  121. struct acpi_device
  122. {
  123.     int device_type;
  124.     ACPI_HANDLE handle;     /* no handle for fixed hardware */
  125.     struct acpi_device *parent;
  126.     struct list_head children;
  127.     struct list_head node;
  128. //    struct list_head wakeup_list;
  129.     struct acpi_device_status status;
  130.     struct acpi_device_flags flags;
  131.     struct acpi_device_pnp pnp;
  132. //    struct acpi_device_power power;
  133. //    struct acpi_device_wakeup wakeup;
  134. //    struct acpi_device_perf performance;
  135. //    struct acpi_device_dir dir;
  136.     struct acpi_device_ops ops;
  137. //    struct acpi_driver *driver;
  138.     void *driver_data;
  139. //    struct device dev;
  140.     struct acpi_bus_ops bus_ops;    /* workaround for different code path for hotplug */
  141.  //   enum acpi_bus_removal_type removal_type;    /* indicate for different removal type */
  142. };
  143.  
  144.  
  145. struct acpi_pci_root {
  146.     struct list_head node;
  147.     struct acpi_device * device;
  148.     struct acpi_pci_id id;
  149.     struct pci_bus *bus;
  150.     u16 segment;
  151.     struct resource secondary;      /* downstream bus range */
  152.  
  153. };
  154.  
  155.  
  156. #define acpi_device_bid(d)  ((d)->pnp.bus_id)
  157. #define acpi_device_adr(d)  ((d)->pnp.bus_address)
  158. char *acpi_device_hid(struct acpi_device *device);
  159. #define acpi_device_name(d) ((d)->pnp.device_name)
  160. #define acpi_device_class(d)    ((d)->pnp.device_class)
  161.  
  162. int acpi_match_device_ids(struct acpi_device *device,
  163.               const struct acpi_device_ids *ids);
  164.  
  165. int acpi_pci_irq_add_prt(ACPI_HANDLE handle, struct pci_bus *bus);
  166. int acpi_pci_bind_root(struct acpi_device *device);
  167. struct pci_dev *acpi_get_pci_dev(ACPI_HANDLE handle);
  168. int acpi_is_root_bridge(ACPI_HANDLE handle);
  169.  
  170.