Subversion Repositories Kolibri OS

Rev

Rev 1633 | Details | Compare with Previous | Last modification | View Log | RSS feed

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