usbdebug: Cleanup dbgp_ehci_info call

Change-Id: I9cad64796fcfb7a50d9ed9ec95c56ab855c872e3
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3766
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki 2013-07-11 07:49:46 +03:00 committed by Stefan Reinauer
parent 2c516ed3f3
commit cbe2edefb9
2 changed files with 17 additions and 8 deletions

View File

@ -62,9 +62,8 @@ int dbgp_bulk_read_x(struct ehci_debug_info *dbg_info, void *data, int size);
void set_debug_port(unsigned port); void set_debug_port(unsigned port);
int usbdebug_init(void); int usbdebug_init(void);
struct ehci_debug_info *dbgp_ehci_info(void); struct ehci_debug_info *dbgp_console_output(void);
#define dbgp_console_output dbgp_ehci_info struct ehci_debug_info *dbgp_console_input(void);
#define dbgp_console_input dbgp_ehci_info
int dbgp_ep_is_active(struct ehci_debug_info *dbg_info); int dbgp_ep_is_active(struct ehci_debug_info *dbg_info);
void usbdebug_tx_byte(struct ehci_debug_info *info, unsigned char data); void usbdebug_tx_byte(struct ehci_debug_info *info, unsigned char data);
void usbdebug_tx_flush(struct ehci_debug_info *info); void usbdebug_tx_flush(struct ehci_debug_info *info);

View File

@ -94,6 +94,11 @@ static struct device_operations *ehci_drv_ops;
static struct device_operations ehci_dbg_ops; static struct device_operations ehci_dbg_ops;
#endif #endif
static inline struct ehci_debug_info *dbgp_ehci_info(void)
{
return car_get_var_ptr(&glob_dbg_info);
}
static int dbgp_wait_until_complete(struct ehci_dbg_port *ehci_debug) static int dbgp_wait_until_complete(struct ehci_dbg_port *ehci_debug)
{ {
u32 ctrl; u32 ctrl;
@ -603,7 +608,7 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
#if !defined(__PRE_RAM__) && !defined(__SMM__) #if !defined(__PRE_RAM__) && !defined(__SMM__)
static void usbdebug_re_enable(unsigned ehci_base) static void usbdebug_re_enable(unsigned ehci_base)
{ {
struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); struct ehci_debug_info *dbg_info = dbgp_ehci_info();
unsigned diff; unsigned diff;
if (!dbg_info->ehci_debug) if (!dbg_info->ehci_debug)
@ -618,7 +623,7 @@ static void usbdebug_re_enable(unsigned ehci_base)
static void usbdebug_disable(void) static void usbdebug_disable(void)
{ {
struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); struct ehci_debug_info *dbg_info = dbgp_ehci_info();
dbg_info->status &= ~DBGP_EP_ENABLED; dbg_info->status &= ~DBGP_EP_ENABLED;
} }
@ -661,14 +666,19 @@ int dbgp_ep_is_active(struct ehci_debug_info *dbg_info)
return (dbg_info->status & DBGP_EP_STATMASK) == (DBGP_EP_VALID | DBGP_EP_ENABLED); return (dbg_info->status & DBGP_EP_STATMASK) == (DBGP_EP_VALID | DBGP_EP_ENABLED);
} }
struct ehci_debug_info *dbgp_ehci_info(void) struct ehci_debug_info *dbgp_console_input(void)
{ {
return car_get_var_ptr(&glob_dbg_info); return dbgp_ehci_info();
}
struct ehci_debug_info *dbgp_console_input(void)
{
return dbgp_ehci_info();
} }
int usbdebug_init(void) int usbdebug_init(void)
{ {
struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); struct ehci_debug_info *dbg_info = dbgp_ehci_info();
#if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE #if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE
enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT); enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);