1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-18 16:32:05 +00:00

fusee/sept: fix fuse driver to not infinitely recurse on get_soc_type()

This commit is contained in:
Michael Scire 2020-11-29 17:32:30 -08:00
parent 1107d4858c
commit 7ed9bdd374
5 changed files with 87 additions and 77 deletions

View file

@ -164,11 +164,12 @@ uint32_t fuse_get_spare_bit(uint32_t index) {
/* Read a reserved ODM register. */ /* Read a reserved ODM register. */
uint32_t fuse_get_reserved_odm(uint32_t index) { uint32_t fuse_get_reserved_odm(uint32_t index) {
uint32_t soc_type = fuse_get_soc_type();
if (index < 8) { if (index < 8) {
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs(); volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
return fuse_chip->FUSE_RESERVED_ODM0[index]; return fuse_chip->FUSE_RESERVED_ODM0[index];
} else if (soc_type == 1) { } else {
uint32_t soc_type = fuse_get_soc_type();
if (soc_type == 1) {
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs(); volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
if (index < 22) { if (index < 22) {
return fuse_chip->FUSE_RESERVED_ODM8[index - 8]; return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
@ -182,6 +183,7 @@ uint32_t fuse_get_reserved_odm(uint32_t index) {
return fuse_chip->FUSE_RESERVED_ODM29; return fuse_chip->FUSE_RESERVED_ODM29;
} }
} }
}
return 0; return 0;
} }

View file

@ -164,11 +164,12 @@ uint32_t fuse_get_spare_bit(uint32_t index) {
/* Read a reserved ODM register. */ /* Read a reserved ODM register. */
uint32_t fuse_get_reserved_odm(uint32_t index) { uint32_t fuse_get_reserved_odm(uint32_t index) {
uint32_t soc_type = fuse_get_soc_type();
if (index < 8) { if (index < 8) {
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs(); volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
return fuse_chip->FUSE_RESERVED_ODM0[index]; return fuse_chip->FUSE_RESERVED_ODM0[index];
} else if (soc_type == 1) { } else {
uint32_t soc_type = fuse_get_soc_type();
if (soc_type == 1) {
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs(); volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
if (index < 22) { if (index < 22) {
return fuse_chip->FUSE_RESERVED_ODM8[index - 8]; return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
@ -182,6 +183,7 @@ uint32_t fuse_get_reserved_odm(uint32_t index) {
return fuse_chip->FUSE_RESERVED_ODM29; return fuse_chip->FUSE_RESERVED_ODM29;
} }
} }
}
return 0; return 0;
} }

View file

@ -164,11 +164,12 @@ uint32_t fuse_get_spare_bit(uint32_t index) {
/* Read a reserved ODM register. */ /* Read a reserved ODM register. */
uint32_t fuse_get_reserved_odm(uint32_t index) { uint32_t fuse_get_reserved_odm(uint32_t index) {
uint32_t soc_type = fuse_get_soc_type();
if (index < 8) { if (index < 8) {
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs(); volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
return fuse_chip->FUSE_RESERVED_ODM0[index]; return fuse_chip->FUSE_RESERVED_ODM0[index];
} else if (soc_type == 1) { } else {
uint32_t soc_type = fuse_get_soc_type();
if (soc_type == 1) {
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs(); volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
if (index < 22) { if (index < 22) {
return fuse_chip->FUSE_RESERVED_ODM8[index - 8]; return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
@ -182,6 +183,7 @@ uint32_t fuse_get_reserved_odm(uint32_t index) {
return fuse_chip->FUSE_RESERVED_ODM29; return fuse_chip->FUSE_RESERVED_ODM29;
} }
} }
}
return 0; return 0;
} }

View file

@ -164,11 +164,12 @@ uint32_t fuse_get_spare_bit(uint32_t index) {
/* Read a reserved ODM register. */ /* Read a reserved ODM register. */
uint32_t fuse_get_reserved_odm(uint32_t index) { uint32_t fuse_get_reserved_odm(uint32_t index) {
uint32_t soc_type = fuse_get_soc_type();
if (index < 8) { if (index < 8) {
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs(); volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
return fuse_chip->FUSE_RESERVED_ODM0[index]; return fuse_chip->FUSE_RESERVED_ODM0[index];
} else if (soc_type == 1) { } else {
uint32_t soc_type = fuse_get_soc_type();
if (soc_type == 1) {
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs(); volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
if (index < 22) { if (index < 22) {
return fuse_chip->FUSE_RESERVED_ODM8[index - 8]; return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
@ -182,6 +183,7 @@ uint32_t fuse_get_reserved_odm(uint32_t index) {
return fuse_chip->FUSE_RESERVED_ODM29; return fuse_chip->FUSE_RESERVED_ODM29;
} }
} }
}
return 0; return 0;
} }

View file

@ -164,11 +164,12 @@ uint32_t fuse_get_spare_bit(uint32_t index) {
/* Read a reserved ODM register. */ /* Read a reserved ODM register. */
uint32_t fuse_get_reserved_odm(uint32_t index) { uint32_t fuse_get_reserved_odm(uint32_t index) {
uint32_t soc_type = fuse_get_soc_type();
if (index < 8) { if (index < 8) {
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs(); volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
return fuse_chip->FUSE_RESERVED_ODM0[index]; return fuse_chip->FUSE_RESERVED_ODM0[index];
} else if (soc_type == 1) { } else {
uint32_t soc_type = fuse_get_soc_type();
if (soc_type == 1) {
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs(); volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
if (index < 22) { if (index < 22) {
return fuse_chip->FUSE_RESERVED_ODM8[index - 8]; return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
@ -182,6 +183,7 @@ uint32_t fuse_get_reserved_odm(uint32_t index) {
return fuse_chip->FUSE_RESERVED_ODM29; return fuse_chip->FUSE_RESERVED_ODM29;
} }
} }
}
return 0; return 0;
} }