Changeset 39


Ignore:
Timestamp:
Nov 8, 2010, 9:40:19 PM (15 years ago)
Author:
markus
Message:

fixed bug reading CHS from identify package result; fixed ATA geometry mapping

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/ata.c

    r38 r39  
    22 * ata.c - ATA command processing
    33 *
    4  * Copyright (c) 2010 Christian Mueller. Parts copied from/inspired by the
    5  * Linux AHCI driver; those parts are (c) Linux AHCI/ATA maintainers
     4 * Copyright (c) 2010 Christian Mueller, Markus Thielen.
     5 * Parts copied from/inspired by the Linux AHCI driver;
     6 * those parts are (c) Linux AHCI/ATA maintainers
    67 *
    78 *  This program is free software; you can redistribute it and/or modify
     
    462463
    463464  /* extract total number of sectors */
    464   if (id_buf[ATA_ID_CFS_ENABLE_2] & 0x40) {
     465  if (id_buf[ATA_ID_CFS_ENABLE_2] & 0x400) {
    465466    /* 48-bit LBA supported */
    466467    if (ATA_CAPACITY48_H(id_buf) != 0) {
     
    483484      CUR_CAPACITY(id_buf) == CUR_HEADS(id_buf) *
    484485                              CUR_CYLS(id_buf) *
    485                               CUR_SECTORS(id_buf)) {
     486                                                                                                                        CUR_SECTORS(id_buf)) {
    486487    /* use BIOS-supplied values for geometry */
    487488    geometry->NumHeads        = CUR_HEADS(id_buf);
     
    496497    geometry->TotalCylinders  = ATA_CYLS(id_buf);
    497498
    498   } else {
    499     /* construct values based on typical [SCSI] BIOS algorithms */
     499  }
     500 
     501  /* MT: if neither ATA nor BIOS supply valid data, or if their
     502   *     CHS values result in a sector count lower than determined,
     503   *     we use a typical [SCSI] BIOS algorithm
     504   */
     505  if ((u32) geometry->NumHeads * (u32) geometry->SectorsPerTrack *
     506          (u32) geometry->TotalCylinders < geometry->TotalSectors) {
    500507    geometry->NumHeads        = 255;
    501508    geometry->SectorsPerTrack = 63;
  • trunk/src/os2ahci/ata.h

    r38 r39  
    2525 * Macros to access geometry values in the ATA ID buffer
    2626 */
    27 #define ATA_CYLS(id_buf)            *((u32 *) (id_buf + ATA_ID_CYLS))
    28 #define ATA_HEADS(id_buf)           *((u32 *) (id_buf + ATA_ID_HEADS))
    29 #define ATA_SECTORS(id_buf)         *((u32 *) (id_buf + ATA_ID_SECTORS))
     27#define ATA_CYLS(id_buf)            *((u16 *) (id_buf + ATA_ID_CYLS))
     28#define ATA_HEADS(id_buf)           *((u16 *) (id_buf + ATA_ID_HEADS))
     29#define ATA_SECTORS(id_buf)         *((u16 *) (id_buf + ATA_ID_SECTORS))
    3030#define ATA_CAPACITY(id_buf)        *((u32 *) (id_buf + ATA_ID_LBA_CAPACITY))
    3131
     
    3333#define ATA_CAPACITY48_H(id_buf)    *((u32 *) (id_buf + ATA_ID_LBA_CAPACITY_2 + 2))
    3434
    35 #define CUR_CYLS(id_buf)            *((u32 *) (id_buf + ATA_ID_CUR_CYLS))
    36 #define CUR_HEADS(id_buf)           *((u32 *) (id_buf + ATA_ID_CUR_HEADS))
    37 #define CUR_SECTORS(id_buf)         *((u32 *) (id_buf + ATA_ID_CUR_SECTORS))
     35#define CUR_CYLS(id_buf)            *((u16 *) (id_buf + ATA_ID_CUR_CYLS))
     36#define CUR_HEADS(id_buf)           *((u16 *) (id_buf + ATA_ID_CUR_HEADS))
     37#define CUR_SECTORS(id_buf)         *((u16 *) (id_buf + ATA_ID_CUR_SECTORS))
    3838#define CUR_CAPACITY(id_buf)        *((u32 *) (id_buf + ATA_ID_CUR_CAPACITY))
    3939
  • trunk/src/os2ahci/atapi.c

    r13 r39  
    22 * atapi.c - ATAPI command processing
    33 *
    4  * Copyright (c) 2010 Christian Mueller. Parts copied from/inspired by the
    5  * Linux AHCI driver; those parts are (c) Linux AHCI/ATA maintainers
     4 * Copyright (c) 2010 Christian Mueller, Markus Thielen.
     5 * Parts copied from/inspired by the Linux AHCI driver;
     6 * those parts are (c) Linux AHCI/ATA maintainers
    67 *
    78 *  This program is free software; you can redistribute it and/or modify
  • trunk/src/os2ahci/os2ahci.def

    r36 r39  
    11library os2ahci
    2 Description '$@#thi.guten (www.thiguten.de):1.00.20101105#@OS/2 AHCI Adapter Device Driver'
     2Description '$@#thi.guten (www.thiguten.de):1.00.20101108#@OS/2 AHCI Adapter Device Driver'
    33protmode
    44
  • trunk/src/os2ahci/pci.c

    r36 r39  
    22 * PCI.c - PCI constants and detection code for os2ahci driver
    33 *
    4  * Copyright (c) 2010 Christian Mueller. Parts copied from/inspired by the
    5  * LINUX ahci driver; those parts are (c) Linux AHCI/ATA maintainers
     4 * Copyright (c) 2010 Christian Mueller, Markus Thielen.
     5 * Parts copied from/inspired by the LINUX ahci driver;
     6 * those parts are (c) Linux AHCI/ATA maintainers
    67 *
    78 *  This program is free software; you can redistribute it and/or modify
  • trunk/tools/blddate.cmd

    r34 r39  
    11/*
    2  * blddate.cmd - REXX script to spit out a header file containing 
     2 * blddate.cmd - REXX script to spit out a header file containing
    33 * #defines for the current day, month and year
    44 *
     
    1111
    1212say '/* auto generated by blddate.cmd */'
    13 say '#define BLD_YEAR  ' SUBSTR(d, 1, 4)
    14 say '#define BLD_MONTH ' SUBSTR(d, 5, 2)
    15 say '#define BLD_DAY   ' SUBSTR(d, 7, 2)
     13say '#define BLD_YEAR  ' FORMAT(SUBSTR(d, 1, 4))
     14say '#define BLD_MONTH ' FORMAT(SUBSTR(d, 5, 2))
     15say '#define BLD_DAY   ' FORMAT(SUBSTR(d, 7, 2))
    1616
    1717
  • trunk/tools/bldlvl.cmd

    r27 r39  
    266266    Say "    CTRL+BRK currently disabled"
    267267    Return 0
     268
Note: See TracChangeset for help on using the changeset viewer.