# hd.c File Reference

`#include <pci/hd.h>`
`#include <sys/video.h>`
`#include <sys/device.h>`
`#include <sys/io.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <devfs/devfs.h>`
`#include <string.h>`

Include dependency graph for hd.c:

Go to the source code of this file.

## Functions

int | hdInit (struct device_node *dev)
int | hdIoctl ()
void | hdRead (struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount)
int | hdReset ()
int | hdStandby ()
int | hdStart ()
int | hdStop ()
void | hdWrite (struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount)
int | initHardDisk ()

## Function Documentation

int hdInit | ( | struct device_node * | dev | ) |

Definition at line 145 of file hd.c.

References device_node::devInfo, hdCmd, hdData, driveInfo::hdDev, driveInfo::hdEnable, hdHead, driveInfo::hdMask, driveInfo::hdMulti, driveInfo::hdPort, hdSecCount, driveInfo::hdSector, driveInfo::hdShift, driveInfo::hdSize, hdStat, device_interface::info, device_interface::initialized, inportByte(), inportWord(), kprintf(), outportByte(), and device_interface::size.

Referenced by initHardDisk().

Here is the call graph for this function:

int hdIoctl | ( |  | ) |

Definition at line 137 of file hd.c.

Referenced by initHardDisk().

void hdRead | ( | struct driveInfo * | hdd,
|  | void * | baseAddr,
|  | uInt32 | startSector,
|  | uInt32 | sectorCount |
| ) |  |  |

Definition at line 284 of file hd.c.

References driveInfo::hdCalc, hdCmd, hdCylHi, hdCylLow, hdData, driveInfo::hdDev, driveInfo::hdEnable, hdHead, driveInfo::hdMulti, driveInfo::hdPort, hdSecCount, hdSecNum, driveInfo::hdShift, hdStat, inportByte(), inportWord(), kprintf(), outportByte(), driveInfo::parOffset, and x20.

Referenced by initHardDisk().

Here is the call graph for this function:

int hdReset | ( |  | ) |

Definition at line 141 of file hd.c.

Referenced by initHardDisk().

int hdStandby | ( |  | ) |

Definition at line 125 of file hd.c.

Referenced by initHardDisk().

int hdStart | ( |  | ) |

Definition at line 129 of file hd.c.

Referenced by initHardDisk().

int hdStop | ( |  | ) |

Definition at line 133 of file hd.c.

Referenced by initHardDisk().

void hdWrite | ( | struct driveInfo * | hdd,
|  | void * | baseAddr,
|  | uInt32 | startSector,
|  | uInt32 | sectorCount |
| ) |  |  |

Definition at line 222 of file hd.c.

References driveInfo::hdCalc, hdCmd, hdCylHi, hdCylLow, hdData, driveInfo::hdDev, driveInfo::hdEnable, hdHead, driveInfo::hdMulti, driveInfo::hdPort, hdSecCount, hdSecNum, driveInfo::hdShift, hdStat, inportByte(), kprintf(), outportByte(), outportWord(), driveInfo::parOffset, and x30.

Referenced by initHardDisk().

Here is the call graph for this function:

int initHardDisk | ( |  | ) |

Definition at line 39 of file hd.c.

References bsd_disklabel::d_npartitions, bsd_disklabel::d_partitions, devfs_makeNode(), device_add(), dos_partition::dp_start, fstypenames, driveInfo::hdDev, hdInit(), hdIoctl(), driveInfo::hdPort, hdRead(), hdReset(), driveInfo::hdSize, hdStandby(), hdStart(), hdStop(), hdWrite(), device_interface::info, device_interface::init, device_interface::ioctl, kmalloc(), kprintf(), device_interface::major, memcpy(), name, bsd_disklabel::partition::p_fstype, bsd_disklabel::partition::p_offset, bsd_disklabel::partition::p_size, driveInfo::parOffset, device_interface::read, device_interface::reset, sprintf(), device_interface::standby, device_interface::start, device_interface::stop, device_interface::write, and x1.

Here is the call graph for this function: