On 01/25/13 04:34, David Woodhouse wrote:
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: David Woodhouse <david.woodho...@intel.com>
> ---
> 
> Seriously, UTF-16? Or is that UCS-2? What bizarre world am I in that
> people don't just use UTF-8?
> 
> Yes, the 'WTF' in there needs fixing but I have no idea where those
> numbers come from. I'm assuming there's *some* meaning to them since
> they're not just sequential?

I'll leave the real review to the maintainer of this module :), but the
Type / Sub-Type comments provide a hint for this question:

> diff --git a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h 
> b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
> index b1887b6..3154643 100644
> --- a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
> +++ b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
> @@ -845,6 +845,7 @@ SetupResetReminder (
>  #define  BDS_EFI_MESSAGE_USB_DEVICE_BOOT  0x0305 // Type 03; Sub-Type 05
>  #define  BDS_EFI_MESSAGE_SATA_BOOT        0x0312 // Type 03; Sub-Type 18
>  #define  BDS_EFI_MESSAGE_MAC_BOOT         0x030b // Type 03; Sub-Type 11
> +#define  BDS_EFI_MESSAGE_VIRTIO_BOOT      0x03FE // Type 03; Sub-Type WTF
>  #define  BDS_EFI_MESSAGE_MISC_BOOT        0x03FF

MdePkg/Include/Protocol/DevicePath.h:

#define MESSAGING_DEVICE_PATH     0x03

#define MSG_USB_DP                0x05
#define MSG_SATA_DP               0x12
#define MSG_MAC_ADDR_DP           0x0b

#define END_ENTIRE_DEVICE_PATH_SUBTYPE       0xFF

(If you wonder how a device path can be ended "non-entirely", see 9.3.1
"Generic Device Path Structures" in UEFI-2.3.1+errC -- "This is only
required when an environment variable represents multiple devices.")

I think virtio can't be squeezed into the above BDS_EFI_* scheme
conveniently (there's no corresponding DPN type/subtype), but I believe
it doesn't have to work the other way (ie. you never try to split a
BDS_EFI_* constant into type/subtype). IOW the values are arbitrary.

Since the highest type (not sub-type) in use seems to be
END_DEVICE_PATH_TYPE (0x7f), I'd chose 0x80 for the high byte and
whatever for the low byte in the macro expansion (and I'd drop the
_MESSAGE_ substring):

#define BDS_EFI_VIRTIO_BLK_BOOT 0x8001

(BdsGetBootTypeFromDevicePath() returns an UINT32 and the caller assigns
the value to an UINTN variable, so 0x80?? should fit.)

Laszlo

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to