storage: report physical sector multiplier via storage_get_info()

Show this in in the info dump when we can't find a filesystem to mount
in main() plus in the ipod bootloaders

Change-Id: I3b437ae0032b17f29c0dd94043743f14d2b2f3ad
This commit is contained in:
Solomon Peachy 2025-11-17 08:52:02 -05:00
parent 44b5220f22
commit bc7bc4e8ac
5 changed files with 42 additions and 6 deletions

View file

@ -647,6 +647,15 @@ static void init(void)
#endif #endif
lcd_puts(0, line++, rbversion); lcd_puts(0, line++, rbversion);
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
lcd_putsf(0, line++, "id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
lcd_putsf(0, line++, "id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
struct partinfo pinfo; struct partinfo pinfo;
for (int i = 0 ; i < NUM_VOLUMES ; i++) { for (int i = 0 ; i < NUM_VOLUMES ; i++) {
disk_partinfo(i, &pinfo); disk_partinfo(i, &pinfo);

View file

@ -911,6 +911,15 @@ void main(void)
rc = disk_mount_all(); rc = disk_mount_all();
if (rc <= 0) { if (rc <= 0) {
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
printf("id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
printf("id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
struct partinfo pinfo; struct partinfo pinfo;
printf("No partition found"); printf("No partition found");
for (int i = 0 ; i < NUM_VOLUMES ; i++) { for (int i = 0 ; i < NUM_VOLUMES ; i++) {

View file

@ -34,6 +34,7 @@
#include "ata.h" #include "ata.h"
#include "file_internal.h" #include "file_internal.h"
#include "disk.h" #include "disk.h"
#include "storage.h"
#include "font.h" #include "font.h"
#include "adc.h" #include "adc.h"
#include "backlight.h" #include "backlight.h"
@ -364,6 +365,15 @@ void* main(void)
rc = disk_mount_all(); rc = disk_mount_all();
if (rc<=0) if (rc<=0)
{ {
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
printf("id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
printf("id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
for (int i = 0 ; i < NUM_VOLUMES ; i++) { for (int i = 0 ; i < NUM_VOLUMES ; i++) {
disk_partinfo(i, &pinfo); disk_partinfo(i, &pinfo);
if (pinfo.type) if (pinfo.type)

View file

@ -30,6 +30,10 @@ static bool canflush = true;
static int spinup_time = 0; static int spinup_time = 0;
static struct mutex ata_mutex SHAREDBSS_ATTR; static struct mutex ata_mutex SHAREDBSS_ATTR;
#ifdef MAX_PHYS_SECTOR_SIZE
static uint16_t phys_sector_mult = 1;
#endif
int ata_spinup_time(void) int ata_spinup_time(void)
{ {
return spinup_time; return spinup_time;
@ -49,6 +53,9 @@ void ata_get_info(IF_MD(int drive,)struct storage_info *info)
info->sector_size = log_sector_size; info->sector_size = log_sector_size;
info->num_sectors = total_sectors; info->num_sectors = total_sectors;
#ifdef MAX_PHYS_SECTOR_SIZE
info->phys_sector_mult = phys_sector_mult;
#endif
src = (unsigned short*)&identify_info[27]; src = (unsigned short*)&identify_info[27];
dest = (unsigned short*)vendor; dest = (unsigned short*)vendor;
@ -70,7 +77,6 @@ void ata_get_info(IF_MD(int drive,)struct storage_info *info)
} }
#endif #endif
#ifdef MAX_PHYS_SECTOR_SIZE #ifdef MAX_PHYS_SECTOR_SIZE
#ifdef MAX_VARIABLE_LOG_SECTOR #ifdef MAX_VARIABLE_LOG_SECTOR
@ -90,7 +96,6 @@ struct sector_cache_entry {
}; };
/* buffer for reading and writing large physical sectors */ /* buffer for reading and writing large physical sectors */
static struct sector_cache_entry sector_cache STORAGE_ALIGN_ATTR; static struct sector_cache_entry sector_cache STORAGE_ALIGN_ATTR;
static uint16_t phys_sector_mult = 1;
static int ata_transfer_sectors(uint64_t start, static int ata_transfer_sectors(uint64_t start,
int incount, int incount,

View file

@ -108,6 +108,9 @@ struct storage_info
{ {
unsigned int sector_size; unsigned int sector_size;
sector_t num_sectors; sector_t num_sectors;
#ifdef MAX_PHYS_SECTOR_SIZE
uint16_t phys_sector_mult;
#endif
char *vendor; char *vendor;
char *product; char *product;
char *revision; char *revision;