Lines 54-64
Link Here
|
54 |
|
54 |
|
55 |
#ifndef USE_XREAD |
55 |
#ifndef USE_XREAD |
56 |
static struct edd_packet packet; |
56 |
static struct edd_packet packet; |
|
|
57 |
static char bounce_buffer[512]; |
58 |
|
59 |
static int drvread_one(struct dsk *, void *, daddr_t, unsigned); |
57 |
#endif |
60 |
#endif |
58 |
|
61 |
|
59 |
int |
62 |
int |
60 |
drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) |
63 |
drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) |
61 |
{ |
64 |
{ |
|
|
65 |
#ifndef USE_XREAD |
66 |
int i; |
67 |
|
68 |
/* If the buffer is below 1MB, pass it through directly. */ |
69 |
if (VTOP((char *)buf + nblk * 512) >> 20 == 0) |
70 |
return (drvread_one(dskp, buf, lba, nblk)); |
71 |
|
72 |
/* |
73 |
* Use the bounce buffer to transfer the data one sector at a |
74 |
* time. |
75 |
*/ |
76 |
for (i = 0; i < nblk; i++) { |
77 |
if (drvread_one(dskp, bounce_buffer, lba + i, 1) < 0) |
78 |
return (-1); |
79 |
memcpy((char *)buf + 512 * i, bounce_buffer, 512); |
80 |
} |
81 |
return (0); |
82 |
} |
83 |
|
84 |
static int |
85 |
drvread_one(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) |
86 |
{ |
87 |
#endif |
62 |
static unsigned c = 0x2d5c7c2f; |
88 |
static unsigned c = 0x2d5c7c2f; |
63 |
int retries = 3; |
89 |
int retries = 3; |
64 |
|
90 |
|