Page MenuHomePhabricator

Support dcc console in ATF
Open, NormalPublic


I added the dcc console in the ATF code in the below path

int32_t console_core_putc(int32_t ch, unsigned long base_addr)

while (__dcc_getstatus() & DCC_STATUS_TX)
return ch;


int32_t console_core_getc(unsigned long base_addr)

while (!(__dcc_getstatus() & DCC_STATUS_RX))
return __dcc_getchar();

static inline void __dcc_putchar(char c)

 * The typecast is to make absolutely certain that 'c' is
 * zero-extended.
__asm__ volatile("msr dbgdtrtx_el0, %0"
             : : "r" ((unsigned long)(unsigned char)c));


And i just included the "drivers/console/aarch64/deprecated_console.S"
which has the console_core_init and console_core_putc etc function calls.

But now i upgraded the ATF to V2.2 and i see the console architecture got changed a lot.
Could you please let me know if i want to port the DCC console to the ATF V2.2 what are the changes need to be done?


Event Timeline

vabbarap triaged this task as Normal priority.Dec 2 2019, 12:41 PM
vabbarap created this task.

You'll probably want to write a function like this:

int console_ddc_register(void) {
  static console_t ddc_console;
  ddc_console.putc = ddc_putc;
  ddc_console.getc = ddc_getc;
  return console_register(&ddc_console);

Rename your putc/getc functions to ddc_putc and ddc_getc and make them static. Then add a call to console_ddc_register() somewhere early in the platform init for platforms you want to use this console.

Thanks @jwerner. Will try this.