Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e074c6d
libefiwrapper/Makefile: add the missing eraseblk.o
jeremy-compostella Sep 11, 2020
9aea75b
drivers/lpmemmap: comply with UEFI specification
jeremy-compostella Sep 11, 2020
5abe1f5
libefiwrapper: support LoadImage() and StartImage() Boot Services
jeremy-compostella Sep 11, 2020
f9dc6dc
libefiwrapper/pe: clean-up: make get_section_boundaries() static
jeremy-compostella Sep 11, 2020
9c574c5
libefiwrapper/pe: support 32-bits images relocation
jeremy-compostella Sep 11, 2020
3d8cc46
libefiwrapper/conin: implement a simple ReadKeyStroke()
jeremy-compostella Sep 11, 2020
9fb270c
libefiwrapper/pe: support 64-bits images
jeremy-compostella Sep 17, 2020
4f0c46c
libefiwrapper: use putchar() to send a simple character
jeremy-compostella Sep 18, 2020
b1051b6
libefiwrapper/conout: implement missing output interface functions
jeremy-compostella Sep 18, 2020
0dcf7d7
libefiwrapper/protocol: add LocateProtocol() support
jeremy-compostella Sep 18, 2020
edb9c79
drivers/gop: support 64-bits compilation
jeremy-compostella Sep 18, 2020
ff9c68e
libefiwrapper/ewacpi: support 64-bits compilation
jeremy-compostella Sep 18, 2020
1c70a16
drivers/sdhci_mmc: clean-up: do not mixup int and EFI_STATUS types
jeremy-compostella Sep 18, 2020
f150d12
drivers/gop: set the default mode to 0
jeremy-compostella Sep 22, 2020
9d9717d
drivers/dw3: support 64-bits compilation
jeremy-compostella Sep 22, 2020
77d44e7
libefiwrapper/conin: initialize WaitForKey to an arbitrary value
jeremy-compostella Sep 22, 2020
08e1f79
drivers/lpkey: create a driver to report keys based on havekey()
jeremy-compostella Sep 22, 2020
cabbba7
drivers/lppci: minimal PCI Root Bridge IO Protocol implementation
jeremy-compostella Sep 24, 2020
0f0d3b3
drivers/heci: support the HECI2 protocol
jeremy-compostella Sep 25, 2020
99bc86c
03.03
jeremy-compostella Sep 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/dw3/dw3.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ _usb_init_xdci(EFI_USB_DEVICE_MODE_PROTOCOL *This)
PCI_BUS(pci_dev), PCI_SLOT(pci_dev), PCI_FUNC(pci_dev));

config_params.BaseAddress = (UINTN)pci_read_bar64(pci_dev);
ewdbg("xDCI BaseAddress =0x%llx\n", (uint64_t)config_params.BaseAddress);
ewdbg("xDCI BaseAddress =0x%" PRIx64 "\n", (uint64_t)config_params.BaseAddress);

/* configure xDCI as a system bus master */
pci_command = pci_read_config32(pci_dev, PCI_COMMAND);
Expand All @@ -845,7 +845,7 @@ _usb_init_xdci(EFI_USB_DEVICE_MODE_PROTOCOL *This)
PCI_BUS(pci_dev), PCI_SLOT(pci_dev), PCI_FUNC(pci_dev));

addr_hci = (UINTN)pci_read_bar64(pci_dev);
ewdbg("xHCI BaseAddress =0x%llx\n", (uint64_t)addr_hci);
ewdbg("xHCI BaseAddress =0x%" PRIx64 "\n", (uint64_t)addr_hci);

/* enable xHCI bus master and I/O access */
pci_command = pci_read_config32(pci_dev, PCI_COMMAND);
Expand Down
20 changes: 13 additions & 7 deletions drivers/gop/gop.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (c) 2018-2020, Intel Corporation
* All rights reserved.
*
* Authors: Jérémy Compostella <[email protected]>
Expand Down Expand Up @@ -96,7 +96,7 @@ query_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
static void get_resolution(pcidev_t dev, UINT32 *width, UINT32 *height,
size_t *pipe)
{
uint32_t mmio, size;
unsigned long mmio, size;
size_t i;

mmio = pci_read_config32(dev, 0x10) & ~0xf;
Expand All @@ -114,7 +114,7 @@ static void get_resolution(pcidev_t dev, UINT32 *width, UINT32 *height,

static uint8_t *get_framebuffer(pcidev_t dev, size_t pipe)
{
uint32_t mmio, gmaddr, surf;
unsigned long mmio, gmaddr, surf;

mmio = pci_read_config32(dev, 0x10) & ~0xf;
surf = read32((void *)(mmio + PLANE_SURF + pipe * PIPE_OFFSET));
Expand All @@ -125,7 +125,7 @@ static uint8_t *get_framebuffer(pcidev_t dev, size_t pipe)

static void set_efi_color_order(pcidev_t dev)
{
uint32_t mmio, ctl, surf;
unsigned long mmio, ctl, surf;
size_t i;

mmio = pci_read_config32(dev, 0x10) & ~0xf;
Expand Down Expand Up @@ -251,6 +251,7 @@ static EFI_STATUS gop_init(EFI_SYSTEM_TABLE *st)
};
pcidev_t pci_dev = 0;
size_t i;
EFI_STATUS ret;

if (!st)
return EFI_INVALID_PARAMETER;
Expand All @@ -277,9 +278,14 @@ static EFI_STATUS gop_init(EFI_SYSTEM_TABLE *st)
if (!info.HorizontalResolution || !info.VerticalResolution)
return EFI_SUCCESS;

return interface_init(st, &gop_guid, &gop_handle,
&gop_default, sizeof(gop_default),
(void **)&gop);
ret = interface_init(st, &gop_guid, &gop_handle,
&gop_default, sizeof(gop_default),
(void **)&gop);
if (EFI_ERROR(ret))
return ret;

set_mode((EFI_GRAPHICS_OUTPUT_PROTOCOL *)gop, 0);
return EFI_SUCCESS;
}

static EFI_STATUS gop_exit(EFI_SYSTEM_TABLE *st)
Expand Down
105 changes: 101 additions & 4 deletions drivers/heci/heci.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@
#include "ewlog.h"
#include "heci_impl.h"
#include "heci_protocol.h"
#include "heci2_protocol.h"

#define UNUSED_PARAM __attribute__((__unused__))

#define CPMS 19200
#define HPET_BASE_ADDRESS 0xFED00000
#define ClockCycles() read32((void *)(HPET_BASE_ADDRESS + 0xf0))

static EFI_HECI_PROTOCOL *heci;

static void init_timer(void)
{
uint32_t reg;
Expand Down Expand Up @@ -574,9 +577,77 @@ static EFI_STATUS EFIAPI HeciSubmitCommand(
return EFI_UNSUPPORTED;
}

static EFIAPI EFI_STATUS
heci2_send_w_ack(UNUSED_PARAM HECI2_DEVICE HeciDev,
UINT32 *Message,
UINT32 Length,
UINT32 *RecLength,
UINT8 HostAddress,
UINT8 MEAddress)
{
return heci->SendwACK(Message, Length, RecLength, HostAddress, MEAddress);
}

static EFIAPI EFI_STATUS
heci2_read_msg(UNUSED_PARAM HECI2_DEVICE HeciDev,
UINT32 Blocking,
UINT32 *MessageBody,
UINT32 *Length)
{
return heci->ReadMsg(Blocking, MessageBody, Length);
}

static EFIAPI EFI_STATUS
heci2_send_msg(UNUSED_PARAM HECI2_DEVICE HeciDev,
UINT32 *Message,
UINT32 Length,
UINT8 HostAddress,
UINT8 MEAddress)
{
return heci->SendMsg(Message, Length, HostAddress, MEAddress);
}

static EFIAPI EFI_STATUS
heci2_reset_heci(UNUSED_PARAM HECI2_DEVICE HeciDev)
{
return heci->ResetHeci();
}

static EFIAPI EFI_STATUS
heci2_init_heci(UNUSED_PARAM HECI2_DEVICE HeciDev)
{
return heci->InitHeci();
}

static EFIAPI EFI_STATUS
heci2_me_reset_wait(UNUSED_PARAM HECI2_DEVICE HeciDev,
UINT32 Delay)
{
return heci->SeCResetWait(Delay);
}

static EFIAPI EFI_STATUS
heci2_re_init_heci(UNUSED_PARAM HECI2_DEVICE HeciDev)
{
return heci->ReInitHeci();
}

static EFIAPI EFI_STATUS
heci2_get_me_status(UNUSED_PARAM UINT32 *Status)
{
return heci->GetSeCStatus(Status);
}

static EFIAPI EFI_STATUS
heci2_get_me_mode(UINT32 *Mode)
{
return heci->GetSeCMode(Mode);
}

static EFI_GUID heci_guid = HECI_PROTOCOL_GUID;
static EFI_HANDLE handle;
static EFI_GUID heci2_guid = EFI_HECI2_PROTOCOL_GUID;
static EFI_HANDLE handle2;

static EFI_STATUS heci_init(EFI_SYSTEM_TABLE * st)
{
Expand All @@ -594,11 +665,37 @@ static EFI_STATUS heci_init(EFI_SYSTEM_TABLE * st)
.EnableSeCPG = HeciEnableSeCPG,
.HeciSubmitCommand = HeciSubmitCommand,
};
EFI_HECI_PROTOCOL *heci_drv;
static struct EFI_HECI2_PROTOCOL_ heci2_default = {
.SendwACK = heci2_send_w_ack,
.ReadMsg = heci2_read_msg,
.SendMsg = heci2_send_msg,
.ResetHeci = heci2_reset_heci,
.InitHeci = heci2_init_heci,
.MeResetWait = heci2_me_reset_wait,
.ReInitHeci = heci2_re_init_heci,
.GetMeStatus = heci2_get_me_status,
.GetMeMode = heci2_get_me_mode
};
EFI_STATUS ret;
EFI_HECI2_PROTOCOL *heci2_drv;

ret = interface_init(st, &heci_guid, &handle,
&heci_default, sizeof(heci_default),
(void **)&heci);
if (EFI_ERROR(ret)) {
ewerr("Failed to register HECI protocol");
return ret;
}

ret = interface_init(st, &heci2_guid, &handle2,
&heci2_default, sizeof(heci2_default),
(void **)&heci2_drv);
if (EFI_ERROR(ret)) {
ewerr("Failed to register HECI2 protocol");
interface_free(st, &heci_guid, handle);
}

return interface_init(st, &heci_guid, &handle,
&heci_default, sizeof(heci_default),
(void **)&heci_drv);
return ret;
}

static EFI_STATUS heci_exit(EFI_SYSTEM_TABLE * st)
Expand Down
100 changes: 100 additions & 0 deletions drivers/heci/heci2_protocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/** @file
This protocol provides services for HECI communucation.
See more details in https://github.com/intel/efiwrapper.

Copyright (c) 2019, vit9696. All rights reserved.<BR>
Portions copyright 1999 - 2017 Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause
**/

#ifndef EFI_HECI2_H
#define EFI_HECI2_H

#define EFI_HECI2_PROTOCOL_GUID \
{ 0x3C7BC880, 0x41F8, 0x4869, { 0xAE, 0xFC, 0x87, 0x0A, 0x3E, 0xD2, 0x82, 0x99 } }

typedef UINT32 HECI2_DEVICE;
#define HECI_DEFAULT_DEVICE (0)

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_SENDWACK) (
IN HECI2_DEVICE HeciDev,
IN OUT UINT32 *Message,
IN OUT UINT32 Length,
IN OUT UINT32 *RecLength,
IN UINT8 HostAddress,
IN UINT8 MEAddress
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_READ_MESSAGE) (
IN HECI2_DEVICE HeciDev,
IN UINT32 Blocking,
IN UINT32 *MessageBody,
IN OUT UINT32 *Length
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_SEND_MESSAGE) (
IN HECI2_DEVICE HeciDev,
IN UINT32 *Message,
IN UINT32 Length,
IN UINT8 HostAddress,
IN UINT8 MEAddress
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_RESET) (
IN HECI2_DEVICE HeciDev
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_INIT) (
IN HECI2_DEVICE HeciDev
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_REINIT) (
IN HECI2_DEVICE HeciDev
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_RESET_WAIT) (
IN HECI2_DEVICE HeciDev,
IN UINT32 Delay
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_GET_ME_STATUS) (
OUT UINT32 *Status
);

typedef
EFI_STATUS
(EFIAPI *EFI_HECI2_GET_ME_MODE) (
OUT UINT32 *Mode
);

typedef struct EFI_HECI2_PROTOCOL_ {
EFI_HECI2_SENDWACK SendwACK;
EFI_HECI2_READ_MESSAGE ReadMsg;
EFI_HECI2_SEND_MESSAGE SendMsg;
EFI_HECI2_RESET ResetHeci;
EFI_HECI2_INIT InitHeci;
EFI_HECI2_RESET_WAIT MeResetWait;
EFI_HECI2_REINIT ReInitHeci;
EFI_HECI2_GET_ME_STATUS GetMeStatus;
EFI_HECI2_GET_ME_MODE GetMeMode;
} EFI_HECI2_PROTOCOL;

extern EFI_GUID gEfiHeci2ProtocolGuid;

#endif // EFI_HECI2_H
Loading