Pull request efi-2024-10-rc4

Documentation:

 * Add description of  the pwm command

UEFI

* Correct printf codes in mkeficapsule
* Allow CONFIG_EFI_LOADER_BOUNCE_BUFFER on all architectures
* Free memory in efi_get_dp_from_boot()
This commit is contained in:
Tom Rini
2024-08-24 14:03:28 -06:00
5 changed files with 99 additions and 6 deletions

91
doc/usage/cmd/pwm.rst Normal file
View File

@@ -0,0 +1,91 @@
.. SPDX-License-Identifier: GPL-2.0-or-later
.. index::
single: pwm (command)
pwm command
===========
Synopsis
--------
::
pwm invert <pwm_dev_num> <channel> <polarity>
pwm config <pwm_dev_num> <channel> <period_ns> <duty_ns>
pwm enable <pwm_dev_num> <channel>
pwm disable <pwm_dev_num> <channel>
Description
-----------
The ``pwm`` command is used to access and configure PWM (Pulse Width Modulation)
signals.
pwm invert
----------
* If the value of ``polarity`` is 0, the default polarity is used.
* If the value of ``polarity`` is 1, the polarity is inverted.
pwm config
----------
Configure the period and duty period in nanoseconds.
pwm enable
----------
Enable output on the configured device and channel.
pwm disable
-----------
Disable output on the configured device and channel.
pwm_dev_num
Device number of the pulse width modulation device
channel
Output channel of the PWM device
polarity
* 0 - Use normal polarity
* 1 - Use inverted polarity
duty_ns
Duty period in ns
period_ns
Period time in ns
Examples
--------
Configure device 0, channel 0 to 20 µs period and 14 µs (that is, 70%) duty period::
=> pwm config 0 0 20000 14000
Enable output on the configured device and channel::
=> pwm enable 0 0
Disable output on the configured device and channel::
=> pwm disable 0 0
Invert the signal on the configured device and channel::
=> pwm invert 0 0 1
Configuration
-------------
The ``pwm`` command is only available if CONFIG_CMD_PWM=y.
Return value
------------
If the command succeeds, the return value ``$?`` is set to 0. If an error occurs, the
return value ``$?`` is set to 1.

View File

@@ -93,6 +93,7 @@ Shell commands
cmd/pinmux
cmd/printenv
cmd/pstore
cmd/pwm
cmd/qfw
cmd/read
cmd/reset

View File

@@ -364,7 +364,6 @@ endif
config EFI_LOADER_BOUNCE_BUFFER
bool "EFI Applications use bounce buffers for DMA operations"
depends on ARM64
help
Some hardware does not support DMA to full 64bit addresses. For this
hardware we can create a bounce buffer so that payloads don't have to

View File

@@ -74,6 +74,7 @@ out:
*/
struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid)
{
struct efi_device_path *file_path = NULL;
struct efi_load_option lo;
void *var_value;
efi_uintn_t size;
@@ -92,11 +93,11 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid)
if (ret != EFI_SUCCESS)
goto err;
return efi_dp_from_lo(&lo, guid);
file_path = efi_dp_from_lo(&lo, guid);
err:
free(var_value);
return NULL;
return file_path;
}
/**

View File

@@ -5,6 +5,7 @@
*/
#include <getopt.h>
#include <inttypes.h>
#include <pe.h>
#include <stdbool.h>
#include <stdint.h>
@@ -691,7 +692,7 @@ static uint32_t dump_fmp_payload_header(
static void dump_capsule_auth_header(
struct efi_firmware_image_authentication *capsule_auth_hdr)
{
printf("EFI_FIRMWARE_IMAGE_AUTH.MONOTONIC_COUNT\t\t: %08lX\n",
printf("EFI_FIRMWARE_IMAGE_AUTH.MONOTONIC_COUNT\t\t: %08" PRIX64 "\n",
capsule_auth_hdr->monotonic_count);
printf("EFI_FIRMWARE_IMAGE_AUTH.AUTH_INFO.HDR.dwLENGTH\t: %08X\n",
capsule_auth_hdr->auth_info.hdr.dwLength);
@@ -724,9 +725,9 @@ static void dump_fmp_capsule_image_header(
image_hdr->update_image_size);
printf("FMP_CAPSULE_IMAGE_HDR.UPDATE_VENDOR_CODE_SIZE\t: %08X\n",
image_hdr->update_vendor_code_size);
printf("FMP_CAPSULE_IMAGE_HDR.UPDATE_HARDWARE_INSTANCE\t: %08lX\n",
printf("FMP_CAPSULE_IMAGE_HDR.UPDATE_HARDWARE_INSTANCE\t: %08" PRIX64 "\n",
image_hdr->update_hardware_instance);
printf("FMP_CAPSULE_IMAGE_HDR.IMAGE_CAPSULE_SUPPORT\t: %08lX\n",
printf("FMP_CAPSULE_IMAGE_HDR.IMAGE_CAPSULE_SUPPORT\t: %08" PRIX64 "\n",
image_hdr->image_capsule_support);
printf("--------\n");