inside gPXE.
NON_AUTO_SRCS += core/elf_loader.c
NON_AUTO_SRCS += drivers/net/prism2.c
+SRCS += drivers/net/mlx_ipoib/mt25218.c
+SRCS += drivers/net/mlx_ipoib/mt23108.c
+CFLAGS_mt25218 = -Wno-error
+CFLAGS_mt23108 = -Wno-error
+
# Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
# the automatic build system and varies by target; it includes the
# "-p 0x1234,0x5678" string to set the PCI IDs.
for (bus = 0; bus < 256; ++bus) {
for (dev = 0; dev < 32; ++dev) {
devfn = (dev << 3);
- rc = pcibios_read_config_word(bus, devfn, PCI_VENDOR_ID,
+
+ struct pci_device tmp;
+ tmp.bus = bus;
+ tmp.devfn = devfn;
+
+ rc = pcibios_read_config_word(&tmp, PCI_VENDOR_ID,
&vendor);
if (rc)
return rc;
if (vendor != MELLANOX_VENDOR_ID)
continue;
- rc = pcibios_read_config_word(bus, devfn, PCI_DEVICE_ID,
+ rc = pcibios_read_config_word(&tmp, PCI_DEVICE_ID,
&dev_id);
if (rc)
return rc;
if (dev_id != TAVOR_BRIDGE_DEVICE_ID)
continue;
- rc = pcibios_read_config_byte(bus, devfn,
+ rc = pcibios_read_config_byte(&tmp,
PCI_SECONDARY_BUS,
&sec_bus);
if (rc)
tavor_pci_dev.dev.dev = dev;
tprintf("");
- if (dev->dev_id == TAVOR_DEVICE_ID) {
+ if (dev->device == TAVOR_DEVICE_ID) {
rc = find_mlx_bridge(dev->bus, &br_bus, &br_devfn);
if (rc) {
tprintf("bus=%d devfn=0x%x", br_bus, br_devfn);
/* save config space */
for (i = 0; i < 64; ++i) {
- rc = pcibios_read_config_dword(br_bus, br_devfn, i << 2,
+
+ struct pci_device tmp;
+ tmp.bus = br_bus;
+ tmp.devfn = br_devfn;
+
+ rc = pcibios_read_config_dword(&tmp, i << 2,
&tavor_pci_dev.br.
dev_config_space[i]);
if (rc) {
int i;
int rc;
- if (tavor_pci_dev.dev.dev->dev_id == TAVOR_DEVICE_ID) {
+ if (tavor_pci_dev.dev.dev->device == TAVOR_DEVICE_ID) {
for (i = 0; i < 64; ++i) {
- rc = pcibios_write_config_dword(tavor_pci_dev.br.bus,
- tavor_pci_dev.br.devfn,
+
+ struct pci_device tmp;
+ tmp.bus = tavor_pci_dev.br.bus;
+ tmp.devfn = tavor_pci_dev.br.devfn;
+
+ rc = pcibios_write_config_dword(&tmp,
i << 2,
tavor_pci_dev.br.
dev_config_space[i]);
(~(((unsigned long)align) - 1)));
}
+#include <gpxe/umalloc.h>
+
static int init_dev_data(void)
{
unsigned long tmp;
tprintf("outprm: va=%p, pa=0x%lx", dev_buffers_p->outprm_buf,
virt_to_bus(dev_buffers_p->outprm_buf));
- phys_mem.base =
- (virt_to_phys(_text) - reserve_size) & (~(reserve_size - 1));
-
+ userptr_t lotsofmem = umalloc ( reserve_size * 2 );
+ if ( ! lotsofmem ) {
+ printf ( "Could not allocate large memblock\n" );
+ return -1;
+ }
+ phys_mem.base = ( ( user_to_phys ( lotsofmem, 0 ) + reserve_size ) &
+ ~( reserve_size - 1 ) );
phys_mem.offset = 0;
return 0;
/**************************************************************************
DISABLE - Turn off ethernet interface
***************************************************************************/
-static void tavor_disable(struct dev *dev)
+static void tavor_disable(struct nic *nic)
{
/* put the card in its initial state */
/* This function serves 3 purposes.
* This allows etherboot to reinitialize the interface
* if something is something goes wrong.
*/
- if (dev || 1) { // ????
+ if (nic || 1) { // ????
disable_imp();
}
}
+static struct nic_operations tavor_operations = {
+ .connect = dummy_connect,
+ .poll = tavor_poll,
+ .transmit = tavor_transmit,
+ .irq = tavor_irq,
+};
+
/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/
-static int tavor_probe(struct dev *dev, struct pci_device *pci)
+static int tavor_probe(struct nic *nic, struct pci_device *pci)
{
- struct nic *nic = (struct nic *)dev;
int rc;
unsigned char user_request;
nic->ioaddr = pci->ioaddr & ~3;
nic->irqno = pci->irq;
/* point to NIC specific routines */
- dev->disable = tavor_disable;
- nic->poll = tavor_poll;
- nic->transmit = tavor_transmit;
- nic->irq = tavor_irq;
+ nic->nic_op = &tavor_operations;
return 1;
}
return 0;
}
-static struct pci_id tavor_nics[] = {
+static struct pci_device_id tavor_nics[] = {
PCI_ROM(0x15b3, 0x5a44, "MT23108", "MT23108 HCA driver"),
PCI_ROM(0x15b3, 0x6278, "MT25208", "MT25208 HCA driver"),
};
-static struct pci_driver tavor_driver __pci_driver = {
- .type = NIC_DRIVER,
- .name = "MT23108/MT25208",
- .probe = tavor_probe,
- .ids = tavor_nics,
- .id_count = sizeof(tavor_nics) / sizeof(tavor_nics[0]),
- .class = 0,
-};
+PCI_DRIVER ( tavor_driver, tavor_nics, PCI_NO_CLASS );
+
+DRIVER ( "MT23108/MT25208", nic_driver, pci_driver, tavor_driver,
+ tavor_probe, tavor_disable );
rc = ipoib_send_packet(dest, type, packet, size);
if (rc) {
printf("*** ERROR IN SEND FLOW ***\n");
+#if 0
printf("restarting Etherboot\n");
sleep(1);
longjmp(restart_etherboot, -1);
/* we should not be here ... */
+#endif
return -1;
}
fatal_handling:
printf("restarting Etherboot\n");
+#if 0
sleep(1);
longjmp(restart_etherboot, -1);
/* we should not be here ... */
+#endif
return -1;
}
/**************************************************************************
DISABLE - Turn off ethernet interface
***************************************************************************/
-static void mt25218_disable(struct dev *dev)
+static void mt25218_disable(struct nic *nic)
{
/* put the card in its initial state */
/* This function serves 3 purposes.
* This allows etherboot to reinitialize the interface
* if something is something goes wrong.
*/
- if (dev || 1) { // ????
+ if (nic || 1) { // ????
disable_imp();
}
}
+static struct nic_operations mt25218_operations = {
+ .connect = dummy_connect,
+ .poll = mt25218_poll,
+ .transmit = mt25218_transmit,
+ .irq = mt25218_irq,
+};
+
/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/
-static int mt25218_probe(struct dev *dev, struct pci_device *pci)
+static int mt25218_probe(struct nic *nic, struct pci_device *pci)
{
- struct nic *nic = (struct nic *)dev;
int rc;
unsigned char user_request;
nic->ioaddr = pci->ioaddr & ~3;
nic->irqno = pci->irq;
/* point to NIC specific routines */
- dev->disable = mt25218_disable;
- nic->poll = mt25218_poll;
- nic->transmit = mt25218_transmit;
- nic->irq = mt25218_irq;
+ nic->nic_op = &mt25218_operations;
return 1;
}
return 0;
}
-static struct pci_id mt25218_nics[] = {
+static struct pci_device_id mt25218_nics[] = {
PCI_ROM(0x15b3, 0x6282, "MT25218", "MT25218 HCA driver"),
PCI_ROM(0x15b3, 0x6274, "MT25204", "MT25204 HCA driver"),
};
-static struct pci_driver mt25218_driver __pci_driver = {
- .type = NIC_DRIVER,
- .name = "MT25218",
- .probe = mt25218_probe,
- .ids = mt25218_nics,
- .id_count = sizeof(mt25218_nics) / sizeof(mt25218_nics[0]),
- .class = 0,
-};
+PCI_DRIVER ( mt25218_driver, mt25218_nics, PCI_NO_CLASS );
+
+DRIVER ( "MT25218", nic_driver, pci_driver, mt25218_driver,
+ mt25218_probe, mt25218_disable );
rc = ipoib_send_packet(dest, type, packet, size);
if (rc) {
printf("*** ERROR IN SEND FLOW ***\n");
+#if 0
printf("restarting Etherboot\n");
sleep(1);
longjmp(restart_etherboot, -1);
/* we should not be here ... */
+#endif
return -1;
}
return 0;
fatal_handling:
+#if 0
printf("restarting Etherboot\n");
sleep(1);
longjmp(restart_etherboot, -1);
/* we should not be here ... */
+#endif
return -1;
}