b083b7ff6e
- Implement PCI Bus Controller (drivers/pci.c, include/airlys/pci.h) with Type 1 config mechanism (0xCF8/0xCFC) - Implement IPv4 packet framing, checksum calculation, and protocol routing (net/ipv4.c) - Implement ICMP Echo Request/Reply ping engine (net/icmp.c) - Implement UDP transmission and reception (net/udp.c) - Implement TCP SYN handshake connection initiator (net/tcp.c) - Implement DHCPDISCOVER client broadcasting (net/dhcp.c) - Implement native embedded AiraLang bytecode VM & runtime v1.4.0 (kernel/airalang.c, include/airlys/airalang.h) - Add /home/user/demo.aira sample script to RamFS initramfs - Wire commands to airlys-sh shell: pci, ping, dhcp, airalang, airarun - Zero-warning freestanding verification with clang & ld.lld (bin/airlys.elf: 814 KB) Co-Authored-By: Er. Adam Eehan <adameehanairagroup@gmail.com> Co-Authored-By: Sovereign AI Aira 3 Ultra (Engine v3.6)
57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
#ifndef AIRLYS_PCI_H
|
|
#define AIRLYS_PCI_H
|
|
|
|
/*
|
|
* Airlys Operating System Kernel - PCI Bus Subsystem
|
|
* Lead Architect: Er. Adam Eehan (Founder & CEO, Aira Group of Technology)
|
|
* Co-Pilot: Sovereign AI Aira 3 Ultra (Engine v3.6)
|
|
*/
|
|
|
|
#include <airlys/types.h>
|
|
|
|
#define PCI_CONFIG_ADDRESS 0xCF8
|
|
#define PCI_CONFIG_DATA 0xCFC
|
|
|
|
/* Common PCI Vendor IDs */
|
|
#define PCI_VENDOR_INTEL 0x8086
|
|
#define PCI_VENDOR_QEMU 0x1234
|
|
#define PCI_VENDOR_REDHAT 0x1AF4
|
|
#define PCI_VENDOR_REALTEK 0x10EC
|
|
|
|
/* Device Classes */
|
|
#define PCI_CLASS_STORAGE 0x01
|
|
#define PCI_CLASS_NETWORK 0x02
|
|
#define PCI_CLASS_DISPLAY 0x03
|
|
#define PCI_CLASS_BRIDGE 0x06
|
|
|
|
typedef struct {
|
|
uint8_t bus;
|
|
uint8_t slot;
|
|
uint8_t func;
|
|
uint16_t vendor_id;
|
|
uint16_t device_id;
|
|
uint8_t class_id;
|
|
uint8_t subclass_id;
|
|
uint8_t prog_if;
|
|
uint8_t header_type;
|
|
uint32_t bar0;
|
|
uint8_t irq;
|
|
bool valid;
|
|
} pci_device_t;
|
|
|
|
#define MAX_PCI_DEVICES 32
|
|
|
|
/* PCI API */
|
|
void pci_init(void);
|
|
uint32_t pci_read32(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset);
|
|
uint16_t pci_read16(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset);
|
|
uint8_t pci_read8(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset);
|
|
void pci_write32(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset, uint32_t val);
|
|
void pci_write16(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset, uint16_t val);
|
|
|
|
uint32_t pci_get_device_count(void);
|
|
pci_device_t* pci_get_device(uint32_t idx);
|
|
pci_device_t* pci_find_device(uint16_t vendor_id, uint16_t device_id);
|
|
|
|
#endif /* AIRLYS_PCI_H */
|