pxeundi.c

来自「Next BIOS Source code : Extensible Firmw」· C语言 代码 · 共 184 行

C
184
字号
/*++

Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.

Module Name:

  PxeUndi.c
    
Abstract:

  Wrapper routines that use a PXE-enabled NIC option ROM to 
  supply internal routines for an EFI SNI (Simple Network 
  Interface) Protocol.

  This file relies upon the existence of a PXE-compliant ROM
  in memory, as defined by the Preboot Execution Environment 
  Specification (PXE), Version 2.1, located at

    http://developer.intel.com/ial/wfm/wfmspecs.htm
    
Revision History

--*/

#include "BiosSnp16.h"

EFI_STATUS
PxeStartUndi (
	IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
  IN OUT PXENV_START_UNDI_t      *PxeUndiTable
  )
/*++
  PXE 
  START UNDI
  Op-Code: PXENV_START_UNDI (0000h)
  Input: Far pointer to a PXENV_START_UNDI_t parameter structure that has been initialized by the caller.
  Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
  the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
  constants.
  Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is
  responsible for saving the information it needs to communicate with the hardware.
  This service is also responsible for hooking the Int 1Ah service routine
  Note: This API service must be called only once during UNDI Option ROM boot.
  The UNDI driver is responsible for saving this information and using it every time
  PXENV_UNDI_STARTUP is called.
  Service cannot be used in protected mode.
  typedef struct  {
      PXENV_STATUS Status;
      UINT16 AX;
      UINT16 BX;
      UINT16 DX;
      UINT16 DI;
      UINT16 ES;
  } PXENV_START_UNDI_t;
  Set before calling API service
  AX, BX, DX, DI, ES: BIOS initialization parameter registers. These
  fields should contain the same information passed to the option ROM
  initialization routine by the Host System BIOS. Information about the
  contents of these registers can be found in the [PnP], [PCI] and
  [BBS] specifications.
  Returned from API service
  Status: See the PXENV_STATUS_xxx constants.    
--*/
{
  return MakePxeCall (
           SimpleNetworkDevice, 
           PxeUndiTable,
           sizeof(PXENV_START_UNDI_t),
           PXENV_START_UNDI
           );
}

EFI_STATUS
PxeUndiStartup (
	IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
  IN OUT PXENV_UNDI_STARTUP_t    *PxeUndiTable 
  )
/*++
  PXE 
  UNDI STARTUP    
  Op-Code: PXENV_UNDI_STARTUP (0001h)
  Input: Far pointer to a PXENV_UNDI_STARTUP_t parameter structure that has been initialized by the
  caller.
  Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
  the parameter structure must be set to one of the values represented by the
  PXENV_STATUS_xxx constants.
  Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper
  operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used
  to complete this initialization. The rest of the UNDI APIs will not be available until this call has
  been completed.
  Note: PXENV_UNDI_STARTUP must not be called again without first calling
  PXENV_UNDI_SHUTDOWN.
  PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for
  chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and
  PXENV_STOP_UNDI API calls.
  This service cannot be used in protected mode.
  typedef struct 
  {
      PXENV_STATUS Status;
  } PXENV_UNDI_STARTUP_t;
  Set before calling API service
  N/A
  Returned from API service
  Status: See the PXENV_STATUS_xxx constants.
--*/
{
  return MakePxeCall (
           SimpleNetworkDevice, 
           PxeUndiTable,
           sizeof(PXENV_UNDI_STARTUP_t),
           PXENV_UNDI_STARTUP
           );
}

EFI_STATUS
PxeUndiCleanup (
	IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
  IN OUT PXENV_UNDI_CLEANUP_t    *PxeUndiTable 
  )
/*++
  PXE 
  UNDI CLEANUP
  Op-Code: PXENV_UNDI_CLEANUP (0002h)
  Input: Far pointer to a PXENV_UNDI_CLEANUP_t parameter structure.
  Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field
  in the parameter structure must be set to one of the values represented by the
  PXENV_STATUS_xxx constants.
  Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be
  made just before unloading the Universal NIC Driver. The rest of the API will not be available
  after this call executes.
  This service cannot be used in protected mode.
  typedef struct {
      PXENX_STATUS Status;
  } PXENV_UNDI_CLEANUP_t;
  Set before calling API service
  N/A
  Returned from API service
  Status: See the PXENV_STATUS_xxx constants.
--*/
{
  return MakePxeCall (
           SimpleNetworkDevice, 
           PxeUndiTable,
           sizeof(PXENV_UNDI_CLEANUP_t),
           PXENV_UNDI_CLEANUP
           );
}

EFI_STATUS
PxeUndiInitialize (
	IN     EFI_SIMPLE_NETWORK_DEV   *SimpleNetworkDevice,
  IN OUT PXENV_UNDI_INITIALIZE_t  *PxeUndiTable 
  )
/*++
  PXE 
  UNDI INITIALIZE
  Op-Code: PXENV_UNDI_INITIALIZE (0003h)
  Input: Far pointer to a PXENV_UNDI_INITIALIZE_t parameter structure that has been initialized by the
  caller.
  Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
  the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
  constants.
  Description: This call resets the adapter and programs it with default parameters. The default parameters used
  are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the
  receive and transmit units of the network adapter to readily receive or transmit packets. The
  application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.
  This call must be made by an application to establish an interface to the network adapter driver.
  Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for
  the Protocol field in the parameter structure.
  typedef struct {
    PXENV_STATUS Status;
    ADDR32 ProtocolIni;
    UINT8 reserved[8];
  } PXENV_UNDI_INITIALIZE_t;
  Set before calling API service
  ProtocolIni: Physical address of a memory copy of the driver
  module from the 憄rotocol.ini

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?