• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef DISK_H
2 #define DISK_H
3 
4 #include <stddef.h>
5 #include <stdint.h>
6 #include <stdbool.h>
7 #include <core.h>
8 
9 typedef uint64_t sector_t;
10 typedef uint64_t block_t;
11 
12 struct bios_disk_private {
13 	com32sys_t *regs;
14 };
15 
16 /*
17  * struct disk: contains the information about a specific disk and also
18  * contains the I/O function.
19  */
20 struct disk {
21     void *private;	/* Firmware-private disk info */
22     unsigned int disk_number;	/* in BIOS style */
23     unsigned int sector_size;	/* gener512B or 2048B */
24     unsigned int sector_shift;
25     unsigned int maxtransfer;	/* Max sectors per transfer */
26 
27     unsigned int h, s;		/* CHS geometry */
28     unsigned int secpercyl;	/* h*s */
29     unsigned int _pad;
30 
31     sector_t part_start;   /* the start address of this partition(in sectors) */
32 
33     int (*rdwr_sectors)(struct disk *, void *, sector_t, size_t, bool);
34 };
35 
36 extern void read_sectors(char *, sector_t, int);
37 extern void getoneblk(struct disk *, char *, block_t, int);
38 
39 /* diskio.c */
40 struct disk *bios_disk_init(void *);
41 struct device *device_init(void *);
42 
43 #endif /* DISK_H */
44