Граф коммитов

12 Коммитов

Автор SHA1 Сообщение Дата
dependabot[bot] f4fb337925
Rust Dependency: Update scroll requirement from 0.11 to 0.12 (#399)
Updates the requirements on [scroll](https://github.com/m4b/scroll) to
permit the latest version.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 13:48:49 -05:00
John Schock 298478fa55
Implement a new version of UefiHidDxeV2 with significant improvements to unit test capability and general architecture. (#374)
## Description

This PR introduces a "v2" implementation of UefiHidDxe that has
significant refactoring to support unit tests and architectural
improvements.
- UefiHidDxeV2 code coverage with unit tests is ~80% or greater for all
modules of the UefiHidDxe crate
- Better separation between FFI layers and native rust layers 

The long term plan is to eventually remove the original UefiHidDxe in
favor of this implementation.

- [x] Impacts functionality?
- Driver provides the same functionality as UefiHidDxe which should be
considered deprecated going forward.
- [ ] Impacts security?
- [ ] Breaking change?
- [x] Includes tests?
  - Includes Rust unit tests covering all new modules.
- [x] Includes documentation?
  - Standard rustdocs included.

## How This Was Tested

Tested under QEMU using simulated USB keyboard and mouse.

## Integration Instructions

UefiHidDxeV2 is a drop-in replacement for UefiHidDxe; platforms that
wish to move to the new implementation can do so by pulling in the new
UefiHidDxeV2 and adding the necessary mockall crate to their workspace
Cargo.toml.
2023-12-14 02:55:47 +00:00
John Schock 22011420bd
Add HID Keyboard support to UefiHidDxe (#347)
## Description

Adds HID keyboard support to UefiHidDxe input driver.

- [x] Impacts functionality?
  - Adds keyboard support.
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [x] Includes documentation?
  - standard rustdocs
## How This Was Tested

Tested with USB keyboard support in QEMU. Early iterations also tested
in hardware.

## Integration Instructions
Platforms will need to add `HiiKeyboardLayout = {path =
"HidPkg/Crates/HiiKeyboardLayout"}` to the `[workspace.dependencies]` in
their cargo.toml if not already present.
2023-11-07 02:19:24 +00:00
John Schock 0033f8e82d
Add HiiKeyboardLayout crate to support UEFI HII Keyboard Layouts (#342)
## Description

This crate provides a rust wrapper around UEFI HII Keyboard Layout
structures. The relevant structures defined in the UEFI spec are not
well-suited for direct definition in rust; so this crate defines
analogous rust structures and provides serialization/deserialization
support for converting the rust structures into byte buffers and vice
versa. This crate uses the `scroll` crate
(https://github.com/m4b/scroll) to facilitate
serialization/deserialization of the Hii structures.

## Examples and Usage
Retrieving a default (en-US) layout, writing it to a buffer, and then
reading the buffer back into a rust structure:

```
 use hii_keyboard_layout::{get_default_keyboard_pkg, HiiKeyboardPkg};
 use scroll::{Pread, Pwrite};
 let mut buffer = [0u8; 4096];

 let package = get_default_keyboard_pkg();
 buffer.pwrite(&package, 0).unwrap();

 let package2: HiiKeyboardPkg = buffer.pread(0).unwrap();
 assert_eq!(package, package2);
```

- [x] Impacts functionality?
  - Introduces a new crate providing support for HII layouts.
- [ ] Impacts security?
- [ ] Breaking change?
- [x] Includes tests?
  - Includes standard rust unit tests. 
- [x] Includes documentation?
  - Includes standard rust documentation.

## How This Was Tested

Verified by included unit tests.

## Integration Instructions
This crate requires the "scroll," "num-traits" and "num-drive" crates,
so platforms intending to use it will need to add these as dependencies
in their workspace Cargo.toml files. This PR does this for the workspace
Cargo.toml that is at the root of mu_plus.

Sample:
``` 
scroll = { version = "0.11", default-features = false, features = ["derive"]}
num-traits = { version = "0.2", default-features = false}
num-derive = { version = "0.4", default-features = false}
2023-10-31 11:28:19 -04:00
Michael Kubacki f31f95c052
Use Absolute Pointer Protocol from r-efi 4.3.0 (#336)
## Description

The protocol was upstreamed to r-efi 4.3.0 and can be picked up from
there now.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

- HidPkg build and QEMU Q35 shell boot

## Integration Instructions

N/A

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2023-10-18 17:11:25 -04:00
John Schock 82177d10c7 Adds UefiHidDxe driver - written in Rust, provides input report handling for HidIo pointer devices.
Note: does not yet support HID keyboards. This is planned future work.

- [x] Impacts functionality?
Adds new input support functionality.
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [x] Includes documentation?
  - includes standard RustDocs.

Pointer verified in preboot console (UEFI setup menu and Bitlocker Recovery).

Assuming a project is setup to build rust modules generally, integration of the new stack is accomplished by:
- Remove UsbMouseAbsolutePointerDxe
- Add UsbHidDxe and UefiHidDxe to the build
2023-10-13 13:13:43 -07:00
John Schock 22829e49c4 Adds Rust protocol definition for AbsolutePointer
- [x] Impacts functionality?
Adds new input support functionality.
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [x] Includes documentation?
  - includes standard RustDocs.

Pointer verified in preboot console (UEFI setup menu and Bitlocker Recovery).

N/A
2023-10-13 13:13:43 -07:00
John Schock c926291503 Adds Rust protocol definition of HidIo.
- [x] Impacts functionality?
Adds new input support functionality.
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [x] Includes documentation?
  - includes standard RustDocs.

Pointer verified in preboot console (UEFI setup menu and Bitlocker Recovery).

N/A
2023-10-13 13:13:43 -07:00
dependabot[bot] 506de6336e
Rust Dependency: Update spin requirement from 0.5.2 to 0.9.8 (#319)
Updates the requirements on [spin](https://github.com/mvdnes/spin-rs) to
permit the latest version.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-22 15:40:31 -04:00
Michael Kubacki 42aa905ea5 MsCorePkg: Add HelloWorldRustDxe
Adds a simple Rust based DXE driver to demonstrate how to structure
a DXE driver that only has Rust crate dependencies.

Within the firmware build framework, this is considered a "pure Rust"
DXE driver in that it only has a `Cargo.toml` file in the `[Sources]`
section of the INF with no EDK II library dependencies.

The module uses the `RustAdvancedLoggerDxe` crate (which is a wrapper
around the Advanced Logger protocol) to write debug messages and the
`RustBootServicesAllocatorDxe`.

Co-authored-by: John Schock <joschock@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2023-08-29 23:02:19 -04:00
John Schock a64827e7d5 MsCorePkg: Add RustBootServicesAllocatorDxe
Adds a library crate that implements a global allocator based on
`AllocatePool()`. Memory is allocated from the
`EFI_BOOT_SERVICES_DATA` pool.
2023-08-29 23:02:19 -04:00
Michael Kubacki 8f37c52e2f AdvLoggerPkg: Add RustAdvancedLoggerDxe
Adds a library crate that serves as a Rust wrapper for access to
the Advanced Logger protocol.

Co-authored-by: John Schock <joschock@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2023-08-24 21:29:13 -04:00