[flashrom] [PATCH] ATI R7xx support stub
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Thu Mar 4 03:11:15 CET 2010
Hi,
this patch is not for merging, it is just a small stub to test if I'm
looking at the right BAR.
Initial ATI R7xx SPI host implementation. Does nothing, shouldn't harm
anything.
Compile with "make CONFIG_ATI_R7XX=yes"
Verbose logs appreciated.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Index: flashrom-ati_r7xx/flash.h
===================================================================
--- flashrom-ati_r7xx/flash.h (Revision 919)
+++ flashrom-ati_r7xx/flash.h (Arbeitskopie)
@@ -73,6 +73,9 @@
#if DEDIPROG_SUPPORT == 1
PROGRAMMER_DEDIPROG,
#endif
+#if ATI_R7XX_SUPPORT == 1
+ PROGRAMMER_ATI_R7XX,
+#endif
PROGRAMMER_INVALID /* This must always be the last entry. */
};
@@ -330,7 +333,7 @@
/* print.c */
char *flashbuses_to_text(enum chipbustype bustype);
void print_supported(void);
-#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1) || (ATAHPT_SUPPORT == 1)
+#if (NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+ATI_R7XX_SUPPORT >= 1)
void print_supported_pcidevs(struct pcidev_status *devs);
#endif
void print_supported_wiki(void);
@@ -511,6 +514,11 @@
int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
+/* ati_r7xx.c */
+int ati_r7xx_init(void);
+int ati_r7xx_shutdown(void);
+extern struct pcidev_status ati_r7xx_devs[];
+
/* flashrom.c */
extern enum chipbustype buses_supported;
struct decode_sizes {
Index: flashrom-ati_r7xx/ati_r7xx.c
===================================================================
--- flashrom-ati_r7xx/ati_r7xx.c (Revision 0)
+++ flashrom-ati_r7xx/ati_r7xx.c (Revision 0)
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2010 Carl-Daniel Hailfinger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include "flash.h"
+
+#define PCI_VENDOR_ID_ATI 0x1002
+
+struct pcidev_status ati_r7xx_devs[] = {
+ {PCI_VENDOR_ID_ATI, 0x9440, NT, "AMD/ATI", "Some R770 device"},
+
+ {},
+};
+
+int ati_r7xx_init(void)
+{
+ get_io_perms();
+
+ io_base_addr = pcidev_init(PCI_VENDOR_ID_ATI, PCI_BASE_ADDRESS_2,
+ ati_r7xx_devs, programmer_param);
+
+ /* TODO: Enable flash access. */
+ msg_pdbg("%s: io_base_addr is at %08x\n", __func__, io_base_addr);
+
+ buses_supported = CHIP_BUSTYPE_NONE;
+
+ return 0;
+}
+
+int ati_r7xx_shutdown(void)
+{
+ /* TODO: Disable flash access again. */
+
+ free(programmer_param);
+ pci_cleanup(pacc);
+ release_io_perms();
+ return 0;
+}
Index: flashrom-ati_r7xx/Makefile
===================================================================
--- flashrom-ati_r7xx/Makefile (Revision 919)
+++ flashrom-ati_r7xx/Makefile (Arbeitskopie)
@@ -102,6 +102,9 @@
# Disable Dediprog SF100 until support is complete and tested.
CONFIG_DEDIPROG ?= no
+# Disable ATI R7xx until support is complete and tested.
+CONFIG_ATI_R7XX ?= no
+
# Disable wiki printing by default. It is only useful if you have wiki access.
CONFIG_PRINT_WIKI ?= no
@@ -178,6 +181,12 @@
PROGRAMMER_OBJS += dediprog.o
endif
+ifeq ($(CONFIG_ATI_R7XX), yes)
+FEATURE_CFLAGS += -D'ATI_R7XX_SUPPORT=1'
+PROGRAMMER_OBJS += ati_r7xx.o
+NEED_PCI := yes
+endif
+
# Ugly, but there's no elif/elseif.
ifeq ($(CONFIG_SERPROG), yes)
LIB_OBJS += serial.o
Index: flashrom-ati_r7xx/flashrom.c
===================================================================
--- flashrom-ati_r7xx/flashrom.c (Revision 919)
+++ flashrom-ati_r7xx/flashrom.c (Arbeitskopie)
@@ -44,7 +44,7 @@
* if more than one of them is selected. If only one is selected, it is clear
* that the user wants that one to become the default.
*/
-#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+FT2232_SPI_SUPPORT+SERPROG_SUPPORT+BUSPIRATE_SPI_SUPPORT+DEDIPROG_SUPPORT > 1
+#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+FT2232_SPI_SUPPORT+SERPROG_SUPPORT+BUSPIRATE_SPI_SUPPORT+DEDIPROG_SUPPORT+ATI_R7XX_SUPPORT > 1
#error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all external programmers except one.
#endif
enum programmer programmer =
@@ -75,6 +75,9 @@
#if DEDIPROG_SUPPORT == 1
PROGRAMMER_DEDIPROG
#endif
+#if ATI_R7XX_SUPPORT == 1
+ PROGRAMMER_ATI_R7XX
+#endif
;
#endif
@@ -327,6 +330,25 @@
},
#endif
+#if ATI_R7XX_SUPPORT == 1
+ {
+ .name = "ati_r7xx",
+ .init = ati_r7xx_init,
+ .shutdown = ati_r7xx_shutdown,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .chip_readb = noop_chip_readb,
+ .chip_readw = fallback_chip_readw,
+ .chip_readl = fallback_chip_readl,
+ .chip_readn = fallback_chip_readn,
+ .chip_writeb = noop_chip_writeb,
+ .chip_writew = fallback_chip_writew,
+ .chip_writel = fallback_chip_writel,
+ .chip_writen = fallback_chip_writen,
+ .delay = internal_delay,
+ },
+#endif
+
{}, /* This entry corresponds to PROGRAMMER_INVALID. */
};
Index: flashrom-ati_r7xx/print.c
===================================================================
--- flashrom-ati_r7xx/print.c (Revision 919)
+++ flashrom-ati_r7xx/print.c (Arbeitskopie)
@@ -231,7 +231,7 @@
print_supported_chipsets();
print_supported_boards();
#endif
-#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1)
+#if (NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+ATI_R7XX_SUPPORT >= 1)
printf("\nSupported PCI devices flashrom can use "
"as programmer:\n\n");
#endif
@@ -247,6 +247,9 @@
#if SATASII_SUPPORT == 1
print_supported_pcidevs(satas_sii);
#endif
+#if ATI_R7XX_SUPPORT == 1
+ print_supported_pcidevs(ati_r7xx_devs);
+#endif
}
--
"I do consider assignment statements and pointer variables to be among
computer science's most valuable treasures."
-- Donald E. Knuth
More information about the flashrom
mailing list