1 #include <hal/ahci/ahci.h>
2 #include <lunaix/block.h>
3 #include <lunaix/fs/twifs.h>
6 __blk_rd_serial(struct twimap* map)
8 struct hba_device* hbadev = twimap_data(map, struct hba_device*);
9 twimap_printf(map, "%s", hbadev->serial_num);
13 __blk_rd_last_status(struct twimap* map)
15 struct hba_device* hbadev = twimap_data(map, struct hba_device*);
18 hbadev->last_result.status,
19 hbadev->last_result.error,
20 hbadev->last_result.sense_key);
24 __blk_rd_capabilities(struct twimap* map)
26 struct hba_device* hbadev = twimap_data(map, struct hba_device*);
27 twimap_printf(map, "%p", hbadev->capabilities);
31 __blk_rd_aoffset(struct twimap* map)
33 struct hba_device* hbadev = twimap_data(map, struct hba_device*);
34 twimap_printf(map, "%d", hbadev->alignment_offset);
38 __blk_rd_wwid(struct twimap* map)
40 struct hba_device* hbadev = twimap_data(map, struct hba_device*);
41 u32_t h = hbadev->wwn >> 32;
42 u32_t l = (u32_t)hbadev->wwn;
44 twimap_printf(map, "wwn:%x%x", h, l);
46 twimap_printf(map, "0");
51 ahci_fsexport(struct block_dev* bdev, void* fs_node)
53 struct twifs_node* dev_root = (struct twifs_node*)fs_node;
56 map = twifs_mapping(dev_root, bdev->driver, "serial");
57 map->read = __blk_rd_serial;
59 map = twifs_mapping(dev_root, bdev->driver, "last_status");
60 map->read = __blk_rd_last_status;
62 map = twifs_mapping(dev_root, bdev->driver, "wwid");
63 map->read = __blk_rd_wwid;
65 map = twifs_mapping(dev_root, bdev->driver, "capabilities");
66 map->read = __blk_rd_capabilities;
68 map = twifs_mapping(dev_root, bdev->driver, "alignment_offset");
69 map->read = __blk_rd_aoffset;