Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm

Test improvements to tidy up output and drop duplicate tests
Sandbox SPL/TPL support
Various dm-related improvements
This commit is contained in:
Tom Rini
2018-10-10 13:35:17 -04:00
224 changed files with 5469 additions and 1333 deletions

View File

@@ -7,6 +7,13 @@
#ifndef _BACKLIGHT_H
#define _BACKLIGHT_H
enum {
BACKLIGHT_MAX = 100,
BACKLIGHT_MIN = 0,
BACKLIGHT_OFF = -1,
BACKLIGHT_DEFAULT = -2,
};
struct backlight_ops {
/**
* enable() - Enable a backlight
@@ -15,6 +22,15 @@ struct backlight_ops {
* @return 0 if OK, -ve on error
*/
int (*enable)(struct udevice *dev);
/**
* set_brightness - Set brightness
*
* @dev: Backlight device to update
* @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
* @return 0 if OK, -ve on error
*/
int (*set_brightness)(struct udevice *dev, int percent);
};
#define backlight_get_ops(dev) ((struct backlight_ops *)(dev)->driver->ops)
@@ -27,4 +43,13 @@ struct backlight_ops {
*/
int backlight_enable(struct udevice *dev);
/**
* backlight_set_brightness - Set brightness
*
* @dev: Backlight device to update
* @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
* @return 0 if OK, -ve on error
*/
int backlight_set_brightness(struct udevice *dev, int percent);
#endif

View File

@@ -48,6 +48,5 @@
/* RTC */
#define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0
#define CONFIG_RTC_MC146818
#endif

View File

@@ -19,7 +19,6 @@
#define CONFIG_PCNET_79C973
#define PCNET_HAS_PROM
#define CONFIG_RTC_MC146818
#define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0
/*

View File

@@ -69,7 +69,7 @@ struct fdt_cros_ec {
* @param maxlen Maximum length of the ID field
* @return 0 if ok, -1 on error
*/
int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int maxlen);
int cros_ec_read_id(struct udevice *dev, char *id, int maxlen);
/**
* Read a keyboard scan from the CROS-EC device
@@ -89,18 +89,19 @@ int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan);
* @param image Destination for image identifier
* @return 0 if ok, <0 on error
*/
int cros_ec_read_current_image(struct cros_ec_dev *dev,
enum ec_current_image *image);
int cros_ec_read_current_image(struct udevice *dev,
enum ec_current_image *image);
/**
* Read the hash of the CROS-EC device firmware.
*
* @param dev CROS-EC device
* @param hash_offset Offset in flash to read from
* @param hash Destination for hash information
* @return 0 if ok, <0 on error
*/
int cros_ec_read_hash(struct cros_ec_dev *dev,
struct ec_response_vboot_hash *hash);
int cros_ec_read_hash(struct udevice *dev, uint hash_offset,
struct ec_response_vboot_hash *hash);
/**
* Send a reboot command to the CROS-EC device.
@@ -112,8 +113,7 @@ int cros_ec_read_hash(struct cros_ec_dev *dev,
* @param flags Flags for reboot command (EC_REBOOT_FLAG_*)
* @return 0 if ok, <0 on error
*/
int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd,
uint8_t flags);
int cros_ec_reboot(struct udevice *dev, enum ec_reboot_cmd cmd, uint8_t flags);
/**
* Check if the CROS-EC device has an interrupt pending.
@@ -144,7 +144,7 @@ enum {
* expected), -ve if we should have an cros_ec device but failed to find
* one, or init failed (-CROS_EC_ERR_...).
*/
int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp);
int cros_ec_init(const void *blob, struct udevice**cros_ecp);
/**
* Read information about the keyboard matrix
@@ -152,8 +152,7 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp);
* @param dev CROS-EC device
* @param info Place to put the info structure
*/
int cros_ec_info(struct cros_ec_dev *dev,
struct ec_response_mkbp_info *info);
int cros_ec_info(struct udevice *dev, struct ec_response_mkbp_info *info);
/**
* Read the host event flags
@@ -162,7 +161,7 @@ int cros_ec_info(struct cros_ec_dev *dev,
* @param events_ptr Destination for event flags. Not changed on error.
* @return 0 if ok, <0 on error
*/
int cros_ec_get_host_events(struct cros_ec_dev *dev, uint32_t *events_ptr);
int cros_ec_get_host_events(struct udevice *dev, uint32_t *events_ptr);
/**
* Clear the specified host event flags
@@ -171,7 +170,7 @@ int cros_ec_get_host_events(struct cros_ec_dev *dev, uint32_t *events_ptr);
* @param events Event flags to clear
* @return 0 if ok, <0 on error
*/
int cros_ec_clear_host_events(struct cros_ec_dev *dev, uint32_t events);
int cros_ec_clear_host_events(struct udevice *dev, uint32_t events);
/**
* Get/set flash protection
@@ -184,9 +183,9 @@ int cros_ec_clear_host_events(struct cros_ec_dev *dev, uint32_t events);
* @param prot Destination for updated protection state from EC.
* @return 0 if ok, <0 on error
*/
int cros_ec_flash_protect(struct cros_ec_dev *dev,
uint32_t set_mask, uint32_t set_flags,
struct ec_response_flash_protect *resp);
int cros_ec_flash_protect(struct udevice *dev, uint32_t set_mask,
uint32_t set_flags,
struct ec_response_flash_protect *resp);
/**
@@ -195,7 +194,7 @@ int cros_ec_flash_protect(struct cros_ec_dev *dev,
* @param dev CROS-EC device
* @return 0 if ok, <0 if the test failed
*/
int cros_ec_test(struct cros_ec_dev *dev);
int cros_ec_test(struct udevice *dev);
/**
* Update the EC RW copy.
@@ -205,17 +204,15 @@ int cros_ec_test(struct cros_ec_dev *dev);
* @param imafge_size content length
* @return 0 if ok, <0 if the test failed
*/
int cros_ec_flash_update_rw(struct cros_ec_dev *dev,
const uint8_t *image, int image_size);
int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image,
int image_size);
/**
* Return a pointer to the board's CROS-EC device
*
* This should be implemented by board files.
*
* @return pointer to CROS-EC device, or NULL if none is available
*/
struct cros_ec_dev *board_get_cros_ec_dev(void);
struct udevice *board_get_cros_ec_dev(void);
struct dm_cros_ec_ops {
int (*check_version)(struct udevice *dev);
@@ -249,8 +246,7 @@ void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len);
*/
int cros_ec_calc_checksum(const uint8_t *data, int size);
int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset,
uint32_t size);
int cros_ec_flash_erase(struct udevice *dev, uint32_t offset, uint32_t size);
/**
* Read data from the flash
@@ -267,8 +263,8 @@ int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset,
* @param size Number of bytes to read
* @return 0 if ok, -1 on error
*/
int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
uint32_t size);
int cros_ec_flash_read(struct udevice *dev, uint8_t *data, uint32_t offset,
uint32_t size);
/**
* Read back flash parameters
@@ -278,8 +274,8 @@ int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
* @param dev Pointer to device
* @param info Pointer to output flash info struct
*/
int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
struct ec_response_flash_info *info);
int cros_ec_read_flashinfo(struct udevice *dev,
struct ec_response_flash_info *info);
/**
* Write data to the flash
@@ -299,8 +295,8 @@ int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
* @param size Number of bytes to write
* @return 0 if ok, -1 on error
*/
int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
uint32_t offset, uint32_t size);
int cros_ec_flash_write(struct udevice *dev, const uint8_t *data,
uint32_t offset, uint32_t size);
/**
* Obtain position and size of a flash region
@@ -311,18 +307,18 @@ int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
* @param size Returns size of flash region
* @return 0 if ok, -1 on error
*/
int cros_ec_flash_offset(struct cros_ec_dev *dev, enum ec_flash_region region,
uint32_t *offset, uint32_t *size);
int cros_ec_flash_offset(struct udevice *dev, enum ec_flash_region region,
uint32_t *offset, uint32_t *size);
/**
* Read/write VbNvContext from/to a CROS-EC device.
* Read/write non-volatile data from/to a CROS-EC device.
*
* @param dev CROS-EC device
* @param block Buffer of VbNvContext to be read/write
* @return 0 if ok, -1 on error
*/
int cros_ec_read_vbnvcontext(struct cros_ec_dev *dev, uint8_t *block);
int cros_ec_write_vbnvcontext(struct cros_ec_dev *dev, const uint8_t *block);
int cros_ec_read_nvdata(struct udevice *dev, uint8_t *block, int size);
int cros_ec_write_nvdata(struct udevice *dev, const uint8_t *block, int size);
/**
* Read the version information for the EC images
@@ -331,8 +327,8 @@ int cros_ec_write_vbnvcontext(struct cros_ec_dev *dev, const uint8_t *block);
* @param versionp This is set to point to the version information
* @return 0 if ok, -1 on error
*/
int cros_ec_read_version(struct cros_ec_dev *dev,
struct ec_response_get_version **versionp);
int cros_ec_read_version(struct udevice *dev,
struct ec_response_get_version **versionp);
/**
* Read the build information for the EC
@@ -341,7 +337,7 @@ int cros_ec_read_version(struct cros_ec_dev *dev,
* @param versionp This is set to point to the build string
* @return 0 if ok, -1 on error
*/
int cros_ec_read_build_info(struct cros_ec_dev *dev, char **strp);
int cros_ec_read_build_info(struct udevice *dev, char **strp);
/**
* Switch on/off a LDO / FET.
@@ -387,7 +383,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config);
*
* @param ec CROS-EC device
*/
void cros_ec_check_keyboard(struct cros_ec_dev *dev);
void cros_ec_check_keyboard(struct udevice *dev);
struct i2c_msg;
/*

View File

@@ -270,7 +270,7 @@ struct driver {
* @dev Device to check
* @return platform data, or NULL if none
*/
void *dev_get_platdata(struct udevice *dev);
void *dev_get_platdata(const struct udevice *dev);
/**
* dev_get_parent_platdata() - Get the parent platform data for a device
@@ -280,7 +280,7 @@ void *dev_get_platdata(struct udevice *dev);
* @dev Device to check
* @return parent's platform data, or NULL if none
*/
void *dev_get_parent_platdata(struct udevice *dev);
void *dev_get_parent_platdata(const struct udevice *dev);
/**
* dev_get_uclass_platdata() - Get the uclass platform data for a device
@@ -290,7 +290,7 @@ void *dev_get_parent_platdata(struct udevice *dev);
* @dev Device to check
* @return uclass's platform data, or NULL if none
*/
void *dev_get_uclass_platdata(struct udevice *dev);
void *dev_get_uclass_platdata(const struct udevice *dev);
/**
* dev_get_priv() - Get the private data for a device
@@ -300,7 +300,7 @@ void *dev_get_uclass_platdata(struct udevice *dev);
* @dev Device to check
* @return private data, or NULL if none
*/
void *dev_get_priv(struct udevice *dev);
void *dev_get_priv(const struct udevice *dev);
/**
* dev_get_parent_priv() - Get the parent private data for a device
@@ -314,7 +314,7 @@ void *dev_get_priv(struct udevice *dev);
* @dev Device to check
* @return parent data, or NULL if none
*/
void *dev_get_parent_priv(struct udevice *dev);
void *dev_get_parent_priv(const struct udevice *dev);
/**
* dev_get_uclass_priv() - Get the private uclass data for a device
@@ -324,7 +324,7 @@ void *dev_get_parent_priv(struct udevice *dev);
* @dev Device to check
* @return private uclass data for this device, or NULL if none
*/
void *dev_get_uclass_priv(struct udevice *dev);
void *dev_get_uclass_priv(const struct udevice *dev);
/**
* struct dev_get_parent() - Get the parent of a device
@@ -332,7 +332,7 @@ void *dev_get_uclass_priv(struct udevice *dev);
* @child: Child to check
* @return parent of child, or NULL if this is the root device
*/
struct udevice *dev_get_parent(struct udevice *child);
struct udevice *dev_get_parent(const struct udevice *child);
/**
* dev_get_driver_data() - get the driver data used to bind a device
@@ -359,7 +359,7 @@ struct udevice *dev_get_parent(struct udevice *child);
* @dev: Device to check
* @return driver data (0 if none is provided)
*/
ulong dev_get_driver_data(struct udevice *dev);
ulong dev_get_driver_data(const struct udevice *dev);
/**
* dev_get_driver_ops() - get the device's driver's operations
@@ -370,7 +370,7 @@ ulong dev_get_driver_data(struct udevice *dev);
* @dev: Device to check
* @return void pointer to driver's operations or NULL for NULL-dev or NULL-ops
*/
const void *dev_get_driver_ops(struct udevice *dev);
const void *dev_get_driver_ops(const struct udevice *dev);
/**
* device_get_uclass_id() - return the uclass ID of a device
@@ -378,7 +378,7 @@ const void *dev_get_driver_ops(struct udevice *dev);
* @dev: Device to check
* @return uclass ID for the device
*/
enum uclass_id device_get_uclass_id(struct udevice *dev);
enum uclass_id device_get_uclass_id(const struct udevice *dev);
/**
* dev_get_uclass_name() - return the uclass name of a device
@@ -388,7 +388,7 @@ enum uclass_id device_get_uclass_id(struct udevice *dev);
* @dev: Device to check
* @return pointer to the uclass name for the device
*/
const char *dev_get_uclass_name(struct udevice *dev);
const char *dev_get_uclass_name(const struct udevice *dev);
/**
* device_get_child() - Get the child of a device by index
@@ -519,13 +519,28 @@ int device_find_first_child(struct udevice *parent, struct udevice **devp);
*/
int device_find_next_child(struct udevice **devp);
/**
* device_find_first_inactive_child() - Find the first inactive child
*
* This is used to locate an existing child of a device which is of a given
* uclass.
*
* @parent: Parent device to search
* @uclass_id: Uclass to look for
* @devp: Returns device found, if any
* @return 0 if found, else -ENODEV
*/
int device_find_first_inactive_child(struct udevice *parent,
enum uclass_id uclass_id,
struct udevice **devp);
/**
* device_has_children() - check if a device has any children
*
* @dev: Device to check
* @return true if the device has one or more children
*/
bool device_has_children(struct udevice *dev);
bool device_has_children(const struct udevice *dev);
/**
* device_has_active_children() - check if a device has any active children

View File

@@ -11,7 +11,7 @@
enum fmap_compress_t {
FMAP_COMPRESS_NONE,
FMAP_COMPRESS_LZO,
FMAP_COMPRESS_LZ4,
};
enum fmap_hash_t {
@@ -26,6 +26,7 @@ struct fmap_entry {
uint32_t length;
uint32_t used; /* Number of bytes used in region */
enum fmap_compress_t compress_algo; /* Compression type */
uint32_t unc_length; /* Uncompressed length */
enum fmap_hash_t hash_algo; /* Hash algorithm */
const uint8_t *hash; /* Hash value */
int hash_size; /* Hash size */

View File

@@ -44,6 +44,9 @@ struct udevice;
/* Members of this uclass sequence themselves with aliases */
#define DM_UC_FLAG_SEQ_ALIAS (1 << 0)
/* Same as DM_FLAG_ALLOC_PRIV_DMA */
#define DM_UC_FLAG_ALLOC_PRIV_DMA (1 << 5)
/**
* struct uclass_driver - Driver for the uclass
*

File diff suppressed because it is too large Load Diff

View File

@@ -802,23 +802,6 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
const u8 *fdtdec_locate_byte_array(const void *blob, int node,
const char *prop_name, int count);
/**
* Look up a property in a node which contains a memory region address and
* size. Then return a pointer to this address.
*
* The property must hold one address with a length. This is only tested on
* 32-bit machines.
*
* @param blob FDT blob
* @param node node to examine
* @param prop_name name of property to find
* @param basep Returns base address of region
* @param size Returns size of region
* @return 0 if ok, -1 on error (property not found)
*/
int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
fdt_addr_t *basep, fdt_size_t *sizep);
/**
* Obtain an indexed resource from a device property.
*
@@ -849,34 +832,6 @@ int fdt_get_named_resource(const void *fdt, int node, const char *property,
const char *prop_names, const char *name,
struct fdt_resource *res);
/**
* Decode a named region within a memory bank of a given type.
*
* This function handles selection of a memory region. The region is
* specified as an offset/size within a particular type of memory.
*
* The properties used are:
*
* <mem_type>-memory<suffix> for the name of the memory bank
* <mem_type>-offset<suffix> for the offset in that bank
*
* The property value must have an offset and a size. The function checks
* that the region is entirely within the memory bank.5
*
* @param blob FDT blob
* @param node Node containing the properties (-1 for /config)
* @param mem_type Type of memory to use, which is a name, such as
* "u-boot" or "kernel".
* @param suffix String to append to the memory/offset
* property names
* @param basep Returns base of region
* @param sizep Returns size of region
* @return 0 if OK, -ive on error
*/
int fdtdec_decode_memory_region(const void *blob, int node,
const char *mem_type, const char *suffix,
fdt_addr_t *basep, fdt_size_t *sizep);
/* Display timings from linux include/video/display_timing.h */
enum display_flags {
DISPLAY_FLAGS_HSYNC_LOW = 1 << 0,

View File

@@ -12,7 +12,8 @@
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
#define barrier() \
__asm__ __volatile__("": : :"memory")
/*
* This version is i.e. to prevent dead stores elimination on @ptr
* where gcc and llvm may behave differently when otherwise using
@@ -26,7 +27,8 @@
* the compiler that the inline asm absolutely may see the contents
* of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
*/
#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
#define barrier_data(ptr) \
__asm__ __volatile__("": :"r"(ptr) :"memory")
/*
* This macro obfuscates arithmetic on a variable address so that gcc

View File

@@ -39,16 +39,17 @@ enum log_level_t {
enum log_category_t {
LOGC_FIRST = 0, /* First part mirrors UCLASS_... */
LOGC_NONE = UCLASS_COUNT,
LOGC_ARCH,
LOGC_BOARD,
LOGC_CORE,
LOGC_NONE = UCLASS_COUNT, /* First number is after all uclasses */
LOGC_ARCH, /* Related to arch-specific code */
LOGC_BOARD, /* Related to board-specific code */
LOGC_CORE, /* Related to core features (non-driver-model) */
LOGC_DM, /* Core driver-model */
LOGC_DT, /* Device-tree */
LOGC_EFI, /* EFI implementation */
LOGC_ALLOC, /* Memory allocation */
LOGC_COUNT,
LOGC_END,
LOGC_COUNT, /* Number of log categories */
LOGC_END, /* Sentinel value for a list of log categories */
};
/* Helper to cast a uclass ID to a log category */
@@ -88,8 +89,22 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
*/
#if CONFIG_IS_ENABLED(LOG)
#define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL)
#define log_err(_fmt...) log(LOG_CATEGORY, LOGL_ERR, ##_fmt)
#define log_warning(_fmt...) log(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
#define log_notice(_fmt...) log(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
#define log_info(_fmt...) log(LOG_CATEGORY, LOGL_INFO, ##_fmt)
#define log_debug(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
#define log_content(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_CONTENT, ##_fmt)
#define log_io(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
#else
#define _LOG_MAX_LEVEL LOGL_INFO
#define log_err(_fmt...)
#define log_warning(_fmt...)
#define log_notice(_fmt...)
#define log_info(_fmt...)
#define log_debug(_fmt...)
#define log_content(_fmt...)
#define log_io(_fmt...)
#endif
/* Emit a log record if the level is less that the maximum */
@@ -175,7 +190,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
})
#else
#define log_ret(_ret) (_ret)
#define log_msg_ret(_ret) (_ret)
#define log_msg_ret(_msg, _ret) (_ret)
#endif
/**

View File

@@ -26,16 +26,6 @@ struct sandbox_state;
*/
ssize_t os_read(int fd, void *buf, size_t count);
/**
* Access to the OS read() system call with non-blocking access
*
* \param fd File descriptor as returned by os_open()
* \param buf Buffer to place data
* \param count Number of bytes to read
* \return number of bytes read, or -1 on error
*/
ssize_t os_read_no_block(int fd, void *buf, size_t count);
/**
* Access to the OS write() system call
*
@@ -75,6 +65,7 @@ int os_open(const char *pathname, int flags);
#define OS_O_RDWR 2
#define OS_O_MASK 3 /* Mask for read/write flags */
#define OS_O_CREAT 0100
#define OS_O_TRUNC 01000
/**
* Access to the OS close() system call
@@ -334,4 +325,29 @@ void os_localtime(struct rtc_time *rt);
* os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger)
*/
void os_abort(void);
/**
* os_mprotect_allow() - Remove write-protection on a region of memory
*
* The start and length will be page-aligned before use.
*
* @start: Region start
* @len: Region length in bytes
* @return 0 if OK, -1 on error from mprotect()
*/
int os_mprotect_allow(void *start, size_t len);
/**
* os_write_file() - Write a file to the host filesystem
*
* This can be useful when debugging for writing data out of sandbox for
* inspection by external tools.
*
* @name: File path to write to
* @buf: Data to write
* @size: Size of data to write
* @return 0 if OK, -ve on error
*/
int os_write_file(const char *name, const void *buf, int size);
#endif

View File

@@ -15,6 +15,16 @@ struct panel_ops {
* @return 0 if OK, -ve on error
*/
int (*enable_backlight)(struct udevice *dev);
/**
* set_backlight - Set panel backlight brightness
*
* @dev: Panel device containing the backlight to update
* @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
* @return 0 if OK, -ve on error
*/
int (*set_backlight)(struct udevice *dev, int percent);
/**
* get_timings() - Get display timings from panel.
*
@@ -29,13 +39,23 @@ struct panel_ops {
#define panel_get_ops(dev) ((struct panel_ops *)(dev)->driver->ops)
/**
* panel_enable_backlight() - Enable the panel backlight
* panel_enable_backlight() - Enable/disable the panel backlight
*
* @dev: Panel device containing the backlight to enable
* @enable: true to enable the backlight, false to dis
* @return 0 if OK, -ve on error
*/
int panel_enable_backlight(struct udevice *dev);
/**
* panel_set_backlight - Set brightness for the panel backlight
*
* @dev: Panel device containing the backlight to update
* @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
* @return 0 if OK, -ve on error
*/
int panel_set_backlight(struct udevice *dev, int percent);
/**
* panel_get_display_timing() - Get display timings from panel.
*

View File

@@ -24,7 +24,7 @@
#define EFI_PMBR_OSTYPE_EFI 0xEF
#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
#define GPT_HEADER_SIGNATURE_UBOOT 0x5452415020494645ULL
#define GPT_HEADER_REVISION_V1 0x00010000
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
#define GPT_ENTRY_NUMBERS CONFIG_EFI_PARTITION_ENTRIES_NUMBERS

1
include/string.h Normal file
View File

@@ -0,0 +1 @@
#include <linux/string.h>

View File

@@ -11,6 +11,7 @@ enum sysreset_t {
SYSRESET_WARM, /* Reset CPU, keep GPIOs active */
SYSRESET_COLD, /* Reset CPU and GPIOs */
SYSRESET_POWER, /* Reset PMIC (remove and restore power) */
SYSRESET_POWER_OFF, /* Turn off power */
SYSRESET_COUNT,
};
@@ -31,11 +32,20 @@ struct sysreset_ops {
/**
* get_status() - get printable reset status information
*
* @dev: Device to check
* @buf: Buffer to receive the textual reset information
* @size: Size of the passed buffer
* @return 0 if OK, -ve on error
*/
int (*get_status)(struct udevice *dev, char *buf, int size);
/**
* get_last() - get information on the last reset
*
* @dev: Device to check
* @return last reset state (enum sysreset_t) or -ve error
*/
int (*get_last)(struct udevice *dev);
};
#define sysreset_get_ops(dev) ((struct sysreset_ops *)(dev)->driver->ops)
@@ -49,14 +59,23 @@ struct sysreset_ops {
int sysreset_request(struct udevice *dev, enum sysreset_t type);
/**
* get_status() - get printable reset status information
* sysreset_get_status() - get printable reset status information
*
* @dev: Device to check
* @buf: Buffer to receive the textual reset information
* @size: Size of the passed buffer
* @return 0 if OK, -ve on error
*/
int sysreset_get_status(struct udevice *dev, char *buf, int size);
/**
* sysreset_get_last() - get information on the last reset
*
* @dev: Device to check
* @return last reset state (enum sysreset_t) or -ve error
*/
int sysreset_get_last(struct udevice *dev);
/**
* sysreset_walk() - cause a system reset
*
@@ -71,6 +90,19 @@ int sysreset_get_status(struct udevice *dev, char *buf, int size);
*/
int sysreset_walk(enum sysreset_t type);
/**
* sysreset_get_last_walk() - get information on the last reset
*
* This works through the available sysreset devices until it finds one that can
* perform a reset. If the provided sysreset type is not available, the next one
* will be tried.
*
* If no device prives the information, this function returns -ENOENT
*
* @return last reset state (enum sysreset_t) or -ve error
*/
int sysreset_get_last_walk(void);
/**
* sysreset_walk_halt() - try to reset, otherwise halt
*

View File

@@ -81,6 +81,12 @@ enum tpm_capability_areas {
TPM_CAP_VERSION_VAL = 0x0000001A,
};
enum tmp_cap_flag {
TPM_CAP_FLAG_PERMANENT = 0x108,
};
#define TPM_TAG_PERMANENT_FLAGS 0x001f
#define TPM_NV_PER_GLOBALLOCK BIT(15)
#define TPM_NV_PER_PPREAD BIT(16)
#define TPM_NV_PER_PPWRITE BIT(0)
@@ -93,6 +99,14 @@ enum {
TPM_PUBEK_SIZE = 256,
};
enum {
TPM_CMD_EXTEND = 0x14,
TPM_CMD_GET_CAPABILITY = 0x65,
TPM_CMD_NV_DEFINE_SPACE = 0xcc,
TPM_CMD_NV_WRITE_VALUE = 0xcd,
TPM_CMD_NV_READ_VALUE = 0xcf,
};
/**
* TPM return codes as defined in the TCG Main specification
* (TPM Main Part 2 Structures; Specification version 1.2)
@@ -231,6 +245,40 @@ struct tpm_permanent_flags {
u8 disable_full_da_logic_info;
} __packed;
#define TPM_SHA1_160_HASH_LEN 0x14
struct __packed tpm_composite_hash {
u8 digest[TPM_SHA1_160_HASH_LEN];
};
struct __packed tpm_pcr_selection {
__be16 size_of_select;
u8 pcr_select[3]; /* matches vboot's struct */
};
struct __packed tpm_pcr_info_short {
struct tpm_pcr_selection pcr_selection;
u8 locality_at_release;
struct tpm_composite_hash digest_at_release;
};
struct __packed tpm_nv_attributes {
__be16 tag;
__be32 attributes;
};
struct __packed tpm_nv_data_public {
__be16 tag;
__be32 nv_index;
struct tpm_pcr_info_short pcr_info_read;
struct tpm_pcr_info_short pcr_info_write;
struct tpm_nv_attributes permission;
u8 read_st_clear;
u8 write_st_clear;
u8 write_define;
__be32 data_size;
};
/**
* Issue a TPM_Startup command.
*
@@ -477,4 +525,32 @@ u32 tpm_find_key_sha1(const u8 auth[20], const u8 pubkey_digest[20],
*/
u32 tpm_get_random(void *data, u32 count);
/**
* tpm_finalise_physical_presence() - Finalise physical presence
*
* @return return code of the operation (0 = success)
*/
u32 tpm_finalise_physical_presence(void);
/**
* tpm_nv_set_locked() - lock the non-volatile space
*
* @return return code of the operation (0 = success)
*/
u32 tpm_nv_set_locked(void);
/**
* tpm_set_global_lock() - set the global lock
*
* @return return code of the operation (0 = success)
*/
u32 tpm_set_global_lock(void);
/**
* tpm_resume() - start up the TPM from resume (after suspend)
*
* @return return code of the operation (0 = success)
*/
u32 tpm_resume(void);
#endif /* __TPM_V1_H */

View File

@@ -83,6 +83,7 @@ enum tpm2_command_codes {
TPM2_CC_PCR_SETAUTHPOL = 0x012C,
TPM2_CC_DAM_RESET = 0x0139,
TPM2_CC_DAM_PARAMETERS = 0x013A,
TPM2_CC_NV_READ = 0x014E,
TPM2_CC_GET_CAPABILITY = 0x017A,
TPM2_CC_PCR_READ = 0x017E,
TPM2_CC_PCR_EXTEND = 0x0182,

View File

@@ -55,7 +55,7 @@ enum video_log2_bpp {
* @xsize: Number of pixel columns (e.g. 1366)
* @ysize: Number of pixels rows (e.g.. 768)
* @rot: Display rotation (0=none, 1=90 degrees clockwise, etc.)
* @bpix: Encoded bits per pixel
* @bpix: Encoded bits per pixel (enum video_log2_bpp)
* @vidconsole_drv_name: Driver to use for the text console, NULL to
* select automatically
* @font_size: Font size in pixels (0 to use a default value)
@@ -120,8 +120,9 @@ int video_reserve(ulong *addrp);
* video_clear() - Clear a device's frame buffer to background color.
*
* @dev: Device to clear
* @return 0
*/
void video_clear(struct udevice *dev);
int video_clear(struct udevice *dev);
/**
* video_sync() - Sync a device's frame buffer with its hardware
@@ -131,8 +132,10 @@ void video_clear(struct udevice *dev);
* buffer are displayed to the user.
*
* @dev: Device to sync
* @force: True to force a sync even if there was one recently (this is
* very expensive on sandbox)
*/
void video_sync(struct udevice *vid);
void video_sync(struct udevice *vid, bool force);
/**
* video_sync_all() - Sync all devices' frame buffers with there hardware
@@ -266,6 +269,6 @@ int lg4573_spi_startup(unsigned int bus, unsigned int cs,
*/
void video_get_info_str(int line_number, char *info);
#endif /* CONFIG_DM_VIDEO */
#endif /* !CONFIG_DM_VIDEO */
#endif