Changeset dbe06865 in rtems for cpukit/libblock/src


Ignore:
Timestamp:
Mar 25, 2003, 5:01:52 PM (17 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ebe5abc
Parents:
c151cfc
Message:

2003-03-25 Thomas Doerfler <Thomas.Doerfler@…>

PR 367/filesystem

  • Makefile.am, include/rtems/ide_part_table.h, src/ata.c, src/ide_part_table.c: Some bugs were still present in the DOSFS implementation:
    • FAT12 did not work properly on Big-Endian machines
    • Some synchronization and error handling problems were present
    • Some legal codings for EOC were not recognized
Location:
cpukit/libblock/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/ata.c

    rc151cfc rdbe06865  
    1919#include <chain.h>
    2020#include <assert.h>
     21#include <string.h> /* for "memset" declaration */
    2122
    2223#include <rtems/diskdevs.h>
     
    11531154                 0;
    11541155
    1155 #ifndef ATA_DEV_IS_FLASH_DISK
    11561156            if ((CF_LE_W(buffer[ATA_IDENT_WORD_FIELD_VALIDITY]) &
    1157                  ATA_IDENT_BIT_VALID) == 0)
     1157                 ATA_IDENT_BIT_VALID) == 0) {
     1158              /* no "supported modes" info -> use default */
     1159              ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
     1160            }
     1161            else {
     1162              ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
     1163                ((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
     1164                ((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
     1165                ((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
     1166                ((CF_LE_W(buffer[63]) & 0x2) ?
     1167                 ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
     1168                ((CF_LE_W(buffer[63]) & 0x4) ?
     1169                 ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
     1170              if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
    11581171                continue;
    1159 #endif
    1160             ATA_DEV_INFO(ctrl_minor, dev).modes_avaible =
    1161             ((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) |
    1162             ((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) |
    1163             ((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) |
    1164             ((CF_LE_W(buffer[63]) & 0x2) ?
    1165             ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) |
    1166             ((CF_LE_W(buffer[63]) & 0x4) ?
    1167             ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0);
    1168 
    1169             if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0)
    1170                 continue;
    1171            
    1172             /*
    1173              * choose most appropriate ATA device data I/O speed supported by
    1174              * the controller
    1175              */
    1176             status = ide_controller_config_io_speed(
     1172              /*
     1173               * choose most appropriate ATA device data I/O speed supported
     1174               * by the controller
     1175               */
     1176              status = ide_controller_config_io_speed(
    11771177                ctrl_minor,
    11781178                ATA_DEV_INFO(ctrl_minor, dev).modes_avaible);
    1179             if (status != RTEMS_SUCCESSFUL)
     1179              if (status != RTEMS_SUCCESSFUL)
    11801180                continue;
    1181                    
    1182 #ifdef ATA_DEV_IS_FLASH_DISK
    1183             ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3;
    1184 #endif       
     1181            }     
    11851182            /*
    11861183             * Ok, let register new ATA device in the system
  • cpukit/libblock/src/ide_part_table.c

    rc151cfc rdbe06865  
    2020
    2121#include <rtems/ide_part_table.h>
    22 
     22#include <string.h>
    2323
    2424/*
     
    113113}
    114114
     115/*
     116 * is_fat_partition --
     117 *      checks if the partition type is defined for FAT
     118 *
     119 * PARAMETERS:
     120 *      type - type of partition to check
     121 *
     122 * RETURNS:
     123 *      TRUE if partition type is extended, FALSE otherwise
     124 */
     125static rtems_boolean
     126is_fat_partition(unsigned8 type)
     127{
     128  static const unsigned8 fat_part_types[] = {
     129    DOS_FAT12_PARTITION,DOS_FAT16_PARTITION,
     130    DOS_P32MB_PARTITION,
     131    FAT32_PARTITION    ,FAT32_LBA_PARTITION,
     132    FAT16_LBA_PARTITION
     133  };
     134
     135  return (NULL != memchr(fat_part_types,type,sizeof(fat_part_types)));
     136}
     137
    115138
    116139/*
     
    158181    part_desc->size = LE_TO_CPU_U32(temp);
    159182
    160     if ((part_desc->sys_type == EMPTY_PARTITION) ||
    161         ((part_desc->size == 0) && (!is_extended(part_desc->sys_type))))
    162     {
    163         /* empty partition */
    164         free(part_desc);
    165         return RTEMS_SUCCESSFUL;
    166     }
    167    
    168     *new_part_desc = part_desc;
    169 
     183    /*
     184     * use partitions that are
     185     * - extended
     186     * or
     187     * - FAT type and non-zero
     188     */
     189    if (is_extended(part_desc->sys_type) ||
     190        (is_fat_partition(part_desc->sys_type)) && (part_desc->size != 0)) {
     191      *new_part_desc = part_desc;
     192    }
     193    else { 
     194      /* empty partition */
     195      free(part_desc);
     196    }
    170197    return RTEMS_SUCCESSFUL;
    171198}
Note: See TracChangeset for help on using the changeset viewer.