mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
ata_disk_handler
This commit is contained in:
@ -13,7 +13,35 @@ struct apic_IO_APIC_RTE_entry entry;
|
||||
*/
|
||||
void ata_disk_handler(ul irq_num, ul param, struct pt_regs *regs)
|
||||
{
|
||||
struct ata_identify_device_data info;
|
||||
kdebug("irq_num=%ld", irq_num);
|
||||
|
||||
// 从端口读入磁盘配置信息
|
||||
io_insw(PORT_DISK0_DATA, &info, 256);
|
||||
kdebug("General_Config=%#018lx", info.General_Config);
|
||||
printk("Serial number:");
|
||||
unsigned char buf[64];
|
||||
int js=0;
|
||||
//printk("%d", info.Serial_Number);
|
||||
printk("sizeof short=%d\n", sizeof(ushort));
|
||||
|
||||
for(int i = 0;i<10;i++)
|
||||
{
|
||||
printk("[%d] %d \n",js, ((info.Serial_Number[i])));
|
||||
printk("[%d] %d shift 8\n",js, ((info.Serial_Number[i]) >> 8));
|
||||
printk("[%d] %d and 0xff\n",js, ((info.Serial_Number[i]) >> 8)&0xff);
|
||||
buf[js++]=((info.Serial_Number[i]) >> 8) & 0xff;
|
||||
buf[js++]=(info.Serial_Number[i] & 0xff);
|
||||
}
|
||||
buf[js] = '\0';
|
||||
printk("xxx");
|
||||
printk("buf[0]=%d", buf[0]);
|
||||
printk("buf[0]=%c", buf[0]);
|
||||
printk("%s", buf);
|
||||
printk("\n");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
hardware_intr_controller ata_disk_intr_controller =
|
||||
@ -31,7 +59,7 @@ hardware_intr_controller ata_disk_intr_controller =
|
||||
*/
|
||||
void ata_init()
|
||||
{
|
||||
entry.vector = 0x2f;
|
||||
entry.vector = 0x2e;
|
||||
entry.deliver_mode = IO_APIC_FIXED;
|
||||
entry.dest_mode = DEST_PHYSICAL;
|
||||
entry.deliver_status = IDLE;
|
||||
@ -47,14 +75,14 @@ void ata_init()
|
||||
|
||||
irq_register(entry.vector, &entry, &ata_disk_handler, 0, &ata_disk_intr_controller, "ATA Disk 1");
|
||||
|
||||
io_out8(PORT_DISK1_STATUS_CTRL_REG, 0); // 使能中断请求
|
||||
io_out8(PORT_DISK0_STATUS_CTRL_REG, 0); // 使能中断请求
|
||||
|
||||
io_out8(PORT_DISK1_ERR_STATUS, 0);
|
||||
io_out8(PORT_DISK1_SECTOR_CNT, 0);
|
||||
io_out8(PORT_DISK1_LBA_7_0, 0);
|
||||
io_out8(PORT_DISK1_LBA_15_8, 0);
|
||||
io_out8(PORT_DISK1_LBA_23_16, 0);
|
||||
io_out8(PORT_DISK1_DEVICE_CONFIGURE_REG, 0);
|
||||
io_out8(PORT_DISK0_ERR_STATUS, 0);
|
||||
io_out8(PORT_DISK0_SECTOR_CNT, 0);
|
||||
io_out8(PORT_DISK0_LBA_7_0, 0);
|
||||
io_out8(PORT_DISK0_LBA_15_8, 0);
|
||||
io_out8(PORT_DISK0_LBA_23_16, 0);
|
||||
io_out8(PORT_DISK0_DEVICE_CONFIGURE_REG, 0);
|
||||
|
||||
io_out8(PORT_DISK1_CONTROLLER_STATUS_CMD, 0xec); // 获取硬件设备识别信息
|
||||
io_out8(PORT_DISK0_CONTROLLER_STATUS_CMD, 0xec); // 获取硬件设备识别信息
|
||||
}
|
Reference in New Issue
Block a user