/*++
*******************************************************************************
* Copyright (c) 1990-98 Digi International Inc., All Rights Reserved				*
* 																										*
* This software contains proprietary and confidential information of Digi		*
* International Inc.  By accepting transfer of this copy, Recipient agrees		*
* to retain this software in confidence, to prevent disclosure to others,		*
* and to make no use of this software other than that for which it was			*
* delivered.  This is an unpublished copyrighted work of Digi International	*
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly	*
* prohibited.																						*
* 																										*
* Restricted Rights Legend																		*
*																										*
* Use, duplication, or disclosure by the Government is subject to					*
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in			*
* Technical Data and Computer Software clause at DFARS 252.227-7031 or			*
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -				*
* Restricted Rights at 48 CFR 52.227-19, as applicable.								*
*																										*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343				*
*																										*
*******************************************************************************

Module Name:

   dxblog.c

Abstract:

   Routines to log errors as well as print out debug messages.

Author:

   Michael Zarns

--*/

#include "digidxb.h"


VOID
dxbLogResourceConflict( 
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL, 
	           ( "DXB: Error assigning resources for adapter %S\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_RESOURCE_CONFLICT, 1, NULL, 0,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogAdapterNotFound( 
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Adapter %S not found!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_ADAPTER_NOT_FOUND, 2, NULL, 0, 
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
dxbLogAdapterResetFailed( 
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Reset failed, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_ADAPTER_RESET_FAILED, 3, NULL, 0, 
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogMemoryFailure(
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Memory test failed, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_ADAPTER_MEMORY_FAILURE, 4, NULL, 0, 
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogFileNotFound(
	IN PUNICODE_STRING Filename )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: File %S not found!\n", Filename->Buffer ) );
	DigiLogError( gpDriverObject, DXB_FILE_NOT_FOUND, 5, NULL, 0,
	              Filename->Buffer, Filename->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
dxbLogBiosFailed(
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Bios failed to load, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_BIOS_DOWNLOAD_FAILED, 6, NULL, 0,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogPostFailed(
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Post failed to load, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_POST_FAILED, 7, NULL, 0,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogFepFailed(
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Fep failed to load, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_FEP_DOWNLOAD_FAILED, 8, NULL, 0,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


VOID
dxbLogBadFepImage(
	IN PUNICODE_STRING AdapterName,
	IN PUNICODE_STRING FileName,
	IN USHORT          FileType )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Bad Fep image, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_BAD_FEP_IMAGE, 9, &FileType, sizeof FileType,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), 
	              FileName->Buffer, FileName->Length + sizeof(WCHAR) );
}


VOID
dxbLogPostErrors(
	IN PUNICODE_STRING AdapterName )
{
	SRAPRINT2(DIGIERROR, SRA_MED_LEVEL,  
                  ( "DXB: Post errors found, adapter %S!\n", AdapterName->Buffer ) );
	DigiLogError( gpDriverObject, DXB_POST_ERRORS, 10, NULL, 0,
	              AdapterName->Buffer, AdapterName->Length + sizeof(WCHAR), NULL, 0 );
}


