Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
475c7970
Commit
475c7970
authored
12 years ago
by
Rob Herring
Committed by
Tom Rini
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmd_disk: use common get_device_and_partition function
Signed-off-by:
Rob Herring
<
rob.herring@calxeda.com
>
parent
cfda5aea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/cmd_disk.c
+19
-58
19 additions, 58 deletions
common/cmd_disk.c
with
19 additions
and
58 deletions
common/cmd_disk.c
+
19
−
58
View file @
475c7970
...
@@ -23,14 +23,16 @@
...
@@ -23,14 +23,16 @@
*/
*/
#include
<common.h>
#include
<common.h>
#include
<command.h>
#include
<command.h>
#include
<part.h>
#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_SCSI) || \
defined(CONFIG_USB_STORAGE)
int
common_diskboot
(
cmd_tbl_t
*
cmdtp
,
const
char
*
intf
,
int
argc
,
int
common_diskboot
(
cmd_tbl_t
*
cmdtp
,
const
char
*
intf
,
int
argc
,
char
*
const
argv
[])
char
*
const
argv
[])
{
{
char
*
boot_device
=
NULL
;
int
dev
,
part
;
char
*
ep
;
ulong
addr
=
CONFIG_SYS_LOAD_ADDR
;
int
dev
,
part
=
0
;
ulong
cnt
;
ulong
addr
,
cnt
;
disk_partition_t
info
;
disk_partition_t
info
;
image_header_t
*
hdr
;
image_header_t
*
hdr
;
block_dev_desc_t
*
dev_desc
;
block_dev_desc_t
*
dev_desc
;
...
@@ -40,72 +42,30 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
...
@@ -40,72 +42,30 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
#endif
#endif
bootstage_mark
(
BOOTSTAGE_ID_IDE_START
);
bootstage_mark
(
BOOTSTAGE_ID_IDE_START
);
switch
(
argc
)
{
if
(
argc
>
3
)
{
case
1
:
addr
=
CONFIG_SYS_LOAD_ADDR
;
boot_device
=
getenv
(
"bootdevice"
);
break
;
case
2
:
addr
=
simple_strtoul
(
argv
[
1
],
NULL
,
16
);
boot_device
=
getenv
(
"bootdevice"
);
break
;
case
3
:
addr
=
simple_strtoul
(
argv
[
1
],
NULL
,
16
);
boot_device
=
argv
[
2
];
break
;
default:
bootstage_error
(
BOOTSTAGE_ID_IDE_ADDR
);
bootstage_error
(
BOOTSTAGE_ID_IDE_ADDR
);
return
CMD_RET_USAGE
;
return
CMD_RET_USAGE
;
}
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_ADDR
);
bootstage_mark
(
BOOTSTAGE_ID_IDE_ADDR
);
if
(
!
boot_device
)
{
if
(
argc
>
1
)
puts
(
"
\n
** No boot device **
\n
"
);
addr
=
simple_strtoul
(
argv
[
1
],
NULL
,
16
);
bootstage_error
(
BOOTSTAGE_ID_IDE_BOOT_DEVICE
);
return
1
;
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_BOOT_DEVICE
);
dev
=
simple_strtoul
(
boot_device
,
&
ep
,
16
);
bootstage_mark
(
BOOTSTAGE_ID_IDE_BOOT_DEVICE
);
dev_desc
=
get_dev
(
intf
,
dev
);
part
=
get_dev
ice_and_partition
(
intf
,
(
argc
==
3
)
?
argv
[
2
]
:
NULL
,
if
(
dev_desc
->
type
==
DEV_TYPE_UNKNOWN
)
{
&
dev_desc
,
&
info
);
printf
(
"
\n
** Device %d not available
\n
"
,
dev
);
if
(
part
<
0
)
{
bootstage_error
(
BOOTSTAGE_ID_IDE_TYPE
);
bootstage_error
(
BOOTSTAGE_ID_IDE_TYPE
);
return
1
;
return
1
;
}
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_TYPE
);
if
(
*
ep
)
{
if
(
*
ep
!=
':'
)
{
puts
(
"
\n
** Invalid boot device, use `dev[:part]' **
\n
"
);
bootstage_error
(
BOOTSTAGE_ID_IDE_PART
);
return
1
;
}
part
=
simple_strtoul
(
++
ep
,
NULL
,
16
);
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_PART
);
if
(
get_partition_info
(
dev_desc
,
part
,
&
info
))
{
dev
=
dev_desc
->
dev
;
bootstage_error
(
BOOTSTAGE_ID_IDE_PART_INFO
);
bootstage_mark
(
BOOTSTAGE_ID_IDE_TYPE
);
return
1
;
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_PART_INFO
);
if
((
strncmp
((
char
*
)
info
.
type
,
BOOT_PART_TYPE
,
sizeof
(
info
.
type
))
!=
0
)
&&
(
strncmp
((
char
*
)
info
.
type
,
BOOT_PART_COMP
,
sizeof
(
info
.
type
))
!=
0
)
)
{
printf
(
"
\n
** Invalid partition type
\"
%.32s
\"
"
" (expect
\"
"
BOOT_PART_TYPE
"
\"
)
\n
"
,
info
.
type
);
bootstage_error
(
BOOTSTAGE_ID_IDE_PART_TYPE
);
return
1
;
}
bootstage_mark
(
BOOTSTAGE_ID_IDE_PART_TYPE
);
printf
(
"
\n
Loading from disk device %d, partition %d: "
printf
(
"
\n
Loading from %s device %d, partition %d: "
"Name: %.32s Type: %.32s
\n
"
,
dev
,
part
,
info
.
name
,
info
.
type
);
"Name: %.32s Type: %.32s
\n
"
,
intf
,
dev
,
part
,
info
.
name
,
info
.
type
);
debug
(
"First Block: %ld, # of blocks: %ld, Block Size: %ld
\n
"
,
debug
(
"First Block: %ld, # of blocks: %ld, Block Size: %ld
\n
"
,
info
.
start
,
info
.
size
,
info
.
blksz
);
info
.
start
,
info
.
size
,
info
.
blksz
);
...
@@ -181,3 +141,4 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
...
@@ -181,3 +141,4 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
return
bootm_maybe_autostart
(
cmdtp
,
argv
[
0
]);
return
bootm_maybe_autostart
(
cmdtp
,
argv
[
0
]);
}
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment