File: fwvendor.txt
Copyright (c) 1994-1997  Digital Equipment Corporation


			     --------------
			      Introduction
			     --------------

This file documents the firmware vendor API that is available on all
shipping versions of the NT firmware for Alpha AXP systems.

We assume that you have a copy of Revision 1.1 of the ARC spec.

Unless otherwise specified, the following rules apply to every
firmware API in this document:

1. The API exists on the NT firmware of every Alpha AXP system, as of
   version V3.5 of the NT firmware.

2. Digital NT Engineering can provide a file that contains the
   function prototype for this call, and any datatype definitions that
   are specific to this call.

Digital's NT Engineering group can provide you with the file described
in point #2.  Digital Equipment Corporation is not liable or
responsible for any damages resulting from the use of this file.


		       --------------------------
			Vendor Vector Definition
		       --------------------------

The longword at offset 0x28 in the System Parameter Block points at the
Vendor Vector, which is also sometimes called the Private Vector.  The
Alpha AXP Vendor Vector has pointers to these functions:

    AllocatePool,
    StallExecution,
    Print,
    ReturnExtendedSystemInformation,
    VideoDisplayInitialize,
    EISAReadRegisterBufferUCHAR,
    EISAWriteRegisterBufferUCHAR,
    EISAReadPortUCHAR,
    EISAReadPortUSHORT,
    EISAReadPortULONG,
    EISAWritePortUCHAR,
    EISAWritePortUSHORT,
    EISAWritePortULONG,
    FreePool,
    CallBios,
    TranslateBusAddress,
    ReadPortUCHAR,
    ReadPortUSHORT,
    ReadPortULONG,
    WritePortUCHAR,
    WritePortUSHORT,
    WritePortULONG,
    ReadRegisterUCHAR,
    ReadRegisterUSHORT,
    ReadRegisterULONG,
    WriteRegisterUCHAR,
    WriteRegisterUSHORT,
    WriteRegisterULONG,
    GetBusDataByOffset,
    SetBusDataByOffset,
    WidePrint,
    ReturnLanguageId,
    GetAdapter,
    AllocateCommonBuffer,
    FreeCommonBuffer.
    ReturnArcInformation,
    IssueSrbDirect.

   
   
		       --------------------------
			Structures and Datatypes
		       --------------------------
				    
The structures and datatypes used by these calls include:

//
// Basic definitions from types.h.
//

#define IN
#define OUT
#define	NULL	0
#define TRUE    1
#define FALSE   0
#define VOID    void

typedef signed char     CHAR;           //  8 bits    signed
typedef unsigned char   UCHAR;          //  8 bits  unsigned
typedef signed short    SHORT;          // 16 bits    signed
typedef unsigned short  USHORT;         // 16 bits  unsigned
typedef signed long     LONG;           // 32 bits    signed
typedef unsigned long   ULONG;          // 32 bits  unsigned
typedef __int64         LARGEINTEGER;   // 64 bits    signed
typedef UCHAR           BOOLEAN;	
typedef SHORT           WCHAR;

typedef unsigned int   size_t;
typedef __int64         fpos_t;         // to match arc seek requirement.
typedef __int64         off_t;

typedef int            time_t;
typedef __int64        clock_t;

typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;

typedef LONGLONG quad_t;
typedef ULONGLONG u_quad_t;

typedef LONG ARC_STATUS;

typedef CHAR *PCHAR;
typedef UCHAR *PUCHAR;
typedef LONG *PLONG;
typedef ULONG *PULONG;
typedef SHORT *PSHORT;
typedef USHORT *PUSHORT;
typedef WCHAR *PWCHAR;
typedef LARGEINTEGER *PLARGEINTEGER;

//
// ARC status codes, from errno.h.
//

#define ESUCCESS        0           // No error
#define E2BIG           1           // Argument list too long
#define EACCES          2           // Permission denied
#define EAGAIN          3           // Resource temporarily unavailable
#define EBADF           4           // Bad file descriptor
#define EBUSY           5           // Resource busy
#define EFAULT          6           // Bad address
#define EINVAL          7           // Invalid argument
#define EIO             8           // Input/output error
#define EISDIR          9           // Is a directory
#define EMFILE          10          // Too many open files
#define EMLINK          11          // Too many links
#define ENAMETOOLONG    12          // Filename too long
#define ENODEV          13          // No such device
#define ENOENT          14          // No such file or directory
#define ENOEXEC         15          // Execute format error
#define ENOMEM          16          // Not enough memory
#define ENOSPC          17          // No space left on device
#define ENOTDIR         18          // Not a directory
#define ENOTTY          19          // Inappropriate I/O control operation
#define ENXIO           20          // Media not loaded
#define EROFS           21          // Read-only file system
#define ENFILE		22          // File table overflow 
#define ESPIPE		23          // Illegal seek 
#define EDOM		24          // Argument too large 
#define ERANGE		25          // Result too large 


//
// Structure used to return system and processor information.
// 
//

typedef struct _EXTENDED_SYSTEM_INFORMATION {
    ULONG   ProcessorId;
    ULONG   ProcessorRevision;
    ULONG   ProcessorPageSize;
    ULONG   NumberOfPhysicalAddressBits;
    ULONG   MaximumAddressSpaceNumber;
    ULONG   ProcessorCycleCounterPeriod;
    ULONG   SystemRevision;
    UCHAR   SystemSerialNumber[16];
    UCHAR   FirmwareVersion[16];
} EXTENDED_SYSTEM_INFORMATION, *PEXTENDED_SYSTEM_INFORMATION;

//
// Define structure used to call BIOS emulator.  
//

typedef struct X86_BIOS_ARGUMENTS {
    ULONG Eax;
    ULONG Ebx;
    ULONG Ecx;
    ULONG Edx;
    ULONG Esi;
    ULONG Edi;
    ULONG Ebp;
} X86_BIOS_ARGUMENTS, *PX86_BIOS_ARGUMENTS;

//
// Define types of bus information.  
//

typedef enum _BUS_DATA_TYPE {
    Cmos,
    EisaConfiguration,
    Pos,
    CbusConfiguration,
    PCIConfiguration,
    VMEConfiguration,
    NuBusConfiguration,
    PCMCIAConfiguration,
    MPIConfiguration,
    MPSAConfiguration,
    MaximumBusDataType
} BUS_DATA_TYPE, *PBUS_DATA_TYPE;

//
// Define the I/O bus interface types. 
//

typedef enum _INTERFACE_TYPE {
    Internal,
    Isa,
    Eisa,
    MicroChannel,
    TurboChannel,
    PCIBus,
    VMEBus,
    NuBus,
    PCMCIABus,
    CBus,
    MPIBus,
    MPSABus,
    MaximumInterfaceType
}INTERFACE_TYPE, *PINTERFACE_TYPE;

//
// Define the device description structure.  
//

typedef struct _DEVICE_DESCRIPTION {
    ULONG Version;
    BOOLEAN Master;
    BOOLEAN ScatterGather;
    BOOLEAN DemandMode;
    BOOLEAN AutoInitialize;
    BOOLEAN Dma32BitAddresses;
    BOOLEAN IgnoreCount;
    BOOLEAN Reserved1;          // must be false
    BOOLEAN Reserved2;          // must be false
    ULONG BusNumber;
    ULONG DmaChannel;
    INTERFACE_TYPE  InterfaceType;
    DMA_WIDTH DmaWidth;
    DMA_SPEED DmaSpeed;
    ULONG MaximumLength;
    ULONG DmaPort;
} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;

//
// Define languages for external programs.
//

typedef enum _LANGUAGE_ID_TYPE {
    LANGUAGE_ID_UNKNOWN,    
    LANGUAGE_ID_ENGLISH,
    LANGUAGE_ID_FRENCH,
    LANGUAGE_ID_GERMAN,
    LANGUAGE_ID_SPANISH,
    LANGUAGE_ID_JAPANESE,
    LANGUAGE_ID_ITALIAN,
    LANGUAGE_ID_ENGLISH_UK,
    LANGUAGE_ID_MAXIMUM
} LANGUAGE_ID_TYPE;

//
// Define ARC Information structure
//

typedef struct{
    ULONG  Version;
    UCHAR **SearchPath;
    UCHAR *Reserved1;
    UCHAR *Reserved2;
    UCHAR *Reserved3;
    UCHAR *Reserved4;

} ARC_INFORMATION;


//
// SCSI I/O Request Block
//

typedef struct _SCSI_REQUEST_BLOCK {
    USHORT Length;                  // offset 0
    UCHAR Function;                 // offset 2
    UCHAR SrbStatus;                // offset 3
    UCHAR ScsiStatus;               // offset 4
    UCHAR PathId;                   // offset 5
    UCHAR TargetId;                 // offset 6
    UCHAR Lun;                      // offset 7
    UCHAR QueueTag;                 // offset 8
    UCHAR QueueAction;              // offset 9
    UCHAR CdbLength;                // offset a
    UCHAR SenseInfoBufferLength;    // offset b
    ULONG SrbFlags;                 // offset c
    ULONG DataTransferLength;       // offset 10
    ULONG TimeOutValue;             // offset 14
    PVOID DataBuffer;               // offset 18
    PVOID SenseInfoBuffer;          // offset 1c
    struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
    PVOID OriginalRequest;          // offset 24
    PVOID SrbExtension;             // offset 28
    ULONG QueueSortKey;             // offset 2c
    UCHAR Cdb[16];                  // offset 30
} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;



			     -------------
			      API Listing
			     -------------

The function prototype for each Vendor Vector call is given, followed
by a short description.

Unless otherwise specified, a particular call exists on the NT
firmware of every Alpha AXP system, as of version V3.5 of the
firmware.



PVOID
AllocatePool (
    IN ULONG NumberOfBytes
    );
/*++

Routine Description:

    This routine allocates the requested number of bytes from the firmware
    pool.  If enough pool exists to satisfy the request, a pointer to the
    next free cache-aligned block is returned, otherwise NULL is returned.

Arguments:

    NumberOfBytes	The number of bytes to be allocated.

Return Value:

    NULL		Not enough pool exists to satisfy the request.

    Non-NULL	 	A pointer to the allocated pool.

--*/




VOID
StallExecution (
    IN ULONG Microseconds
    );
/*++

Routine Description:

    This stalls for at least the requested number of microseconds.

Arguments:

    Microseconds 	The number of microseconds to stall.

Return Value:

    None.

--*/




ULONG
Print (
    IN PCHAR Format,
    ...
    );
/*++

Routine Description:

    This performs a printf to the console output device.

Arguments:

    Format		A printf format string

    Other args		(Optional) arguments for the format string.

Return Value:

    None.

--*/




VOID
ReturnExtendedSystemInformation (
    OUT PEXTENDED_SYSTEM_INFORMATION SystemInfo
    );
/*++

Routine Description:

    This returns detailed information about the Alpha AXP system and
    processor.

Arguments:

    SystemInfo		A structure with the system and processor info.

Return Value:

    None.

--*/





ARC_STATUS
VideoDisplayInitialize (
    OUT PVOID UnusedParameter
    );
/*++

Routine Description:

    This routine initializes the video control registers, and clears the
    video screen.

Arguments:

    UnusedParameter            Unused.  This is to maintain calling
                               argument compatibility with older versions
                               of the firmware.

Return Value:

    If the video was initialized, ESUCCESS is returned, otherwise an error
    code is returned.

--*/




ULONG
EISAReadRegisterBufferUCHAR (
    IN ULONG BusNumber,
    IN ULONG Offset,
    OUT PVOID Buffer,
    IN ULONG Length
    );
/*++

Routine Description:

    This reads EISA memory space using byte reads.

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

    Buffer		A pointer to the data area to receive the EISA data.

    Length		Number of bytes to read.
    

Return Value:

    This returns the number of bytes actually read.  If this is not
    equal to the Length argument, an error has occurred.  Explicitly
    detected errors are signalled by returning a value of 0.

--*/




ULONG
EISAWriteRegisterBufferUCHAR (
    IN ULONG BusNumber,
    IN ULONG Offset,
    OUT PVOID Buffer,
    IN ULONG Length
    );
/*++

Routine Description:

    This writes EISA memory space using byte writes.

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

    Buffer		A pointer to the data to be written to the EISA memory.

    Length		Number of bytes to write.
    

Return Value:

    This returns the number of bytes actually written.  If this is not
    equal to the Length argument, an error has occurred.  Explicitly
    detected errors are signalled by returning a value of 0.

--*/



UCHAR
EISAReadPortUCHAR (
    IN ULONG BusNumber,
    IN ULONG Offset
    );
/*++

Routine Description:

    This reads EISA I/O space using a byte read.

    On Alpha, we check for a read to 0C80--0C83, and manually
    return the EISA System Board ID bytes.

    The only functionality this provides over the more generic
    Vendor Read and Write Port functions is the manual trapping
    of the Eisa system board ID address, which could be added to the
    newer generic functions.  This function is an older method of
    accessing I/O space.  You should be using the ReadPortxxxx functions
    instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

Return Value:

    This returns the byte read.  On an error, 0 is returned.

--*/




USHORT
EISAReadPortUSHORT (
    IN ULONG BusNumber,
    IN ULONG Offset
    );
/*++

Routine Description:

    This reads EISA I/O space using a word read.

    On Alpha, we check for a read to 0C80--0C83, and manually
    return the EISA System Board ID bytes.

    The only functionality this provides over the more generic
    Vendor Read and Write Port functions is the manual trapping
    of the Eisa system board ID address, which could be added to the
    newer generic functions.  This function is an older method of
    accessing I/O space.  You should be using the ReadPortxxxx functions
    instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

Return Value:

    This returns the word read.  On an error, 0 is returned.

--*/




ULONG
EISAReadPortULONG (
    IN ULONG BusNumber,
    IN ULONG Offset
    );
/*++

Routine Description:

    This reads EISA I/O space using a longword read.

    On Alpha, we check for a read to 0C80--0C83, and manually
    return the EISA System Board ID bytes.

    The only functionality this provides over the more generic
    Vendor Read and Write Port functions is the manual trapping
    of the Eisa system board ID address, which could be added to the
    newer generic functions.  This function is an older method of
    accessing I/O space.  You should be using the ReadPortxxxx functions
    instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

Return Value:

    This returns the longword read.  On an error, 0 is returned.

--*/


VOID
EISAWritePortUCHAR (
    IN ULONG BusNumber,
    IN ULONG Offset,
    IN UCHAR Datum
    );
/*++

Routine Description:

    This writes EISA I/O space using a byte write.

    This provides less functionality than the Vendor Read and Write
    Port functions.  This function is an older method of accessing I/O
    space.  You should be using the WritePortxxxx functions instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

    Datum		The byte to be written.

Return Value:

    None.  Errors will cause either a no-op or a bugcheck.

--*/



VOID
EISAWritePortUSHORT (
    IN ULONG BusNumber,
    IN ULONG Offset,
    IN USHORT Datum
    );
/*++

Routine Description:

    This writes EISA I/O space using a word write.

    This provides less functionality than the Vendor Read and Write
    Port functions.  This function is an older method of accessing I/O
    space.  You should be using the WritePortxxxx functions instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

    Datum		The word to be written.

Return Value:

    None.  Errors will cause either a no-op or a bugcheck.

--*/



VOID
EISAWritePortULONG (
    IN ULONG BusNumber,
    IN ULONG Offset,
    IN ULONG Datum
    );
/*++

Routine Description:

    This writes EISA I/O space using a longword write.

    This provides less functionality than the Vendor Read and Write
    Port functions.  This function is an older method of accessing I/O
    space.  You should be using the WritePortxxxx functions instead!

Arguments:

    BusNumber		EISA bus number, starting with 0.

    Offset		Byte offset from the beginning of EISA space for
    			this bus.

			This must be based off the .IoStart value in the
			EISA adapter's ConfigurationData, which is held in
			the Component Data Structure node.  Therefore, this 
			will already have the EISA QVA bits set up.

    Datum		The longword to be written.

Return Value:

    None.  Errors will cause either a no-op or a bugcheck.

--*/



VOID
FreePool (
    IN PVOID MemoryPointer
    );
/*++

Routine Description:

    This routine frees memory previously allocated with FwAllocatePool()

Arguments:

    MemoryPointer - Pointer to memory previously allocated by FwAllocatePool().

Return Value:

    None.

--*/



BOOLEAN
CallBios (
    IN ULONG InterruptNumber,
    IN OUT PX86_BIOS_ARGUMENTS BiosArguments
    );
/*++

Routine Description:

    This routine is the call-back entry point into the firmware for
    performing Intel BIOS function calls.

Arguments:

    InterruptNumber	Intel software interrupt number.  Functions supported are:

	Int 10 - Video Services: 0x02,0x06,0x09,0x0a,0x0e,0x0f,0x13.
	Int 15 - System service: 0x86, 0x0x90,0x91,0xd8.
	Int 16 - Keyboard: 0x00,0x01,0x02,0x10,0x11.
	Int 1A - Clock or PCI: 0x00,0x02,0x04,0xb1.
	Int 2F - Windows present: always return 0 - windows is not installed.

	Right now, should only pass context of x86 registers to the X86_BIOS_ARGUMENTS    
	structure.  No support for segment register yet.


    BiosArguments	Structure containing the Intel CPU register contents
			before and after the BIOS function call.

Return Value:

    TRUE    - If the interrupt was completed successfully (Carry = 0).
    FALSE   - otherwise.

--*/




BOOLEAN
TranslateBusAddress (
    IN INTERFACE_TYPE  InterfaceType,
    IN ULONG BusNumber,
    IN PHYSICAL_ADDRESS BusAddress,
    IN OUT PULONG AddressSpace,
    OUT PPHYSICAL_ADDRESS TranslatedAddress
    );
/*++

Routine Description:

    This translates a conceptual bus address into a QVA that can
    be used by a program running on top of the firmware.

    We assume that the caller is asking for a kernel mode translation.
    If not, the results returned and the firmware state is unpredictable.

Arguments:

    InterfaceType - Supplies the type of bus which the address is for.

    BusNumber - Supplies the bus number for the device; not used in Jensen

    BusAddress - Supplies the bus relative address.

    AddressSpace - Supplies the address space number for the device: 0 for
        memory and 1 for I/O space.

    TranslatedAddress - Supplies a pointer to return the translated
    address.  This address may be used as an argument to the Read/Write
    Port/Register functions.


Return Value:

    A return value of TRUE indicates that a system physical address
    corresponding to the supplied bus relative address and bus address
    number has been returned in TranslatedAddress.

    A return value of FALSE occurs if the translation for the address was
    not possible.

--*/




UCHAR
ReadPortUCHAR (
    PUCHAR Port
    );
/*++

Routine Description:

    This reads the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be read.

Return Value:

    The byte read from Port space.

--*/


USHORT
ReadPortUSHORT (
    PUSHORT Port
    );
/*++

Routine Description:

    This reads the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be read.

Return Value:

    The word read from Port space.

--*/


ULONG
ReadPortULONG (
    PULONG Port
    );
/*++

Routine Description:

    This reads the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be read.

Return Value:

    The longword read from Port space.

--*/




VOID
WritePortUCHAR (
    PUCHAR Port,
    UCHAR   Value
    );
/*++

Routine Description:

    This writes a value to the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/


VOID
WritePortUSHORT (
    PUSHORT Port,
    USHORT  Value
    );
/*++

Routine Description:

    This writes a value to the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/


VOID
WritePortULONG (
    PULONG Port,
    ULONG   Value
    );
/*++

Routine Description:

    This writes a value to the machine Port (I/O csr) space.

Arguments:

    Port		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/




UCHAR
ReadRegisterUCHAR (
    PUCHAR Register
    );
/*++

Routine Description:

    This reads from the machine Register (memory) space.

Arguments:

    Register		The QVA to be read.

Return Value:

    The value read from the QVA address.

--*/





USHORT
ReadRegisterUSHORT (
    PUSHORT Register
    );
/*++

Routine Description:

    This reads from the machine Register (memory) space.

Arguments:

    Register		The QVA to be read.

Return Value:

    The value read from the QVA address.

--*/


ULONG
ReadRegisterULONG (
    PULONG Register
    );
/*++

Routine Description:

    This reads from the machine Register (memory) space.

Arguments:

    Register		The QVA to be read.

Return Value:

    The value read from the QVA address.

--*/


VOID
WriteRegisterUCHAR (
    PUCHAR Register,
    UCHAR   Value
    );
/*++

Routine Description:

    This writes a value to the machine Register (memory) space.

Arguments:

    Register		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/


VOID
WriteRegisterUSHORT (
    PUSHORT Register,
    USHORT  Value
    );
/*++

Routine Description:

    This writes a value to the machine Register (memory) space.

Arguments:

    Register		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/


VOID
WriteRegisterULONG (
    PULONG Register,
    ULONG   Value
    );
/*++

Routine Description:

    This writes a value to the machine Register (memory) space.

Arguments:

    Register		The QVA to be written.

    Value		The data to be written.

Return Value:

    None.

--*/



/*++

Firmware Version Notice : xxxBusDataByOffset

The following calls were first implemented in these versions of the
NT firmware for Alpha AXP:

	DECpc AXP 150 (Jensen)	:	3.5-2
	Culzean			:	3.5-2
	Avanti			:	3.5-11
	Mustang			:	3.5-11
	Sable			:	3.5-26(mp)
	Mikasa			:	3.5-6
	Burns			:	TBD
	Quicksilver		:	TBD
	Noname			:	3.5-11
	All other machines	:	All firmware versions

--*/

ULONG
GetBusDataByOffset(
    IN BUS_DATA_TYPE  BusDataType,
    IN ULONG BusNumber,
    IN ULONG SlotNumber,
    IN PVOID Buffer,
    IN ULONG Offset,
    IN ULONG Length
    )
/*++

Routine Description:

    This function reads data from a specified bus slot into a buffer.

    This function currently supports only PCI bus configuration data.

Arguments:

    BusDataType		A value indicating the bus type of the query.
		        This function currently supports only the value
			of PCIConfiguration.

    BusNumber		The bus number.  These are numbered starting at 0.

    SlotNumber		The bus slot.

    Buffer		A pointer to a buffer that will receive the bus
			data.  This must be large enough to hold all of
			the requested data.

    Offset		The offset into the bus space.  For PCI
			configuration, this is the offset into PCI
			configuration space.

    Length		The number of bytes to be read.

Return Value:

    0			The requested bus type, or the requested bus number,
			do not exist.

    0			The request was to read beyond the common PCI header
			and no card is plugged into the requested slot, or
			the slot does not exist.

    2			The request was to read within the common PCI header
			and no card is plugged into the requested slot,
			or the slot does not exist, or the card is a PCI-PCI
			bridge.
    
    Any other value	The number of bytes that were read into the caller's
			buffer.

--*/



ULONG
SetBusDataByOffset(
    IN BUS_DATA_TYPE  BusDataType,
    IN ULONG BusNumber,
    IN ULONG SlotNumber,
    IN PVOID Buffer,
    IN ULONG Offset,
    IN ULONG Length
    )
/*++

Routine Description:

    This function writes data into a specified bus slot.

    This function currently supports only PCI bus configuration data.

Arguments:

    BusDataType		A value indicating the bus type of the query.
		        This function currently supports only the value
			of PCIConfiguration.

    BusNumber		The bus number.  These are numbered starting at 0.

    SlotNumber		The bus slot.

    Buffer		A pointer to a buffer that contains the data to be
			written to the specified bus slot.

    Offset		The offset into the bus space.  For PCI
			configuration, this is the offset into PCI
			configuration space.

    Length		The number of bytes to be written.

Return Value:

    0			The requested bus type, or the requested bus number,
			do not exist.

    0			No card is plugged into the requested slot, or
			the slot does not exist.

    Any other value	The number of bytes that were written to the
			specified slot.

--*/

/*++

End of Firmware Version Notice : xxxBusDataByOffset

--*/



/*++

Firmware Version Notice : WidePrint, ReturnLanguageId

The following calls were first implemented in this version of the NT
firmware for Alpha Systems:

	V4.21

--*/


ULONG
WidePrint (
    PWCHAR Format,
    ...
    );
/*++

Routine Description:

    This performs a wprintf to the console output device.

Arguments:

    Format		A wprintf Unicode format string

    Other args		(Optional) arguments for the format string.

Return Value:

    None.

--*/

LONG
ReturnLanguageId ( 
    IN VOID 
    )

/*++

Routine Description:

    Returns the Language ID value, so that the language can be know
    to ARC Applications.

Arguments:

Return Value:

    The current Language ID value.

--*/

/*++

End of Firmware Version Notice : WidePrint, ReturnLanguageId

--*/




/*++

Firmware Version Notice : GetAdapter, AllocateCommonBuffer, FreeCommonBuffer.

The following calls were first implemented in this version of the
NT firmware for Alpha AXP:

		V4.21

--*/

PADAPTER_OBJECT
GetAdapter(
    IN PDEVICE_DESCRIPTION DeviceDescription,
    IN OUT PULONG NumberOfMapRegisters
    )

/*++

Routine Description:

    This function returns the appropriate adapter object for the device defined
    in the device description structure.  Eisa, Isa, pci bus types and all
    master devices are supported for the system.

Arguments:

    DeviceDescription - Supplies a description of the deivce.

    NumberOfMapRegisters - Returns the maximum number of map registers which
        may be allocated by the device driver.

Return Value:

    A pointer to the requested adapter object or NULL if an adapter could not
    be created.

--*/


PVOID
AllocateCommonBuffer(
    IN PADAPTER_OBJECT AdapterObject,
    IN ULONG Length,
    OUT PPHYSICAL_ADDRESS LogicalAddress,
    IN BOOLEAN CacheEnabled
    )
/*++

Routine Description:

    This function allocates the memory for a common buffer and maps so that it
    can be accessed by a master device and the CPU.

Arguments:

    AdapterObject - Supplies a pointer to the adapter object used by this
        device.

    Length - Supplies the length of the common buffer to be allocated.

    LogicalAddress - Returns the logical address of the common buffer.

    CacheEnable - Indicates whether the memeory is cached or not.

Return Value:

    Returns the virtual address of the common buffer.  If the buffer cannot be
    allocated then NULL is returned.

--*/


VOID
FreeCommonBuffer(
    IN PADAPTER_OBJECT AdapterObject,
    IN ULONG Length,
    IN PHYSICAL_ADDRESS LogicalAddress,
    IN PVOID VirtualAddress,
    IN BOOLEAN CacheEnabled
    )
/*++

Routine Description:

    This function frees a common buffer and all of the resouces it uses.

Arguments:

    AdapterObject - Supplies a pointer to the adapter object used by this
        device.

    Length - Supplies the length of the common buffer. This should be the same
        value used for the allocation of the buffer.

    LogicalAddress - Supplies the logical address of the common buffer.  This
        must be the same value return by HalAllocateCommonBuffer.

    VirtualAddress - Supplies the virtual address of the common buffer.  This
        must be the same value return by HalAllocateCommonBuffer.

    CacheEnable - Indicates whether the memeory is cached or not.

Return Value:

    None

--*/

ARC_STATUS
ReturnArcInformation (
    OUT PARC_INFORMATION ArcInformation
    )
/*++

Routine Description:

    This returns miscellaneous information on the I/O busses in the
    machine.  This currently only includes a search path for the
    bus configuration utilities.

Arguments:

    ArcInformation     A pointer to a ARC_INFORMATION structure that
                       will receive the bus information.

Return Value:

    ESUCCESS or an error condition.

--*/

ARC_STATUS
IssueSrbDirect(
    UCHAR ScsiAdapterId,
    UCHAR PathId,
    UCHAR TargetId,
    UCHAR LunId,
    PSCSI_REQUEST_BLOCK Srb,
    PVOID BufferAddress,
    ULONG BufferLength,
    BOOLEAN WriteToDevice
    )

/*++

Routine Description:

    Send the SRB directly to the scsi device.

Arguments:

    ScsiAdapterId - The scsi bus number that you want to send the srb to.
    PathId - The path number that you want to send the srb to.
    TargetId - The target number that you want to send the srb to.
    LunId -  The lun number that you want to send the srb to.
             Currently only lun 0 supported.
    Srb - The srb to be sent to the scsi device.
    BufferAddress - The buffer for the data transfer.
    BufferLength - The length of the data transfer.
    WriteToDevice - Determines the direction of the data transfer.

Return Value:

    ARC_STATUS

--*/


