Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[legal] Add FILE_LICENCE declarations to EFI header files
Autodetect the BSD licence statement in EFI header files, and add a
suitable FILE_LICENCE macro to the version imported into the iPXE
tree.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed May 29, 2010
1 parent ae5ce45 commit 03b1020
Show file tree
Hide file tree
Showing 40 changed files with 96 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Base.h
Expand Up @@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __BASE_H__
#define __BASE_H__

FILE_LICENCE ( BSD3 );

//
// Include processor specific binding
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Guid/HiiFormMapMethodGuid.h
Expand Up @@ -17,6 +17,8 @@
#ifndef __EFI_HII_FORMMAP_GUID_H__
#define __EFI_HII_FORMMAP_GUID_H__

FILE_LICENCE ( BSD3 );

#define EFI_HII_STANDARD_FORM_GUID \
{ 0x3bd2f4ec, 0xe524, 0x46e4, { 0xa9, 0xd8, 0x51, 0x1, 0x17, 0x42, 0x55, 0x62 } }

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Guid/PcAnsi.h
Expand Up @@ -18,6 +18,8 @@
#ifndef __PC_ANSI_H__
#define __PC_ANSI_H__

FILE_LICENCE ( BSD3 );

#define EFI_PC_ANSI_GUID \
{ \
0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Guid/SmBios.h
Expand Up @@ -22,6 +22,8 @@
#ifndef __SMBIOS_GUID_H__
#define __SMBIOS_GUID_H__

FILE_LICENCE ( BSD3 );

#define SMBIOS_TABLE_GUID \
{ \
0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Guid/WinCertificate.h
Expand Up @@ -17,6 +17,8 @@
#ifndef __EFI_WIN_CERTIFICATE_H__
#define __EFI_WIN_CERTIFICATE_H__

FILE_LICENCE ( BSD3 );

//
// _WIN_CERTIFICATE.wCertificateType
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Ia32/ProcessorBind.h
Expand Up @@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__

FILE_LICENCE ( BSD3 );

///
/// Define the processor type so other code can make processor based choices.
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/IndustryStandard/Pci22.h
Expand Up @@ -20,6 +20,8 @@
#ifndef _PCI22_H_
#define _PCI22_H_

FILE_LICENCE ( BSD3 );

#define PCI_MAX_BUS 255
#define PCI_MAX_DEVICE 31
#define PCI_MAX_FUNC 7
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/IndustryStandard/PeImage.h
Expand Up @@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PE_IMAGE_H__
#define __PE_IMAGE_H__

FILE_LICENCE ( BSD3 );

//
// PE32+ Subsystem type for EFI images
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiBootMode.h
Expand Up @@ -18,6 +18,8 @@
#ifndef __PI_BOOT_MODE_H__
#define __PI_BOOT_MODE_H__

FILE_LICENCE ( BSD3 );

///
/// EFI boot mode
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiDependency.h
Expand Up @@ -17,6 +17,8 @@
#ifndef __PI_DEPENDENCY_H__
#define __PI_DEPENDENCY_H__

FILE_LICENCE ( BSD3 );

///
/// If present, this must be the first and only opcode,
/// EFI_DEP_BEFORE is only used by DXE driver.
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiDxeCis.h
Expand Up @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_DXECIS_H__
#define __PI_DXECIS_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Uefi/UefiMultiPhase.h>
#include <ipxe/efi/Pi/PiMultiPhase.h>

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiFirmwareFile.h
Expand Up @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_FIRMWARE_FILE_H__
#define __PI_FIRMWARE_FILE_H__

FILE_LICENCE ( BSD3 );

#pragma pack(1)
///
/// Used to verify the integrity of the file.
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiFirmwareVolume.h
Expand Up @@ -18,6 +18,8 @@
#ifndef __PI_FIRMWAREVOLUME_H__
#define __PI_FIRMWAREVOLUME_H__

FILE_LICENCE ( BSD3 );

///
/// EFI_FV_FILE_ATTRIBUTES
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiHob.h
Expand Up @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_HOB_H__
#define __PI_HOB_H__

FILE_LICENCE ( BSD3 );

//
// HobType of EFI_HOB_GENERIC_HEADER.
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiMultiPhase.h
Expand Up @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_MULTIPHASE_H__
#define __PI_MULTIPHASE_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Pi/PiFirmwareVolume.h>
#include <ipxe/efi/Pi/PiFirmwareFile.h>
#include <ipxe/efi/Pi/PiBootMode.h>
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiS3BootScript.h
Expand Up @@ -16,6 +16,8 @@
#ifndef _PI_S3_BOOT_SCRIPT_H_
#define _PI_S3_BOOT_SCRIPT_H_

FILE_LICENCE ( BSD3 );

//*******************************************
// EFI Boot Script Opcode definitions
//*******************************************
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Pi/PiStatusCode.h
Expand Up @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_STATUS_CODE_H__
#define __PI_STATUS_CODE_H__

FILE_LICENCE ( BSD3 );

//
// Required for IA32 and IPF defines for CPU exception types
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/PiDxe.h
Expand Up @@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_DXE_H__
#define __PI_DXE_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Uefi/UefiBaseType.h>
#include <ipxe/efi/Uefi/UefiSpec.h>

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/ComponentName2.h
Expand Up @@ -17,6 +17,8 @@
#ifndef __EFI_COMPONENT_NAME2_H__
#define __EFI_COMPONENT_NAME2_H__

FILE_LICENCE ( BSD3 );

///
/// Global ID for the Component Name Protocol
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/Cpu.h
Expand Up @@ -17,6 +17,8 @@
#ifndef __ARCH_PROTOCOL_CPU_H__
#define __ARCH_PROTOCOL_CPU_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Protocol/DebugSupport.h>

#define EFI_CPU_ARCH_PROTOCOL_GUID \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/CpuIo.h
Expand Up @@ -24,6 +24,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _CPUIO_H_
#define _CPUIO_H_

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Protocol/CpuIo2.h>

#define EFI_CPU_IO_PROTOCOL_GUID \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/CpuIo2.h
Expand Up @@ -30,6 +30,8 @@
#ifndef __CPU_IO2_H__
#define __CPU_IO2_H__

FILE_LICENCE ( BSD3 );

#define EFI_CPU_IO2_PROTOCOL_GUID \
{ \
0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/DebugSupport.h
Expand Up @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __DEBUG_SUPPORT_H__
#define __DEBUG_SUPPORT_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/IndustryStandard/PeImage.h>

typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/DevicePath.h
Expand Up @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
#define __EFI_DEVICE_PATH_PROTOCOL_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Guid/PcAnsi.h>

///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/DriverBinding.h
Expand Up @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_DRIVER_BINDING_H__
#define __EFI_DRIVER_BINDING_H__

FILE_LICENCE ( BSD3 );

///
/// The global ID for the ControllerHandle Driver Protocol.
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/NetworkInterfaceIdentifier.h
Expand Up @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_NETWORK_INTERFACE_IDENTIFER_H__
#define __EFI_NETWORK_INTERFACE_IDENTIFER_H__

FILE_LICENCE ( BSD3 );

//
// GUID retired from UEFI Specification 2.1b
//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/PciIo.h
Expand Up @@ -16,6 +16,8 @@
#ifndef __PCI_IO_H__
#define __PCI_IO_H__

FILE_LICENCE ( BSD3 );

///
/// Global ID for the PCI I/O Protocol
///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/PciRootBridgeIo.h
Expand Up @@ -19,6 +19,8 @@
#ifndef __PCI_ROOT_BRIDGE_IO_H__
#define __PCI_ROOT_BRIDGE_IO_H__

FILE_LICENCE ( BSD3 );

#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
{ \
0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/SimpleNetwork.h
Expand Up @@ -26,6 +26,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __SIMPLE_NETWORK_H__
#define __SIMPLE_NETWORK_H__

FILE_LICENCE ( BSD3 );

#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
{ \
0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/SimpleTextIn.h
Expand Up @@ -18,6 +18,8 @@
#ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__
#define __SIMPLE_TEXT_IN_PROTOCOL_H__

FILE_LICENCE ( BSD3 );

#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
{ \
0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Protocol/SimpleTextOut.h
Expand Up @@ -20,6 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __SIMPLE_TEXT_OUT_H__
#define __SIMPLE_TEXT_OUT_H__

FILE_LICENCE ( BSD3 );

#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
{ \
0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi.h
Expand Up @@ -20,6 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PI_UEFI_H__
#define __PI_UEFI_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Uefi/UefiBaseType.h>
#include <ipxe/efi/Uefi/UefiSpec.h>

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiBaseType.h
Expand Up @@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __UEFI_BASETYPE_H__
#define __UEFI_BASETYPE_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Base.h>

//
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiGpt.h
Expand Up @@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __UEFI_GPT_H__
#define __UEFI_GPT_H__

FILE_LICENCE ( BSD3 );

///
/// The primary GUID Partition Table Header must be
/// located in LBA 1 (i.e., the second logical block).
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h
Expand Up @@ -20,6 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
#define __UEFI_INTERNAL_FORMREPRESENTATION_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Guid/HiiFormMapMethodGuid.h>

///
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiMultiPhase.h
Expand Up @@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __UEFI_MULTIPHASE_H__
#define __UEFI_MULTIPHASE_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Guid/WinCertificate.h>
///
/// Enumeration of memory types introduced in UEFI.
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiPxe.h
Expand Up @@ -21,6 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_PXE_H__
#define __EFI_PXE_H__

FILE_LICENCE ( BSD3 );

#pragma pack(1)

#define PXE_BUSTYPE(a, b, c, d) \
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/Uefi/UefiSpec.h
Expand Up @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __UEFI_SPEC_H__
#define __UEFI_SPEC_H__

FILE_LICENCE ( BSD3 );

#include <ipxe/efi/Uefi/UefiMultiPhase.h>

#include <ipxe/efi/Protocol/DevicePath.h>
Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/efi/X64/ProcessorBind.h
Expand Up @@ -15,6 +15,8 @@
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__

FILE_LICENCE ( BSD3 );

///
/// Define the processor type so other code can make processor based choices
///
Expand Down
18 changes: 18 additions & 0 deletions src/include/ipxe/efi/import.pl
Expand Up @@ -16,6 +16,7 @@ sub try_import_file {
return unless $filename =~ /\.h$/;
print "$filename...";

( undef, undef, my $basename ) = splitpath ( $filename );
my $outfile = catfile ( $ipxedir, $filename );
foreach my $edkdir ( @$edkdirs ) {
my $infile = catfile ( $edkdir, $filename );
Expand All @@ -27,6 +28,8 @@ sub try_import_file {
mkpath ( $outdir );
open my $outfh, ">$outfile" or die "Could not open $outfile: $!\n";
my @dependencies = ();
my $licence;
my $guard;
while ( <$infh> ) {
# Strip CR and trailing whitespace
s/\r//g;
Expand All @@ -36,10 +39,25 @@ sub try_import_file {
if ( s/^\#include\s+[<\"](\S+)[>\"]/\#include <ipxe\/efi\/$1>/ ) {
push @dependencies, $1;
}
# Check for BSD licence statement
if ( /^\s*THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE/ ) {
die "Licence detected after header guard\n" if $guard;
$licence = "BSD3";
}
# Write out line
print $outfh "$_\n";
# Apply FILE_LICENCE() immediately after include guard
if ( /^\#define\s+_?_\S+_H_?_$/ ) {
die "Duplicate header guard detected in $infile\n" if $guard;
$guard = 1;
print $outfh "\nFILE_LICENCE ( $licence );\n" if $licence;
}
}
close $outfh;
close $infh;
# Warn if no licence was detected
warn "Cannot detect licence in $infile\n" unless $licence;
warn "Cannot detect header guard in $infile\n" unless $guard;
# Recurse to handle any included files that we don't already have
foreach my $dependency ( @dependencies ) {
if ( ! -e catfile ( $ipxedir, $dependency ) ) {
Expand Down

0 comments on commit 03b1020

Please sign in to comment.