#include <stdint.h>
#include <stdio.h>
+#ifdef __FreeBSD__
+ #include <machine/cpufunc.h>
+ #define off64_t off_t
+ #define lseek64 lseek
+ #define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0)
+ #define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0)
+ #define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0)
+ #define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); })
+ #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
+ #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
+#else
+ #define OUTB outb
+ #define OUTW outw
+ #define OUTL outl
+ #define INB inb
+ #define INW inw
+ #define INL inl
+#endif
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
struct flashchip {
#define TEST_OK_READ (1<<1)
#define TEST_OK_ERASE (1<<2)
#define TEST_OK_WRITE (1<<3)
+#define TEST_OK_PR (TEST_OK_PROBE|TEST_OK_READ)
#define TEST_OK_PREW (TEST_OK_PROBE|TEST_OK_READ|TEST_OK_ERASE|TEST_OK_WRITE)
#define TEST_OK_MASK 0x0f
#define AMIC_ID 0x7F37 /* AMIC */
#define AMIC_ID_NOPREFIX 0x37 /* AMIC */
+#define AMIC_A25L40P 0x2013
+#define AMIC_A29040B 0x86
+#define AMIC_A49LF040A 0x9d
#define ASD_ID 0x25 /* ASD, not listed in JEP106W */
#define ASD_AE49F2008 0x52
#define ISSI_ID 0xD5 /* ISSI Integrated Silicon Solutions */
-#define MSYSTEMS_ID 0x156F /* M-Systems, not listed in JEP106W */
-#define MSYSTEMS_MD2200 0xDB
-#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */
-#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
-
/*
* MX25 chips are SPI, first byte of device ID is memory type,
* second byte of device ID is log(bitsize)-9.
int map_flash_registers(struct flashchip *flash);
/* layout.c */
-int show_id(uint8_t *bios, int size);
+int show_id(uint8_t *bios, int size, int force);
int read_romlayout(char *name);
int find_romentry(char *name);
int handle_romentries(uint8_t *buffer, uint8_t *content);
int erase_29f002(struct flashchip *flash);
int write_29f002(struct flashchip *flash, uint8_t *buf);
-/* pm49fl004.c */
-int probe_49fl004(struct flashchip *flash);
-int erase_49fl004(struct flashchip *flash);
-int write_49fl004(struct flashchip *flash, uint8_t *buf);
+/* pm49fl00x.c */
+int probe_49fl00x(struct flashchip *flash);
+int erase_49fl00x(struct flashchip *flash);
+int write_49fl00x(struct flashchip *flash, uint8_t *buf);
/* sharplhf00l04.c */
int probe_lhf00l04(struct flashchip *flash);