Go to the documentation of this file.
83 devInfo->
major = hdC + 0x1;
97 if (d[0].dp_type == 0xEE) {
101 secbuf = (
char *)
kmalloc(65536);
103 if (
gptread(&freebsd_ufs_uuid, devInfo, secbuf) == -1) {
104 kprintf(
"%s: unable to load GPT\n",
"KERNEL");
113 devInfo2->
info = hdd2;
116 if (
gptfind(&freebsd_ufs_uuid, devInfo2, hdd->
part) == -1) {
118 kprintf(
"%s: no UFS partition was found\n",
"KERNEL");
125 if (
device_add(minor,
'c', devInfo2) == 0x0) {
127 kprintf(
"%s - Type: [0x%X - %s], Start: [%i], Offset: [%i], Size: [%i], MM: [%i:%i]\n",
name, d[0].dp_type, (d[0].dp_type >= 0 && d[0].dp_type <= 255) ? part_types[d[0].dp_type] :
"Unknown", hdd2->
lba_start, hdd2->
parOffset, hdd2->
lba_end - hdd2->
lba_start, devInfo->
major, minor);
135 for (i = 0x0; i < 0x4; i++) {
140 if (d[i].dp_type == 0xEE)
141 kprintf(
"Motherfucker Jones! We're GPT.... Lick My Nuts Now Bitch!\n");
143 if (d[i].dp_type != 0x0) {
149 devInfo2->
info = hdd2;
152 if (
device_add(minor,
'c', devInfo2) == 0x0) {
154 kprintf(
"%s - Type: [0x%X - %s], Start: [0x%X], Size: [0x%X], MM: [%i:%i]\n",
name, d[i].dp_type, (d[i].dp_type >= 0 && d[i].dp_type <= 255) ? part_types[d[i].dp_type] :
"Unknown", d[i].dp_start, d[i].dp_size, devInfo->
major, minor);
158 if (d[i].dp_type == 0xA5) {
173 devInfo2->
info = hdd2;
227 for (counter = 1000000; counter >= 0; counter--) {
235 kprintf(
"Error Initializing Drive\n");
244 for (counter = 10000000; counter >= 0; counter--) {
246 if ((retVal & 1) != 0x0) {
247 kprintf(
"Error Drive Not Available\n");
250 if ((retVal & 8) != 0x0) {
255 kprintf(
"Time Out Waiting On Drive\n");
262 for (counter = 0; counter < 256; counter++) {
266 retVal = tmp[0x2F] & 0xFF;
302 kprintf(
"Error BLOCK Mode Unavailable: [%x]\n", retVal);
359 short transactionCount = 0x0;
360 short *tmp = (
short *) baseAddr;
370 if ((sectorCount >> hdd->
hdShift) == 0x0) {
371 hdd->
hdCalc = sectorCount;
372 transactionCount = 1;
376 transactionCount = sectorCount >> hdd->
hdShift;
378 for (; transactionCount > 0; transactionCount--) {
380 for (counter = 10000000; counter >= 0; counter--) {
385 kprintf(
"Time Out Waiting On Drive\n");
389 retVal = startSector >> 8;
395 retVal |= (hdd->
hdDev | 0xA0);
402 for (counter = 10000000; counter >= 0; counter--) {
404 if ((retVal & 1) != 0x0) {
408 if ((retVal & 8) != 0x0) {
412 kprintf(
"Time Out Waiting On Drive\n");
414 go:
for (counter = 0; counter < (hdd->
hdCalc << 8); counter++) {
417 tmp += (counter + 0);
418 startSector += hdd->
hdCalc;
426 short transactionCount = 0x0;
427 short *tmp = (
short *) baseAddr;
435 if ((sectorCount >> hdd->
hdShift) == 0x0) {
436 hdd->
hdCalc = sectorCount;
437 transactionCount = 1;
441 transactionCount = sectorCount >> hdd->
hdShift;
443 for (; transactionCount > 0; transactionCount--) {
445 for (counter = 10000000; counter >= 0; counter--) {
450 kprintf(
"Time Out Waiting On Drive\n");
454 retVal = startSector >> 8;
460 retVal |= (hdd->
hdDev | 0xA0);
468 for (counter = 10000000; counter >= 0; counter--) {
470 if ((retVal & 1) != 0x0) {
471 kprintf(
"HD Read Error: [%i:0x%X:%i]\n", counter, (
uInt32) baseAddr, startSector);
474 if ((retVal & 8) != 0x0) {
478 kprintf(
"Error: Time Out Waiting On Drive\n");
480 go:
for (counter = 0; counter < (hdd->
hdCalc << 8); counter++) {
484 tmp += (counter + 0);
485 startSector += hdd->
hdCalc;
u_int8_t words_per_logical_sector[4]
int _initHardDisk(int hdD)
u_int8_t total_num_sectors[4]
int hdWrite(struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount)
int gptfind(const uuid_t *uuid, struct device_interface *devInfo, int part)
void outportWord(unsigned int, unsigned short)
outputut one word to specified port
struct ata_identify_data * ata_identify
void outportByte(unsigned int, unsigned char)
outputut one byte to specified port
void kfree(void *baseAddr)
int hdInit(struct device_node *dev)
u_int16_t physical_logical_sector_info
int device_add(int, char, struct device_interface *)
#define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE
#define GPT_ENT_TYPE_FREEBSD_UFS
void * memcpy(const void *dst, const void *src, size_t length)
int sprintf(char *buf, const char *fmt,...)
unsigned char inportByte(unsigned int)
input one byte from specified port
u_int16_t command_set_enabled1
int gptread(const uuid_t *uuid, struct device_interface *devInfo, char *buf)
int devfs_makeNode(char *name, uInt8 type, uInt16 major, uInt16 minor)
int(* write)(void *, void *, uInt32, uInt32)
unsigned short inportWord(unsigned int)
input one word from specified port
int(* read)(void *, void *, uInt32, uInt32)
struct bsd_disklabel::partition d_partitions[8]
void * kmalloc(uInt32 len)
u_int8_t max_48bit_lba[8]
struct device_interface * devInfo
int kprintf(const char *,...)
#define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE
int hdRead(struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount)