iPXE
Functions
snp.c File Reference

SNP driver. More...

#include <errno.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_snp.h>
#include "snpnet.h"
#include "nii.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int snp_supported (EFI_HANDLE device)
 Check to see if driver supports a device.
static int nii_supported (EFI_HANDLE device)
 Check to see if driver supports a device.
struct efi_driver snp_driver __efi_driver (EFI_DRIVER_NORMAL)
 EFI SNP driver.

Detailed Description

SNP driver.

Definition in file snp.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int snp_supported ( EFI_HANDLE  device) [static]

Check to see if driver supports a device.

Parameters:
deviceEFI device handle
Return values:
rcReturn status code

Definition at line 45 of file snp.c.

References EFI_SYSTEM_TABLE::BootServices, DBGC, DBGCP, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL, efi_simple_network_protocol_guid, efi_systab, ENOTTY, find_snpdev(), NULL, and EFI_BOOT_SERVICES::OpenProtocol.

                                               {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        EFI_STATUS efirc;

        /* Check that this is not a device we are providing ourselves */
        if ( find_snpdev ( device ) != NULL ) {
                DBGCP ( device, "SNP %s is provided by this binary\n",
                        efi_handle_name ( device ) );
                return -ENOTTY;
        }

        /* Test for presence of simple network protocol */
        if ( ( efirc = bs->OpenProtocol ( device,
                                          &efi_simple_network_protocol_guid,
                                          NULL, efi_image_handle, device,
                                          EFI_OPEN_PROTOCOL_TEST_PROTOCOL))!=0){
                DBGCP ( device, "SNP %s is not an SNP device\n",
                        efi_handle_name ( device ) );
                return -EEFI ( efirc );
        }
        DBGC ( device, "SNP %s is an SNP device\n",
               efi_handle_name ( device ) );

        return 0;
}
static int nii_supported ( EFI_HANDLE  device) [static]

Check to see if driver supports a device.

Parameters:
deviceEFI device handle
Return values:
rcReturn status code

Definition at line 77 of file snp.c.

References EFI_SYSTEM_TABLE::BootServices, DBGC, DBGCP, EEFI, efi_handle_name(), efi_image_handle, efi_nii31_protocol_guid, EFI_OPEN_PROTOCOL_TEST_PROTOCOL, efi_systab, ENOTTY, find_snpdev(), NULL, and EFI_BOOT_SERVICES::OpenProtocol.

                                               {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        EFI_STATUS efirc;

        /* Check that this is not a device we are providing ourselves */
        if ( find_snpdev ( device ) != NULL ) {
                DBGCP ( device, "NII %s is provided by this binary\n",
                        efi_handle_name ( device ) );
                return -ENOTTY;
        }

        /* Test for presence of NII protocol */
        if ( ( efirc = bs->OpenProtocol ( device,
                                          &efi_nii31_protocol_guid,
                                          NULL, efi_image_handle, device,
                                          EFI_OPEN_PROTOCOL_TEST_PROTOCOL))!=0){
                DBGCP ( device, "NII %s is not an NII device\n",
                        efi_handle_name ( device ) );
                return -EEFI ( efirc );
        }
        DBGC ( device, "NII %s is an NII device\n",
               efi_handle_name ( device ) );

        return 0;
}
struct efi_driver niionly_driver __efi_driver ( EFI_DRIVER_NORMAL  ) [read]
Initial value:
 {
        .name = "NII",
        .supported = nii_supported,
        .start = nii_start,
        .stop = nii_stop,
}

EFI SNP driver.

EFI NII chainloading-device-only driver.

EFI NII driver.