Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Hardware » Магнитные носители информации » Ремонт накопителей WD (Western Digital). Часть VIII

Модерирует : Akam1, Dr_StandBy, vertex4

Akam1 (05-02-2019 02:46): http://forum.ru-board.com/topic.cgi?forum=84&topic=5433  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Smyg1



Gold Member
Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору
/*
  Downloading and activating microcode involves the following steps:
  1) Download: The application client transfers microcode to the device server in one or more WRITE BUFFER commands;
  2) Save: After receiving the complete microcode, if defined by the download microcode mode, the device server saves the microcode to nonvolatile storage; and
  3) Activate: After receiving the complete microcode and after saving it to nonvolatile storage if defined by the download microcode mode, the SCSI target device begins using the new microcode for the first time after an event defined by the download microcode mode.
 
  Table 180 — WRITE BUFFER MODE field
  00h * Combined header and data
  01h Vendor specific
  02h * Data
  03h Reserved
  04h * Download microcode and activate
  05h Download microcode, save, and activate
  06h * Download microcode with offsets and activate
  07h Download microcode with offsets, save, and activate
  08h - 09h Reserved
  0Ah * Write data to echo buffer
  0Bh - 0Dh Reserved
  0Eh Download microcode with offsets, save, and defer activation
  0Fh Activate deferred microcode
  10h - 1Bh Reserved
  1Ch Download application log
  1Dh - 1Fh Reserved
  * If the WRITE BUFFER command specifies this mode, then the command shall be processed without error before the SCSI target device has spun up after power on as described in
 
 
  CDB0 - OPERATION CODE (3Bh)
  CDB1 - MODE
  CDB2 - BUFFER ID
  CDB3 - BUFFER OFFSET (MSB)
  CDB4  
  CDB5 - (LSB)
  CDB6 - ALLOCATION LENGTH (MSB)
  CDB7  
  CDB8 - (LSB)
  CDB9 - CONTROL
*/
 
 
 
/* http://bbs.dostor.com/viewthread.php?tid=5545&extra=page%3D1&page=1  
*/
/*
Said very arid, my ‰ЏЋ procedure, everybody analyzes, possibly the ratio listens to me to say also can have the harvest.
 
This is the SEAGATE one section of promotion procedure (partial), now should also be allowed to use. The resources document does not know which table of contents put to in, later will find comes up again.
 
From this section of procedure s.scsi_command [ 0 ] = 0x3b... 0x05... 0x07 may see, the promotion process actually is one transmission process, first delivers the code in BUFFER carries out, the behind  
instruction is the condition surveillance.
 
To the hard disk said is needs the special way carries on the transmission promotion code, otherwise, your code could regard as by the hard disk DATA writes on the plate piece.
 
The translation is uses BC 3.1, states: Same year very are many with SEAGATE hard disk correlation software mostly uses or profits from this section of procedure, therefore the movement flow has the similarity  
in the certain degree and other software, even the window position all same. Promotes the FIRMWARE process is specially simple, really has no new pattern to be allowed to advance in the procedure, the  
WINDOWS version also may do the window flowered smart somewhat. But, this procedure has the copyright, please everybody do not have to be left intact copy, understands after was allowed the transformation,  
only if were under the authorization only then can copy verbatim issues oneself the thing.
*/
 
 
 
void download_firmware()
        {
        SCSI *dl;
        int w, key, fh, choice, org_asa, new_asa, n= 0, off= 0;
        unsigned bufsize= 8*1024, rv;
        char *filename, *p;
        long l, j, i, jj, offset;
 
        if (!is_seagate_disk(inq))
                message("WARNING !\r\n"
                        "\r\n"
                        "Download firmware is only tested with Seagate disk drives.";
 
        filename= calloc(1, 128);
        if (!filename)
                {
                printf("Error allocating %u bytes of memory\n", 128);
                exit(0);
                }
 
        strcpy(filename, config->download_file);
        key= edit_string_window(filename, 70, "Enter firmware file to download";
        if (key== KEY_ENTER)
                {
                fh= open(filename, O_RDONLY|O_BINARY);
                if (fh!= -1)
                        {
                        w= window_create(-1, 9, 60, 18, BLUEs.target_id;
                                        dl->s.lun= inq->s.lun;
 
                                        dl->s.scsi_command[0]= 0x3B;
                                        if (off== 0)
                                                {
                                                p= farmalloc(l);
                                                if (p== NULL)
                                                        {
                                                        message("Error allocating %lu bytes", l);
                                                        einde(-1);
                                                        }
 
                                                dl->s.scsi_command[1]= 0x05;
                                                dl->s.data_buffer= p;
                                                dl->s.data_buffer_length= l;
                                                }
                                        else
                                                dl->s.scsi_command[1]= 0x07;
 
                                        *(unsigned long *)&dl->s.scsi_command[5]=
                                                swaplong(dl->s.data_buffer_length);
 
                                        if (off== 1)
                                                {
                                                offset= 0;
                                                j= l / bufsize;
                                                jj= l % bufsize;
                                                gotoxy(1,3);
                                                cprintf("%lu blocks of %uK and %lu bytes\r\n",
                                                        j, (bufsize >> 10), jj);
                                                cprintf("Block:";
                                                for (i= 0; i < j; i++)
                                                        {
                                                        _dos_read(fh, dl->s.data_buffer, bufsize, &rv);
                                                        *(unsigned long *)&dl->s.scsi_command[2]=
                                                                swaplong(offset);
                                                        if (rv== bufsize)
                                                                scsi_execute(dl, 1);
                                                        else
                                                                {
                                                                message("Error while reading firmware file";
                                                                einde(-1);
                                                                }
 
                                                        gotoxy(8,4);
                                                        cprintf("%lu", i);
                                                        offset+= rv;
                                                        }
 
                                                if (jj)
                                                        {
                                                        gotoxy(20,3);
                                                        _dos_read(fh, dl->s.data_buffer, jj, &rv);
                                                        *(unsigned long *)&dl->s.scsi_command[2]=
                                                                swaplong(offset);
                                                        *(unsigned long *)&dl->s.scsi_command[5]=
                                                                swaplong(rv);
                                                        if (rv== jj)
                                                                scsi_execute_bg(dl);
                                                        else
                                                                {
                                                                message("Error while reading firmware file";
                                                                einde(-1);
                                                                }
 
                                                        gotoxy(26,4);
                                                        cprintf("%u", i);
                                                        offset+= rv;
                                                        }
                                                }
                                        else
                                                {
                                                cprintf("Reading file %s, %lu KB", filename, l >> 10);
                                                rv= file_read_into_memory(fh, p, l);
                                                if (rv)
                                                        {
                                                        message("Error while reading firmware file";
                                                        einde(-1);
                                                        }
                                                scsi_execute_bg(dl);
                                                }
 
                                        gotoxy(1,4);
                                        clreol();
                                        cprintf("Download status :";
 
                                        n= 0;
                                        while(dl->s.status== 0)
                                                {
                                                gotoxy(18,4);
                                                putch(wiekje[n++]);
                                                if (!wiekje[n]) n= 0;
                                                gotoxy(19,4);
                                                cprintf("%-10.10s", aspi_status_name(dl->s.status));
                                                delay(250);
                                                }
 
                                        gotoxy(18,4);
                                        putch(' ');
                                        gotoxy(19,4);
                                        cprintf("%-10.10s", aspi_status_name(dl->s.status));
 
                                        if (dl->s.status!= 1)
                                                {
                                                gotoxy(1,5);
                                                print_sense_info_short(dl);
                                                }
                                        else
                                                {
                                                gotoxy(1,6);
                                                cprintf("Waiting for unit";
                                                wait_unit_ready(inq);
 
                                                new_asa= seagate_asa_level(inq);
                                                gotoxy(1,6);
                                                clreol();
                                                cprintf("New ASA level is ASA%u", new_asa);
 
                                                if (org_asa!= new_asa)
                                                        {
                                                        message("You upgraded your drive to a new\r\n"
                                                        "ASA level, drive needs low level format !\r\n"
*/
                                        "\r\n"
                                                        "%s", fortune(fun_message));
                                                        }
                                                }
 
                                        if (off== 0)
                                                {
                                                dl->s.data_buffer= NULL;
                                                dl->s.data_buffer_length= 0;
                                                farfree(p);
                                                }
                                        scsi_destroy(dl);
 
                                        pause();
                                        }
                                }
 
                        close(fh);
                        window_destroy(w);
                        strcpy(config->download_file, filename);
                        cfg_save();
                        }
                else
                        message("Error opening file %s\n\r->%s", filename, sys_errlist[errno]);
                }
 
        free(filename);
        }

Всего записей: 5422 | Зарегистр. 03-10-2006 | Отправлено: 17:51 13-09-2018 | Исправлено: Smyg1, 18:50 13-09-2018
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Hardware » Магнитные носители информации » Ремонт накопителей WD (Western Digital). Часть VIII
Akam1 (05-02-2019 02:46): http://forum.ru-board.com/topic.cgi?forum=84&topic=5433


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru