File: fwarc.txt

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

This file documents the firmware arc 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.  If not,
please contact MIPS Computer Systems.


   	               --------------------------
			Firmware Vector Definition
		       --------------------------

The longword at offset 0x20 in the System Parameter Block points at the
Firmware Vector.  The Alpha AXP Firmware Vector has pointers to these functions:

	Load,
	Invoke, 
	Execute, 
	Halt, 
	PowerDown
	Restart,
	Reboot, 
	EnterInteractiveMode, 
	GetPeer, 
	GetChild, 
	GetParent, 
	GetConfigurationData, 
	AddChild, 
	DeleteComponent, 
	GetComponent, 
	SaveConfiguration, 
	GetSystemId, 
	GetMemoryDescriptor, 
	GetTime, 
	GetRelativeTime, 
	GetDirectoryEntry, 
	Open, 
	Close, 
	Read, 
	GetReadStatus, 
	Write, 
	Seek, 
	Mount, 
	GetEnvironmentVariable, 
	SetEnvironmentVariable, 
	GetFileInformation, 
	SetFileInformation,
	FlushAllCaches, 
	TestUnicodeCharacter, 
	GetDisplayStatus.



	      	       --------------------------
			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 



//
// Configuration types and structures 
//

typedef enum{
    SystemClass,
    ProcessorClass,
    CacheClass,
    AdapterClass,
    ControllerClass,
    PeripheralClass,
    MemoryClass,
    MaximumClass
} CONFIGURATION_CLASS;


typedef enum {
    ArcSystem,
    CentralProcessor,
    FloatingPointProcessor,
    PrimaryIcache,
    PrimaryDcache,
    SecondaryIcache,
    SecondaryDcache,
    SecondaryCache,
    EisaAdapter,
    TcAdapter,
    ScsiAdapter,
    DtiAdapter,
    MultiFunctionAdapter,
    DiskController,
    TapeController,
    CdromController,
    WormController,
    SerialController,
    NetworkController,
    DisplayController,
    ParallelController,
    PointerController,
    KeyboardController,
    AudioController,
    OtherController,
    DiskPeripheral,
    FloppyDiskPeripheral,
    TapePeripheral,
    ModemPeripheral,
    MonitorPeripheral,
    PrinterPeripheral,
    PointerPeripheral,
    KeyboardPeripheral,
    TerminalPeripheral,
    OtherPeripheral,
    LinePeripheral,
    NetworkPeripheral,
    SystemMemory,
    MaximumType
} CONFIGURATION_TYPE,*PCONFIGURATION_TYPE;


typedef enum {
    Failed = 1,
    ReadOnly = 2,
    Removable = 4,
    ConsoleIn = 8,
    ConsoleOut = 16,
    Input = 32,
    Output = 64
} IDENTIFIERFLAG;


typedef struct {
    CONFIGURATION_CLASS Class;
    CONFIGURATION_TYPE Type;
    IDENTIFIERFLAG Flags;
    USHORT Version;
    USHORT Revision;
    ULONG Key;
    ULONG AffinityMask;
    ULONG ConfigurationDataLength;
    ULONG IdentifierLength;
    CHAR *Identifier;
} CONFIGURATION_COMPONENT,*PCONFIGURATION_COMPONENT;

//
// System ID structure
//

typedef struct {
    CHAR VendorId[8];
    CHAR ProductId[8];
} SYSTEM_ID;


//
// Memory type and structure.
//

typedef enum {
    MemoryExceptionBlock,
    MemorySystemBlock,
    MemoryFree,
    MemoryBad,
    MemoryLoadedProgram,
    MemoryFirmwareTemporary,
    MemoryFirmwarePermanent,
    MemoryFreeContiguous,
    MemorySpecialMemory,
    MemoryMaximum
} MEMORY_TYPE;


typedef struct {
    MEMORY_TYPE Type;
    ULONG BasePage;
    ULONG PageCount;
} MEMORY_DESCRIPTOR;


//
// Time structure 
//

typedef struct _TIME_FIELDS{
    USHORT Year;        // range [1601...]
    USHORT Month;       // range [1..12]
    USHORT Day;         // range [1..31]
    USHORT Hour;        // range [0..23]
    USHORT Minute;      // range [0..59]
    USHORT Second;      // range [0..59]
    USHORT Milliseconds;// range [0..999]
    USHORT Weekday;     // range [0..6] == [Sunday..Saturday]
} TIME_FIELDS,*PTIME_FIELDS;


//
// Input/Ouput type definitions and structures
//


#define StandardIn      0                     
#define StandardOut     1                     

#define ReadOnlyFile    1
#define HiddenFile      2
#define SystemFile      4
#define ArchiveFile     8
#define DirectoryFile   16
#define DeleteFile      32

typedef struct {
    ULONG FileNameLength;
    UCHAR FileAttribute;
    CHAR FileName[32];
} DIRECTORY_ENTRY;

typedef enum {
    OpenReadOnly,   
    OpenWriteOnly,
    OpenReadWrite,
    CreateWriteOnly,
    CreateReadWrite,
    SupersedeWriteOnly,
    SupersedeReadWrite,
    OpenDirectory,
    CreateDirectory,
    OpenMaximumMode
} OPEN_MODE;


typedef enum {
    SeekAbsolute,
    SeekRelative,
    SeekMaximum
} SEEK_MODE;


typedef enum {
    MountLoadMedia,
    MountUnloadMedia,
    MountMaximum
} MOUNT_OPERATION;

typedef struct {
    LARGE_INTEGER StartingAddress;
    LARGE_INTEGER EndingAddress;
    LARGE_INTEGER CurrentAddress;
    CONFIGURATION_TYPE Type;
    ULONG FileNameLength;
    UCHAR Attributes;
    CHAR FileName[32];
} FILE_INFORMATION;


//
// Display Status structure
//

typedef struct {
    USHORT CursorXPosition;
    USHORT CursorYPosition;
    USHORT CursorMaxXPosition;
    USHORT CursorMaxYPosition;
    UCHAR ForegroundColor;
    UCHAR BackgroundColor;
    BOOLEAN HighIntensity;
    BOOLEAN Underscored;
    BOOLEAN ReverseVideo;
} ARC_DISPLAY_STATUS;


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

The function prototype for each Firmware 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.

LONG
Load (
    IN PCHAR ImagePath,
    IN ULONG TopAddress,
    OUT PULONG EntryAddress,
    OUT PULONG LowAddress
    )

/*++

Routine Description:

    This routine attempts to load the specified file from the specified
    device.

Arguments:

    ImagePath - Supplies a pointer to the path of the file to load.

    TopAddress - Supplies the top address of a region of memory into which
                 the file is to be loaded.

    EntryAddress - Supplies a pointer to a variable to receive the entry point
                   of the image, if defined.

    LowAddress - Supplies a pointer to a variable to receive the low address
                 of the loaded file.

Return Value:

    ESUCCESS is returned if the specified image file is loaded
    successfully. Otherwise, an unsuccessful status is returned
    that describes the reason for failure.

--*/


LONG
Invoke(
    IN ULONG ExecAddr,
    IN ULONG StackAddr,
    IN ULONG Argc,
    IN PCHAR Argv[],
    IN PCHAR Envp[]
    )


Routine Description:

    This routine invokes a loaded program.

Arguments:

    ExecAddr - Supplies the address of the routine to call.

    StackAddr - Supplies the address to which the stack pointer is set.

    Argc, Argv, Envp - Supply the arguments and environment to pass to
                       Loaded program.

    The stack pointer is saved in register s0 so that when the loaded
    program returns, the old stack pointer can be restored.


Return Value:

    ESUCCESS is returned if the address is valid.
    EFAULT indicates an invalid address.

--*/


LONG
Execute(
    IN PCHAR ImagePath,
    IN ULONG Argc,
    IN PCHAR Argv[],
    IN PCHAR Envp[]
    )


Routine Description:

    This routine loads a program into memory and invokes it.  The program is 
    loaded into memory at the top of a 4-Mbytes region of contiguous free
    memory.  The stack pointer is set to point to the low address of the 
    loaded program.

Arguments:
    
    ImagePath - Supplies a pointer to the path of the file to execute.

    Argc, Argv, Envp - Supply the arguments and environment to pass to
                       the executed program.
   
Return Value:

    ESUCCESS if succeeded.  Otherwise, an unsuccessful status is returned
    that describes the reason for failure.
    
--*/


VOID
Halt(
    VOID
    )

Routine Description: 

    Implemented as Restart.
                            
Arguments: None
    
Return Value: None

--*/


VOID
PowerDown(
    VOID
    )

Routine Description: 

    Implemented as Restart.
                        
Arguments: None
    
Return Value: None

--*/


void
PowerDown(
    void
    )

Routine Description: 

    Implemented as Restart.
                        
Arguments: None
    
Return Value: None

--*/

VOID
Restart (
    IN VOID
    )
/*++

Routine Description:

    This routine implements the Firmware reload function.
    It does the MP synchronization for a reboot, and reloads
    the firmware from ROM, and then jumps to the firmware.
    
Arguments:

    None.

Return Value:

    Does not return to the caller.

--*/

VOID
FwReboot(
    IN VOID
    )
/*++

Routine Description:

    This routine implements the Firmware Reboot termination function.
    It generates a soft reset to the system.

Arguments:

    None.

Return Value:

    Does not return to the caller.

--*/

VOID
EnterInteractiveMode(
    IN VOID
    )
/*++

Routine Description:

    This routine terminates the executing program and enters the interactive
    mode of the firmware.  System firmware will take whatever action is necessary
    to reestablish its execution environment.

Arguments:

    None.

Return Value:

    None.

--*/


PCONFIGURATION_COMPONENT
GetPeer (
    IN PCONFIGURATION_COMPONENT Component
    )

/*++

Routine Description:

    This function returns the peer of the named component.

Arguments:

    Component - Supplies a pointer to a configuration component.

Return Value:

    Returns a pointer to the configuration component for the next peer of
    Component.  If Component has no next peer, NULL is returned.

--*/


PCONFIGURATION_COMPONENT
GetChild (
    IN PCONFIGURATION_COMPONENT Component OPTIONAL
    )

/*++

Routine Description:

    Returns a pointer to the configuration component for the first child of
    Component.  If Component is NULL, a pointer to the root configuration
    component is returned.

Arguments:

    Component - Supplies an optional pointer to a configuration component.

Return Value:

    Returns a pointer to the configuration component for the first child of
    Component.  If Component has no children, this pointer will be NULL. If
    Component is NULL, a pointer to the root configuration component is
    returned. 

--*/


PCONFIGURATION_COMPONENT
GetParent (
    IN PCONFIGURATION_COMPONENT Component
    )

/*++

Routine Description:

    This function returns the parent of the named component.

Arguments:

    Component - Supplies a pointer to a configuration component.

Return Value:

    Returns a pointer to the configuration component for the parent of
    Component.  If Component has no parent NULL is returned (this is only
    true for the root configuration component).

--*/


PCONFIGURATION_COMPONENT
AddChild (
    IN PCONFIGURATION_COMPONENT Component,
    IN PCONFIGURATION_COMPONENT NewComponent,
    IN PVOID ConfigurationData OPTIONAL
    )

/*++

Routine Description:

    This routine adds a new component entry as a child of Component, including
    an identifier string if the IdentifierLength field of NewComponent is
    non-zero, and configuration data if the ConfigurationDataLength field of
    NewComponent is non-zero and the ConfigurationData parameter is present.
    If Component is NULL, the root component is being added.

Arguments:

    Component - Supplies a pointer to a configuration component.

    NewComponent - Supplies a pointer to a new configuration component
                   to be added as a child of Component.

    ConfigurationData - Supplies an optional pointer to a configuration
                        data buffer.

Return Value:

    Returns a pointer to the new configuration component entry.  If the
    create operation was unsuccessful, NULL is returned.

--*/


LONG
DeleteComponent (
    IN PCONFIGURATION_COMPONENT Component
    )

/*++

Routine Description:

    This function deletes a component entry.  If the entry has one or more
    children, an error is returned, otherwise the entry is deleted.  Deleting
    the entry will implicitly delete the identifier string and the configuration
    data.

    Note that no attempt is made to compress the entry, identifier, or the
    configuration data areas after an entry is deleted, as doing so would
    potentially invalidate outstanding pointers.

Arguments:

    Component - Supplies a pointer to a configuration component.

Return Value:

    Returns ESUCCESS if the entry was successfully deleted, otherwise one of
    the following error codes is returned.

    EINVAL          Component is not a valid configuration component, or the
                    configuration is not valid.

    EACCES          Component has children, and cannot be freed until they
                    are deleted.

    ENOMEM          No memory for reclaiming freed up Identifier, Data and 
                    EisaData space

--*/


PCONFIGURATION_COMPONENT
GetComponent (
    IN PCHAR Pathname
    )

/*++

Routine Description:

    This routine searches the configuration tree for the component that best
    matches the Pathname string.

Arguments:

    Pathname - Supplies a string containing the pathname to search.

Return Value:

    Returns a pointer to the configuration component that best matches
    pathname.


--*/


LONG
GetConfigurationData (
    OUT PVOID ConfigurationData,
    IN PCONFIGURATION_COMPONENT Component
    )

/*++

Routine Description:

    This functions returns the configuration data associated with Component
    in the buffer supplied by ConfigurationData.  The length of the data
    is stored in the Component structure.

Arguments:

    ConfigurationData - Supplies a pointer to a buffer to receive the
                        configuration data.

    Component - Supplies a pointer to a configuration component.

Return Value:

    If the configuration data is successfully copied into the buffer
    provided by ConfigurationData, ESUCCESS is returned.  Otherwise one of
    the following error codes is returned.

    EINVAL          Component is not a valid configuration component, or the
                    configuration is invalid.

--*/


LONG
SaveConfiguration(
    VOID
    )
/*++

Routine Description:

    Update the NVRam Configuration Data.

Arguments:

    None.

Return Value:

    ESUCCESS    - if the NVRAM data was read successfully
    EIO         - if an error occurs while reading NVRAM data

--*/

PSYSTEM_ID
GetSystemId (
    VOID
    )

/*++

Routine Description:

    This function returns the system ID, which consists of an eight byte
    VendorId and an eight byte ProductId.

Arguments:

    None.

Return Value:

    Returns a pointer to a buffer containing the system id structure.

--*/


PMEMORY_DESCRIPTOR
GetMemoryDescriptor (
    IN PMEMORY_DESCRIPTOR MemoryDescriptor OPTIONAL
    )

/*++

Routine Description:

    This routine returns a pointer to the next memory descriptor. If
    the specified memory descriptor is NULL, then a pointer to the
    first memory descriptor is returned. If there are no more memory
    descriptors, then NULL is returned.

Arguments:

    MemoryDescriptor - Supplies a optional pointer to a memory descriptor.

Return Value:

    If there are any more entries in the memory descriptor list, the
    address of the next descriptor is returned. Otherwise, NULL is
    returned.

--*/


PTIME_FIELDS
GetTime (
    VOID
    )

/*++

Routine Description:

    This routine returns a time structure filled in with the current
    time read from the RTC.

Arguments:

    None.

Return Value:

    Returns a pointer to a time structure.  If the time information is
    valid, valid data is returned, otherwise all fields are returned as zero.

--*/


ULONG
GetRelativeTime (
    VOID
    )

/*++

Routine Description:

    This routine returns a ULONG which increases at a rate of one per second.
    This routine must be called at least once per day for the number to maintain
    an accurate count.

Arguments:

    None.

Return Value:

    Returns a ULONG.  If the time information is valid, valid
    data is returned, otherwise a zero is returned.

--*/


LONG
GetDirectoryEntry (
    IN  ULONG FileId,
    OUT PDIRECTORY_ENTRY Buffer,
    IN  ULONG Length,
    OUT PULONG Count
    )

/*++

Routine Description:

    This function reads from a file the requested number of directory entries.

Arguments:

    FileId - Supplies the file table index.

    Buffer - Supplies a pointer to the buffer to receive the directory
             entries.

    Length - Supplies the number of directory entries to be read.

    Count - Supplies a pointer to a variable that receives the number of
        directory entries actually read..

Return Value:

    If the specified file is open for read, then a read is attempted
    and the status of the operation is returned. Otherwise, return an
    unsuccessful status.

--*/


LONG
Open (
    IN PCHAR OpenPath,
    IN OPEN_MODE OpenMode,
    OUT PULONG FileId
    )

/*++

Routine Description:

    This function opens the file specified by OpenPath.
    If the device portion of the pathanme is already opened, it reuses
    the fid. Otherwise it looks for a driver able to handle this
    device and logs the opened device so that it can be reused.

Arguments:

    OpenPath   -    ARC compliant pathname of the device/file to be opened.
                    i.e: ARC compliant pathname of a file in A drive:
                    multi(0)disk(0)fdisk(0)\arcdos.exe - for isa system
                    or eisa(0)disk(0)fdisk(0)\arcdos.exe - for eisa system
                    For a file in D drive (FAT format only): 
                    scsi(0)disk(0)rdisk(0)partition(2)\arcdos.c
                    For a file from network through net adapter:
                    net(0)arcdos.exe

                    (Note: see ARC spec for more details on path specification)

    OpenMode   -    Supplies the mode in wich the file is opened:

       OpenReadOnly, OpenWriteOnly, and OpenReadWrite modes open a device or exiting 
       file for the specified access.  If the pathname being opened includes the console
       protocol specifier, the Open will fail if either the  OpenMode is inconsistent 
       with the device flags, or if the device does not support the console type specified. 
       These are the only open modes that are valid for devices.  All other open modes are
       valid only for files.
       CreateWriteOnly and CreateReadWrite modes create a file with the specified 
       access.  If the file exists, an error code is returned.  
       SupersedeWriteOnly and SupersedeReadOnly modes either open or create a file, 
       depending upon whether the file already exists.  If the file exists, it is 
       truncated to zero.  If the file is a directory, an error code is returned.  
       When a file is created, only the ArchiveFile attribute flag is set.
       OpenDirectory mode opens an existing directory for read-only access.  If the 
       file is not a directory, an error code is returned.  CreateDirectory mode 
       creates a directory for read-only access, with the DirectoryFile and 
       ArchiveFile attribute flags set.  There is no supersede mode for directories.

    FileId     -    Pointer to a variable that receives the fid for this
                    pathname.

Return Value:

    If the file is successfully opened returns ESUCCESS otherwise
    returns an unsuccessfull status.

--*/


LONG
Close (
    IN ULONG FileId
    )

/*++

Routine Description:

    This function closes a file or a device if it is open.
    The DeviceId field indicates if the FileId is a device
    (it has the value DEVICE_DEVICE) or is a file.
    When closing a file, after the file is closed the
    reference counter for the device is decremented and if zero
    the device is also closed and the device name removed from
    the table of opened devices.
    If FileId specifies a device, the reference counter is
    decremented and if zero the device is closed and the device
    name removed from the table of opened devices.

Arguments:

    FileId - Supplies the file table index.

Return Value:

    If the specified file is open, then a close is attempted and
    the status of the operation is returned. Otherwise, return an
    unsuccessful status.


LONG
Read (
    IN ULONG FileId,
    OUT PVOID Buffer,
    IN ULONG Length,
    OUT PULONG Count
    )

/*++

Routine Description:

    This function reads data from the device or file sepecified by FileId
    into memory starting at the address in Buffer.  If the Read operation 
    succeeds, the actual number of bytes read is store in *Count, and the 
    bytes offset is updated accordingly.

   
Arguments:

    FileId - Supplies the file table index.

    Buffer - Supplies a pointer to the buffer that receives the data
        read.

    Length - Supplies the number of bytes that are to be read.

    Count - Supplies a pointer to a variable that receives the number of
        bytes actually transfered.

Return Value:

    If the specified file is open for read, then a read is attempted
    and the status of the operation is returned. Otherwise, return an
    unsuccessful status.  If a call to Read with Length > 0 return 
    ESUCCESS and a *Count equal to 0, end of file has been reached. 

--*/


LONG
GetReadStatus (
    IN ULONG FileId
    )

/*++

Routine Description:

     This routine determines if more than 0 bytes would be returned if a 
     read operation were performed on FileId.  

Arguments:
    
     FileId - Supplies the file table index.

Return Value:

    ESUCCESS if more than 0 bytes would be returned; otherwise, an error status
    code is returned.

--*/


LONG
Write (
    IN ULONG FileId,
    IN PVOID Buffer,
    IN ULONG Length,
    OUT PULONG Count
    )

/*++

Routine Description:

    This function writes to a file or a device that is open.

    Some Alpha machines cannot do DMA within a certain region of memory.
    E.g.: Alpha/Jensen cannot do DMA in the .5MB -- 1MB memory space.
    So, transfers within such spaces are done with double-buffering.  This is
    transparent to the code that called this function.

Arguments:

    FileId - Supplies the file table index.

    Buffer - Supplies a pointer to the buffer that contains the data
        to write.

    Length - Supplies the number of bytes that are to be written.

    Count - Supplies a pointer to a variable that receives the number of
        bytes actually transfered.

Return Value:

    If the specified file is open for write, then a write is attempted
    and the status of the operation is returned. Otherwise, return an
    unsuccessful status.

--*/


LONG
Seek (
    IN ULONG FileId,
    IN PLARGE_INTEGER Offset,
    IN SEEK_MODE SeekMode
    )

/*++

Routine Description:  The Seek routine changes the CurrentAddress 
    (as returned by GetFileInformation) associated with the device,
    partition, or file specified by the LARGEINTEGER structure.  The
    64 bit value is obtained by concatenation of HighPart with LowPart.
    If SeekMode is SeekAbsolute, the CurrentAddress is set to Offset.
    If SeekMode is SeekRelative, the value of Offset is added to the
    CurrentAddress associated with the specified FileID creating a new
    CurrentAddress, using 64-bit signed addition.
    If the file specified by FileId has the attribute DirectoryFile, a
    Seek with SeekMode of SeekAbsolute and a position 0 causes the 
    directory entry pointer to be reset to the first entry in the 
    directory.



Arguments:
    
    FileId - Supplies the file table index.
    
    Offset - Supplies to new device/file position.
 
    SeekMode -  Supplies the mode for the seek operation.
               
Return Value:

    If the specified file is open, then a seek is attempted and
    the status of the operation is returned. Otherwise, return an
    unsuccessful status.

--*/


LONG
Mount (
    IN PCHAR MountPath,
    IN MOUNT_OPERATION Operation
    )

/*++

Routine Description:

    This routine loads and unloads media for devices that support removable media.
           

Arguments:
    
     MountPath - specifies the path to the media for the device.
     Operation - MountLoadMedia to load the media or MountUnloadMedia to unload it.

Return Value:
    
     ESUCCESS if the operation succeeds; otherwise, an error status code is returned.

--*/


LONG
GetFileInformation (
    IN ULONG FileId,
    OUT PFILE_INFORMATION Finfo
    )

/*++

Routine Description:

    This function gets the file information for the specified FileId.

Arguments:

    FileId - Supplies the file table index.

    Finfo - Supplies a pointer to where the File Informatino is stored.

Return Value:

    If the specified file is open then this routine dispatches to the
    File routine.
    Otherwise, returns an unsuccessful status.

--*/


LONG
SetFileInformation (
    IN ULONG FileId,
    IN ULONG AttributeFlags,
    IN ULONG AttributeMask
    )

/*++

Routine Description:

    This function sets the file attributes for the specified FileId.

Arguments:

    FileId - Supplies the file table index.

    AttributeFlags - Supply the attributes to be set for the file.
    AttributeMask

Return Value:

    If the specified file is open and is not a device then this routine
    dispatches to the file system  routine.
    Otherwise, returns an unsuccessful status.

--*/


PCHAR
GetEnvironmentVariable (
    IN PCHAR Variable
    )

/*++

Routine Description:

    This routine searches (not case sensitive) the environment data for
    Variable, and if found returns a pointer to a zero terminated string that
    contains the value, otherwise a NULL pointer is returned.

    If the variable specified by Variable is protected, we get the information
    from special global variables.
    
Arguments:

    Variable - Supplies a zero terminated string containing an environment
               variable.

Return Value:

    If successful, returns a zero terminated string that is the value of
    Variable, otherwise NULL is returned.

--*/


LONG
SetEnvironmentVariable(
    IN PCHAR Variable,
    IN PCHAR Value
    )

/*++

Routine Description:

    This routine sets the specified Variable (case insenstive) to 
    the specified Value.


Arguments:

    Variable - Supplies a zero terminated string containing an environment
               variable.

    Value - Supplies a zero terminated string containing an environment
               variable value.

Return Value:

    ESUCCESS        if the variable is set successfully

    ENOSPC          No space in the environment data for set operation.

    EACCES          A protected environment variable cannot be changed.

    EIO             If the Environment is not available. Most likely due
                    to an invalid NVRam checksum.
--*/


PARC_DISPLAY_STATUS
GetDisplayStatus (
    IN ULONG FileId
    )
/*++

Routine Description:

Arguments:

    FileId - Not used.

Return Value:

    Address of DisplayStatus Structure.

--*/


  


