PERFORCE change 1187103 for review
Brooks Davis
brooks at FreeBSD.org
Tue Oct 22 20:21:20 UTC 2013
http://p4web.freebsd.org/@@1187103?ac=10
Change 1187103 by brooks at brooks_zenith on 2013/10/22 20:20:25
Remove references to the now defunct isf(4) device.
Affected files ...
.. //depot/projects/ctsrd/beribsd/src/ctsrd/atsectl/atsectl.c#5 edit
Differences ...
==== //depot/projects/ctsrd/beribsd/src/ctsrd/atsectl/atsectl.c#5 (text+ko) ====
@@ -57,25 +57,16 @@
#include <net/ethernet.h>
-/* XXXBED: should install and include sys/dev/isf.h */
-struct isf_range {
- off_t ir_off; /* Offset of range to delete (set to 0xFF) */
- size_t ir_size; /* Size of range */
-};
-#define ISF_ERASE _IOW('I', 1, struct isf_range)
-#define ISF_ERASE_BLOCK (128 * 1024)
-#define DEV_ISF0_PATH "/dev/isf0"
+#define CONFIG_BLOCK (128 * 1024)
#define DEV_CFI0_PATH "/dev/cfi0"
-static u_char block[ISF_ERASE_BLOCK];
+static u_char block[CONFIG_BLOCK];
#define UNKNOWN 0
-#define ISF 1
-#define CFI 2
+#define CFI 1
static int fdev = UNKNOWN;
static const char *fdevs[] = {
"UNKNOWN",
- "ISF",
"CFI"
};
static int gflag;
@@ -98,59 +89,30 @@
{
int fd;
- fd = open(DEV_ISF0_PATH, O_RDONLY, 0);
- if (fd == -1)
- fd = open(DEV_CFI0_PATH, O_RDONLY, 0);
- else
- fdev = ISF;
+ fd = open(DEV_CFI0_PATH, O_RDONLY, 0);
if (fd == -1)
errx(1, "Failed to open " DEV_CFI0_PATH);
else
fdev = CFI;
- if (read(fd, block, sizeof(block)) != ISF_ERASE_BLOCK)
+ if (read(fd, block, sizeof(block)) != CONFIG_BLOCK)
errx(1, "Short read from %s", fdevs[fdev]);
close(fd);
}
static void
-erase_block(void)
-{
- struct isf_range ir;
- int fd;
-
- if (fdev != ISF)
- return;
-
- fd = open(DEV_ISF0_PATH, O_RDONLY, 0);
- if (fd == -1)
- errx(1, "Failed to open " DEV_ISF0_PATH);
-
- ir.ir_off = 0;
- ir.ir_size = ISF_ERASE_BLOCK;
-
- if (ioctl(fd, ISF_ERASE, &ir) == -1)
- err(1, "ioctl(%s, %jx, %zx)", DEV_ISF0_PATH,
- (intmax_t)ir.ir_off, ir.ir_size);
-
- close(fd);
-}
-
-static void
write_block(void)
{
int fd;
- assert(fdev == ISF || fdev == CFI);
+ assert(fdev == CFI);
- fd = open(DEV_ISF0_PATH, O_WRONLY, 0);
- if (fd == -1)
- fd = open(DEV_CFI0_PATH, O_WRONLY, 0);
+ fd = open(DEV_CFI0_PATH, O_WRONLY, 0);
if (fd == -1)
errx(1, "Failed to open " DEV_CFI0_PATH);
- if (write(fd, block, sizeof(block)) != ISF_ERASE_BLOCK)
+ if (write(fd, block, sizeof(block)) != CONFIG_BLOCK)
errx(1, "Short write on %s", fdevs[fdev]);
close(fd);
@@ -215,12 +177,9 @@
print_eaddr();
if (eaddr == NULL) {
- /* (isf|cfi)0.factory_ppr="0x0123456789abcdef" */
- rc = kenv(KENV_GET, "isf0.factory_ppr", buf, sizeof(buf));
+ /* cfi0.factory_ppr="0x0123456789abcdef" */
+ rc = kenv(KENV_GET, "cfi0.factory_ppr", buf, sizeof(buf));
if (rc == -1)
- rc = kenv(KENV_GET, "cfi0.factory_ppr", buf,
- sizeof(buf));
- if (rc == -1)
err(1, "Could not find Intel flash PPR serial\n");
MD5Init(&ctx);
@@ -281,7 +240,6 @@
block[ALTERA_ETHERNET_OPTION_BITS_OFF + 2] = 0x00;
block[ALTERA_ETHERNET_OPTION_BITS_OFF + 3] = 0x00;
- erase_block();
write_block();
printf("Updated to:\n");
More information about the p4-projects
mailing list