#include #include #include #include /* * Only primary ATA disk is supported by now, just * hardcode it here. */ struct bdev hda; /* Init block layer */ void block_init() { memset(&hda, 0, sizeof(struct bdev)); hda.id = TOXIC_HDA_0; hda.sector_size = SECTOR_SIZE; } struct bdev * bdev_get(int id) { /* Just a single bdev is supported */ if (id) return NULL; return &hda; } /* Read len bytes from bdev starting at addr into buf*/ int bread( struct bdev *bdev, unsigned int addr, unsigned int len, void *buf) { /* * XXX: This should be a function call into the disk driver. * i.e. bdev->read(), or something like that */ return ata_read_sector(addr, len, buf); }