Commit cd55473e authored by Dinolek's avatar Dinolek
Browse files

Update

Add option to dump bootrom, backup and restore emmc partitions
Merge https://github.com/amonet-kamakiri/kamakiri/tree/master/brom-payload changes
And other small fixes
parent 4ae4ed74
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
__pycache__
*.pyc
build
*.log
*.pyc
__pycache__
backup
bin
build
dumps
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ AS := arm-none-eabi-as
LD := arm-none-eabi-gcc
OBJCOPY := arm-none-eabi-objcopy

CFLAGS := -std=gnu99 -Os -mthumb -mcpu=cortex-a9 -fno-builtin-printf -fno-strict-aliasing -fno-builtin-memcpy -mno-unaligned-access
CFLAGS := -std=gnu99 -Os -mthumb -mcpu=cortex-a9 -fno-builtin-printf -fno-strict-aliasing -fno-builtin-memcpy -mno-unaligned-access -Wall -Wextra
LDFLAGS := -T linker.x -nodefaultlibs -nostdlib -lgcc

BUILD_DIR := ./build
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ static const uint32_t K[64] = {
static void
sha256_transform(uint32_t *state, const uint32_t *data)
{
  uint32_t W[16];
  uint32_t W[16] = {0};
  unsigned j;
  #ifdef _SHA256_UNROLL2
  uint32_t a,b,c,d,e,f,g,h;
+5 −4
Original line number Diff line number Diff line
@@ -502,6 +502,7 @@ out:
static int mmc_rpmb_request_check(struct msdc_host *host,
        struct mmc_ioc_rpmb_req *p_req)
{
    (void)host;
    /*
     * Some parameters are a must for the operation. Different
     * operation expect different paramters. Below code is
@@ -711,7 +712,7 @@ int mmc_rpmb_get_write_count(struct msdc_host *host, uint32_t *wc) {
    struct mmc_ioc_rpmb_req req = { 0 };
    int ret = 0;
    uint16_t result = 0;
    char nonce[32] = { 0 };
    uint8_t nonce[32] = { 0 };
    req.type = RPMB_GET_WRITE_COUNTER;
    req.wc = wc;
    req.result = &result;
@@ -759,7 +760,7 @@ int mmc_rpmb_read(struct msdc_host *host, void *buf) {
    struct mmc_ioc_rpmb_req req = { 0 };
    int ret = 0;
    uint16_t result = 0;
    char nonce[32] = { 0 };
    uint8_t nonce[32] = { 0 };
    req.type = RPMB_READ_DATA;
    req.blk_cnt = 1;
    req.result = &result;
@@ -823,8 +824,8 @@ int mmc_rpmb_write(struct msdc_host *host, void *buf) {
    struct mmc_ioc_rpmb_req req = { 0 };
    int ret = 0;
    uint16_t result = 0;
    char nonce[32] = { 0 };
    char mac[32] = { 0 };
    uint8_t nonce[32] = { 0 };
    uint8_t mac[32] = { 0 };
    uint32_t wc;

    uint8_t tmp[0x100];
+6 −14
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ int msdc_pio_read(struct msdc_host *host, void *buf)

        break;
    }
end:
    // data->bytes_xfered += size;
    N_MSG(FIO, "        PIO Read<%d>bytes\n", size);
        
@@ -181,7 +180,6 @@ end:
*/
int msdc_pio_write(struct msdc_host* host, void *buf)
{
    u32  base = host->base;
    u32  num = 1;
    u32 *ptr;
    u8  *u8ptr;
@@ -252,7 +250,6 @@ int msdc_pio_write(struct msdc_host* host, void *buf)

        break;
    }
end:    
    // data->bytes_xfered += size;
    N_MSG(FIO, "        PIO Write<%d>bytes\n", size);
    if (size != 0x200)
@@ -271,7 +268,9 @@ static unsigned int msdc_command_start(struct msdc_host *host,
                                      int                 tune,   /* not used */
                                      unsigned long       timeout)
{
    u32 base = host->base;
    (void)tune;
    (void)timeout;

    u32 opcode = cmd->opcode;
    u32 rawcmd;
    u32 rawarg;
@@ -472,12 +471,9 @@ static unsigned int msdc_command_resp_polling(struct msdc_host *host,
        int                 tune,
        unsigned long       timeout)
{
    u32 base = host->base;
    (void)tune;
    (void)timeout;
    u32 intsts;
    u32 resp;
    //u32 status;
    // unsigned long tmo;
    //struct mmc_data   *data = host->data;

    u32 cmdsts = MSDC_INT_CMDRDY  | MSDC_INT_RSPCRCERR  | MSDC_INT_CMDTMO;     

@@ -493,8 +489,6 @@ static unsigned int msdc_command_resp_polling(struct msdc_host *host,
#endif


    resp = host->cmd_rsp;

    /*polling*/
    // tmo = jiffies + timeout;
    while (1){
@@ -616,7 +610,6 @@ static unsigned int msdc_command_resp_polling(struct msdc_host *host,
        }
#endif /* end of MTK_MSDC_USE_CMD23 */
    }
out:
    host->cmd = NULL;

    return cmd->error;
@@ -649,7 +642,6 @@ unsigned int msdc_cmd(struct msdc_host *host, struct mmc_command *cmd) {

void msdc_set_blknum(struct msdc_host *host, u32 blknum)
{
    u32 base = host->base;

    (void)host;
    sdr_write32(SDC_BLK_NUM, blknum);
}
Loading