blob: d4758f56645d115766c1dd69065488336be67532 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include <toxic/config.h>
#include <toxic/string.h>
#include <block/block.h>
#include <ata/ata.h>
/*
* 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);
}
|