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