nicamd: Introduce new programmer driver for AMD NICs

On a PCnet32 FAST card with a nice PLCC32 socket, only 18 of the 20 ad-
dress lines were connected. It's not easy to detect this, but we'll do
our best: Check the ROM contents for repeating patterns, and allow the
user to override the guessed size. We use the ROM BAR here, though not
for the actual flash reading / writing. According to the datasheet the
ROM BAR interface always reads four bytes, and doesn't seem to support
writes.

Otherwise tested successfully with the first 256KiB of an SST39VF040.

Datasheet used:
https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/datasheets/20550.pdf

Change-Id: I3bddfcd1e242d28790a0916197ebd8b8bba5a70a
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/530
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/Makefile b/Makefile
index ac73011..a9f2429 100644
--- a/Makefile
+++ b/Makefile
@@ -132,6 +132,7 @@
 	CONFIG_ATAPROMISE \
 	CONFIG_INTERNAL_X86 \
 	CONFIG_NIC3COM \
+	CONFIG_NICAMD \
 	CONFIG_NICNATSEMI \
 	CONFIG_NICREALTEK \
 	CONFIG_RAYER_SPI \
@@ -146,6 +147,7 @@
 	CONFIG_INTERNAL \
 	CONFIG_IT8212 \
 	CONFIG_NIC3COM \
+	CONFIG_NICAMD \
 	CONFIG_NICINTEL \
 	CONFIG_NICINTEL_EEPROM \
 	CONFIG_NICINTEL_SPI \
@@ -435,6 +437,9 @@
 # Always enable 3Com NICs for now.
 CONFIG_NIC3COM ?= yes
 
+# Always enable AMD NICs for now.
+CONFIG_NICAMD ?= yes
+
 # Enable NVIDIA graphics cards. Note: write and erase do not work properly.
 CONFIG_GFXNVIDIA ?= yes
 
@@ -647,6 +652,11 @@
 PROGRAMMER_OBJS += nic3com.o
 endif
 
+ifeq ($(CONFIG_NICAMD), yes)
+FEATURE_FLAGS += -D'CONFIG_NICAMD=1'
+PROGRAMMER_OBJS += nicamd.o
+endif
+
 ifeq ($(CONFIG_GFXNVIDIA), yes)
 FEATURE_FLAGS += -D'CONFIG_GFXNVIDIA=1'
 PROGRAMMER_OBJS += gfxnvidia.o