Skip to contentSkip to conversation

PRD_ENTRIES is 256

PATCH William Lee Irwin III 3 participants 4 messages Feb 25, 2004

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw
Quoted 4 lines · William Lee Irwin III

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.

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.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
#2 lore raw
Quoted 4 lines · William Lee Irwin III
Quoted 4 lines

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.

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

#3 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · William Lee Irwin III

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.

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