summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2020-12-30 19:30:30 +0800
committerIru Cai <mytbk920423@gmail.com>2020-12-30 19:30:30 +0800
commit1da105df18417410462f1b8cbff9e5241bd2dd3d (patch)
treea05e981cabf4d88b80677f104f51fc5058c4155c
parentf51fc1ffb484b94255a94fd935ae8cda4e6c1713 (diff)
downloadcoreboot-1da105df18417410462f1b8cbff9e5241bd2dd3d.tar.xz
add PchStartUsbInit
-rw-r--r--src/soc/intel/broadwell/refcode/broadwell_refcode.asm14
-rw-r--r--src/soc/intel/broadwell/refcode/usb.c23
-rw-r--r--src/soc/intel/broadwell/refcode/usb.h3
3 files changed, 34 insertions, 6 deletions
diff --git a/src/soc/intel/broadwell/refcode/broadwell_refcode.asm b/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
index 364bc1a789..c593c8fbb0 100644
--- a/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
+++ b/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
@@ -13,6 +13,8 @@ bits 32
global refcode_entry
extern finalize_usb
+extern PchStartUsbInit
+global CommonUsbInit
refcode_entry:
pushad
@@ -73,7 +75,7 @@ push edx
push dword [esi + 0x1a]
push dword [esi + 0x1e]
push eax
-call fcn_00011751 ; call 0x11751
+call PchStartUsbInit ; call 0x11751
mov eax, dword [ebp - 0xc]
pop edx
pop ecx
@@ -22408,7 +22410,7 @@ push ecx
push edx
push edx
push eax
-call fcn_00011751 ; call 0x11751
+call PchStartUsbInit ; call 0x11751
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -28482,7 +28484,7 @@ pop edi
pop ebp
ret
-fcn_00011751:
+PchStartUsbInit_:
push ebp
mov ebp, esp
push edi
@@ -28573,7 +28575,7 @@ push 0
push dword [ebp + 0x10]
push dword [ebp + 0xc]
push dword [ebp + 8]
-call fcn_000151c7 ; call 0x151c7
+call CommonUsbInit ; call 0x151c7
add esp, 0x20
mov ebx, eax
call fcn_00015480 ; call 0x15480
@@ -28661,7 +28663,7 @@ push edx
push dword [eax + 0xe]
push dword [eax + 6]
push dword [eax + 1]
-call fcn_00011751 ; call 0x11751
+call PchStartUsbInit ; call 0x11751
add esp, 0x10
mov ebx, eax
@@ -34519,7 +34521,7 @@ pop edi
pop ebp
ret
-fcn_000151c7:
+CommonUsbInit:
push ebp
mov ebp, esp
push edi
diff --git a/src/soc/intel/broadwell/refcode/usb.c b/src/soc/intel/broadwell/refcode/usb.c
index 818b40a59f..4b9dd99749 100644
--- a/src/soc/intel/broadwell/refcode/usb.c
+++ b/src/soc/intel/broadwell/refcode/usb.c
@@ -1,5 +1,6 @@
#define __SIMPLE_DEVICE__ 1
+#include <console/console.h>
#include <device/pci_ops.h>
#include <soc/rcba.h>
#include <soc/iobp.h>
@@ -7,6 +8,28 @@
#include "pch.h"
#include "usb.h"
+int PchStartUsbInit(void *usb_pol, uintptr_t ehcibar, uintptr_t xhcibar, uint8_t revision)
+{
+ printk(BIOS_DEBUG, "%s: revision is %d.\n", __func__, revision);
+ printk(BIOS_DEBUG, "EHCIBAR is 0x%lx, XHCIBAR is 0x%lx.\n", ehcibar, xhcibar);
+
+ if (usb_pol == NULL) {
+ printk(BIOS_ERR, "usb_pol pointer is NULL!\n");
+ return 0x80000002;
+ }
+
+ uint32_t rcba_fd = RCBA32(FD);
+
+ int ret = CommonUsbInit(usb_pol, ehcibar, xhcibar, 0, RCBA_BASE_ADDRESS, &rcba_fd,
+ revision);
+
+ if (ret < 0) {
+ printk(BIOS_ERR, "CommonUsbInit returns 0x%x!\n", ret);
+ }
+ RCBA32(FD) = rcba_fd;
+ return ret;
+}
+
static void finalize_ehci(void)
{
/*
diff --git a/src/soc/intel/broadwell/refcode/usb.h b/src/soc/intel/broadwell/refcode/usb.h
index 93cd3e7a8a..b394cad0c3 100644
--- a/src/soc/intel/broadwell/refcode/usb.h
+++ b/src/soc/intel/broadwell/refcode/usb.h
@@ -1,6 +1,9 @@
#ifndef BDW_REFCODE_USB_H
#define BDW_REFCODE_USB_H
+int PchStartUsbInit(void *usb_pol, uintptr_t ehcibar, uintptr_t xhcibar, uint8_t revision);
+int CommonUsbInit(void *usb_pol, uintptr_t ehcibar, uintptr_t xhcibar, uint8_t bus,
+ uintptr_t rcba, uint32_t *rcba_fd, uint8_t revision);
void finalize_usb(void);
#endif