Theory of Operation
R
SATA Programmer’s Reference Manual
39
// At this point, iAllStatus will contain:
// 0 ==> no devices present
// 1 ==> master device present
// 2 ==> slave device present
// -1 ==> Not supported or unknown (P-ATA)
//
return( iAllStatus); // done
A.4
Device Presence Check – Using ACPI
//
// The following sample code (for Windows WDM drivers) can be used to execute a
// control method that will return the status of the SATA port(s) associated with
// a SATA channel. It also illustrates how to execute an ACPI control method that
// returns the connection status for a logical channel. This code assumes that a
// PDO (
Physical Device Object
) exists for both the logical primary and secondary
// channels. WDM device drivers can only execute control methods associated with
// their corresponding _ADR object in ACPI namespace (of which there is a direct
// relationship between the _ADR object and the PDO).
// This sample driver code uses the ACPI sample code illustrated
// in
A.5 ACPI Control Method (GSPS).
//
// Function Protos
NTSTATUS SATA_CheckPortStatus( IN PDEVICE_OBJECT pDO, PDWORD pdwStatus);
NTSTATUS SendIRP( IN PDEVICE_OBJECT Pdo, IN ULONG Ioctl, IN PVOID InputBuffer,
IN ULONG InputSize, IN PACPI_EVAL_OUTPUT_BUFFER OutputBuffer,
IN ULONG OutputSize);
VOID ProcessConnectStatus( DWORD dwPortStatus);
{
.
.
.
NT_STATUS status;
DWORD dwPortStatus;
Status = SATA_CheckPortStatus( pDO, &dwPortStatus);
if( !NT_SUCCESS( status))
//
// Not an ACPI OS or control method not supported. Set the
// status to indicate that port status is unknown
//
dwPortStatus = -1;
ProcessConnectStatus( dwPortStatus); // TODO – implementation specific
Summary of Contents for 82801EB
Page 6: ...R 6 SATA Programmer s Reference Manual This page is intentionally left blank...
Page 8: ...Introduction R 8 SATA Programmer s Reference Manual This page is intentionally left blank...
Page 10: ...Conventions R 10 SATA Programmer s Reference Manual This page is intentionally left blank...
Page 59: ...Theory of Operation R SATA Programmer s Reference Manual 59...