Hi Rick,
from your messages on IRC, I guess you almost got it. You have to select SOUTHBRIDGE_INTEL_I82801GX in your mainboard's Kconfig. Just do a `git grep select\ SOUTHBRIDGE_INTEL_I82801GX` and you'll find where it's set for other boards. The correct files should then be added by Makefiles.
More answers inline below...
On 15.10.2016 10:24, Antonius Riko wrote:
Everyone,
I tried to port I946GZ and following from 945 example on intel mainboard,
and I got error when compiling :
build/romstage/mainboard/intel/i946gz/romstage.o: In function `mainboard_romstage_entry': /home/bianchi/coreboot/src/mainboard/intel/i946gz/romstage.c:214: undefined reference to `southbridge_detect_s3_resume' /home/bianchi/coreboot/src/mainboard/intel/i946gz/romstage.c:217: undefined reference to `enable_smbus' build/romstage/northbridge/intel/i945/raminit.o: In function `spd_read_byte': /home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: undefined reference to `smbus_read_byte' /home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: undefined reference to `smbus_read_byte' /home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: undefined reference to `smbus_read_byte' /home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: undefined reference to `smbus_read_byte' /home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: undefined reference to `smbus_read_byte' build/romstage/northbridge/intel/i945/raminit.o:/home/bianchi/coreboot/src/northbridge/intel/i945/raminit.c:62: more undefined references to `smbus_read_byte' follow src/arch/x86/Makefile.inc:264: recipe for target 'build/cbfs/fallback/romstage.debug' failed make: *** [build/cbfs/fallback/romstage.debug] Error 1
When I patch it with :
#include <southbridge/intel/i82801gx/early_lpc.c> #include <southbridge/intel/i82801gx/early_smbus.c> #include <southbridge/intel/i82801gx/lpc.c>
Including .c files is a bad idea. We did that before and still do in some places, but will get rid of it in the future hopefully. Also you are mixing romstage (early_*.c) and ramstage (lpc.c) code here.
I guess the remaining errors are caused by the mixing.
Hope that helps, Nico
the errors are gone but I got : GEN generated/bootblock.ld CP bootblock/arch/x86/bootblock.ld LINK cbfs/fallback/bootblock.debug OBJCOPY cbfs/fallback/bootblock.elf OBJCOPY bootblock.raw.bin CC romstage/mainboard/intel/i946gz/romstage.o In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_enable_ioapic': src/southbridge/intel/i82801gx/lpc.c:52:20: error: passing argument 1 of 'pcie_write_config8' makes integer from pointer without a cast [-Werror=int-conversion] pci_write_config8(dev, ACPI_CNTL, ACPI_EN); ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:49:6: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' void pcie_write_config8(pci_devfn_t dev, unsigned int where, u8 value) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_enable_serial_irqs': src/southbridge/intel/i82801gx/lpc.c:66:20: error: passing argument 1 of 'pcie_write_config8' makes integer from pointer without a cast [-Werror=int-conversion] pci_write_config8(dev, SERIRQ_CNTL, ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:49:6: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' void pcie_write_config8(pci_devfn_t dev, unsigned int where, u8 value) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_pirq_init': src/southbridge/intel/i82801gx/lpc.c:95:24: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') config_t *config = dev->chip_info; ^ src/southbridge/intel/i82801gx/lpc.c:97:43: error: dereferencing pointer to incomplete type 'config_t {aka struct southbridge_intel_i82801gx_config}' pci_write_config8(dev, PIRQA_ROUT, config->pirqa_routing); ^ src/southbridge/intel/i82801gx/lpc.c:111:17: error: 'all_devices' undeclared (first use in this function) for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { ^ src/southbridge/intel/i82801gx/lpc.c:111:17: note: each undeclared identifier is reported only once for each function it appears in src/southbridge/intel/i82801gx/lpc.c:111:56: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) { ^ src/southbridge/intel/i82801gx/lpc.c:114:15: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) ^ src/southbridge/intel/i82801gx/lpc.c:114:35: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI) ^ src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_gpi_routing': src/southbridge/intel/i82801gx/lpc.c:136:24: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') config_t *config = dev->chip_info; ^ src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_power_options': src/southbridge/intel/i82801gx/lpc.c:169:24: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') config_t *config = dev->chip_info; ^ src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_rtc_init': src/southbridge/intel/i82801gx/lpc.c:287:26: error: passing argument 1 of 'pcie_read_config8' makes integer from pointer without a cast [-Werror=int-conversion] reg8 = pci_read_config8(dev, GEN_PMCON_3); ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:25:4: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' u8 pcie_read_config8(pci_devfn_t dev, unsigned int where) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c:291:21: error: passing argument 1 of 'pcie_write_config8' makes integer from pointer without a cast [-Werror=int-conversion] pci_write_config8(dev, GEN_PMCON_3, reg8); ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:49:6: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' void pcie_write_config8(pci_devfn_t dev, unsigned int where, u8 value) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_fixups': src/southbridge/intel/i82801gx/lpc.c:402:20: error: passing argument 1 of 'pcie_write_config8' makes integer from pointer without a cast [-Werror=int-conversion] pci_write_config8(dev, 0xad, 0x3); ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:49:6: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' void pcie_write_config8(pci_devfn_t dev, unsigned int where, u8 value) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: In function 'lpc_init': src/southbridge/intel/i82801gx/lpc.c:410:21: error: passing argument 1 of 'pcie_write_config16' makes integer from pointer without a cast [-Werror=int-conversion] pci_write_config16(dev, PCI_COMMAND, 0x000f); ^ In file included from src/arch/x86/include/arch/io.h:247:0, from src/mainboard/intel/i946gz/romstage.c:20: src/arch/x86/include/arch/pci_mmio_cfg.h:57:6: note: expected 'pci_devfn_t {aka unsigned int}' but argument is of type 'struct device *' void pcie_write_config16(pci_devfn_t dev, unsigned int where, u16 value) ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c:418:21: error: passing argument 1 of 'i82801gx_pirq_init' makes integer from pointer without a cast [-Werror=int-conversion] i82801gx_pirq_init(dev); ^ src/southbridge/intel/i82801gx/lpc.c:91:13: note: expected 'device_t {aka unsigned int}' but argument is of type 'struct device *' static void i82801gx_pirq_init(device_t dev) ^ src/southbridge/intel/i82801gx/lpc.c:421:25: error: passing argument 1 of 'i82801gx_power_options' makes integer from pointer without a cast [-Werror=int-conversion] i82801gx_power_options(dev); ^ src/southbridge/intel/i82801gx/lpc.c:162:13: note: expected 'device_t {aka unsigned int}' but argument is of type 'struct device *' static void i82801gx_power_options(device_t dev) ^ src/southbridge/intel/i82801gx/lpc.c:424:29: error: passing argument 1 of 'i82801gx_configure_cstates' makes integer from pointer without a cast [-Werror=int-conversion] i82801gx_configure_cstates(dev); ^ src/southbridge/intel/i82801gx/lpc.c:266:13: note: expected 'device_t {aka unsigned int}' but argument is of type 'struct device *' static void i82801gx_configure_cstates(device_t dev) ^ src/southbridge/intel/i82801gx/lpc.c: At top level: src/southbridge/intel/i82801gx/lpc.c:484:6: error: no previous prototype for 'acpi_fill_fadt' [-Werror=missing-prototypes] void acpi_fill_fadt(acpi_fadt_t * fadt) ^ src/southbridge/intel/i82801gx/lpc.c: In function 'acpi_fill_fadt': src/southbridge/intel/i82801gx/lpc.c:486:17: error: initialization makes integer from pointer without a cast [-Werror=int-conversion] device_t dev = dev_find_slot(0, PCI_DEVFN(0x1f,0)); ^ src/southbridge/intel/i82801gx/lpc.c:487:22: error: invalid type argument of '->' (have 'device_t {aka unsigned int}') config_t *chip = dev->chip_info; ^ src/southbridge/intel/i82801gx/lpc.c: In function 'i82801gx_lpc_read_resources': src/southbridge/intel/i82801gx/lpc.c:611:2: error: implicit declaration of function 'pci_dev_read_resources' [-Werror=implicit-function-declaration] pci_dev_read_resources(dev); ^ src/southbridge/intel/i82801gx/lpc.c:614:21: error: passing argument 1 of 'new_resource' makes pointer from integer without a cast [-Werror=int-conversion] res = new_resource(dev, IOINDEX_SUBTRACTIVE(io_index++, 0)); ^ In file included from src/include/device/device.h:14:0, from src/arch/x86/include/arch/acpi.h:54, from src/mainboard/intel/i946gz/romstage.c:25: src/include/device/resource.h:61:25: note: expected 'struct device *' but argument is of type 'device_t {aka unsigned int}' extern struct resource *new_resource(struct device * dev, unsigned index); ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c:620:21: error: passing argument 1 of 'new_resource' makes pointer from integer without a cast [-Werror=int-conversion] res = new_resource(dev, IOINDEX_SUBTRACTIVE(io_index++, 0)); ^ In file included from src/include/device/device.h:14:0, from src/arch/x86/include/arch/acpi.h:54, from src/mainboard/intel/i946gz/romstage.c:25: src/include/device/resource.h:61:25: note: expected 'struct device *' but argument is of type 'device_t {aka unsigned int}' extern struct resource *new_resource(struct device * dev, unsigned index); ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c:626:21: error: passing argument 1 of 'new_resource' makes pointer from integer without a cast [-Werror=int-conversion] res = new_resource(dev, 3); /* IOAPIC */ ^ In file included from src/include/device/device.h:14:0, from src/arch/x86/include/arch/acpi.h:54, from src/mainboard/intel/i946gz/romstage.c:25: src/include/device/resource.h:61:25: note: expected 'struct device *' but argument is of type 'device_t {aka unsigned int}' extern struct resource *new_resource(struct device * dev, unsigned index); ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c:637:23: error: passing argument 1 of 'new_resource' makes pointer from integer without a cast [-Werror=int-conversion] res = new_resource(dev, IOINDEX_SUBTRACTIVE(io_index++, 0)); ^ In file included from src/include/device/device.h:14:0, from src/arch/x86/include/arch/acpi.h:54, from src/mainboard/intel/i946gz/romstage.c:25: src/include/device/resource.h:61:25: note: expected 'struct device *' but argument is of type 'device_t {aka unsigned int}' extern struct resource *new_resource(struct device * dev, unsigned index); ^ In file included from src/mainboard/intel/i946gz/romstage.c:44:0: src/southbridge/intel/i82801gx/lpc.c: At top level: src/southbridge/intel/i82801gx/lpc.c:684:15: error: variable 'pci_ops' has initializer but incomplete type static struct pci_operations pci_ops = { ^ src/southbridge/intel/i82801gx/lpc.c:685:2: error: unknown field 'set_subsystem' specified in initializer .set_subsystem = set_subsystem, ^ src/southbridge/intel/i82801gx/lpc.c:685:19: error: excess elements in struct initializer [-Werror] .set_subsystem = set_subsystem, ^ src/southbridge/intel/i82801gx/lpc.c:685:19: note: (near initialization for 'pci_ops') src/southbridge/intel/i82801gx/lpc.c:688:15: error: variable 'device_ops' has initializer but incomplete type static struct device_operations device_ops = { ^ src/southbridge/intel/i82801gx/lpc.c:689:2: error: unknown field 'read_resources' specified in initializer .read_resources = i82801gx_lpc_read_resources, ^ src/southbridge/intel/i82801gx/lpc.c:689:21: error: excess elements in struct initializer [-Werror] .read_resources = i82801gx_lpc_read_resources, ^ src/southbridge/intel/i82801gx/lpc.c:689:21: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:690:2: error: unknown field 'set_resources' specified in initializer .set_resources = pci_dev_set_resources, ^ src/southbridge/intel/i82801gx/lpc.c:690:20: error: 'pci_dev_set_resources' undeclared here (not in a function) .set_resources = pci_dev_set_resources, ^ src/southbridge/intel/i82801gx/lpc.c:690:20: error: excess elements in struct initializer [-Werror] src/southbridge/intel/i82801gx/lpc.c:690:20: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:691:2: error: unknown field 'enable_resources' specified in initializer .enable_resources = pci_dev_enable_resources, ^ src/southbridge/intel/i82801gx/lpc.c:691:22: error: 'pci_dev_enable_resources' undeclared here (not in a function) .enable_resources = pci_dev_enable_resources, ^ src/southbridge/intel/i82801gx/lpc.c:691:22: error: excess elements in struct initializer [-Werror] src/southbridge/intel/i82801gx/lpc.c:691:22: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:692:2: error: unknown field 'acpi_inject_dsdt_generator' specified in initializer .acpi_inject_dsdt_generator = southbridge_inject_dsdt, ^ src/southbridge/intel/i82801gx/lpc.c:692:32: error: excess elements in struct initializer [-Werror] .acpi_inject_dsdt_generator = southbridge_inject_dsdt, ^ src/southbridge/intel/i82801gx/lpc.c:692:32: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:693:2: error: unknown field 'write_acpi_tables' specified in initializer .write_acpi_tables = acpi_write_hpet, ^ src/southbridge/intel/i82801gx/lpc.c:693:28: error: 'acpi_write_hpet' undeclared here (not in a function) .write_acpi_tables = acpi_write_hpet, ^ src/southbridge/intel/i82801gx/lpc.c:693:28: error: excess elements in struct initializer [-Werror] src/southbridge/intel/i82801gx/lpc.c:693:28: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:694:2: error: unknown field 'init' specified in initializer .init = lpc_init, ^ src/southbridge/intel/i82801gx/lpc.c:694:12: error: excess elements in struct initializer [-Werror] .init = lpc_init, ^ src/southbridge/intel/i82801gx/lpc.c:694:12: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:695:2: error: unknown field 'scan_bus' specified in initializer .scan_bus = scan_lpc_bus, ^ src/southbridge/intel/i82801gx/lpc.c:695:15: error: 'scan_lpc_bus' undeclared here (not in a function) .scan_bus = scan_lpc_bus, ^ src/southbridge/intel/i82801gx/lpc.c:695:15: error: excess elements in struct initializer [-Werror] src/southbridge/intel/i82801gx/lpc.c:695:15: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:696:2: error: unknown field 'enable' specified in initializer .enable = i82801gx_enable, ^ src/southbridge/intel/i82801gx/lpc.c:696:14: error: 'i82801gx_enable' undeclared here (not in a function) .enable = i82801gx_enable, ^ src/southbridge/intel/i82801gx/lpc.c:696:14: error: excess elements in struct initializer [-Werror] src/southbridge/intel/i82801gx/lpc.c:696:14: note: (near initialization for 'device_ops') src/southbridge/intel/i82801gx/lpc.c:697:2: error: unknown field 'ops_pci' specified in initializer .ops_pci = &pci_ops, ^ src/southbridge/intel/i82801gx/lpc.c:697:14: error: excess elements in struct initializer [-Werror] .ops_pci = &pci_ops, ^ src/southbridge/intel/i82801gx/lpc.c:697:14: note: (near initialization for 'device_ops')
Is there any way fixing it ?
Thanks Rick