Ejemplo n.º 1
0
/*
功能:
    获取硬盘信息。主要是获取对应硬盘的容量,获取的信息保存在hd_info中
参数:
    device:系统统一设备编号
返回值:
    (无)
*/
static void hd_identify(int index){
    int hd_index=HD_INDEX(index);

    struct s_hd_command cmd;
    cmd.device=MAKE_DEVICE_REG(0,hd_index,0);
    cmd.command=ATA_IDENTIFY;
    hd_command_out(&cmd);

#ifdef DEBUG_HD
    printl("interrupt_wait\n");
#endif

    interrupt_wait();

    port_read(REG_P_DATA,hdbuf,SECTOR_SIZE);

#ifdef DEBUG_HD
    print_identify_info((u16*)hdbuf); 
#endif
    
    u16 *hdinfo=(u16*)hdbuf;
    //硬盘基址 
    hd_info[hd_index].primary[0].base=0;
    //硬盘扇区数
    hd_info[hd_index].primary[0].size=((int)hdinfo[61]<<16)+hdinfo[60];
}
Ejemplo n.º 2
0
/**
 * <Ring 1> Get the disk information.
 * 
 * @param drive  Drive Nr.
 *****************************************************************************/
PRIVATE void hd_identify(int drive)
{
	struct hd_cmd cmd;
	cmd.device  = MAKE_DEVICE_REG(0, drive, 0);
	cmd.command = ATA_IDENTIFY;
	hd_cmd_out(&cmd);
	interrupt_wait();
	port_read(REG_DATA, hdbuf, SECTOR_SIZE);

	print_identify_info((u16*)hdbuf);
}
Ejemplo n.º 3
0
/* @param drive  When drive == 0, master is selected
		When drive == 1 slave is selected*/
PUBLIC void kernelHdIdentify(int drive)
{
	struct hd_cmd cmd;
	cmd.device = MAKE_DEVICE_REG(0, drive, 0);
	cmd.command = ATA_IDENTIFY;
	hd_cmd_out(&cmd);
	hdIdentifyBlockEip = p_proc_running - proc_table;
	kernelBlock();
	port_read(REG_DATA, hdbuf, SECTOR_SIZE);

	//analysis_identify_info((u16*)hdbuf);
}
Ejemplo n.º 4
0
Archivo: hd.c Proyecto: cosail/lwos
/*
 *	<ring 1> get the disk information
 */
static void hd_identify(int drive)
{
	struct hd_cmd cmd;
	cmd.device = MAKE_DEVICE_REG(0, drive, 0);
	cmd.command = ATA_INDENTIFY;
	hd_cmd_out(&cmd);
	interrupt_wait();
	port_read(REG_DATA, hdbuf, SECTOR_SIZE);

	print_identify_info((u16*)hdbuf);
	
	u16 * hdinfo = (u16*)hdbuf;
	hd_info[drive].primary[0].base = 0;
	hd_info[drive].primary[0].size = ((int)hdinfo[61] << 16) + hdinfo[60];
}
Ejemplo n.º 5
0
Archivo: hd.c Proyecto: wwssllabcd/myOS
/**
 * <Ring 1> Get the disk information.
 *
 * @param drive  Drive Nr.
 *****************************************************************************/
PRIVATE void hd_identify(int drive)
{
    struct hd_cmd cmd;
    cmd.device  = MAKE_DEVICE_REG(0, drive, 0);
    cmd.command = ATA_IDENTIFY;
    ERIC_DEBUG(",IdTB");
    hd_cmd_out(&cmd);
    interrupt_wait();

    ERIC_DEBUG(",ReadData");
    port_read(REG_DATA, hdbuf, SECTOR_SIZE);
    print_identify_info((u16*)hdbuf);

    u16* hdinfo = (u16*)hdbuf;

    hd_info[drive].primary[0].base = 0;
    /* Total Nr of User Addressable Sectors */
    hd_info[drive].primary[0].size = ((int)hdinfo[61] << 16) + hdinfo[60];
}
Ejemplo n.º 6
0
Archivo: hd.c Proyecto: Zach41/OS
PRIVATE void hd_identify(int drive) {
    HD_CMD cmd;

    cmd.device  = MAKE_DEVICE_REG(0, drive, 0);
    cmd.command = ATA_IDENTIFY;	/* 向硬盘发送IDENTIFY指令 */

    hd_cmd_out(&cmd);
    interrupt_wait();

    /* 中断结束 */
    port_read(REG_DATA, hdbuf, SECTOR_SIZE);

    /* print_identify_info((u16*)hdbuf); */

    u16* hdinfo = (u16*)hdbuf;

    hd_info[drive].primary[0].base = 0;
    hd_info[drive].primary[0].size = ((int)hdinfo[61] << 16) + hdinfo[60];
}