44 lines
836 B
C
44 lines
836 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _PCI_H_
|
|
#define _PCI_H_
|
|
|
|
#include <kernel/common.h>
|
|
|
|
#include <lib/list.h>
|
|
|
|
struct pci_host {
|
|
vaddr_t base;
|
|
u16 segment_group;
|
|
u8 start_bus;
|
|
u8 end_bus;
|
|
};
|
|
|
|
struct pci_device {
|
|
struct pci_host *host;
|
|
|
|
u8 class_major;
|
|
u8 class_minor;
|
|
u8 prog_if;
|
|
u8 revision;
|
|
u16 vendor;
|
|
u16 device_id;
|
|
|
|
u8 bus;
|
|
u8 slot;
|
|
u8 func;
|
|
|
|
paddr_t bar0;
|
|
paddr_t bar1;
|
|
paddr_t bar2;
|
|
paddr_t bar3;
|
|
paddr_t bar4;
|
|
paddr_t bar5;
|
|
};
|
|
|
|
void pci_register_host(struct pci_host *host);
|
|
u32 pci_config_read(struct pci_host *host, u32 bus, u32 slot, u32 func, u32 offset);
|
|
void pci_config_write(struct pci_host *host, u32 bus, u32 slot, u32 func, u32 offset, u32 val);
|
|
size_t pci_find_device(u16 major, u16 minor, list_t *out);
|
|
u32 pci_driver_class(u8 major, u8 minor, u8 prog_if);
|
|
|
|
#endif /* _PCI_H_ */
|