/*

Copyright (c)   Stratus Computer. 

Module Name:

    srautil.h

Abstract:

    Stratus utility routine definitions for Async driver

*/

#ifndef _SRAPROTO_H_
#define _SRAPROTO_H_


typedef struct _SRA_ADAPTER SRA_ADAPTER,*PSRA_ADAPTER;

typedef struct DXB_DEVICE_EXTENSION DXB_DEVICE_EXTENSION, *PDXB_DEVICE_EXTENSION;

// srautil.c & srawmi.c prototypes


VOID    
AdapterTable_RemoveEntry(PDXB_DEVICE_EXTENSION  val);

VOID    
AdapterTable_AddEntry(PDXB_DEVICE_EXTENSION val); 

NTSTATUS
SraDriverEntry(
    PDRIVER_OBJECT      DriverObject,
    PUNICODE_STRING     RegistryPath
    );

VOID
SraDriverUnload(
    PDRIVER_OBJECT      DriverObject
    );

NTSTATUS
SraLock(
    );

NTSTATUS
SraUnlock(
    );

NTSTATUS
SraMiniportInitialize(
    PDXB_DEVICE_EXTENSION Adapter
    );

PSRA_ADAPTER
SraFindOrCreateAdapter(
    IN PDXB_DEVICE_EXTENSION Adapter
    );


NTSTATUS
FindPciSlotEIOVA (
    PDXB_DEVICE_EXTENSION Adapter
     );

VOID
SraUnlinkAdapter(
    PDXB_DEVICE_EXTENSION Adapter
    );

VOID
SraReconcileOnlineAdapterState(
    PSRA_ADAPTER SraAdapter
    );

PSRA_ADAPTER
SraFirstAdapter(
    );

PSRA_ADAPTER
SraNextAdapter(
    PSRA_ADAPTER      SraAdapter
    );
VOID
SraResetAdapterProperties(
    PSRA_ADAPTER     SraAdapter
    );

NTSTATUS
SraReadAdapterKey(
    PSRA_ADAPTER  SraAdapter
    );

VOID
SraLinkAdapter(
    PDXB_DEVICE_EXTENSION Adapter,
    PSRA_ADAPTER  SraAdapter
    );


NTSTATUS
SraWriteAdapterKey(
    PSRA_ADAPTER  SraAdapter
    );

NTSTATUS
SraTryToBringUpAdapter(
    PSRA_ADAPTER     SraAdapter
    );

NTSTATUS
SraShootAdapter(
    PSRA_ADAPTER     SraAdapter,
    BOOLEAN          Force
    );

PSRA_ADAPTER
SraGetAdapter(
    PDXB_DEVICE_EXTENSION     Adapter
    );

VOID
SraGetAdapterKeyName(
    IN PSRA_ADAPTER     SraAdapter,
    OUT PWCHAR          Buffer
    );

VOID
SraDeleteAdapterKey(
    PSRA_ADAPTER  SraAdapter
    );

VOID
SraReferenceAdapter(
    PSRA_ADAPTER SraAdapter
    );

VOID
SraDereferenceAdapter(
    PSRA_ADAPTER SraAdapter
    );

VOID
SraSetAdapterState(
    PSRA_ADAPTER     SraAdapter,
    ULONG            NewState,
    ULONG            NewReason
    );

VOID
SraLockAndReferenceAdapter(
    PSRA_ADAPTER SraAdapter
    );

ULONG
SraEventWmiCount(
    PDEVICE_OBJECT      DeviceObject
    );

NTSTATUS
SraEventWmiName(
    PDEVICE_OBJECT      DeviceObject,
    IN  ULONG           InstanceId,
    IN  PVOID           DataBlock,
    IN OUT PLONG        SizeDataBlock
    );

NTSTATUS
SraWmiLock(
    PDEVICE_OBJECT      DeviceObject
    );

NTSTATUS
SraWmiUnlock(
    PDEVICE_OBJECT      DeviceObject
    );

ULONG
SraAdapterWmiCount(
    PDEVICE_OBJECT      DeviceObject
    );

NTSTATUS
SraAdapterWmiName(
    PDEVICE_OBJECT      DeviceObject,
    IN  ULONG           InstanceId,
    IN  PVOID           DataBlock,
    IN OUT PLONG        SizeDataBlock
    );

NTSTATUS
SraAdapterWmiFindInstance(
    PDEVICE_OBJECT      DeviceObject,
    PVOID               DataBlock,
    ULONG               SizeDataBlock,
    PULONG              InstanceId
    );

NTSTATUS
SraAdapterWmiMethod(
    PDEVICE_OBJECT DeviceObject,
    ULONG  InstanceId,
    ULONG  MethodId,
    PVOID  DataBlock,
    ULONG  SizeInDataBlock,
    PLONG  SizeOutDataBlock
    );

NTSTATUS
SraAdapterWmiFillDataBlock(
    PDEVICE_OBJECT DeviceObject,
    ULONG  InstanceId,
    PVOID  DataBlock,
    PLONG  SizeDataBlock
    );

VOID
SraAdapterWmiEventCb(
    PDEVICE_OBJECT DeviceObject,
    PDEVICE_ID     DeviceId,
    ULONG          State,
    ULONG          Reason,
    PVOID          Context);

ULONG
SraDrvrWmiCount(
    PDEVICE_OBJECT      DeviceObject
    );

NTSTATUS
SraDrvrWmiName(
    PDEVICE_OBJECT      DeviceObject,
    IN  ULONG           InstanceId,
    IN  PVOID           DataBlock,
    IN OUT PLONG        SizeDataBlock
    );

NTSTATUS
SraDrvrWmiMethod(
    PDEVICE_OBJECT DeviceObject,
    ULONG  InstanceId,
    ULONG  MethodId,
    PVOID  DataBlock,
    ULONG  SizeInDataBlock,
    PLONG  SizeOutDataBlock
    );

NTSTATUS
SraDrvrWmiFillDataBlock(
    PDEVICE_OBJECT DeviceObject,
    ULONG  InstanceId,
    PVOID  DataBlock,
    PLONG  SizeDataBlock
    );

NTSTATUS
SraDrvrWmiChangeInstance(
    PDEVICE_OBJECT DeviceObject,
    ULONG  InstanceId,
    PVOID  DataBlock,
    ULONG  SizeDataBlock
    );

NTSTATUS
SraWmiInitialize(
    PDRIVER_OBJECT      DriverObject,
    PUNICODE_STRING     RegistryPath
    );

VOID
SraWmiUnload(
    );

NTSTATUS
SraWmiCreateInterface(
    PDRIVER_OBJECT      DriverObject
    );

VOID
SraWmiDeleteInterface(
    );

VOID
SraWmiAdapterStateChange(
    PSRA_ADAPTER              SraAdapter
    );

VOID
SraMiniportHalt(
    PDXB_DEVICE_EXTENSION    Adapter
    );

NTSTATUS
SraTryToBringUpAdapter(
    PSRA_ADAPTER   SraAdapter
    );

NTSTATUS
SraWriteDriverKey(
    );

ULONG
SraAdapterToInstanceId(
    PSRA_ADAPTER SraAdapter
    );

PSRA_ADAPTER
SraInstanceIdToAdapter(
    ULONG InstanceId
    );

PSRA_ADAPTER
SraDevicePathIdToAdapter(
    IN  PDEVICE_ID DevicePathId,
    OUT PULONG     InstanceId
    );

/*
// I may add these later

BOOLEAN
SraIsAdapterAddressable(
    PDIGI_CONTROLLER_EXTENSION Adapter
    );

BOOLEAN
SraAdapterRemoved(
    PDIGI_CONTROLLER_EXTENSION Adapter
    );
*/

#endif _SRAPROTO_H_
