Skip to content

Commit

Permalink
MIPS: PS2: ROM: Resolve the name for the region in the ROMVER file
Browse files Browse the repository at this point in the history
'J' indicates Japan, 'E' indicates Europe, 'C' indicates China, 'A' the
USA and 'H' Asia. 'X' indicates a TEST machine, and 'T' either a TOOL
machine or a Namco System 246 archade machine if the ROM type is 'Z'.

Note that 'E' includes Australia and 'A' includes Mexico.

Signed-off-by: Fredrik Noring <noring@nocrew.org>
  • Loading branch information
frno7 committed Sep 7, 2019
1 parent 12ca554 commit 6df106a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 4 additions & 1 deletion arch/mips/include/asm/mach-ps2/rom.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ struct rom_extinfo rom_read_extinfo(const char *name,
* @date.month: month ROM was created
* @date.day: day ROM was created
*
* The @type name can be resolved with rom_type_name().
* The @region and @type names can be resolved with rom_region_name() and
* rom_type_name().
*
* Note that ``'E'`` includes Australia and ``'A'`` includes Mexico.
*
Expand All @@ -157,6 +158,8 @@ struct rom_ver {

struct rom_ver rom_version(void);

const char *rom_region_name(char region);

const char *rom_type_name(char type);

bool rom_empty_dir(const struct rom_dir dir);
Expand Down
24 changes: 22 additions & 2 deletions arch/mips/ps2/rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,26 @@ struct rom_ver rom_version(void)
}
EXPORT_SYMBOL_GPL(rom_version);

/**
* rom_region_name - name for the ROM region character in the ROMVER file
* @region: &rom_ver.region region character.
*
* Context: any
* Return: ROM region name, ``"-"`` if undefined or ``"?"`` if unrecognised
*/
const char *rom_region_name(char region)
{
return region == 'J' ? "Japan" :
region == 'E' ? "Europe" : /* Including Australia. */
region == 'C' ? "China" :
region == 'A' ? "USA" : /* Including Mexico. */
region == 'H' ? "Asia" : /* Technically same as the USA. */
region == 'T' ? "TOOL" : /* Namco system if ROM type is 'Z'. */
region == 'X' ? "TEST" : /* Only the DTL-H10000 model. */
region == '-' ? "-" : "?";
}
EXPORT_SYMBOL_GPL(rom_region_name);

/**
* rom_type_name - name for the ROM type character in the ROMVER file in ROM0
* @type: &rom_ver.type type character.
Expand Down Expand Up @@ -677,8 +697,8 @@ static int __init ps2_rom_init(void)
rom1_dir = rom_dir_init("rom1", ROM1_BASE, ROM1_SIZE);

v = rom_version();
pr_info("rom0: Version %04x %c %s %04d-%02d-%02d\n",
v.number, v.region, rom_type_name(v.type),
pr_info("rom0: Version %04x %s %s %04d-%02d-%02d\n",
v.number, rom_region_name(v.region), rom_type_name(v.type),
v.date.year, v.date.month, v.date.day);

return 0;
Expand Down

0 comments on commit 6df106a

Please sign in to comment.