[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] ieee1275: no-data-command bus specific method
From: |
Eric Snowberg |
Subject: |
[PATCH 4/7] ieee1275: no-data-command bus specific method |
Date: |
Mon, 26 Feb 2018 17:34:17 -0800 |
IEEE 1275-1994 Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices
E.3.2.2 Bus-specific methods for bus nodes
A package implementing the scsi-2 device type shall implement the
following bus-specific method:
no-data-command ( cmd-addr -- error? )
Executes a simple SCSI command, automatically retrying under
certain conditions. cmd-addr is the address of a 6-byte command buffer
containing an SCSI command that does not have a data transfer phase.
Executes the command, retrying indefinitely with the same retry criteria
as retry-command.
error? is nonzero if an error occurred, zero otherwise.
NOTE no-data-command is a convenience function. It provides
no capabilities that are not present in retry-command, but for
those commands that meet its restrictions, it is easier to use.
Signed-off-by: Eric Snowberg <address@hidden>
---
grub-core/kern/ieee1275/ieee1275.c | 49 ++++++++++++++++++++++++++++++++++++
include/grub/ieee1275/ieee1275.h | 4 +++
2 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/grub-core/kern/ieee1275/ieee1275.c
b/grub-core/kern/ieee1275/ieee1275.c
index 7de87ac..89e4f7d 100644
--- a/grub-core/kern/ieee1275/ieee1275.c
+++ b/grub-core/kern/ieee1275/ieee1275.c
@@ -733,3 +733,52 @@ grub_ieee1275_set_address (grub_ieee1275_ihandle_t ihandle,
return args.catch_result;
}
+
+int
+grub_ieee1275_no_data_command (grub_ieee1275_ihandle_t ihandle,
+ const void *cmd_addr, grub_ssize_t *result)
+{
+ struct set_address
+ {
+ struct grub_ieee1275_common_hdr common;
+ grub_ieee1275_cell_t method;
+ grub_ieee1275_cell_t ihandle;
+ grub_ieee1275_cell_t cmd_addr;
+ grub_ieee1275_cell_t error;
+ grub_ieee1275_cell_t catch_result;
+ }
+ args;
+
+ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2);
+
+ /* IEEE 1275-1994 Standard for Boot (Initialization Configuration)
+ Firmware: Core Requirements and Practices
+
+ E.3.2.2 Bus-specific methods for bus nodes
+
+ A package implementing the scsi-2 device type shall implement the
+ following bus-specific method:
+
+ no-data-command ( cmd-addr -- error? )
+ Executes a simple SCSI command, automatically retrying under
+ certain conditions. cmd-addr is the address of a 6-byte command buffer
+ containing an SCSI command that does not have a data transfer phase.
+ Executes the command, retrying indefinitely with the same retry criteria
+ as retry-command.
+
+ error? is nonzero if an error occurred, zero otherwise.
+ NOTE no-data-command is a convenience function. It provides
+ no capabilities that are not present in retry-command, but for
+ those commands that meet its restrictions, it is easier to use. */
+ args.method = (grub_ieee1275_cell_t) "no-data-command";
+ args.ihandle = ihandle;
+ args.cmd_addr = (grub_ieee1275_cell_t) cmd_addr;
+
+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+ return -1;
+
+ if (result)
+ *result = args.error;
+
+ return args.catch_result;
+}
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 1ba9f27..7ef326a 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -215,6 +215,10 @@ int EXPORT_FUNC(grub_ieee1275_set_address)
(grub_ieee1275_ihandle_t ihandle,
grub_uint32_t target,
grub_uint32_t lun);
+int EXPORT_FUNC(grub_ieee1275_no_data_command) (grub_ieee1275_ihandle_t
ihandle,
+ const void *cmd_addr,
+ grub_ssize_t *result);
+
int EXPORT_FUNC(grub_ieee1275_decode_unit4) (grub_ieee1275_ihandle_t ihandle,
void *addr, grub_size_t size,
grub_uint32_t *phy_lo,
--
1.7.1
- [PATCH 0/7] Add additional IEEE1275 methods, Eric Snowberg, 2018/02/26
- [PATCH 1/7] ieee1275: decode-unit command for 4 addr cell devs, Eric Snowberg, 2018/02/26
- [PATCH 2/7] ieee1275: encode-unit command for 4 addr cell devs, Eric Snowberg, 2018/02/26
- [PATCH 3/7] ieee1275: set-address bus specific method, Eric Snowberg, 2018/02/26
- [PATCH 4/7] ieee1275: no-data-command bus specific method,
Eric Snowberg <=
- [PATCH 5/7] ieee1275: block-size deblocker support method, Eric Snowberg, 2018/02/26
- [PATCH 6/7] sparc64: #blocks disk node method, Eric Snowberg, 2018/02/26
- [PATCH 7/7] sparc64: #blocks64 disk node method, Eric Snowberg, 2018/02/26