libpayload: ehci: Fix warnings about discarded volatile

We can trust free() and memset() to work correctly on volatile
references, so cast volatile pointers to (void *) when calling them.

Change-Id: Ieff7f78133b72f303349cca0a0ca3bbf37ec52bb
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1896
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
This commit is contained in:
Nico Huber 2012-11-23 11:58:57 +01:00 committed by Patrick Georgi
parent ba22e4c3fd
commit 4f83d1b0c6
1 changed files with 12 additions and 12 deletions

View File

@ -102,7 +102,7 @@ static void ehci_shutdown (hci_t *controller)
free(phys_to_virt(EHCI_INST(controller)->operation->periodiclistbase)); free(phys_to_virt(EHCI_INST(controller)->operation->periodiclistbase));
/* Free dummy QH */ /* Free dummy QH */
free(EHCI_INST(controller)->dummy_qh); free((void *)EHCI_INST(controller)->dummy_qh);
EHCI_INST(controller)->operation->configflag = 0; EHCI_INST(controller)->operation->configflag = 0;
@ -179,10 +179,10 @@ static void free_qh_and_tds(ehci_qh_t *qh, qtd_t *cur)
qtd_t *next; qtd_t *next;
while (cur) { while (cur) {
next = (qtd_t*)phys_to_virt(cur->next_qtd & ~31); next = (qtd_t*)phys_to_virt(cur->next_qtd & ~31);
free(cur); free((void *)cur);
cur = next; cur = next;
} }
free(qh); free((void *)qh);
} }
static int wait_for_tds(qtd_t *head) static int wait_for_tds(qtd_t *head)
@ -288,7 +288,7 @@ static int ehci_bulk (endpoint_t *ep, int size, u8 *data, int finalize)
qtd_t *head = memalign(32, sizeof(qtd_t)); qtd_t *head = memalign(32, sizeof(qtd_t));
qtd_t *cur = head; qtd_t *cur = head;
while (1) { while (1) {
memset(cur, 0, sizeof(qtd_t)); memset((void *)cur, 0, sizeof(qtd_t));
cur->token = QTD_ACTIVE | cur->token = QTD_ACTIVE |
(pid << QTD_PID_SHIFT) | (pid << QTD_PID_SHIFT) |
(0 << QTD_CERR_SHIFT); (0 << QTD_CERR_SHIFT);
@ -309,7 +309,7 @@ static int ehci_bulk (endpoint_t *ep, int size, u8 *data, int finalize)
/* create QH */ /* create QH */
ehci_qh_t *qh = memalign(32, sizeof(ehci_qh_t)); ehci_qh_t *qh = memalign(32, sizeof(ehci_qh_t));
memset(qh, 0, sizeof(ehci_qh_t)); memset((void *)qh, 0, sizeof(ehci_qh_t));
qh->horiz_link_ptr = virt_to_phys(qh) | QH_QH; qh->horiz_link_ptr = virt_to_phys(qh) | QH_QH;
qh->epchar = ep->dev->address | qh->epchar = ep->dev->address |
(endp << QH_EP_SHIFT) | (endp << QH_EP_SHIFT) |
@ -356,7 +356,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
/* create qTDs */ /* create qTDs */
qtd_t *head = memalign(32, sizeof(qtd_t)); qtd_t *head = memalign(32, sizeof(qtd_t));
qtd_t *cur = head; qtd_t *cur = head;
memset(cur, 0, sizeof(qtd_t)); memset((void *)cur, 0, sizeof(qtd_t));
cur->token = QTD_ACTIVE | cur->token = QTD_ACTIVE |
(toggle?QTD_TOGGLE_DATA1:0) | (toggle?QTD_TOGGLE_DATA1:0) |
(EHCI_SETUP << QTD_PID_SHIFT) | (EHCI_SETUP << QTD_PID_SHIFT) |
@ -373,7 +373,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
if (dalen > 0) { if (dalen > 0) {
toggle ^= 1; toggle ^= 1;
cur = next; cur = next;
memset(cur, 0, sizeof(qtd_t)); memset((void *)cur, 0, sizeof(qtd_t));
cur->token = QTD_ACTIVE | cur->token = QTD_ACTIVE |
(toggle?QTD_TOGGLE_DATA1:0) | (toggle?QTD_TOGGLE_DATA1:0) |
(((dir == OUT)?EHCI_OUT:EHCI_IN) << QTD_PID_SHIFT) | (((dir == OUT)?EHCI_OUT:EHCI_IN) << QTD_PID_SHIFT) |
@ -388,7 +388,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
toggle = 1; toggle = 1;
cur = next; cur = next;
memset(cur, 0, sizeof(qtd_t)); memset((void *)cur, 0, sizeof(qtd_t));
cur->token = QTD_ACTIVE | cur->token = QTD_ACTIVE |
(toggle?QTD_TOGGLE_DATA1:QTD_TOGGLE_DATA0) | (toggle?QTD_TOGGLE_DATA1:QTD_TOGGLE_DATA0) |
((dir == OUT)?EHCI_IN:EHCI_OUT) << QTD_PID_SHIFT | ((dir == OUT)?EHCI_IN:EHCI_OUT) << QTD_PID_SHIFT |
@ -399,7 +399,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
/* create QH */ /* create QH */
ehci_qh_t *qh = memalign(32, sizeof(ehci_qh_t)); ehci_qh_t *qh = memalign(32, sizeof(ehci_qh_t));
memset(qh, 0, sizeof(ehci_qh_t)); memset((void *)qh, 0, sizeof(ehci_qh_t));
qh->horiz_link_ptr = virt_to_phys(qh) | QH_QH; qh->horiz_link_ptr = virt_to_phys(qh) | QH_QH;
qh->epchar = dev->address | qh->epchar = dev->address |
(endp << QH_EP_SHIFT) | (endp << QH_EP_SHIFT) |
@ -525,7 +525,7 @@ static void *ehci_create_intr_queue(
/* initialize QH */ /* initialize QH */
const int endp = ep->endpoint & 0xf; const int endp = ep->endpoint & 0xf;
memset(&intrq->qh, 0, sizeof(intrq->qh)); memset((void *)&intrq->qh, 0, sizeof(intrq->qh));
intrq->qh.horiz_link_ptr = PS_TERMINATE; intrq->qh.horiz_link_ptr = PS_TERMINATE;
intrq->qh.epchar = ep->dev->address | intrq->qh.epchar = ep->dev->address |
(endp << QH_EP_SHIFT) | (endp << QH_EP_SHIFT) |
@ -628,7 +628,7 @@ static u8 *ehci_poll_intr_queue(void *const queue)
/* reset queue if we fully processed it after underrun */ /* reset queue if we fully processed it after underrun */
else if (intrq->qh.td.next_qtd & QTD_TERMINATE) { else if (intrq->qh.td.next_qtd & QTD_TERMINATE) {
usb_debug("resetting underrun ehci interrupt queue.\n"); usb_debug("resetting underrun ehci interrupt queue.\n");
memset(&intrq->qh.td, 0, sizeof(intrq->qh.td)); memset((void *)&intrq->qh.td, 0, sizeof(intrq->qh.td));
intrq->qh.td.next_qtd = virt_to_phys(&intrq->head->td); intrq->qh.td.next_qtd = virt_to_phys(&intrq->head->td);
} }
return ret; return ret;
@ -699,7 +699,7 @@ ehci_init (pcidev_t addr)
* and doesn't violate the standard. * and doesn't violate the standard.
*/ */
EHCI_INST(controller)->dummy_qh = (ehci_qh_t *)memalign(32, sizeof(ehci_qh_t)); EHCI_INST(controller)->dummy_qh = (ehci_qh_t *)memalign(32, sizeof(ehci_qh_t));
memset(EHCI_INST(controller)->dummy_qh, 0, memset((void *)EHCI_INST(controller)->dummy_qh, 0,
sizeof(*EHCI_INST(controller)->dummy_qh)); sizeof(*EHCI_INST(controller)->dummy_qh));
EHCI_INST(controller)->dummy_qh->horiz_link_ptr = QH_TERMINATE; EHCI_INST(controller)->dummy_qh->horiz_link_ptr = QH_TERMINATE;
for (i = 0; i < 1024; ++i) for (i = 0; i < 1024; ++i)