fix crasher bug in nandfs, add code to get nandfs usage

This commit is contained in:
bushing 2009-05-02 05:55:07 -07:00
parent 45b8895ac9
commit ef02581dda

15
nand.c
View File

@ -97,10 +97,15 @@ void nand_irq(void)
break; break;
case IPC_NAND_READ: case IPC_NAND_READ:
err = nand_correct(last_page_read, ipc_data, ipc_ecc); err = nand_correct(last_page_read, ipc_data, ipc_ecc);
if (current_request.args[1] != 0xFFFFFFFF) {
memcpy32((void*)current_request.args[1], ipc_data, PAGE_SIZE); memcpy32((void*)current_request.args[1], ipc_data, PAGE_SIZE);
memcpy32((void*)current_request.args[2], ipc_ecc, ECC_BUFFER_SIZE);
dc_flushrange((void*)current_request.args[1], PAGE_SIZE); dc_flushrange((void*)current_request.args[1], PAGE_SIZE);
}
if (current_request.args[2] != 0xFFFFFFFF) {
memcpy32((void*)current_request.args[2], ipc_ecc, ECC_BUFFER_SIZE);
dc_flushrange((void*)current_request.args[2], ECC_BUFFER_SIZE); dc_flushrange((void*)current_request.args[2], ECC_BUFFER_SIZE);
}
break; break;
default: default:
gecko_printf("Got IRQ for unknown NAND req %d\n", current_request.req); gecko_printf("Got IRQ for unknown NAND req %d\n", current_request.req);
@ -187,8 +192,8 @@ void nand_read_page(u32 pageno, void *data, void *ecc) {
__nand_set_address(0, pageno); __nand_set_address(0, pageno);
nand_send_command(NAND_READ_PRE, 0x1f, 0, 0); nand_send_command(NAND_READ_PRE, 0x1f, 0, 0);
dc_invalidaterange(data, PAGE_SIZE); if (((s32)data) != -1) dc_invalidaterange(data, PAGE_SIZE);
dc_invalidaterange(ecc, ECC_BUFFER_SIZE); if (((s32)ecc) != -1) dc_invalidaterange(ecc, ECC_BUFFER_SIZE);
__nand_wait(); __nand_wait();
__nand_setup_dma(data, ecc); __nand_setup_dma(data, ecc);
@ -215,8 +220,8 @@ void nand_write_page(u32 pageno, void *data, void *ecc) {
gecko_printf("Error: nand_write to page %d forbidden\n", pageno); gecko_printf("Error: nand_write to page %d forbidden\n", pageno);
return; return;
} }
dc_flushrange(data, PAGE_SIZE); if (((s32)data) != -1) dc_flushrange(data, PAGE_SIZE);
dc_flushrange(ecc, PAGE_SPARE_SIZE); if (((s32)ecc) != -1) dc_flushrange(ecc, PAGE_SPARE_SIZE);
ahb_flush_to(AHB_NAND); ahb_flush_to(AHB_NAND);
__nand_set_address(0, pageno); __nand_set_address(0, pageno);
__nand_setup_dma(data, ecc); __nand_setup_dma(data, ecc);