From 94cf5e2e91aa91011c9c5612c2ec8a798eb9b8ea Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 25 Jul 2016 17:36:42 +0100 Subject: [PATCH] nc100: udpate to new block I/O --- Kernel/platform-nc100/devrd.c | 37 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/Kernel/platform-nc100/devrd.c b/Kernel/platform-nc100/devrd.c index 6c5674d0..305e21b2 100644 --- a/Kernel/platform-nc100/devrd.c +++ b/Kernel/platform-nc100/devrd.c @@ -13,43 +13,30 @@ static const uint8_t kmap[] = { 0x83, 0x84, 0x85 }; static int rd_transfer(bool is_read, uint8_t rawflag) { - blkno_t block; - int block_xfer; uint16_t dptr; - int dlen; int ct = 0; int map; - const uint8_t *p; + const uint8_t *p = kmap; if(rawflag) { p = (const uint8_t *)&udata.u_page; - dlen = udata.u_count; - dptr = (uint16_t)udata.u_base; - if ((dlen|udata.u_offset) & BLKMASK) { - udata.u_error = EIO; + if (d_blkoff(BLKSHIFT)) return -1; - } - block = udata.u_offset >> 9; - block_xfer = dlen >> 9; - } else { /* rawflag == 0 */ - p = kmap; - dlen = 512; - dptr = (uint16_t)udata.u_buf->bf_data; - block = udata.u_buf->bf_blk; - block_xfer = 1; - map = 0; } - block += 2*320; /* ramdisc starts at 320K in */ - - while (ct < block_xfer) { + + udata.u_block += 2*320; /* ramdisc starts at 320K in */ + + dptr = (uint16_t)udata.u_dptr; + + while (ct < udata.u_nblock) { /* Pass the page to map for the data */ map = p[(dptr >> 14)]; - rd_memcpy(is_read, map, dptr, block); - block++; + rd_memcpy(is_read, map, dptr, udata.u_block); + udata.u_block++; ct++; - dptr += 512; + dptr += BLKSIZE; } - return ct; + return ct << BLKSHIFT; } int rd_open(uint8_t minor, uint16_t flag) -- 2.34.1