Subversion Repositories Kolibri OS

Rev

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