libpayload: Fix initialization of OHCI driver

This fixes some memory corruption, leaking and padding issues within
the initialization of the OHCI driver.

Change-Id: If6891f2a53e339d32c4324f4c9e0b1ed07596a60
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1126
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
This commit is contained in:
Nico Huber
2012-06-20 11:37:17 +02:00
parent 9951adeffd
commit 542fe85da9
2 changed files with 21 additions and 15 deletions

View File

@@ -189,22 +189,15 @@
volatile u32 HcRhPortStatus[];
} __attribute__ ((packed)) opreg_t;
typedef struct {
typedef struct { /* should be 256 bytes according to spec */
u32 HccaInterruptTable[32];
volatile u16 HccaFrameNumber;
volatile u16 HccaPad1;
volatile u32 HccaDoneHead;
u8 reserved[116]; // pad to 256 byte
u8 reserved[116]; /* pad according to spec */
u8 what[4]; /* really pad to 256 as spec only covers 252 */
} __attribute__ ((packed)) hcca_t;
typedef struct ohci {
opreg_t *opreg;
hcca_t *hcca;
usbdev_t *roothub;
} ohci_t;
typedef enum { OHCI_SETUP=0, OHCI_OUT=1, OHCI_IN=2, OHCI_FROM_TD=3 } ohci_pid_t;
typedef volatile struct {
u32 config;
u32 tail_pointer;
@@ -259,4 +252,13 @@
#define OHCI_INST(controller) ((ohci_t*)((controller)->instance))
typedef struct ohci {
opreg_t *opreg;
hcca_t *hcca;
usbdev_t *roothub;
ed_t *periodic_ed;
} ohci_t;
typedef enum { OHCI_SETUP=0, OHCI_OUT=1, OHCI_IN=2, OHCI_FROM_TD=3 } ohci_pid_t;
#endif