summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2017-04-26 21:00:10 +0200
committerMichael Brown2017-04-26 21:15:39 +0200
commitdd976cb50d842b9ba30a5b6413134fdefa9e864d (patch)
treeb68d45df81b1da4d3f4226cab428c99051b8ff3d /src/core
parent[intel] Do not enable ASDE on i350 backplane NIC (diff)
downloadipxe-dd976cb50d842b9ba30a5b6413134fdefa9e864d.tar.gz
ipxe-dd976cb50d842b9ba30a5b6413134fdefa9e864d.tar.xz
ipxe-dd976cb50d842b9ba30a5b6413134fdefa9e864d.zip
[block] Provide sandev_read() and sandev_write() as global symbols
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/sanboot.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/core/sanboot.c b/src/core/sanboot.c
index f134f76a..1fd63490 100644
--- a/src/core/sanboot.c
+++ b/src/core/sanboot.c
@@ -577,12 +577,12 @@ int sandev_reset ( struct san_device *sandev ) {
* @v block_rw Block read/write method
* @ret rc Return status code
*/
-int sandev_rw ( struct san_device *sandev, uint64_t lba,
- unsigned int count, userptr_t buffer,
- int ( * block_rw ) ( struct interface *control,
- struct interface *data,
- uint64_t lba, unsigned int count,
- userptr_t buffer, size_t len ) ) {
+static int sandev_rw ( struct san_device *sandev, uint64_t lba,
+ unsigned int count, userptr_t buffer,
+ int ( * block_rw ) ( struct interface *control,
+ struct interface *data,
+ uint64_t lba, unsigned int count,
+ userptr_t buffer, size_t len ) ) {
union san_command_params params;
unsigned int remaining;
size_t frag_len;
@@ -618,6 +618,46 @@ int sandev_rw ( struct san_device *sandev, uint64_t lba,
}
/**
+ * Read from SAN device
+ *
+ * @v sandev SAN device
+ * @v lba Starting logical block address
+ * @v count Number of logical blocks
+ * @v buffer Data buffer
+ * @ret rc Return status code
+ */
+int sandev_read ( struct san_device *sandev, uint64_t lba,
+ unsigned int count, userptr_t buffer ) {
+ int rc;
+
+ /* Read from device */
+ if ( ( rc = sandev_rw ( sandev, lba, count, buffer, block_read ) ) != 0 )
+ return rc;
+
+ return 0;
+}
+
+/**
+ * Write to SAN device
+ *
+ * @v sandev SAN device
+ * @v lba Starting logical block address
+ * @v count Number of logical blocks
+ * @v buffer Data buffer
+ * @ret rc Return status code
+ */
+int sandev_write ( struct san_device *sandev, uint64_t lba,
+ unsigned int count, userptr_t buffer ) {
+ int rc;
+
+ /* Write to device */
+ if ( ( rc = sandev_rw ( sandev, lba, count, buffer, block_write ) ) != 0 )
+ return rc;
+
+ return 0;
+}
+
+/**
* Describe SAN device
*
* @v sandev SAN device
@@ -735,8 +775,8 @@ static int sandev_parse_iso9660 ( struct san_device *sandev ) {
}
/* Read primary volume descriptor */
- if ( ( rc = sandev_rw ( sandev, lba, count, virt_to_user ( scratch ),
- block_read ) ) != 0 ) {
+ if ( ( rc = sandev_read ( sandev, lba, count,
+ virt_to_user ( scratch ) ) ) != 0 ) {
DBGC ( sandev, "SAN %#02x could not read ISO9660 primary"
"volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );