Skip to content

Commit

Permalink
[driver] Add support for the AoE boot firmware table (aBFT)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
  • Loading branch information
mcb30 committed Sep 13, 2010
1 parent 43a46e1 commit e604684
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 251 deletions.
63 changes: 63 additions & 0 deletions src/driver/abft.c
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#pragma warning(disable:4100) /* unreferenced formal parameter */

#include <ntddk.h>
#include <ntstrsafe.h>
#include "sanbootconf.h"
#include "nic.h"
#include "abft.h"

/**
* Do nothing with NIC
*
* @v pdo Physical device object
* @v netcfginstanceid Interface name within registry
* @v opaque iBFT NIC structure
* @ret ntstatus NT status
*/
static NTSTATUS abft_dummy ( PDEVICE_OBJECT pdo,
LPCWSTR netcfginstanceid,
PVOID opaque ) {
return STATUS_SUCCESS;
}

/**
* Parse aBFT
*
* @v acpi ACPI description header
*/
VOID parse_abft ( PACPI_DESCRIPTION_HEADER acpi ) {
PABFT_TABLE abft = ( PABFT_TABLE ) acpi;
NTSTATUS status;

/* Dump structure information */
DbgPrint ( "Found aBFT target e%d.%d\n", abft->shelf, abft->slot );
DbgPrint ( "Found aBFT NIC %02x:%02x:%02x:%02x:%02x:%02x\n",
abft->mac[0], abft->mac[1], abft->mac[2],
abft->mac[3], abft->mac[4], abft->mac[5] );

/* Check for existence of NIC */
status = find_nic ( abft->mac, abft_dummy, NULL );
if ( NT_SUCCESS ( status ) ) {
DbgPrint ( "Successfully identified aBFT NIC\n" );
} else {
DbgPrint ( "Could not identify aBFT NIC\n" );
}
}
58 changes: 58 additions & 0 deletions src/driver/abft.h
@@ -0,0 +1,58 @@
#ifndef _ABFT_H
#define _ABFT_H

/*
* Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/** @file
*
* AoE boot firmware table
*
* The working draft specification for the SRP boot firmware table can
* be found at
*
* http://www.etherboot.org/wiki/aoe/abft
*
*/

#include "acpi.h"

/** AoE Boot Firmware Table signature */
#define ABFT_SIG "aBFT"

/**
* AoE Boot Firmware Table (aBFT)
*/
#pragma pack(1)
typedef struct _ABFT_TABLE {
/** ACPI header */
ACPI_DESCRIPTION_HEADER acpi;
/** AoE shelf */
USHORT shelf;
/** AoE slot */
UCHAR slot;
/** Reserved */
UCHAR reserved_a;
/** MAC address */
UCHAR mac[6];
} ABFT_TABLE, *PABFT_TABLE;
#pragma pack()

extern VOID parse_abft ( PACPI_DESCRIPTION_HEADER acpi );

#endif /* _ABFT_H */

0 comments on commit e604684

Please sign in to comment.