From e6d10426d985251dad331d539cf95ee5aa2ba90d Mon Sep 17 00:00:00 2001 From: acevest Date: Wed, 17 May 2023 23:51:43 +0800 Subject: [PATCH] =?utf8?q?=E5=9B=9E=E9=80=80=E5=9C=A8bochs=E4=B8=8A?= =?utf8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=AF=BB=E5=8F=96PCI?= =?utf8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 1 - drivers/pci.c | 32 -------------------------------- include/pci.h | 3 --- 3 files changed, 36 deletions(-) diff --git a/Makefile b/Makefile index 70fc756..f6e3e65 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,6 @@ endif CFLAGS = -g -c -fno-builtin -m32 -DBUILDER='"$(shell whoami)"' CFLAGS += -DFIX_SYSENTER_ESP_MODE=1 -#CFLAGS += -DPCI_RW_ALIGN_MODE SYSTEMMAP = System.map KERNELBIN = KERNEL.BIN LINKSCRIPT = scripts/link.ld diff --git a/drivers/pci.c b/drivers/pci.c index 74db154..a027ba1 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -23,7 +23,6 @@ LIST_HEAD(pci_devs); const char *pci_get_info(unsigned int classcode, unsigned int progif); -#if PCI_RW_ALIGN_MODE int pci_read_config_byte(int cmd) { outl(PCI_CONFIG_CMD(cmd), PCI_ADDR); return inb(PCI_DATA + (PCI_GET_CMD_REG(cmd) & 3)); @@ -53,37 +52,6 @@ void pci_write_config_long(int value, int cmd) { outl(PCI_CONFIG_CMD(cmd), PCI_ADDR); outl(value, PCI_DATA); } -#else -int pci_read_config_byte(int cmd) { - outl(cmd, PCI_ADDR); - return inb(PCI_DATA); -} - -int pci_read_config_word(int cmd) { - outl(cmd, PCI_ADDR); - return inw(PCI_DATA); -} - -int pci_read_config_long(int cmd) { - outl(cmd, PCI_ADDR); - return inl(PCI_DATA); -} - -void pci_write_config_byte(int value, int cmd) { - outl(cmd, PCI_ADDR); - outb(value & 0xFF, PCI_DATA); -} - -void pci_write_config_word(int value, int cmd) { - outl(cmd, PCI_ADDR); - outw(value & 0xFFFF, PCI_DATA); -} - -void pci_write_config_long(int value, int cmd) { - outl(cmd, PCI_ADDR); - outl(value, PCI_DATA); -} -#endif void scan_pci_bus(int bus) { u8 dev, devfn; diff --git a/include/pci.h b/include/pci.h index 4120007..d0ca66f 100644 --- a/include/pci.h +++ b/include/pci.h @@ -25,11 +25,8 @@ // PCI Command // 这个PCI_CMD是写入PCI_ADDR的,通过bus,dev,fn,reg可以定位到某个PCI总线(可以有多条PCI总线)上的某个设备的某个功能的某个寄存器 #define PCI_CMD(bus, dev, fn, reg) (0x80000000 | (bus << 16) | (dev << 11) | (fn << 8) | reg) - -#if PCI_RW_ALIGN_MODE #define PCI_CONFIG_CMD(cmd) (cmd & ~3) #define PCI_GET_CMD_REG(cmd) (cmd & 0xFF) -#endif // PCI Device // All PCI compliant devices must support the Vendor ID, Device ID, Command and Status, Revision ID, Class Code and -- 2.44.0