[PATCH 1/1] disk: drop Amiga partition table support
Heinrich Schuchardt <[email protected]>
| Newsgroups | gmane.comp.boot-loaders.u-boot |
|---|---|
| Message-ID | <20260823101128.87329-1-xypron.glpk__44254.5722633199$1787479938$gmane$org@gmx.de> |
The AmigaOne is not supported anymore by U-Boot. There seems to be no need to keep support for Amiga partition tables anymore. The usage in sandbox*defconfig has been for compile testing only. theodorable-x86-conga-qa3-e3845-pcie-x4_defconfig and octeon_ebb7304_defconfig support GPT partition tables. Signed-off-by: Heinrich Schuchardt <[email protected]> --- configs/octeon_ebb7304_defconfig | 1 - configs/sandbox64_defconfig | 1 - configs/sandbox_flattree_defconfig | 1 - configs/sandbox_noinst_defconfig | 1 - configs/sandbox_spl_defconfig | 1 - ...able-x86-conga-qa3-e3845-pcie-x4_defconfig | 1 - disk/Kconfig | 13 - disk/Makefile | 1 - disk/part.c | 1 - disk/part_amiga.c | 385 ------------------ disk/part_amiga.h | 137 ------- doc/usage/cmd/part.rst | 2 +- include/part.h | 2 - 13 files changed, 1 insertion(+), 546 deletions(-) delete mode 100644 disk/part_amiga.c delete mode 100644 disk/part_amiga.h diff --git a/configs/octeon_ebb7304_defconfig b/configs/octeon_ebb7304_defconfig index 2b7210cd4fb..d441bf71f50 100644 --- a/configs/octeon_ebb7304_defconfig +++ b/configs/octeon_ebb7304_defconfig @@ -38,7 +38,6 @@ CONFIG_CMD_TIME=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y -CONFIG_AMIGA_PARTITION=y CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_FLASH=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 2e37374d646..5dae5d87894 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -103,7 +103,6 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_SPAWN=y CONFIG_MAC_PARTITION=y -CONFIG_AMIGA_PARTITION=y CONFIG_OF_LIVE=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 4ad2bb01673..3f722c0b85c 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -77,7 +77,6 @@ CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y -CONFIG_AMIGA_PARTITION=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_EXT4=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 076be6586cf..29afc12b6ed 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -113,7 +113,6 @@ CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y -CONFIG_AMIGA_PARTITION=y CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_OF_PLATDATA=y CONFIG_SPL_OF_REAL=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 3b6d18d7d76..f83a9eb8ef4 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -91,7 +91,6 @@ CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y -CONFIG_AMIGA_PARTITION=y CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_OF_PLATDATA=y CONFIG_SPL_OF_PLATDATA_INST=y diff --git a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig index ebe333b0b16..1529efb113a 100644 --- a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig +++ b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig @@ -47,7 +47,6 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ISO_PARTITION=y -CONFIG_AMIGA_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_REDUNDANT=y CONFIG_ENV_RELOC_GD_ENV_ADDR=y diff --git a/disk/Kconfig b/disk/Kconfig index 672ad46a48f..ea4df87b243 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -86,19 +86,6 @@ config SPL_ISO_PARTITION depends on SPL select SPL_PARTITIONS -config AMIGA_PARTITION - bool "Enable AMIGA partition table" - select PARTITIONS - help - Say Y here if you would like to use device under U-Boot which - were partitioned under AmigaOS. - -config SPL_AMIGA_PARTITION - bool "Enable AMIGA partition table for SPL" - depends on SPL - default y if AMIGA_PARTITION - select SPL_PARTITIONS - config EFI_PARTITION bool "Enable EFI GPT partition table" default y if BOOT_DEFAULTS diff --git a/disk/Makefile b/disk/Makefile index 2248a659f8b..64f164f3b67 100644 --- a/disk/Makefile +++ b/disk/Makefile @@ -15,6 +15,5 @@ ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),) obj-$(CONFIG_$(PHASE_)MAC_PARTITION) += part_mac.o obj-$(CONFIG_$(PHASE_)DOS_PARTITION) += part_dos.o obj-$(CONFIG_$(PHASE_)ISO_PARTITION) += part_iso.o -obj-$(CONFIG_$(PHASE_)AMIGA_PARTITION) += part_amiga.o obj-$(CONFIG_$(PHASE_)EFI_PARTITION) += part_efi.o endif diff --git a/disk/part.c b/disk/part.c index 4923dc44593..3c9bba9b328 100644 --- a/disk/part.c +++ b/disk/part.c @@ -315,7 +315,6 @@ static void print_part_header(const char *type, struct blk_desc *desc) #if CONFIG_IS_ENABLED(MAC_PARTITION) || \ CONFIG_IS_ENABLED(DOS_PARTITION) || \ CONFIG_IS_ENABLED(ISO_PARTITION) || \ - CONFIG_IS_ENABLED(AMIGA_PARTITION) || \ CONFIG_IS_ENABLED(EFI_PARTITION) || \ CONFIG_IS_ENABLED(MTD_PARTITIONS) printf("\nPartition Map for %s device %d -- Partition Type: %s\n\n", diff --git a/disk/part_amiga.c b/disk/part_amiga.c deleted file mode 100644 index 22bf99f1b88..00000000000 --- a/disk/part_amiga.c +++ /dev/null @@ -1,385 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2001 - * Hans-Joerg Frieden, Hyperion Entertainment - * [email protected] - */ -#include <command.h> -#include <env.h> -#include "part_amiga.h" -#include <part.h> -#include <vsprintf.h> - -#undef AMIGA_DEBUG - -#ifdef AMIGA_DEBUG -#define PRINTF(fmt, args...) printf(fmt ,##args) -#else -#define PRINTF(fmt, args...) -#endif - -struct block_header -{ - u32 id; - u32 summed_longs; - s32 chk_sum; -}; - -static unsigned char block_buffer[DEFAULT_SECTOR_SIZE]; -static struct rigid_disk_block rdb = {0}; -static struct bootcode_block bootcode = {0}; - -/* - * Copy a bcpl to a c string - */ -static void bcpl_strcpy(char *to, char *from) -{ - int len = *from++; - - while (len) - { - *to++ = *from++; - len--; - } - *to = 0; -} - -/* - * Print a BCPL String. BCPL strings start with a byte with the length - * of the string, and don't contain a terminating nul character - */ -static void bstr_print(char *string) -{ - int len = *string++; - char buffer[256]; - int i; - - i = 0; - while (len) - { - buffer[i++] = *string++; - len--; - } - - buffer[i] = 0; - printf("%-10s", buffer); -} - -/* - * Sum a block. The checksum of a block must end up at zero - * to be valid. The chk_sum field is selected so that adding - * it yields zero. - */ -int sum_block(struct block_header *header) -{ - s32 *block = (s32 *)header; - u32 i; - s32 sum = 0; - - for (i = 0; i < header->summed_longs; i++) - sum += *block++; - - return (sum != 0); -} - -/* - * Print an AmigaOS disk type. Disk types are a four-byte identifier - * describing the file system. They are usually written as a three-letter - * word followed by a backslash and a version number. For example, - * DOS\0 would be the original file system. SFS\0 would be SmartFileSystem. - * DOS\1 is FFS. - */ -static void print_disk_type(u32 disk_type) -{ - char buffer[6]; - buffer[0] = (disk_type & 0xFF000000)>>24; - buffer[1] = (disk_type & 0x00FF0000)>>16; - buffer[2] = (disk_type & 0x0000FF00)>>8; - buffer[3] = '\\'; - buffer[4] = (disk_type & 0x000000FF) + '0'; - buffer[5] = 0; - printf("%s", buffer); -} - -/* - * Print the info contained within the given partition block - */ -static void print_part_info(struct partition_block *p) -{ - struct amiga_part_geometry *g; - - g = (struct amiga_part_geometry *)&(p->environment); - - bstr_print(p->drive_name); - printf("%6d\t%6d\t", - g->low_cyl * g->block_per_track * g->surfaces , - (g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1); - print_disk_type(g->dos_type); - printf("\t%5d\n", g->boot_priority); -} - -/* - * Search for the Rigid Disk Block. The rigid disk block is required - * to be within the first 16 blocks of a drive, needs to have - * the ID AMIGA_ID_RDISK ('RDSK') and needs to have a valid - * sum-to-zero checksum - */ -struct rigid_disk_block *get_rdisk(struct blk_desc *desc) -{ - int i; - int limit; - char *s; - - s = env_get("amiga_scanlimit"); - if (s) - limit = dectoul(s, NULL); - else - limit = AMIGA_BLOCK_LIMIT; - - for (i=0; i<limit; i++) - { - ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer); - if (res == 1) - { - struct rigid_disk_block *trdb = (struct rigid_disk_block *)block_buffer; - if (trdb->id == AMIGA_ID_RDISK) - { - PRINTF("Rigid disk block suspect at %d, checking checksum\n",i); - if (sum_block((struct block_header *)block_buffer) == 0) - { - PRINTF("FOUND\n"); - memcpy(&rdb, trdb, sizeof(struct rigid_disk_block)); - return (struct rigid_disk_block *)&rdb; - } - } - } - } - PRINTF("Done scanning, no RDB found\n"); - return NULL; -} - -/* - * Search for boot code - * Again, the first boot block must be located somewhere in the first 16 blocks, or rooted in the - * Ridgid disk block - */ - -struct bootcode_block *get_bootcode(struct blk_desc *desc) -{ - int i; - int limit; - char *s; - - s = env_get("amiga_scanlimit"); - if (s) - limit = dectoul(s, NULL); - else - limit = AMIGA_BLOCK_LIMIT; - - PRINTF("Scanning for BOOT from 0 to %d\n", limit); - - for (i = 0; i < limit; i++) - { - ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer); - if (res == 1) - { - struct bootcode_block *boot = (struct bootcode_block *)block_buffer; - if (boot->id == AMIGA_ID_BOOT) - { - PRINTF("BOOT block at %d, checking checksum\n", i); - if (sum_block((struct block_header *)block_buffer) == 0) - { - PRINTF("Found valid bootcode block\n"); - memcpy(&bootcode, boot, sizeof(struct bootcode_block)); - return &bootcode; - } - } - } - } - - PRINTF("No boot code found on disk\n"); - return 0; -} - -/* - * Test if the given partition has an Amiga partition table/Rigid - * Disk block - */ -static int part_test_amiga(struct blk_desc *desc) -{ - struct rigid_disk_block *rdb; - struct bootcode_block *bootcode; - - PRINTF("part_test_amiga: Testing for an Amiga RDB partition\n"); - - rdb = get_rdisk(desc); - if (rdb) - { - bootcode = get_bootcode(desc); - if (bootcode) - PRINTF("part_test_amiga: bootable Amiga disk\n"); - else - PRINTF("part_test_amiga: non-bootable Amiga disk\n"); - - return 0; - } - else - { - PRINTF("part_test_amiga: no RDB found\n"); - return -1; - } - -} - -/* - * Find partition number partnum on the given drive. - */ -static struct partition_block *find_partition(struct blk_desc *desc, - int partnum) -{ - struct rigid_disk_block *rdb; - struct partition_block *p; - u32 block; - - PRINTF("Trying to find partition block %d\n", partnum); - rdb = get_rdisk(desc); - if (!rdb) - { - PRINTF("find_partition: no rdb found\n"); - return NULL; - } - - PRINTF("find_partition: Scanning partition list\n"); - - block = rdb->partition_list; - PRINTF("find_partition: partition list at 0x%x\n", block); - - while (block != 0xFFFFFFFF) - { - ulong res = blk_dread(desc, block, 1, (ulong *)block_buffer); - if (res == 1) - { - p = (struct partition_block *)block_buffer; - if (p->id == AMIGA_ID_PART) - { - PRINTF("PART block suspect at 0x%x, checking checksum\n",block); - if (sum_block((struct block_header *)p) == 0) - { - if (partnum == 0) break; - else - { - partnum--; - block = p->next; - } - } - } else block = 0xFFFFFFFF; - } else block = 0xFFFFFFFF; - } - - if (block == 0xFFFFFFFF) - { - PRINTF("PART block not found\n"); - return NULL; - } - - return (struct partition_block *)block_buffer; -} - -/* - * Get info about a partition - */ -static int part_get_info_amiga(struct blk_desc *desc, int part, - struct disk_partition *info) -{ - struct partition_block *p = find_partition(desc, part - 1); - struct amiga_part_geometry *g; - u32 disk_type; - - if (!p) return -1; - - g = (struct amiga_part_geometry *)&(p->environment); - info->start = g->low_cyl * g->block_per_track * g->surfaces; - info->size = (g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1; - info->blksz = rdb.block_bytes; - bcpl_strcpy((char *)info->name, p->drive_name); - - disk_type = g->dos_type; - - info->type[0] = (disk_type & 0xFF000000)>>24; - info->type[1] = (disk_type & 0x00FF0000)>>16; - info->type[2] = (disk_type & 0x0000FF00)>>8; - info->type[3] = '\\'; - info->type[4] = (disk_type & 0x000000FF) + '0'; - info->type[5] = 0; - - return 0; -} - -static void part_print_amiga(struct blk_desc *desc) -{ - struct rigid_disk_block *rdb; - struct bootcode_block *boot; - struct partition_block *p; - u32 block; - int i = 1; - - rdb = get_rdisk(desc); - if (!rdb) - { - PRINTF("part_print_amiga: no rdb found\n"); - return; - } - - PRINTF("part_print_amiga: Scanning partition list\n"); - - block = rdb->partition_list; - PRINTF("part_print_amiga: partition list at 0x%x\n", block); - - printf("Summary: DiskBlockSize: %d\n" - " Cylinders : %d\n" - " Sectors/Track: %d\n" - " Heads : %d\n\n", - rdb->block_bytes, rdb->cylinders, rdb->sectors, - rdb->heads); - - printf(" First Num. \n" - "Nr. Part. Name Block Block Type Boot Priority\n"); - - while (block != 0xFFFFFFFF) - { - ulong res; - - PRINTF("Trying to load block #0x%X\n", block); - - res = blk_dread(desc, block, 1, (ulong *)block_buffer); - if (res == 1) - { - p = (struct partition_block *)block_buffer; - if (p->id == AMIGA_ID_PART) - { - PRINTF("PART block suspect at 0x%x, checking checksum\n",block); - if (sum_block((struct block_header *)p) == 0) - { - printf("%-4d ", i); i++; - print_part_info(p); - block = p->next; - } - } else block = 0xFFFFFFFF; - } else block = 0xFFFFFFFF; - } - - boot = get_bootcode(desc); - if (boot) - { - printf("Disk is bootable\n"); - } -} - -U_BOOT_PART_TYPE(amiga) = { - .name = "AMIGA", - .part_type = PART_TYPE_AMIGA, - .max_entries = AMIGA_ENTRY_NUMBERS, - .get_info = part_get_info_amiga, - .print = part_print_amiga, - .test = part_test_amiga, -}; diff --git a/disk/part_amiga.h b/disk/part_amiga.h deleted file mode 100644 index 3c27bfe8fde..00000000000 --- a/disk/part_amiga.h +++ /dev/null @@ -1,137 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2000 - * Hans-Joerg Frieden, Hyperion Entertainment - * [email protected] - */ - -#ifndef _DISK_PART_AMIGA_H -#define _DISK_PART_AMIGA_H - -#if CONFIG_IS_ENABLED(ISO_PARTITION) -/* Make the buffers bigger if ISO partition support is enabled -- CD-ROMS - have 2048 byte blocks */ -#define DEFAULT_SECTOR_SIZE 2048 -#else -#define DEFAULT_SECTOR_SIZE 512 -#endif - -#define AMIGA_BLOCK_LIMIT 16 - -/* - * Amiga disks have a very open structure. The head for the partition table information - * is stored somewhere within the first 16 blocks on disk, and is called the - * "RigidDiskBlock". - */ - -struct rigid_disk_block -{ - u32 id; - u32 summed_longs; - s32 chk_sum; - u32 host_id; - u32 block_bytes; - u32 flags; - u32 bad_block_list; - u32 partition_list; - u32 file_sys_header_list; - u32 drive_init; - u32 bootcode_block; - u32 reserved_1[5]; - - /* Physical drive geometry */ - u32 cylinders; - u32 sectors; - u32 heads; - u32 interleave; - u32 park; - u32 reserved_2[3]; - u32 write_pre_comp; - u32 reduced_write; - u32 step_rate; - u32 reserved_3[5]; - - /* logical drive geometry */ - u32 rdb_blocks_lo; - u32 rdb_blocks_hi; - u32 lo_cylinder; - u32 hi_cylinder; - u32 cyl_blocks; - u32 auto_park_seconds; - u32 high_rdsk_block; - u32 reserved_4; - - char disk_vendor[8]; - char disk_product[16]; - char disk_revision[4]; - char controller_vendor[8]; - char controller_product[16]; - char controller_revision[4]; - - u32 reserved_5[10]; -}; - -/* - * Each partition on this drive is defined by such a block - */ - -struct partition_block -{ - u32 id; - u32 summed_longs; - s32 chk_sum; - u32 host_id; - u32 next; - u32 flags; - u32 reserved_1[2]; - u32 dev_flags; - char drive_name[32]; - u32 reserved_2[15]; - u32 environment[17]; - u32 reserved_3[15]; -}; - -struct bootcode_block -{ - u32 id; - u32 summed_longs; - s32 chk_sum; - u32 host_id; - u32 next; - u32 load_data[123]; -}; - -#define AMIGA_ID_RDISK 0x5244534B -#define AMIGA_ID_PART 0x50415254 -#define AMIGA_ID_BOOT 0x424f4f54 - -/* - * The environment array in the partition block - * describes the partition - */ - -struct amiga_part_geometry -{ - u32 table_size; - u32 size_blocks; - u32 unused1; - u32 surfaces; - u32 sector_per_block; - u32 block_per_track; - u32 reserved; - u32 prealloc; - u32 interleave; - u32 low_cyl; - u32 high_cyl; - u32 num_buffers; - u32 buf_mem_type; - u32 max_transfer; - u32 mask; - s32 boot_priority; - u32 dos_type; - u32 baud; - u32 control; - u32 boot_blocks; -}; - -#endif /* _DISK_PART_AMIGA_H_ */ diff --git a/doc/usage/cmd/part.rst b/doc/usage/cmd/part.rst index a0e7be08a9a..e523781f94a 100644 --- a/doc/usage/cmd/part.rst +++ b/doc/usage/cmd/part.rst @@ -174,7 +174,7 @@ Examples varname=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 => => part types - Supported partition tables: EFI, AMIGA, DOS, ISO, MAC + Supported partition tables: EFI, DOS, ISO, MAC This shows looking at a device with multiple partition tables:: diff --git a/include/part.h b/include/part.h index 15daacd7faa..eda4ee1b54e 100644 --- a/include/part.h +++ b/include/part.h @@ -26,7 +26,6 @@ struct block_drvr { #define PART_TYPE_MAC 0x01 #define PART_TYPE_DOS 0x02 #define PART_TYPE_ISO 0x03 -#define PART_TYPE_AMIGA 0x04 #define PART_TYPE_EFI 0x05 #define PART_TYPE_MTD 0x06 #define PART_TYPE_UBI 0x07 @@ -35,7 +34,6 @@ struct block_drvr { #define DOS_ENTRY_NUMBERS 8 #define ISO_ENTRY_NUMBERS 64 #define MAC_ENTRY_NUMBERS 64 -#define AMIGA_ENTRY_NUMBERS 8 #define MTD_ENTRY_NUMBERS 64 #define UBI_ENTRY_NUMBERS UBI_MAX_VOLUMES -- 2.53.0