Changeset View
Changeset View
Standalone View
Standalone View
stand/uboot/common/main.c
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | else | ||||
strcpy(slice, "<auto>"); | strcpy(slice, "<auto>"); | ||||
if (currdev.d_disk.partition >= 0) | if (currdev.d_disk.partition >= 0) | ||||
sprintf(partition, "%d", currdev.d_disk.partition); | sprintf(partition, "%d", currdev.d_disk.partition); | ||||
else | else | ||||
strcpy(partition, "<auto>"); | strcpy(partition, "<auto>"); | ||||
printf(" Checking unit=%d slice=%s partition=%s...", | printf(" Checking unit=%d slice=%s partition=%s...", | ||||
currdev.d_unit, slice, partition); | currdev.dd.d_unit, slice, partition); | ||||
} | } | ||||
static int | static int | ||||
probe_disks(int devidx, int load_type, int load_unit, int load_slice, | probe_disks(int devidx, int load_type, int load_unit, int load_slice, | ||||
int load_partition) | int load_partition) | ||||
{ | { | ||||
int open_result, unit; | int open_result, unit; | ||||
struct open_file f; | struct open_file f; | ||||
currdev.d_disk.slice = load_slice; | currdev.d_disk.slice = load_slice; | ||||
currdev.d_disk.partition = load_partition; | currdev.d_disk.partition = load_partition; | ||||
f.f_devdata = &currdev; | f.f_devdata = &currdev; | ||||
open_result = -1; | open_result = -1; | ||||
if (load_type == -1) { | if (load_type == -1) { | ||||
printf(" Probing all disk devices...\n"); | printf(" Probing all disk devices...\n"); | ||||
/* Try each disk in succession until one works. */ | /* Try each disk in succession until one works. */ | ||||
for (currdev.d_unit = 0; currdev.d_unit < UB_MAX_DEV; | for (currdev.dd.d_unit = 0; currdev.dd.d_unit < UB_MAX_DEV; | ||||
currdev.d_unit++) { | currdev.dd.d_unit++) { | ||||
print_disk_probe_info(); | print_disk_probe_info(); | ||||
open_result = devsw[devidx]->dv_open(&f, &currdev); | open_result = devsw[devidx]->dv_open(&f, &currdev); | ||||
if (open_result == 0) { | if (open_result == 0) { | ||||
printf(" good.\n"); | printf(" good.\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
return (-1); | return (-1); | ||||
} | } | ||||
if (load_unit == -1) { | if (load_unit == -1) { | ||||
printf(" Probing all %s devices...\n", device_typename(load_type)); | printf(" Probing all %s devices...\n", device_typename(load_type)); | ||||
/* Try each disk of given type in succession until one works. */ | /* Try each disk of given type in succession until one works. */ | ||||
for (unit = 0; unit < UB_MAX_DEV; unit++) { | for (unit = 0; unit < UB_MAX_DEV; unit++) { | ||||
currdev.d_unit = uboot_diskgetunit(load_type, unit); | currdev.dd.d_unit = uboot_diskgetunit(load_type, unit); | ||||
if (currdev.d_unit == -1) | if (currdev.dd.d_unit == -1) | ||||
break; | break; | ||||
print_disk_probe_info(); | print_disk_probe_info(); | ||||
open_result = devsw[devidx]->dv_open(&f, &currdev); | open_result = devsw[devidx]->dv_open(&f, &currdev); | ||||
if (open_result == 0) { | if (open_result == 0) { | ||||
printf(" good.\n"); | printf(" good.\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
return (-1); | return (-1); | ||||
} | } | ||||
if ((currdev.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) { | if ((currdev.dd.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) { | ||||
print_disk_probe_info(); | print_disk_probe_info(); | ||||
open_result = devsw[devidx]->dv_open(&f,&currdev); | open_result = devsw[devidx]->dv_open(&f,&currdev); | ||||
if (open_result == 0) { | if (open_result == 0) { | ||||
printf(" good.\n"); | printf(" good.\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | for (i = 0; devsw[i] != NULL; i++) { | ||||
if (devsw[i]->dv_init == NULL) | if (devsw[i]->dv_init == NULL) | ||||
continue; | continue; | ||||
if ((devsw[i]->dv_init)() != 0) | if ((devsw[i]->dv_init)() != 0) | ||||
continue; | continue; | ||||
printf("Found U-Boot device: %s\n", devsw[i]->dv_name); | printf("Found U-Boot device: %s\n", devsw[i]->dv_name); | ||||
currdev.d_dev = devsw[i]; | currdev.dd.d_dev = devsw[i]; | ||||
currdev.d_type = currdev.d_dev->dv_type; | currdev.dd.d_unit = 0; | ||||
currdev.d_unit = 0; | |||||
if ((load_type == -1 || (load_type & DEV_TYP_STOR)) && | if ((load_type == -1 || (load_type & DEV_TYP_STOR)) && | ||||
strcmp(devsw[i]->dv_name, "disk") == 0) { | strcmp(devsw[i]->dv_name, "disk") == 0) { | ||||
if (probe_disks(i, load_type, load_unit, load_slice, | if (probe_disks(i, load_type, load_unit, load_slice, | ||||
load_partition) == 0) | load_partition) == 0) | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 209 Lines • Show Last 20 Lines |