summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/broadwell/refcode/Makefile.inc1
-rw-r--r--src/soc/intel/broadwell/refcode/broadwell_refcode.asm107
-rw-r--r--src/soc/intel/broadwell/refcode/main.c44
-rw-r--r--src/soc/intel/broadwell/refcode/refcode.h15
-rw-r--r--src/soc/intel/broadwell/refcode/usb.h2
5 files changed, 120 insertions, 49 deletions
diff --git a/src/soc/intel/broadwell/refcode/Makefile.inc b/src/soc/intel/broadwell/refcode/Makefile.inc
index a6cd5fdbfc..a8a4a146f2 100644
--- a/src/soc/intel/broadwell/refcode/Makefile.inc
+++ b/src/soc/intel/broadwell/refcode/Makefile.inc
@@ -3,6 +3,7 @@ romstage-y += printk.c
ramstage-libs += $(obj)/broadwell_refcode.o
ramstage-y += usb.c
+ramstage-y += main.c
$(obj)/%.o: $(src)/soc/intel/broadwell/refcode/%.asm
echo "NASM $@"
diff --git a/src/soc/intel/broadwell/refcode/broadwell_refcode.asm b/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
index c593c8fbb0..f6b40b2cbc 100644
--- a/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
+++ b/src/soc/intel/broadwell/refcode/broadwell_refcode.asm
@@ -16,17 +16,26 @@ extern finalize_usb
extern PchStartUsbInit
global CommonUsbInit
+extern broadwell_refcode_main
+global refcode_ppi_guid
+global refcode_locate_ppi
+global refcode_init
+global refcode_locate_ppi
+global InstallPchInitPpi
+global init_system_agent
+global PchInitialize
+
refcode_entry:
pushad
mov eax, dword [esp + 0x24]
push eax
-call fcn_00000012 ; call 0x12
+call broadwell_refcode_main ; call 0x12
pop ecx
mov dword [esp + 0x1c], eax
popad
ret
-fcn_00000012:
+refcode_main:
push ebp
mov ebp, esp
push esi
@@ -34,7 +43,7 @@ push ebx
sub esp, 0x1c
mov esi, dword [ebp + 8]
push esi
-call fcn_00016434 ; call 0x16434
+call refcode_init ; call 0x16434
add esp, 0x10
mov ebx, eax
test eax, eax
@@ -46,27 +55,27 @@ pop eax
pop edx
push ebx
push 0
-call fcn_0000e020 ; call 0xe020
+call InstallPchInitPpi ; call 0xe020
mov dword [esp], ref_0002069a ; mov dword [esp], 0x2069a
call fcn_0001545e ; call 0x1545e
pop ecx
pop eax
push ebx
push 0
-call fcn_0000058b ; call 0x58b
+call init_system_agent ; call 0x58b
mov dword [esp], ref_000206b5 ; mov dword [esp], 0x206b5
call fcn_0001545e ; call 0x1545e
add esp, 0xc
push 0
push 0
push ebx
-call fcn_0000d87f ; call 0xd87f
+call PchInitialize ; call 0xd87f
lea eax, [ebp - 0xc]
push eax
push 0
push 0
-push ref_000291dc ; push 0x291dc
-call fcn_0001975d ; call 0x1975d
+push refcode_ppi_guid ; push 0x291dc
+call refcode_locate_ppi ; call 0x1975d
mov eax, dword [ebp - 0xc]
add esp, 0x20
movzx edx, byte [eax]
@@ -118,7 +127,7 @@ push eax
push 0
push 0
push ref_0002930c ; push 0x2930c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x20
mov esi, eax
call fcn_00015480 ; call 0x15480
@@ -431,7 +440,7 @@ push eax
push 0
push 0
push ref_0002928c ; push 0x2928c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -603,7 +612,7 @@ mov ebx, dword [ebp - 4]
leave
ret
-fcn_0000058b:
+init_system_agent:
push ebp
mov ebp, esp
push edi
@@ -618,7 +627,7 @@ push eax
push 0
push 0
push ref_0002930c ; push 0x2930c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -922,7 +931,7 @@ push 0
push 0
push ref_0002932c ; push 0x2932c
mov dword [ebp - 0x1c], 0
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov eax, dword [ebp - 0x1c]
add esp, 0x10
test eax, eax
@@ -1061,7 +1070,7 @@ push eax
push 0
push 0
push ref_0002919c ; push 0x2919c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x20
mov dword [ebp - 0x3c], eax
call fcn_00015480 ; call 0x15480
@@ -1573,7 +1582,7 @@ push 0
push 0
push ref_000290cc ; push 0x290cc
mov dword [ebp - 0x20], 0
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -2432,8 +2441,8 @@ lea eax, [ebp - 0x20]
push eax
push 0
push 0
-push ref_000291dc ; push 0x291dc
-call fcn_0001975d ; call 0x1975d
+push refcode_ppi_guid ; push 0x291dc
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -2860,7 +2869,7 @@ push eax
push 0
push 0
push ref_000290cc ; push 0x290cc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov esi, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -3212,7 +3221,7 @@ push eax
push 0
push 0
push ref_000291ac ; push 0x291ac
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x20
mov dword [ebp - 0x2c], eax
call fcn_00015480 ; call 0x15480
@@ -3244,7 +3253,7 @@ push eax
push 0
push 0
push ref_0002917c ; push 0x2917c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov dword [ebp - 0x2c], eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -3488,9 +3497,9 @@ lea eax, [ebp - 0x1c]
push eax
push 0
push 0
-push ref_000291dc ; push 0x291dc
+push refcode_ppi_guid ; push 0x291dc
mov dword [ebp - 0x2c], edx
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x20
mov esi, eax
call fcn_00015480 ; call 0x15480
@@ -3618,7 +3627,7 @@ push eax
push 0
push 0
push ref_000291ac ; push 0x291ac
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -4305,7 +4314,7 @@ push eax
push 0
push 0
push ref_000290cc ; push 0x290cc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -7775,7 +7784,7 @@ push eax
push 0
push 0
push ref_000290cc ; push 0x290cc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -10910,7 +10919,7 @@ push eax
push 0
push 0
push ref_0002913c ; push 0x2913c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -13657,7 +13666,7 @@ push eax
push 0
push 0
push ref_000291fc ; push 0x291fc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -19435,7 +19444,7 @@ push eax
push 0
push 0
push ref_0002911c ; push 0x2911c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
test eax, eax
jne short loc_0000beea ; jne 0xbeea
@@ -19490,8 +19499,8 @@ lea eax, [ebp - 0x20]
push eax
push 0
push ebx
-push ref_000291dc ; push 0x291dc
-call fcn_0001975d ; call 0x1975d
+push refcode_ppi_guid ; push 0x291dc
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
test eax, eax
je short loc_0000bf36 ; je 0xbf36
@@ -21115,7 +21124,7 @@ push eax
push 0
push 0
push ref_0002913c ; push 0x2913c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov esi, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -22011,7 +22020,7 @@ pop edi
pop ebp
ret
-fcn_0000d87f:
+PchInitialize:
push ebp
mov ebp, esp
push edi
@@ -22042,8 +22051,8 @@ lea eax, [ebp - 0x20]
push eax
push 0
push 0
-push ref_000291dc ; push 0x291dc
-call fcn_0001975d ; call 0x1975d
+push refcode_ppi_guid ; push 0x291dc
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x20
mov edi, eax
call fcn_00015480 ; call 0x15480
@@ -22759,7 +22768,7 @@ pop edi
pop ebp
ret
-fcn_0000e020:
+InstallPchInitPpi:
push ebp
mov ebp, esp
push esi
@@ -27346,7 +27355,7 @@ push 0
push 0
push ref_0002917c ; push 0x2917c
mov dword [ebp - 0x1c], 0
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -28652,7 +28661,7 @@ push eax
push 0
push 0
push ref_000291bc ; push 0x291bc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
mov ebx, eax
test eax, eax
@@ -30759,7 +30768,7 @@ push 0
push ebx
push ref_0002912c ; push 0x2912c
mov dword [ebp - 0x1c], 0
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
test eax, eax
jne short loc_00012e18 ; jne 0x12e18
@@ -36378,7 +36387,7 @@ loc_00016432: ; not directly referenced
pop ebp
ret
-fcn_00016434:
+refcode_init:
push ebp
mov ebp, esp
push ebx
@@ -42461,7 +42470,7 @@ call dword [edx + 0x1c] ; ucall
leave
ret
-fcn_0001975d:
+refcode_locate_ppi:
push ebp
mov ebp, esp
sub esp, 8
@@ -44247,7 +44256,7 @@ push eax
push 0
push 0
push ref_000290bc ; push 0x290bc
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
mov ebx, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -45265,8 +45274,8 @@ lea eax, [ebp - 0xc]
push eax
push 0
push 0
-push ref_000291dc ; push 0x291dc
-call fcn_0001975d ; call 0x1975d
+push refcode_ppi_guid ; push 0x291dc
+call refcode_locate_ppi ; call 0x1975d
mov esi, eax
call fcn_00015480 ; call 0x15480
add esp, 0x10
@@ -46377,7 +46386,7 @@ push 0
push 0
push 0
push ref_0002909c ; push 0x2909c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
test eax, eax
jne short loc_0001ba89 ; jne 0x1ba89
@@ -46402,7 +46411,7 @@ push edi
push 0
push ebx
push ref_0002915c ; push 0x2915c
-call fcn_0001975d ; call 0x1975d
+call refcode_locate_ppi ; call 0x1975d
add esp, 0x10
mov esi, eax
test eax, eax
@@ -49997,7 +50006,7 @@ loc_0001e035:
mov eax, dword [ebp - 0x20]
xor edi, edi
mov dword [eax], 0x80000010
-mov dword [eax + 4], ref_000291dc ; mov dword [eax + 4], 0x291dc
+mov dword [eax + 4], refcode_ppi_guid ; mov dword [eax + 4], 0x291dc
mov dword [eax + 8], ebx
lea eax, [ebx + 0x284]
mov byte [ebx], 0xc
@@ -55790,8 +55799,8 @@ dd 0x0118f618
ref_00026f5c:
dd 0x00000020
-dd ref_000291dc
-dd fcn_0000d87f
+dd refcode_ppi_guid
+dd PchInitialize
dd 0x80000040
dd ref_0002909c
dd fcn_0000be41
@@ -58122,7 +58131,7 @@ dd 0x4547693e
dd 0x822100a3
dd 0xb220a43c
-ref_000291dc:
+refcode_ppi_guid:
dd 0x50031131
dd 0x43ef4f24
dd 0x3773afb7
diff --git a/src/soc/intel/broadwell/refcode/main.c b/src/soc/intel/broadwell/refcode/main.c
new file mode 100644
index 0000000000..7e2e234c5e
--- /dev/null
+++ b/src/soc/intel/broadwell/refcode/main.c
@@ -0,0 +1,44 @@
+#include "usb.h"
+#include "refcode.h"
+
+struct _MRC_PEI_SERVICES;
+typedef struct _MRC_PEI_SERVICES MRC_PEI_SERVICES;
+struct _refcode_struct;
+typedef struct _refcode_struct refcode_struct;
+
+MRC_PEI_SERVICES ** refcode_init(struct pei_data *);
+int InstallPchInitPpi(int, MRC_PEI_SERVICES **);
+int init_system_agent(int, MRC_PEI_SERVICES **);
+int PchInitialize(int, MRC_PEI_SERVICES **);
+
+static inline void*
+get_usb_policy(refcode_struct *r)
+{
+ return (void*)r + 644;
+}
+
+static inline uint8_t
+get_revision(refcode_struct *r)
+{
+ return *(uint8_t*)(r);
+}
+
+int broadwell_refcode_main(struct pei_data *pei_data)
+{
+ MRC_PEI_SERVICES **pei_pointer;
+ refcode_struct *refcode_struct_ptr;
+
+ pei_pointer = refcode_init(pei_data);
+ if (pei_pointer == NULL)
+ return -1;
+
+ InstallPchInitPpi(0, pei_pointer);
+ init_system_agent(0, pei_pointer);
+ PchInitialize(0, pei_pointer);
+ refcode_locate_ppi(&refcode_ppi_guid, 0, 0, (void**)(&refcode_struct_ptr));
+ PchStartUsbInit(get_usb_policy(refcode_struct_ptr),
+ pei_data->ehcibar, pei_data->xhcibar,
+ get_revision(refcode_struct_ptr));
+ finalize_usb();
+ return 0;
+}
diff --git a/src/soc/intel/broadwell/refcode/refcode.h b/src/soc/intel/broadwell/refcode/refcode.h
new file mode 100644
index 0000000000..2a34ec7593
--- /dev/null
+++ b/src/soc/intel/broadwell/refcode/refcode.h
@@ -0,0 +1,15 @@
+#ifndef _SOC_INTEL_BROADWELL_REFCODE_REFCODE_H_
+#define _SOC_INTEL_BROADWELL_REFCODE_REFCODE_H_
+
+#include "soc/pei_data.h"
+
+struct EFI_GUID {
+ char guid[16];
+};
+
+extern struct EFI_GUID refcode_ppi_guid;
+
+int refcode_locate_ppi(struct EFI_GUID *g, int, int, void **ppi);
+int broadwell_refcode_main(struct pei_data *pei_data);
+
+#endif
diff --git a/src/soc/intel/broadwell/refcode/usb.h b/src/soc/intel/broadwell/refcode/usb.h
index b394cad0c3..e3b262d4a4 100644
--- a/src/soc/intel/broadwell/refcode/usb.h
+++ b/src/soc/intel/broadwell/refcode/usb.h
@@ -1,6 +1,8 @@
#ifndef BDW_REFCODE_USB_H
#define BDW_REFCODE_USB_H
+#include <types.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);