Subversion Repositories Kolibri OS

Rev

Rev 1633 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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