/* * This file is part of the flashrom project. * * Copyright (C) 2009 Uwe Hermann * * 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 #include #include #include "flash.h" #define BIOS_ROM_ADDR 0x30 #define BIOS_ROM_DATA 0x33 #define PCI_VENDOR_ID_RTL 0x10ec //#define PCI_VENDOR_ID_RTL 0x1186 uint32_t internal_conf; uint16_t id; struct pcidev_status nics_rtl[] = { /* 3C90xB */ /* {0x10b7, 0x9055, PCI_OK, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-TX"}, {0x10b7, 0x9001, PCI_NT, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-T4" }, {0x10b7, 0x9004, PCI_OK, "3COM", "3C90xB: PCI 10BASE-T (TPO)" }, {0x10b7, 0x9005, PCI_NT, "3COM", "3C90xB: PCI 10BASE-T/10BASE2/AUI (COMBO)" }, {0x10b7, 0x9006, PCI_NT, "3COM", "3C90xB: PCI 10BASE-T/10BASE2 (TPC)" }, {0x10b7, 0x900a, PCI_NT, "3COM", "3C90xB: PCI 10BASE-FL" }, {0x10b7, 0x905a, PCI_NT, "3COM", "3C90xB: PCI 10BASE-FX" }, {0x10b7, 0x9058, PCI_OK, "3COM", "3C905B: Cyclone 10/100/BNC" },*/ /* 3C905C */ // {0x10b7, 0x9200, PCI_OK, "3COM", "3C905C: EtherLink 10/100 PCI (TX)" }, /* 3C980C */ // {0x10b7, 0x9805, PCI_NT, "3COM", "3C980C: EtherLink Server 10/100 PCI (TX)" }, /* D-Link DGE-528T PCI */ {0x1186, 0x4300, PCI_OK, "D-Link", "DGE-528T: Gigabit Ethernet Adapter PCI" }, {}, }; int nicrtl_init(void) { get_io_perms(); io_base_addr = pcidev_init(PCI_VENDOR_ID_RTL, PCI_BASE_ADDRESS_0, nics_rtl, programmer_param); printf("io_base_addr: 0x%04x\n", io_base_addr); fflush(stdout); if (!io_base_addr) io_base_addr = pcidev_init(0x1186, PCI_BASE_ADDRESS_0, nics_rtl, programmer_param); id = pcidev_dev->device_id; buses_supported = CHIP_BUSTYPE_PARALLEL; return 0; } int nicrtl_shutdown(void) { free(programmer_param); pci_cleanup(pacc); release_io_perms(); return 0; } void nicrtl_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 nicrtl_chip_readb(const chipaddr addr) { OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR); return INB(io_base_addr + BIOS_ROM_DATA); }