Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Evan Lojewski
ast2050-flashrom
Commits
070647d1
Commit
070647d1
authored
21 years ago
by
Ollie Lho
Browse files
Options
Download
Email Patches
Plain Diff
More jedec standard consolidation
Corresponding to flashrom svn r18 and coreboot v2 svn r1464.
parent
3a3dea72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
32 deletions
+38
-32
jedec.c
jedec.c
+37
-31
jedec.h
jedec.h
+1
-1
No files found.
jedec.c
View file @
070647d1
...
...
@@ -139,39 +139,46 @@ void write_page_jedec(volatile char *bios, char *src, volatile char *dst,
toggle_ready_jedec
(
dst
-
1
);
}
int
write_sector_jedec
(
volatile
char
*
bios
,
unsigned
char
*
src
,
int
wirte_byte_program_jedec
(
volatile
unsigned
char
*
bios
,
unsigned
char
*
src
,
volatile
unsigned
char
*
dst
)
{
volatile
unsigned
char
*
Temp
;
if
(
*
dst
!=
0xff
)
{
printf
(
"FATAL: dst %p not erased (val 0x%x)
\n
"
,
dst
,
*
dst
);
return
(
-
1
);
}
/* transfer data from source to destination */
if
(
*
src
==
0xFF
)
{
dst
++
,
src
++
;
/* If the data is 0xFF, don't program it */
return
0
;
}
/* Issue JEDEC Byte Program command */
Temp
=
bios
+
0x5555
;
*
Temp
=
0xAA
;
Temp
=
bios
+
0x2AAA
;
*
Temp
=
0x55
;
Temp
=
bios
+
0x5555
;
*
Temp
=
0xA0
;
*
dst
=
*
src
;
toggle_ready_jedec
(
bios
);
if
(
*
dst
!=
*
src
)
printf
(
"BAD! dst 0x%lx val 0x%x src 0x%x
\n
"
,
(
unsigned
long
)
dst
,
*
dst
,
*
src
);
dst
++
,
src
++
;
return
0
;
}
int
write_sector_jedec
(
volatile
unsigned
char
*
bios
,
unsigned
char
*
src
,
volatile
unsigned
char
*
dst
,
unsigned
int
page_size
)
{
int
i
;
volatile
char
*
Temp
;
for
(
i
=
0
;
i
<
page_size
;
i
++
)
{
if
(
*
dst
!=
0xff
)
{
printf
(
"FATAL: dst %p not erased (val 0x%x)
\n
"
,
dst
,
*
dst
);
return
(
-
1
);
}
/* transfer data from source to destination */
if
(
*
src
==
0xFF
)
{
dst
++
,
src
++
;
/* If the data is 0xFF, don't program it */
continue
;
}
/* Issue JEDEC Byte Program command */
Temp
=
bios
+
0x5555
;
*
Temp
=
0xAA
;
Temp
=
bios
+
0x2AAA
;
*
Temp
=
0x55
;
Temp
=
bios
+
0x5555
;
*
Temp
=
0xA0
;
*
dst
=
*
src
;
toggle_ready_jedec
(
bios
);
if
(
*
dst
!=
*
src
)
printf
(
"BAD! dst 0x%lx val 0x%x src 0x%x
\n
"
,
(
unsigned
long
)
dst
,
*
dst
,
*
src
);
dst
++
,
src
++
;
wirte_byte_program_jedec
(
bios
,
src
,
dst
);
}
return
(
0
);
...
...
@@ -180,8 +187,8 @@ int write_sector_jedec(volatile char *bios,
int
write_jedec
(
struct
flashchip
*
flash
,
unsigned
char
*
buf
)
{
int
i
;
int
total_size
=
flash
->
total_size
*
1024
,
page_size
=
flash
->
page_size
;
int
total_size
=
flash
->
total_size
*
1024
;
int
page_size
=
flash
->
page_size
;
volatile
unsigned
char
*
bios
=
flash
->
virt_addr
;
erase_chip_jedec
(
flash
);
...
...
@@ -194,8 +201,7 @@ int write_jedec(struct flashchip *flash, unsigned char *buf)
printf
(
"%04d at address: 0x%08x"
,
i
,
i
*
page_size
);
write_page_jedec
(
bios
,
buf
+
i
*
page_size
,
bios
+
i
*
page_size
,
page_size
);
printf
(
"
\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b
"
);
printf
(
"
\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b
"
);
}
printf
(
"
\n
"
);
protect_jedec
(
bios
);
...
...
This diff is collapsed.
Click to expand it.
jedec.h
View file @
070647d1
...
...
@@ -5,7 +5,7 @@ extern int probe_jedec(struct flashchip *flash);
extern
int
erase_chip_jedec
(
struct
flashchip
*
flash
);
extern
int
write_jedec
(
struct
flashchip
*
flash
,
unsigned
char
*
buf
);
extern
int
erase_sector_jedec
(
volatile
char
*
bios
,
unsigned
int
page
);
extern
int
write_sector_jedec
(
volatile
char
*
bios
,
extern
int
write_sector_jedec
(
volatile
unsigned
char
*
bios
,
unsigned
char
*
src
,
volatile
unsigned
char
*
dst
,
unsigned
int
page_size
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment