Commit f35b5e7c authored by Alexander Beregalov's avatar Alexander Beregalov Committed by Jeff Garzik

sata_sx4: speed up ECC initialization

ECC initialization takes too long. It writes zeroes by portions
of 4 byte, it takes more than 6 minutes on my machine to initialize
512Mb ECC DIMM module. Change portion to 128Kb - it significantly
reduces initialization time.
Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 2102d749
...@@ -193,6 +193,7 @@ enum { ...@@ -193,6 +193,7 @@ enum {
PDC_TIMER_MASK_INT, PDC_TIMER_MASK_INT,
}; };
#define ECC_ERASE_BUF_SZ (128 * 1024)
struct pdc_port_priv { struct pdc_port_priv {
u8 dimm_buf[(ATA_PRD_SZ * ATA_MAX_PRD) + 512]; u8 dimm_buf[(ATA_PRD_SZ * ATA_MAX_PRD) + 512];
...@@ -1280,7 +1281,6 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) ...@@ -1280,7 +1281,6 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
{ {
int speed, size, length; int speed, size, length;
u32 addr, spd0, pci_status; u32 addr, spd0, pci_status;
u32 tmp = 0;
u32 time_period = 0; u32 time_period = 0;
u32 tcount = 0; u32 tcount = 0;
u32 ticks = 0; u32 ticks = 0;
...@@ -1395,14 +1395,17 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) ...@@ -1395,14 +1395,17 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
PDC_DIMM_SPD_TYPE, &spd0); PDC_DIMM_SPD_TYPE, &spd0);
if (spd0 == 0x02) { if (spd0 == 0x02) {
void *buf;
VPRINTK("Start ECC initialization\n"); VPRINTK("Start ECC initialization\n");
addr = 0; addr = 0;
length = size * 1024 * 1024; length = size * 1024 * 1024;
buf = kzalloc(ECC_ERASE_BUF_SZ, GFP_KERNEL);
while (addr < length) { while (addr < length) {
pdc20621_put_to_dimm(host, (void *) &tmp, addr, pdc20621_put_to_dimm(host, buf, addr,
sizeof(u32)); ECC_ERASE_BUF_SZ);
addr += sizeof(u32); addr += ECC_ERASE_BUF_SZ;
} }
kfree(buf);
VPRINTK("Finish ECC initialization\n"); VPRINTK("Finish ECC initialization\n");
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment