Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[STALE] add SCSI Protocol support#1155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
sky5454 wants to merge12 commits intorust-osdev:main
base:main
Choose a base branch
Loading
fromsky5454:main

Conversation

sky5454
Copy link
Contributor

@sky5454sky5454 commentedMay 1, 2024
edited by phip1611
Loading

Steps to Undraft

  • Restart the work (PR ist stale for over 1 year now)

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See theRewriting History guide for help.
  • Update the changelog (if necessary)

Only preliminary support.
some problem I faced:

  • the buffer of I/O data. maybe the best way is to wrap byReader/Writer trait
    • uefi-raw/src/protocol/scsi.rs: ScsiIoProtocol::execute_scsi_command()
    • uefi/src/proto/scsi.rs: ExtScsiPassThru::pass_thru()
    • wrap and make theScsiIoScsiRequestPacket/ExtScsiIoScsiRequestPacket to be conveniently used in Rust
  • The dev path which using theDevice Path Protocol
  • TARGET_MAX_BYTES unused, for: The Target is an array of size TARGET_MAX_BYTES and it represents the id of the SCSI device to send the SCSI Request Packet.
  • The naming rule of enum.
  • The data sync with c and rust ffi, vec <-> c data ptr and len.
#[derive(Debug)]#[repr(C)]pubstructScsiIoScsiRequestPacket{pubtimeout:u64,/// DataBuffer: A pointer to the data buffer to transfer from or to the SCSI device.///  - InDataBuffer: A pointer to the data buffer to transfer between the SCSI controller and the SCSI device for SCSI READ command. For all SCSI WRITE Commands this must point to NULL .///  - OutDataBuffer: A pointer to the data buffer to transfer between the SCSI controller and the SCSI device for SCSI WRITE command. For all SCSI READ commands this field must point to NULL .pubin_data_buffer:*mutc_void,pubout_data_buffer:*mutc_void,pubsense_data:*mutc_void,pubcdb:*mutc_void,pubin_transfer_length:u32,pubout_transfer_length:u32,pubcdb_length:u8,pubdata_direction:DataDirection,pubhost_adapter_status:HostAdapterStatus,pubtarget_status:TargetStatus,pubsense_data_length:u8,}#[derive(Debug)]#[repr(C)]pubstructExtScsiIoScsiRequestPacket{pubtimeout:u64,pubin_data_buffer:*mutc_void,pubout_data_buffer:*mutc_void,pubsense_data:*mutc_void,pubcdb:*mutc_void,pubin_transfer_length:u32,pubout_transfer_length:u32,pubcdb_length:u8,pubdata_direction:ExtDataDirection,pubhost_adapter_status:ExtHostAdapterStatus,pubtarget_status:ExtTargetStatus,pubsense_data_length:u8,}

After read "SPC" which docs fromT10 (SCSI Standard Groups), I Know that in_data_buffer,out_data_buffer,sense_data,cdb have variable length. so I decide to make a struct like

pub timeout:u64,/// data_buffer is in_data_buffer or out_data_bufferpub data_buffer:Vec<u8>    pub cdb:Vec<u8>    pub sense_data:Vec<u8>    pub data_direction:ExtDataDirection,pub host_adapter_status:ExtHostAdapterStatus,pub target_status:ExtTargetStatus,

but data couldn't share between FFI and c. That's a problem. We should share those data by ptr.

according to uefi scsi usage from edk2:

…w `execute_scsi_command` send req packet is ok.**PASSED**: - SCSI_IO all api, SCSI_THRU `mode()` and `reset()` api, are test passed.**PROBLEM**: 1. panic at allocator.rs while test_scsi_io return; 2. still problem with `DevicePath`,`target_id`,`pass_thru`;**UNKNOWN**: - scsi req ok but resp without test at `execute_scsi_command()`.
@sky5454
Copy link
ContributorAuthor

sky5454 commentedMay 5, 2024
edited
Loading

SCSI_IO

The main part of SCSI_IO is finished. though something need some optimization.

  • data_buf maybe need in and out at the sametime.?
  • resp no test still.

Running at VMWare with two SCSI sampleTestUnitReady andInquiryCommand:
image

EXT_SCSI_THRU

only test mode() and reset() passed.
some trouble.

  • DevicePath/DevicePathProtocol
  • Target ids
  • the packet sample about scsi thru. I couldn't find it clearly.

image

@sky5454sky5454 marked this pull request as ready for reviewMay 11, 2024 03:04
@sky5454
Copy link
ContributorAuthor

sky5454 commentedMay 11, 2024
edited
Loading

  • NowUEFI SCSI I/O protocol is ready.
  • AndUEFI Scsi Thru I/O protocol Will not be published in this PR. I would continue to code it at branchsky5454:dev-scsi

image

after you review the code and resolve the panic, you could merge it.

@nicholasbishop
Copy link
Member

Before I review fully, it would help to do some cleanup:

  • Fix CI errors (run formatting, fix lints, etc)
  • Remove all unused code
  • Resolve TODOs if possible

This will make review easier :)

phip1611 and sky5454 reacted with thumbs up emoji

@sky5454
Copy link
ContributorAuthor

sry, has no time to cleanup it for my tired life, just review/reedit and merge it plz.

@nicholasbishopnicholasbishop mentioned this pull requestJan 11, 2025
2 tasks
@phip1611
Copy link
Member

The split-out from#1517 took care of the uefi-raw part. Someone needs to rebase it and do the remaining work for uefi (high-level wrapper)

@phip1611phip1611 changed the titleadd SCSI Protocol support[STALE] add SCSI Protocol supportJun 22, 2025
@phip1611phip1611 marked this pull request as draftJune 22, 2025 10:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicholasbishopnicholasbishopAwaiting requested review from nicholasbishop

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sky5454@nicholasbishop@phip1611

[8]ページ先頭

©2009-2025 Movatter.jp