mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-09 08:37:58 +08:00
2002-10-28 Eugeny S. Mints <Eugeny.Mints@oktet.ru>
* Added ATA support. * include/rtems/blkdev.h: Added last IO status. * include/rtems/ata.h, include/rtems/ata_internal.h, include/rtems/ide_part_table.h, src/ata.c, src/ide_part_table.c: New files.
This commit is contained in:
1 parent
42b7ce27ce
commit
ef142d71a5
7 files changed
+2418
No files matched your search
@@ -1,3 +1,11 @@
|
||||
2002-10-28 Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
|
||||
* Added ATA support.
|
||||
* include/rtems/blkdev.h: Added last IO status.
|
||||
* include/rtems/ata.h, include/rtems/ata_internal.h,
|
||||
include/rtems/ide_part_table.h, src/ata.c, src/ide_part_table.c: New
|
||||
files.
|
||||
|
||||
2002-10-25 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||
|
||||
* configure.ac: Add nostdinc to AM_INIT_AUTOMAKE.
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* ata.h
|
||||
*
|
||||
* ATA RTEMS driver header file. This file should be included from an
|
||||
* application.
|
||||
*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
* Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef __ATA_H__
|
||||
#define __ATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <rtems/blkdev.h>
|
||||
|
||||
rtems_device_driver ata_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *args);
|
||||
|
||||
#define ATA_DRIVER_TABLE_ENTRY \
|
||||
{ata_initialize, GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES}
|
||||
|
||||
/* ATA IOCTL request codes */
|
||||
#define ATAIO_SET_MULTIPLE_MODE _IO('A', 1)
|
||||
|
||||
/*
|
||||
* ATA driver configuration parameters
|
||||
* FIXME: should be configured more easy...
|
||||
*/
|
||||
#define ATA_DRIVER_MESSAGE_QUEUE_SIZE 50
|
||||
#define ATA_DRIVER_TASK_PRIORITY 140
|
||||
#define ATA_DRIVER_TASK_STACK_SIZE 16*1024
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __ATA_H__ */
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -62,6 +62,10 @@ typedef struct blkdev_request {
|
||||
blkdev_request_op req; /* Block device operation (read or write) */
|
||||
blkdev_request_cb req_done; /* Callback function */
|
||||
void *done_arg; /* Argument to be passed to callback function*/
|
||||
rtems_status_code status; /* Last I/O operation completion status */
|
||||
int error; /* If status != RTEMS_SUCCESSFUL, this field
|
||||
* contains error code
|
||||
*/
|
||||
blkdev_bnum start; /* Start block number */
|
||||
rtems_unsigned32 count; /* Number of blocks to be exchanged */
|
||||
rtems_unsigned32 bufnum; /* Number of buffers provided */
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ide_part_table.h
|
||||
*
|
||||
* The header file for library supporting "MS-DOS-style" partition table
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
*
|
||||
* Author: Konstantin Abramenko <Konstantin.Abramenko@oktet.ru>
|
||||
* Alexander Kukuta <Alexander.Kukuta@oktet.ru>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTEMS_IDE_PART_TABLE_H__
|
||||
#define __RTEMS_IDE_PART_TABLE_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <chain.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/blkdev.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/bdbuf.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/* Minor base number for all logical devices */
|
||||
#define RTEMS_IDE_SECTOR_BITS 9
|
||||
#define RTEMS_IDE_SECTOR_SIZE 512
|
||||
#define RTEMS_IDE_PARTITION_DESCRIPTOR_SIZE 16
|
||||
#define RTEMS_IDE_PARTITION_MAX_PARTITION_NUMBER 63
|
||||
#define RTEMS_IDE_PARTITION_MAX_SUB_PARTITION_NUMBER 4
|
||||
#define RTEMS_IDE_PARTITION_DEV_NAME_LENGTH_MAX 16
|
||||
|
||||
#define RTEMS_IDE_PARTITION_MSDOS_SIGNATURE_DATA1 0x55
|
||||
#define RTEMS_IDE_PARTITION_MSDOS_SIGNATURE_DATA2 0xaa
|
||||
#define RTEMS_IDE_PARTITION_MSDOS_SIGNATURE_OFFSET 0x1fe
|
||||
#define RTEMS_IDE_PARTITION_TABLE_OFFSET 0x1be
|
||||
#define RTEMS_IDE_PARTITION_BOOTABLE_OFFSET 0
|
||||
#define RTEMS_IDE_PARTITION_SYS_TYPE_OFFSET 4
|
||||
#define RTEMS_IDE_PARTITION_START_OFFSET 8
|
||||
#define RTEMS_IDE_PARTITION_SIZE_OFFSET 12
|
||||
|
||||
/*
|
||||
* Conversion from and to little-endian byte order. (no-op on i386/i486)
|
||||
*/
|
||||
|
||||
#if (CPU_BIG_ENDIAN == TRUE)
|
||||
# define LE_TO_CPU_U16(v) CPU_swap_u16(v)
|
||||
# define LE_TO_CPU_U32(v) CPU_swap_u32(v)
|
||||
# define CPU_TO_LE_U16(v) CPU_swap_u16(v)
|
||||
# define CPU_TO_LE_U32(v) CPU_swap_u32(v)
|
||||
#else
|
||||
# define LE_TO_CPU_U16(v) (v)
|
||||
# define LE_TO_CPU_U32(v) (v)
|
||||
# define CPU_TO_LE_U16(v) (v)
|
||||
# define CPU_TO_LE_U32(v) (v)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* sector_data_t --
|
||||
* corresponds to the sector on the device
|
||||
*/
|
||||
typedef struct sector_data_s
|
||||
{
|
||||
unsigned32 sector_num; /* sector number on the device */
|
||||
unsigned8 data[0]; /* raw sector data */
|
||||
} sector_data_t;
|
||||
|
||||
|
||||
/*
|
||||
* Enum partition types
|
||||
*/
|
||||
enum {
|
||||
EMPTY_PARTITION = 0,
|
||||
EXTENDED_PARTITION = 5,
|
||||
DM6_PARTITION = 0x54,
|
||||
EZD_PARTITION = 0x55,
|
||||
DM6_AUX1PARTITION = 0x51,
|
||||
DM6_AUX3PARTITION = 0x53,
|
||||
LINUX_SWAP = 0x82,
|
||||
LINUX_NATIVE = 0x83,
|
||||
LINUX_EXTENDED = 0x85
|
||||
};
|
||||
|
||||
|
||||
/* Forward declaration */
|
||||
struct disk_desc_s;
|
||||
|
||||
/*
|
||||
* part_desc_t --
|
||||
* contains all neccessary information about partition
|
||||
*/
|
||||
typedef struct part_desc_s {
|
||||
unsigned8 bootable; /* is the partition active */
|
||||
unsigned8 sys_type; /* type of partition */
|
||||
unsigned8 log_id; /* logical number of partition */
|
||||
unsigned32 start; /* first partition sector, in absolute numeration */
|
||||
unsigned32 size; /* size in sectors */
|
||||
unsigned32 end; /* last partition sector, end = start + size - 1 */
|
||||
struct disk_desc_s *disk_desc; /* descriptor of disk, partition contains in */
|
||||
struct part_desc_s *ext_part; /* extended partition containing this one */
|
||||
|
||||
/* partitions, containing in this one */
|
||||
struct part_desc_s *sub_part[RTEMS_IDE_PARTITION_MAX_SUB_PARTITION_NUMBER];
|
||||
} part_desc_t;
|
||||
|
||||
|
||||
|
||||
typedef struct disk_desc_s {
|
||||
dev_t dev; /* device number */
|
||||
|
||||
/* device name in /dev filesystem */
|
||||
unsigned8 dev_name[RTEMS_IDE_PARTITION_DEV_NAME_LENGTH_MAX];
|
||||
|
||||
unsigned32 sector_size; /* size of sector */
|
||||
unsigned32 sector_bits; /* the base-2 logarithm of sector_size */
|
||||
unsigned32 lba_size; /* total amount of sectors in lba address mode */
|
||||
int last_log_id; /* used for logical disks enumerating */
|
||||
|
||||
/* primary partition descriptors */
|
||||
part_desc_t *partitions[RTEMS_IDE_PARTITION_MAX_PARTITION_NUMBER];
|
||||
} disk_desc_t;
|
||||
|
||||
|
||||
/*
|
||||
* rtems_ide_part_table_free --
|
||||
* frees disk descriptor structure
|
||||
*
|
||||
* PARAMETERS:
|
||||
* disk_desc - disc descriptor structure to free
|
||||
*
|
||||
* RETURNS:
|
||||
* N/A
|
||||
*/
|
||||
void
|
||||
rtems_ide_part_table_free(disk_desc_t *disk_desc);
|
||||
|
||||
|
||||
/*
|
||||
* rtems_ide_part_table_get --
|
||||
* reads partition table structure from the device
|
||||
* and creates disk description structure
|
||||
*
|
||||
* PARAMETERS:
|
||||
* dev_name - path to physical device in /dev filesystem
|
||||
* disk_desc - returned disc description structure
|
||||
*
|
||||
* RETURNS:
|
||||
* RTEMS_SUCCESSFUL if success, or -1 and corresponding errno else
|
||||
*/
|
||||
rtems_status_code
|
||||
rtems_ide_part_table_get(const char *dev_name, disk_desc_t *disk_desc);
|
||||
|
||||
|
||||
/*
|
||||
* rtems_ide_part_table_initialize --
|
||||
* initializes logical devices on the physical IDE drive
|
||||
*
|
||||
* PARAMETERS:
|
||||
* dev_name - path to physical device in /dev filesystem
|
||||
*
|
||||
* RETURNS:
|
||||
* RTEMS_SUCCESSFUL if success, or -1 and corresponding errno else
|
||||
*/
|
||||
rtems_status_code
|
||||
rtems_ide_part_table_initialize(char *dev_name);
|
||||
|
||||
|
||||
#endif /* __RTEMS_IDE_PART_TABLE_H__ */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user