Subversion Repositories Kolibri OS

Rev

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