- memset(file, 0, sizeof(struct boot_file_t*));
- file->fs = &fs_default;
-
- /* Lookup the OF device path */
- /* First, see if a device was specified for the kernel
- * if not, we hope that the user wants a kernel on the same
- * drive and partition as yaboot itself */
-#if 0 /* this is crap */
- if (!spec->dev)
- strcpy(spec->dev, bootdevice);
- strncpy(temp,spec->dev,1024);
- dev_name = parse_device_path(temp, &file_name, &partition);
- if (file_name == NULL)
- file_name = (char *)spec->file;
- if (file_name == NULL) {
- prom_printf("Configuration error: null filename\n");
- return FILE_ERR_NOTFOUND;
- }
- if (partition == -1)
-#endif
- partition = spec->part;
-
-
- DEBUG_F("dev_path = %s\nfile_name = %s\npartition = %d\n",
- spec->dev, spec->file, partition);
-
- /* Find OF device phandle */
- dev = prom_finddevice(spec->dev);
- if (dev == PROM_INVALID_HANDLE) {
- return FILE_ERR_BADDEV;
- }
-
- DEBUG_F("dev_phandle = %p\n", dev);
-
- /* Check the kind of device */
- result = prom_getprop(dev, "device_type", temps, 63);
- if (result == -1) {
- prom_printf("can't get <device_type> for device\n");
- return FILE_ERR_BADDEV;
- }
- temps[result] = 0;
- if (!strcmp(temps, "block"))
- file->device_kind = FILE_DEVICE_BLOCK;
- else if (!strcmp(temps, "network"))
- file->device_kind = FILE_DEVICE_NET;
- else {
- prom_printf("Unkown device type <%s>\n", temps);
- return FILE_ERR_BADDEV;
- }
+ memset(file, 0, sizeof(struct boot_file_t*));
+ file->fs = &fs_default;
+
+ DEBUG_F("dev_path = %s\nfile_name = %s\npartition = %d\n",
+ spec->dev, spec->file, spec->part);
+
+ result = prom_get_devtype(spec->dev);
+ if (result > 0)
+ file->device_kind = result;
+ else
+ return result;