PRD_ENTRIES is 256
PRD_ENTRIES is specified to be precisely 256; on platforms where PAGE_SIZE varies from 4KB the calculation in the current expression defining it is inaccurate, which may cause crashes. This patch changes it to the constant literal 256.
-- wli
===== include/linux/ide.h 1.88 vs edited =====
include/linux/ide.h +1 -1
@@ -224,7 +224,7 @@* allowing each to have about 256 entries (8 bytes each) from this. */ #define PRD_BYTES 8 -#define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES)) +#define PRD_ENTRIES 256/* * Some more useful definitions
Quoted 4 lines · William Lee Irwin III
PRD_ENTRIESis specified to be precisely 256; on platforms wherePAGE_SIZEvaries from 4KB the calculation in the current expression defining it is inaccurate, which may cause crashes. This patch changes it to the constant literal 256.
Ok, thanks. However I cannot find 256 entries limit in any ATA document and from looking at the code 512 entries shouldn't be a problem (?).
--bart
Quoted 15 lines
-- wli
=====
include/linux/ide.h1.88 vs edited =====include/linux/ide.h +1
-1@@ -224,7 +224,7 @@* allowing each to have about 256 entries (8 bytes each) from this. */ #define PRD_BYTES 8 -#define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES)) +#define PRD_ENTRIES 256/* * Some more useful definitions
Quoted 4 lines · William Lee Irwin III
Quoted 4 lines
PRD_ENTRIESis specified to be precisely 256; on platforms wherePAGE_SIZEvaries from 4KB the calculation in the current expression defining it is inaccurate, which may cause crashes. This patch changes it to the constant literal 256.
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Ok, thanks. However I cannot find 256 entries limit in any ATA document and from looking at the code 512 entries shouldn't be a problem (?). --bart
The numbers I'm fishing out of things say that the PRD table can't exceed 64KB in size as it can't cross a 64KB boundary and its length is specified as a 16-bit byte count, so some other method of sizing the thing may be in order. I do recall something went wrong at the time I ran into this. If I turn up where I thought the number 256 came from I'll cite it.
-- wli
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · William Lee Irwin III
PRD_ENTRIESis specified to be precisely 256; on platforms wherePAGE_SIZEvaries from 4KB the calculation in the current expression defining it is inaccurate, which may cause crashes. This patch changes it to the constant literal 256.Ok, thanks. However I cannot find 256 entries limit in any ATA document and from looking at the code 512 entries shouldn't be a problem (?).
I can't find the 256 limit either, but I would swear it exists... I'll ask around. Certainly it would be nice for lba48 to have larger tables...
Jeff