Implement acpi_pci_X_cfg_Y using HalXBusDataByOffset()
Modified: trunk/reactos/drivers/bus/acpi/ospm/osl.c
_____
Modified: trunk/reactos/drivers/bus/acpi/ospm/osl.c
--- trunk/reactos/drivers/bus/acpi/ospm/osl.c 2005-10-22 20:02:03 UTC
(rev 18687)
+++ trunk/reactos/drivers/bus/acpi/ospm/osl.c 2005-10-22 20:03:50 UTC
(rev 18688)
@@ -354,11 +354,28 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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