swissChili | 5fe85a1 | 2021-05-31 08:10:27 -0700 | [diff] [blame^] | 1 | #include <dri/ide/ide.h> |
| 2 | #include <task.h> |
| 3 | #include <alloc.h> |
| 4 | |
| 5 | struct ide_thread_data |
| 6 | { |
| 7 | struct pci_device dev; |
| 8 | uchar bus, slot, func; |
| 9 | }; |
| 10 | |
| 11 | bool ide_supports(struct pci_device *dev) |
| 12 | { |
| 13 | return dev->class == 1 && dev->subclass == 1; |
| 14 | } |
| 15 | |
| 16 | void ide_thread(struct ide_thread_data *data) |
| 17 | { |
| 18 | kprintf("IDE driver thread starting: device=0x%x\n", data->dev.device_id); |
| 19 | } |
| 20 | |
| 21 | void 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 | |
| 32 | void 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 | } |