blob: c5a52413b311f6fa7b34568c0304cb309dd5f69d [file] [log] [blame]
swissChili5fe85a12021-05-31 08:10:27 -07001#include <dri/ide/ide.h>
2#include <task.h>
3#include <alloc.h>
4
5struct ide_thread_data
6{
7 struct pci_device dev;
8 uchar bus, slot, func;
9};
10
11bool ide_supports(struct pci_device *dev)
12{
13 return dev->class == 1 && dev->subclass == 1;
14}
15
16void ide_thread(struct ide_thread_data *data)
17{
18 kprintf("IDE driver thread starting: device=0x%x\n", data->dev.device_id);
19}
20
21void ide_init(struct pci_device dev, uchar bus, uchar slot, uchar func)
22{
23 struct ide_thread_data *data = malloc(sizeof(struct ide_thread_data));
24 data->dev = dev;
25 data->bus = bus;
26 data->slot = slot;
27 data->func = func;
28
29 spawn_thread(ide_thread, data);
30}
31
32void ide_register()
33{
34 struct pci_device_driver dri =
35 {
36 .supports = ide_supports,
37 .init = ide_init,
38 .generic_name = "IDE Controller",
39 };
40
41 pci_register_device_driver(dri);
42}