mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-11-04 07:00:39 +01:00 
			
		
		
		
	Add initial (non-working) code for Highpoint ATA/RAID controllers
It's disabled by default. The current status is detailed at: http://www.flashrom.org/pipermail/flashrom/2010-January/001828.html Corresponding to flashrom svn r908. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
		
							
								
								
									
										10
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Makefile
									
									
									
									
									
								
							@@ -83,6 +83,10 @@ CONFIG_GFXNVIDIA ?= no
 | 
				
			|||||||
# Always enable SiI SATA controllers for now.
 | 
					# Always enable SiI SATA controllers for now.
 | 
				
			||||||
CONFIG_SATASII ?= yes
 | 
					CONFIG_SATASII ?= yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Highpoint (HPT) ATA/RAID controller support.
 | 
				
			||||||
 | 
					# IMPORTANT: This code is not yet working!
 | 
				
			||||||
 | 
					CONFIG_ATAHPT ?= no
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Always enable FT2232 SPI dongles for now.
 | 
					# Always enable FT2232 SPI dongles for now.
 | 
				
			||||||
CONFIG_FT2232SPI ?= yes
 | 
					CONFIG_FT2232SPI ?= yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -138,6 +142,12 @@ PROGRAMMER_OBJS += satasii.o
 | 
				
			|||||||
NEED_PCI := yes
 | 
					NEED_PCI := yes
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifeq ($(CONFIG_ATAHPT), yes)
 | 
				
			||||||
 | 
					FEATURE_CFLAGS += -D'ATAHPT_SUPPORT=1'
 | 
				
			||||||
 | 
					PROGRAMMER_OBJS += atahpt.o
 | 
				
			||||||
 | 
					NEED_PCI := yes
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(CONFIG_FT2232SPI), yes)
 | 
					ifeq ($(CONFIG_FT2232SPI), yes)
 | 
				
			||||||
FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
 | 
					FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
 | 
				
			||||||
# This is a totally ugly hack.
 | 
					# This is a totally ugly hack.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										85
									
								
								atahpt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								atahpt.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * This file is part of the flashrom project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 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; either version 2 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 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 BIOS_ROM_ADDR		0x90
 | 
				
			||||||
 | 
					#define BIOS_ROM_DATA		0x94
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define REG_FLASH_ACCESS	0x58
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PCI_VENDOR_ID_HPT	0x1103
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct pcidev_status ata_hpt[] = {
 | 
				
			||||||
 | 
						{0x1103, 0x0004, PCI_NT, "Highpoint", "HPT366/368/370/370A/372/372N"},
 | 
				
			||||||
 | 
						{0x1103, 0x0005, PCI_NT, "Highpoint", "HPT372A/372N"},
 | 
				
			||||||
 | 
						{0x1103, 0x0006, PCI_NT, "Highpoint", "HPT302/302N"},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int atahpt_init(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						uint32_t reg32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						get_io_perms();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						io_base_addr = pcidev_init(PCI_VENDOR_ID_HPT, PCI_BASE_ADDRESS_4,
 | 
				
			||||||
 | 
									   ata_hpt, programmer_param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Enable flash access. */
 | 
				
			||||||
 | 
						reg32 = pci_read_long(pcidev_dev, REG_FLASH_ACCESS);
 | 
				
			||||||
 | 
						reg32 |= (1 << 24);
 | 
				
			||||||
 | 
						pci_write_long(pcidev_dev, REG_FLASH_ACCESS, reg32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						buses_supported = CHIP_BUSTYPE_PARALLEL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int atahpt_shutdown(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						uint32_t reg32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Disable flash access again. */
 | 
				
			||||||
 | 
						reg32 = pci_read_long(pcidev_dev, REG_FLASH_ACCESS);
 | 
				
			||||||
 | 
						reg32 &= ~(1 << 24);
 | 
				
			||||||
 | 
						pci_write_long(pcidev_dev, REG_FLASH_ACCESS, reg32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(programmer_param);
 | 
				
			||||||
 | 
						pci_cleanup(pacc);
 | 
				
			||||||
 | 
						release_io_perms();
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void atahpt_chip_writeb(uint8_t val, chipaddr addr)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
 | 
				
			||||||
 | 
						OUTB(val, io_base_addr + BIOS_ROM_DATA);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint8_t atahpt_chip_readb(const chipaddr addr)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
 | 
				
			||||||
 | 
						return INB(io_base_addr + BIOS_ROM_DATA);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								flash.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								flash.h
									
									
									
									
									
								
							@@ -55,6 +55,9 @@ enum programmer {
 | 
				
			|||||||
#if SATASII_SUPPORT == 1
 | 
					#if SATASII_SUPPORT == 1
 | 
				
			||||||
	PROGRAMMER_SATASII,
 | 
						PROGRAMMER_SATASII,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#if ATAHPT_SUPPORT == 1
 | 
				
			||||||
 | 
						PROGRAMMER_ATAHPT,
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#if INTERNAL_SUPPORT == 1
 | 
					#if INTERNAL_SUPPORT == 1
 | 
				
			||||||
	PROGRAMMER_IT87SPI,
 | 
						PROGRAMMER_IT87SPI,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -328,7 +331,7 @@ uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, struct pcidev_status *dev
 | 
				
			|||||||
/* print.c */
 | 
					/* print.c */
 | 
				
			||||||
char *flashbuses_to_text(enum chipbustype bustype);
 | 
					char *flashbuses_to_text(enum chipbustype bustype);
 | 
				
			||||||
void print_supported(void);
 | 
					void print_supported(void);
 | 
				
			||||||
#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1)
 | 
					#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1) || (ATAHPT_SUPPORT == 1)
 | 
				
			||||||
void print_supported_pcidevs(struct pcidev_status *devs);
 | 
					void print_supported_pcidevs(struct pcidev_status *devs);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
void print_supported_wiki(void);
 | 
					void print_supported_wiki(void);
 | 
				
			||||||
@@ -466,6 +469,15 @@ uint8_t satasii_chip_readb(const chipaddr addr);
 | 
				
			|||||||
extern struct pcidev_status satas_sii[];
 | 
					extern struct pcidev_status satas_sii[];
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* atahpt.c */
 | 
				
			||||||
 | 
					#if ATAHPT_SUPPORT == 1
 | 
				
			||||||
 | 
					int atahpt_init(void);
 | 
				
			||||||
 | 
					int atahpt_shutdown(void);
 | 
				
			||||||
 | 
					void atahpt_chip_writeb(uint8_t val, chipaddr addr);
 | 
				
			||||||
 | 
					uint8_t atahpt_chip_readb(const chipaddr addr);
 | 
				
			||||||
 | 
					extern struct pcidev_status ata_hpt[];
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ft2232_spi.c */
 | 
					/* ft2232_spi.c */
 | 
				
			||||||
#define FTDI_FT2232H 0x6010
 | 
					#define FTDI_FT2232H 0x6010
 | 
				
			||||||
#define FTDI_FT4232H 0x6011
 | 
					#define FTDI_FT4232H 0x6011
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,6 +146,8 @@ Specify the programmer device. Currently supported are:
 | 
				
			|||||||
.sp
 | 
					.sp
 | 
				
			||||||
.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
 | 
					.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
 | 
				
			||||||
.sp
 | 
					.sp
 | 
				
			||||||
 | 
					.BR "* atahpt" " (for flash ROMs on Highpoint ATA/RAID controllers)"
 | 
				
			||||||
 | 
					.sp
 | 
				
			||||||
.BR "* it87spi" " (for flash ROMs behind an ITE IT87xx Super I/O LPC/SPI translation unit)"
 | 
					.BR "* it87spi" " (for flash ROMs behind an ITE IT87xx Super I/O LPC/SPI translation unit)"
 | 
				
			||||||
.sp
 | 
					.sp
 | 
				
			||||||
.BR "* ft2232spi" " (for flash ROMs attached to a FT2232H/FT4232H based USB SPI programmer)"
 | 
					.BR "* ft2232spi" " (for flash ROMs attached to a FT2232H/FT4232H based USB SPI programmer)"
 | 
				
			||||||
@@ -185,7 +187,8 @@ Example:
 | 
				
			|||||||
Currently the following programmers support this mechanism:
 | 
					Currently the following programmers support this mechanism:
 | 
				
			||||||
.BR nic3com ,
 | 
					.BR nic3com ,
 | 
				
			||||||
.BR gfxnvidia ,
 | 
					.BR gfxnvidia ,
 | 
				
			||||||
.BR satasii .
 | 
					.BR satasii ,
 | 
				
			||||||
 | 
					.BR atahpt .
 | 
				
			||||||
.sp
 | 
					.sp
 | 
				
			||||||
The it87spi programmer has an optional parameter which will set the I/O base
 | 
					The it87spi programmer has an optional parameter which will set the I/O base
 | 
				
			||||||
port of the IT87* SPI controller interface to the port specified in the
 | 
					port of the IT87* SPI controller interface to the port specified in the
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								flashrom.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								flashrom.c
									
									
									
									
									
								
							@@ -44,7 +44,7 @@ enum programmer programmer = PROGRAMMER_DUMMY;
 | 
				
			|||||||
 * if more than one of them is selected. If only one is selected, it is clear
 | 
					 * 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.
 | 
					 * that the user wants that one to become the default.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_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 > 1
 | 
				
			||||||
#error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all external programmers except one.
 | 
					#error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all external programmers except one.
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
enum programmer programmer =
 | 
					enum programmer programmer =
 | 
				
			||||||
@@ -60,6 +60,9 @@ enum programmer programmer =
 | 
				
			|||||||
#if SATASII_SUPPORT == 1
 | 
					#if SATASII_SUPPORT == 1
 | 
				
			||||||
	PROGRAMMER_SATASII
 | 
						PROGRAMMER_SATASII
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#if ATAHPT_SUPPORT == 1
 | 
				
			||||||
 | 
						PROGRAMMER_ATAHPT
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#if FT2232_SPI_SUPPORT == 1
 | 
					#if FT2232_SPI_SUPPORT == 1
 | 
				
			||||||
	PROGRAMMER_FT2232SPI
 | 
						PROGRAMMER_FT2232SPI
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -210,6 +213,25 @@ const struct programmer_entry programmer_table[] = {
 | 
				
			|||||||
	},
 | 
						},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if ATAHPT_SUPPORT == 1
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							.name			= "atahpt",
 | 
				
			||||||
 | 
							.init			= atahpt_init,
 | 
				
			||||||
 | 
							.shutdown		= atahpt_shutdown,
 | 
				
			||||||
 | 
							.map_flash_region	= fallback_map,
 | 
				
			||||||
 | 
							.unmap_flash_region	= fallback_unmap,
 | 
				
			||||||
 | 
							.chip_readb		= atahpt_chip_readb,
 | 
				
			||||||
 | 
							.chip_readw		= fallback_chip_readw,
 | 
				
			||||||
 | 
							.chip_readl		= fallback_chip_readl,
 | 
				
			||||||
 | 
							.chip_readn		= fallback_chip_readn,
 | 
				
			||||||
 | 
							.chip_writeb		= atahpt_chip_writeb,
 | 
				
			||||||
 | 
							.chip_writew		= fallback_chip_writew,
 | 
				
			||||||
 | 
							.chip_writel		= fallback_chip_writel,
 | 
				
			||||||
 | 
							.chip_writen		= fallback_chip_writen,
 | 
				
			||||||
 | 
							.delay			= internal_delay,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if INTERNAL_SUPPORT == 1
 | 
					#if INTERNAL_SUPPORT == 1
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.name			= "it87spi",
 | 
							.name			= "it87spi",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -565,6 +565,9 @@ void print_supported_wiki(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if SATASII_SUPPORT == 1
 | 
					#if SATASII_SUPPORT == 1
 | 
				
			||||||
	print_supported_pcidevs_wiki(satas_sii);
 | 
						print_supported_pcidevs_wiki(satas_sii);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#if ATAHPT_SUPPORT == 1
 | 
				
			||||||
 | 
						print_supported_pcidevs_wiki(ata_hpt);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	printf("\n|}\n");
 | 
						printf("\n|}\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user