The Pedigree Project 0.1
PciDrivers.h
1/* Copyright (c) 2026, Pedigree Developers. SPDX-License-Identifier: ISC */
2#ifndef PEDIGREE_PCI_DRIVERS_H
3#define PEDIGREE_PCI_DRIVERS_H
4
5#include "pedigree/kernel/compiler.h"
6
7#include <stdint.h>
8
9class Device;
10
11namespace PciDrivers {
12struct Driver {
13 uint8_t classCode;
14 uint8_t subclass;
15 uint8_t progInterface;
16 Device* (*attach)(Device* pci);
17 bool (*prepareRemove)(Device* controller);
18 void (*cancelRemove)(Device* controller);
19 void (*remove)(Device* controller);
20};
21
27EXPORTED_PUBLIC bool initialize();
28EXPORTED_PUBLIC bool registerDriver(const Driver* driver);
29
35EXPORTED_PUBLIC bool prepareUnregisterDriver(const Driver* driver);
36EXPORTED_PUBLIC bool unregisterDriver(const Driver* driver);
37
41EXPORTED_PUBLIC bool attach(Device* pci);
42
47EXPORTED_PUBLIC bool prepareRemove(Device* pci);
48EXPORTED_PUBLIC void cancelRemove(Device* pci);
49EXPORTED_PUBLIC bool remove(Device* pci);
50} // namespace PciDrivers
51
52#endif