Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions include/storage.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum storage_type {
STORAGE_SATA,
STORAGE_NVME,
STORAGE_VIRTUAL,
STORAGE_ISCSI,
#ifdef USB_STORAGE
STORAGE_USB,
#endif
Expand Down Expand Up @@ -94,4 +95,6 @@ EFI_STATUS set_logical_unit(UINT64 user_lun, UINT64 factory_lun);
void print_progress(EFI_LBA done, EFI_LBA total, uint32_t sec, uint32_t *prev_sec, uint32_t *prev);
void set_exclude_device(EFI_HANDLE device);

SCSI_DEVICE_PATH *get_scsi_device_path(EFI_DEVICE_PATH *p);

#endif /* _STORAGE_H_ */
7 changes: 5 additions & 2 deletions libefitcp/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ static void EFIAPI data_received(__attribute__((__unused__)) EFI_EVENT evt, void

if (EFI_ERROR(token->token.CompletionToken.Status)) {
rx.receiving = FALSE;
efi_perror(token->token.CompletionToken.Status,
L"TCP data received failed");
ret = uefi_call_wrapper(tcp_connection->Close, 2,
tcp_connection, &close_token);
if (EFI_ERROR(ret))
efi_perror(ret, L"TCP Close failed");

return;
}

Expand Down
4 changes: 4 additions & 0 deletions libfastboot/fastboot_oem.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ static void cmd_oem_set_storage(INTN argc, CHAR8 **argv)
types[total_types++] = STORAGE_NVME;
continue;
}
if (!strcmp(argv[i], (CHAR8 *)"iscsi")) {
types[total_types++] = STORAGE_ISCSI;
continue;
}
if (!strcmp(argv[i], (CHAR8 *)"sdcard")) {
types[total_types++] = STORAGE_SDCARD;
continue;
Expand Down
2 changes: 1 addition & 1 deletion libfastboot/fastboot_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ EFI_STATUS fastboot_ui_init(void)

/* Use large enough margin to not overlap ui_print/ui_error
* area. */
margin = swidth * 12 / 100;
margin = swidth * 4 / 100;
ret = EFI_UNSUPPORTED;

droid = ui_image_get(DROID_IMG_NAME);
Expand Down
1 change: 1 addition & 0 deletions libkernelflinger/Android.mk
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ LOCAL_SRC_FILES := \
qsort.c \
timer.c \
nvme.c \
iscsi.c \
virtual_media.c \
general_block.c \
aes_gcm.c \
Expand Down
20 changes: 15 additions & 5 deletions libkernelflinger/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,17 +1063,27 @@ static EFI_STATUS setup_command_line(
PCI_DEVICE_PATH *boot_device = get_boot_device();
if (boot_device) {
CHAR16 *diskbus = NULL;
enum storage_type storage_type;
#ifdef AUTO_DISKBUS
diskbus = PoolPrint(L"%02x.%x", boot_device->Device, boot_device->Function);
#else
diskbus = PoolPrint(L"%a", (CHAR8 *)PREDEF_DISK_BUS);
#endif
StrToLower(diskbus);
ret = prepend_command_line(&cmdline16,
(aosp_header->header_version < 2)
? L"androidboot.diskbus=%s"
: L"androidboot.boot_devices=pci0000:00/0000:00:%s",
diskbus);

get_boot_device_type(&storage_type);
if (aosp_header->header_version < 2)
ret = prepend_command_line(&cmdline16,
L"androidboot.diskbus=%s",
diskbus);
else
if (storage_type == STORAGE_ISCSI)
ret = prepend_command_line(&cmdline16,
L"androidboot.boot_devices=scsi_disk/0:0:0:0");
else
ret = prepend_command_line(&cmdline16,
L"androidboot.boot_devices=pci0000:00/0000:00:%s",
diskbus);
FreePool(diskbus);
if (EFI_ERROR(ret))
goto out;
Expand Down
86 changes: 86 additions & 0 deletions libkernelflinger/iscsi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2020, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file defines bootlogic data structures, try to keep it without
* any external definitions in order to ease export of it.
*/

#include <lib.h>
#include "storage.h"

#include "protocol/NvmExpressHci.h"
#include "protocol/DevicePath.h"
#include "protocol/NvmExpressPassthru.h"

#define ATTR_UNUSED __attribute__((unused))

#define MSG_SCSI_DP 0x02

#include "pci.h"

SCSI_DEVICE_PATH *get_scsi_device_path(EFI_DEVICE_PATH *p)
{
if (!p)
return NULL;

while (!IsDevicePathEndType(p)) {
if (DevicePathType(p) == MESSAGING_DEVICE_PATH
&& DevicePathSubType(p) == MSG_SCSI_DP)
return (SCSI_DEVICE_PATH *)p;
p = NextDevicePathNode(p);
}
return NULL;
}

static EFI_STATUS iscsi_erase_blocks(
EFI_HANDLE handle ATTR_UNUSED,
EFI_BLOCK_IO * bio ATTR_UNUSED,
EFI_LBA start ATTR_UNUSED,
EFI_LBA end ATTR_UNUSED
)
{
return EFI_UNSUPPORTED;
}

static EFI_STATUS iscsi_check_logical_unit(ATTR_UNUSED EFI_DEVICE_PATH *p, ATTR_UNUSED logical_unit_t log_unit)
{
return log_unit == LOGICAL_UNIT_USER ? EFI_SUCCESS : EFI_UNSUPPORTED;
}

static BOOLEAN is_iscsi(EFI_DEVICE_PATH *p)
{
return get_scsi_device_path(p) != NULL;
}

struct storage STORAGE(STORAGE_ISCSI) = {
.erase_blocks = iscsi_erase_blocks,
.check_logical_unit = iscsi_check_logical_unit,
.probe = is_iscsi,
.name = L"ISCSI"
};

Loading