libpayload/usb: Fix printf format string mismatches in debug messages

This fixes format string mismatch errors in the USB subsystem found by
the compiler's format string checker.

BUG=b:167517417
TEST=enabled all USB controllers on volteer and fixed resulting
	compiler errors when USB_DEBUG is enabled.

Change-Id: I4dc70baefb3cd82fcc915cc2e7f68719cf6870cc
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45024
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Caveh Jalali
2020-09-01 20:37:49 -07:00
committed by Patrick Georgi
parent 2a70419e7c
commit 8079a6a558
5 changed files with 33 additions and 27 deletions

View File

@ -29,6 +29,7 @@
//#define USB_DEBUG
#include <arch/virtual.h>
#include <inttypes.h>
#include <usb/usb.h>
#include "ohci_private.h"
#include "ohci.h"
@ -59,7 +60,7 @@ dump_td (td_t *cur)
else
usb_debug("|..[]...............................................|\n");
usb_debug("|:|============ OHCI TD at [0x%08lx] ==========|:|\n", virt_to_phys(cur));
usb_debug("|:| ERRORS = [%ld] | CONFIG = [0x%08lx] | |:|\n",
usb_debug("|:| ERRORS = [%ld] | CONFIG = [0x%08"PRIx32"] | |:|\n",
3 - ((cur->config & (3UL << 26)) >> 26), cur->config);
usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug("|:| C | Condition Code | [%02ld] |:|\n", (cur->config & (0xFUL << 28)) >> 28);
@ -69,11 +70,11 @@ dump_td (td_t *cur)
usb_debug("|:| I | Data Toggle | [%ld] |:|\n", (cur->config & (3UL << 24)) >> 24);
usb_debug("|:| G | Error Count | [%ld] |:|\n", (cur->config & (3UL << 26)) >> 26);
usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug("|:| Current Buffer Pointer [0x%08lx] |:|\n", cur->current_buffer_pointer);
usb_debug("|:| Current Buffer Pointer [0x%08"PRIx32"] |:|\n", cur->current_buffer_pointer);
usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug("|:| Next TD [0x%08lx] |:|\n", cur->next_td);
usb_debug("|:| Next TD [0x%08"PRIx32"] |:|\n", cur->next_td);
usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug("|:| Current Buffer End [0x%08lx] |:|\n", cur->buffer_end);
usb_debug("|:| Current Buffer End [0x%08"PRIx32"] |:|\n", cur->buffer_end);
usb_debug("|:|-----------------------------------------------|:|\n");
usb_debug("|...................................................|\n");
usb_debug("+---------------------------------------------------+\n");
@ -88,9 +89,9 @@ dump_ed (ed_t *cur)
usb_debug("+---------------------------------------------------+\n");
usb_debug("| Next Endpoint Descriptor [0x%08lx] |\n", cur->next_ed & ~0xFUL);
usb_debug("+---------------------------------------------------+\n");
usb_debug("| | @ 0x%08lx : |\n", cur->config);
usb_debug("| | @ 0x%08"PRIx32" : |\n", cur->config);
usb_debug("| C | Maximum Packet Length | [%04ld] |\n", ((cur->config & (0x3fffUL << 16)) >> 16));
usb_debug("| O | Function Address | [%04ld] |\n", cur->config & 0x7F);
usb_debug("| O | Function Address | [%04"PRIx32"] |\n", cur->config & 0x7F);
usb_debug("| N | Endpoint Number | [%02ld] |\n", (cur->config & (0xFUL << 7)) >> 7);
usb_debug("| F | Endpoint Direction | [%ld] |\n", ((cur->config & (3UL << 11)) >> 11));
usb_debug("| I | Endpoint Speed | [%ld] |\n", ((cur->config & (1UL << 13)) >> 13));
@ -468,7 +469,7 @@ ohci_control (usbdev_t *dev, direction_t dir, int drlen, void *setup, int dalen,
head->tail_pointer = virt_to_phys(final_td);
head->head_pointer = virt_to_phys(first_td);
usb_debug("ohci_control(): doing transfer with %x. first_td at %x\n",
usb_debug("%s(): doing transfer with %x. first_td at %"PRIxPTR"\n", __func__,
head->config & ED_FUNC_MASK, virt_to_phys(first_td));
#ifdef USB_DEBUG
dump_ed(head);
@ -506,7 +507,7 @@ ohci_bulk (endpoint_t *ep, int dalen, u8 *src, int finalize)
td_t *cur, *next;
int remaining = dalen;
u8 *data = src;
usb_debug("bulk: %x bytes from %x, finalize: %x, maxpacketsize: %x\n", dalen, src, finalize, ep->maxpacketsize);
usb_debug("bulk: %x bytes from %p, finalize: %x, maxpacketsize: %x\n", dalen, src, finalize, ep->maxpacketsize);
if (!dma_coherent(src)) {
data = OHCI_INST(ep->dev->controller)->dma_buffer;
@ -596,7 +597,7 @@ ohci_bulk (endpoint_t *ep, int dalen, u8 *src, int finalize)
head->tail_pointer = virt_to_phys(cur);
head->head_pointer = virt_to_phys(first_td) | (ep->toggle?ED_TOGGLE:0);
usb_debug("doing bulk transfer with %x(%x). first_td at %x, last %x\n",
usb_debug("doing bulk transfer with %x(%x). first_td at %"PRIxPTR", last %"PRIxPTR"\n",
head->config & ED_FUNC_MASK,
(head->config & ED_EP_MASK) >> ED_EP_SHIFT,
virt_to_phys(first_td), virt_to_phys(cur));