5 * Copyright (C) 2014 Michael Brown <mbrown@fensystems.co.uk>.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31 #include "efi/Protocol/DevicePath.h"
34 * Initialise device path
36 * @v name Variable name
40 #define EFI_DEVPATH_INIT( name, type, subtype ) { \
42 .SubType = (subtype), \
43 .Length[0] = ( sizeof (name) & 0xff ), \
44 .Length[1] = ( sizeof (name) >> 8 ), \
48 * Initialise device path
55 static inline __attribute__ (( always_inline
)) void
56 efi_devpath_init ( EFI_DEVICE_PATH_PROTOCOL
*path
, unsigned int type
,
57 unsigned int subtype
, size_t len
) {
60 path
->SubType
= subtype
;
61 path
->Length
[0] = ( len
& 0xff );
62 path
->Length
[1] = ( len
>> 8 );
66 * Initialise device path end
68 * @v name Variable name
70 #define EFI_DEVPATH_END_INIT( name ) \
71 EFI_DEVPATH_INIT ( name, END_DEVICE_PATH_TYPE, \
72 END_ENTIRE_DEVICE_PATH_SUBTYPE )
75 * Initialise device path end
79 static inline __attribute__ (( always_inline
)) void
80 efi_devpath_end_init ( EFI_DEVICE_PATH_PROTOCOL
*path
) {
82 efi_devpath_init ( path
, END_DEVICE_PATH_TYPE
,
83 END_ENTIRE_DEVICE_PATH_SUBTYPE
, sizeof ( *path
) );
86 extern EFI_DEVICE_PATH_PROTOCOL
*
87 efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL
*path
);
89 #endif /* _EFIPATH_H */