Ticket #730: atacmds.cpp.diff

File atacmds.cpp.diff, 1.3 KB (added by Casey Biemiller, 6 years ago)

A diff of the atacmds.cpp

  • atacmds.cpp

     
    10971097  return true;
    10981098}
    10991099
     1100// Write GP Log page(s)
     1101bool ataWriteLogExt(ata_device * device, unsigned char logaddr,
     1102                    unsigned page, void * data, unsigned nsectors)
     1103{
     1104  ata_cmd_in in;
     1105  in.in_regs.command      = ATA_WRITE_LOG_EXT;
     1106  in.set_data_out(data, nsectors);
     1107  in.in_regs.lba_low      = logaddr;
     1108  in.in_regs.lba_mid_16   = page;
     1109  in.set_data_out(data, nsectors);
    11001110
     1111  ata_cmd_out out;
     1112  if (!device->ata_pass_through(in, out)) { // TODO: Debug output
     1113    if (nsectors <= 1) {
     1114      pout("ATA_WRITE_LOG_EXT (addr=0x%02x, page=%u, n=%u) failed: %s\n",
     1115           logaddr, page, nsectors, device->get_errmsg());
     1116      return false;
     1117    }
     1118
     1119    // Recurse to retry with single sectors,
     1120    // multi-sector reads may not be supported by ioctl.
     1121    for (unsigned i = 0; i < nsectors; i++) {
     1122      if (!ataWriteLogExt(device, logaddr, page + i,
     1123                         (char *)data + 512*i, 1))
     1124        return false;
     1125    }
     1126  }
     1127
     1128  return true;
     1129}
     1130
    11011131// Read GP Log page(s)
    11021132bool ataReadLogExt(ata_device * device, unsigned char logaddr,
    11031133                   unsigned char features, unsigned page,