Long ago we agreed on kicking the _direct appendix because everything in
[coreboot.git] / src / pc80 / usbdebug_serial.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
16  */
17
18 #include "../lib/usbdebug.c"
19
20 static void early_usbdebug_direct_init(void)
21 {
22         struct ehci_debug_info *dbg_info = (struct ehci_debug_info *)
23             (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
24
25         usbdebug_direct_init(EHCI_BAR, EHCI_DEBUG_OFFSET, dbg_info);
26 }
27
28 void usbdebug_direct_tx_byte(unsigned char data)
29 {
30         struct ehci_debug_info *dbg_info;
31
32         /* "Find" dbg_info structure in Cache */
33         dbg_info = (struct ehci_debug_info *)
34             (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
35
36         if (dbg_info->ehci_debug) {
37                 dbgp_bulk_write_x(dbg_info, &data, 1);
38         }
39 }
40
41 void usbdebug_direct_ram_tx_byte(unsigned char data)
42 {
43         struct ehci_debug_info *dbg_info;
44
45         /* "Find" dbg_info structure in RAM */
46         dbg_info = (struct ehci_debug_info *)
47             ((CONFIG_RAMTOP) - sizeof(struct ehci_debug_info));
48
49         if (dbg_info->ehci_debug) {
50                 dbgp_bulk_write_x(dbg_info, &data, 1);
51         }
52 }