From 7b786e95e78cdf259cb78df500ef4827a3e65381 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 22 Oct 2005 20:03:50 +0000 Subject: [PATCH] Implement acpi_pci_X_cfg_Y using HalXBusDataByOffset() svn path=/trunk/; revision=18688 --- reactos/drivers/bus/acpi/ospm/osl.c | 141 ++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 18 deletions(-) diff --git a/reactos/drivers/bus/acpi/ospm/osl.c b/reactos/drivers/bus/acpi/ospm/osl.c index 65751b38ae5..b9d46a2cd8c 100644 --- a/reactos/drivers/bus/acpi/ospm/osl.c +++ b/reactos/drivers/bus/acpi/ospm/osl.c @@ -354,11 +354,28 @@ acpi_os_read_pci_cfg_byte( u32 addr, u8 * val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_read_pci_cfg_byte is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_read_pci_cfg_byte, slot=0x%X, func=0x%X\n", slot.u.AsULONG, func); + ret = HalGetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + val, + addr, + sizeof(UCHAR)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS @@ -368,11 +385,28 @@ acpi_os_read_pci_cfg_word( u32 addr, u16 * val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_read_pci_cfg_word is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_read_pci_cfg_word, slot=0x%x\n", slot.u.AsULONG); + ret = HalGetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + val, + addr, + sizeof(USHORT)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS @@ -382,11 +416,28 @@ acpi_os_read_pci_cfg_dword( u32 addr, u32 * val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_read_pci_cfg_dword is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_read_pci_cfg_dword, slot=0x%x\n", slot.u.AsULONG); + ret = HalGetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + val, + addr, + sizeof(ULONG)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS @@ -396,11 +447,29 @@ acpi_os_write_pci_cfg_byte( u32 addr, u8 val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + UCHAR buf = val; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_write_pci_cfg_byte is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_write_pci_cfg_byte, slot=0x%x\n", slot.u.AsULONG); + ret = HalSetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + &buf, + addr, + sizeof(UCHAR)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS @@ -410,11 +479,29 @@ acpi_os_write_pci_cfg_word( u32 addr, u16 val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + USHORT buf = val; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_write_pci_cfg_word is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_write_pci_cfg_byte, slot=0x%x\n", slot.u.AsULONG); + ret = HalSetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + &buf, + addr, + sizeof(USHORT)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS @@ -424,11 +511,29 @@ acpi_os_write_pci_cfg_dword( u32 addr, u32 val) { - /* FIXME: What do we do here? */ + NTSTATUS ret; + ULONG buf = val; + PCI_SLOT_NUMBER slot; - DPRINT("acpi_os_write_pci_cfg_dword is not implemented"); + if (func == 0) + return AE_ERROR; - return AE_ERROR; + slot.u.AsULONG = 0; + slot.u.bits.DeviceNumber = (func >> 16) & 0xFFFF; + slot.u.bits.FunctionNumber = func & 0xFFFF; + + DPRINT("acpi_os_write_pci_cfg_byte, slot=0x%x\n", slot.u.AsULONG); + ret = HalSetBusDataByOffset(PCIConfiguration, + bus, + slot.u.AsULONG, + &buf, + addr, + sizeof(ULONG)); + + if (NT_SUCCESS(ret)) + return AE_OK; + else + return AE_ERROR; } ACPI_STATUS