kexts: ahci: implement read support for ATA devices
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
#include <socks/libc/stdio.h>
|
||||
#include "ahci.h"
|
||||
|
||||
extern struct block_device_ops ata_device_ops;
|
||||
extern struct block_device_ops atapi_device_ops;
|
||||
|
||||
extern void create_device_from_ahci_port(int port_no, struct device *controller, volatile struct hba_port *port, int type)
|
||||
{
|
||||
struct block_device *bdev = block_device_create();
|
||||
@@ -37,8 +40,9 @@ extern void create_device_from_ahci_port(int port_no, struct device *controller,
|
||||
}
|
||||
|
||||
/* TODO read IDENTIFY DEVICE log to support non-512 sector sizes */
|
||||
bdev->sector_size = 512;
|
||||
bdev->capacity = identity_data.user_addressable_sectors;
|
||||
bdev->b_ops = &ata_device_ops;
|
||||
bdev->b_sector_size = 512;
|
||||
bdev->b_capacity = identity_data.user_addressable_sectors;
|
||||
|
||||
snprintf(bdev_base->dev_model_name, sizeof bdev_base->dev_model_name, "%s", identity_data.model_number);
|
||||
} else if (type == AHCI_DEV_SATAPI) {
|
||||
@@ -62,8 +66,9 @@ extern void create_device_from_ahci_port(int port_no, struct device *controller,
|
||||
return;
|
||||
}
|
||||
|
||||
bdev->sector_size = big_to_host_u32(cmd_result.block_size);
|
||||
bdev->capacity = big_to_host_u32(cmd_result.last_sector) + 1;
|
||||
bdev->b_ops = &atapi_device_ops;
|
||||
bdev->b_sector_size = big_to_host_u32(cmd_result.block_size);
|
||||
bdev->b_capacity = big_to_host_u32(cmd_result.last_sector) + 1;
|
||||
|
||||
snprintf(bdev_base->dev_model_name, sizeof bdev_base->dev_model_name, "%s", identity_data.model_number);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user