efi_loader: type of efi_secure_mode
[oweals/u-boot.git] / disk / part_amiga.c
index 0f569f0c9bf4b0bf90bd0976b620eb4102bed90c..7eea60b564de3312c1add557f8dc8d0c446040c6 100644 (file)
@@ -1,16 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2001
  * Hans-Joerg Frieden, Hyperion Entertainment
  * Hans-JoergF@hyperion-entertainment.com
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <ide.h>
 #include "part_amiga.h"
+#include <part.h>
 
-#ifdef HAVE_BLOCK_DEVICE
+#ifdef CONFIG_HAVE_BLOCK_DEVICE
 
 #undef AMIGA_DEBUG
 
@@ -132,7 +133,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = getenv("amiga_scanlimit");
+    s = env_get("amiga_scanlimit");
     if (s)
        limit = simple_strtoul(s, NULL, 10);
     else
@@ -140,7 +141,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
 
     for (i=0; i<limit; i++)
     {
-       ulong res = dev_desc->block_read(dev_desc, i, 1, (ulong *)block_buffer);
+       ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            struct rigid_disk_block *trdb = (struct rigid_disk_block *)block_buffer;
@@ -172,7 +173,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = getenv("amiga_scanlimit");
+    s = env_get("amiga_scanlimit");
     if (s)
        limit = simple_strtoul(s, NULL, 10);
     else
@@ -182,7 +183,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
 
     for (i = 0; i < limit; i++)
     {
-       ulong res = dev_desc->block_read(dev_desc, i, 1, (ulong *)block_buffer);
+       ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            struct bootcode_block *boot = (struct bootcode_block *)block_buffer;
@@ -207,27 +208,27 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
  * Test if the given partition has an Amiga partition table/Rigid
  * Disk block
  */
-static int test_part_amiga(struct blk_desc *dev_desc)
+static int part_test_amiga(struct blk_desc *dev_desc)
 {
     struct rigid_disk_block *rdb;
     struct bootcode_block *bootcode;
 
-    PRINTF("test_part_amiga: Testing for an Amiga RDB partition\n");
+    PRINTF("part_test_amiga: Testing for an Amiga RDB partition\n");
 
     rdb = get_rdisk(dev_desc);
     if (rdb)
     {
        bootcode = get_bootcode(dev_desc);
        if (bootcode)
-           PRINTF("test_part_amiga: bootable Amiga disk\n");
+           PRINTF("part_test_amiga: bootable Amiga disk\n");
        else
-           PRINTF("test_part_amiga: non-bootable Amiga disk\n");
+           PRINTF("part_test_amiga: non-bootable Amiga disk\n");
 
        return 0;
     }
     else
     {
-       PRINTF("test_part_amiga: no RDB found\n");
+       PRINTF("part_test_amiga: no RDB found\n");
        return -1;
     }
 
@@ -258,8 +259,7 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
 
     while (block != 0xFFFFFFFF)
     {
-       ulong res = dev_desc->block_read(dev_desc, block, 1,
-                                        (ulong *)block_buffer);
+       ulong res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            p = (struct partition_block *)block_buffer;
@@ -291,8 +291,8 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
 /*
  * Get info about a partition
  */
-static int get_partition_info_amiga(struct blk_desc *dev_desc, int part,
-                                   disk_partition_t *info)
+static int part_get_info_amiga(struct blk_desc *dev_desc, int part,
+                                   struct disk_partition *info)
 {
     struct partition_block *p = find_partition(dev_desc, part-1);
     struct amiga_part_geometry *g;
@@ -319,7 +319,7 @@ static int get_partition_info_amiga(struct blk_desc *dev_desc, int part,
     return 0;
 }
 
-static void print_part_amiga(struct blk_desc *dev_desc)
+static void part_print_amiga(struct blk_desc *dev_desc)
 {
     struct rigid_disk_block *rdb;
     struct bootcode_block *boot;
@@ -330,14 +330,14 @@ static void print_part_amiga(struct blk_desc *dev_desc)
     rdb = get_rdisk(dev_desc);
     if (!rdb)
     {
-       PRINTF("print_part_amiga: no rdb found\n");
+       PRINTF("part_print_amiga: no rdb found\n");
        return;
     }
 
-    PRINTF("print_part_amiga: Scanning partition list\n");
+    PRINTF("part_print_amiga: Scanning partition list\n");
 
     block = rdb->partition_list;
-    PRINTF("print_part_amiga: partition list at 0x%x\n", block);
+    PRINTF("part_print_amiga: partition list at 0x%x\n", block);
 
     printf("Summary:  DiskBlockSize: %d\n"
           "          Cylinders    : %d\n"
@@ -355,7 +355,7 @@ static void print_part_amiga(struct blk_desc *dev_desc)
 
        PRINTF("Trying to load block #0x%X\n", block);
 
-       res = dev_desc->block_read(dev_desc, block, 1, (ulong *)block_buffer);
+       res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            p = (struct partition_block *)block_buffer;
@@ -382,9 +382,10 @@ static void print_part_amiga(struct blk_desc *dev_desc)
 U_BOOT_PART_TYPE(amiga) = {
        .name           = "AMIGA",
        .part_type      = PART_TYPE_AMIGA,
-       .get_info       = get_partition_info_amiga,
-       .print          = print_part_amiga,
-       .test           = test_part_amiga,
+       .max_entries    = AMIGA_ENTRY_NUMBERS,
+       .get_info       = part_get_info_amiga,
+       .print          = part_print_amiga,
+       .test           = part_test_amiga,
 };
 
 #endif