Merge branch 'master' into 3leaf-rewrite
authorMichael Brown <mcb30@etherboot.org>
Tue, 11 Sep 2007 14:42:17 +0000 (15:42 +0100)
committerMichael Brown <mcb30@etherboot.org>
Tue, 11 Sep 2007 14:42:17 +0000 (15:42 +0100)
16 files changed:
src/Makefile
src/drivers/net/mlx_ipoib/cmdif_comm.c
src/drivers/net/mlx_ipoib/cmdif_mt25218.c
src/drivers/net/mlx_ipoib/doc/README.boot_over_ib
src/drivers/net/mlx_ipoib/ib_driver.c
src/drivers/net/mlx_ipoib/ib_mad.c
src/drivers/net/mlx_ipoib/ib_mt23108.c
src/drivers/net/mlx_ipoib/ib_mt25218.c
src/drivers/net/mlx_ipoib/ipoib.c
src/drivers/net/mlx_ipoib/mt23108.c
src/drivers/net/mlx_ipoib/mt23108_imp.c
src/drivers/net/mlx_ipoib/mt25218.c
src/drivers/net/mlx_ipoib/mt25218.h
src/drivers/net/mlx_ipoib/mt25218_imp.c
src/drivers/net/mlx_ipoib/mt_version.c
src/drivers/net/mlx_ipoib/patches/dhcpd.patch

index 0682dc5..f0e85e1 100644 (file)
@@ -165,6 +165,11 @@ SRCDIRS            += usr
 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.
index d43a106..cf7b9e5 100644 (file)
@@ -542,7 +542,10 @@ static int cmd_mgid_hash(__u8 * gid, __u16 * mgid_hash_p)
 {
        int rc;
        command_fields_t cmd_desc;
-       __u16 result[2];
+       union {
+               __u32 u32;
+               __u16 u16[2];
+       } result;
 
        memset(&cmd_desc, 0, sizeof cmd_desc);
 
@@ -554,9 +557,9 @@ static int cmd_mgid_hash(__u8 * gid, __u16 * mgid_hash_p)
 
        rc = cmd_invoke(&cmd_desc);
        if (!rc) {
-               rc = gw_read_cr(HCR_BASE + 16, (__u32 *) result);
+               rc = gw_read_cr(HCR_BASE + 16, &result.u32);
                if (!rc) {
-                       *mgid_hash_p = result[0];
+                       *mgid_hash_p = result.u16[0];
                }
        }
 
index fb95edb..704fb1f 100644 (file)
 #include "cmdif_priv.h"
 #include "mt25218.h"
 
-/*
- *  cmd_sys_dis
- */
-static int cmd_sys_dis(void)
-{
-       return 0;
-}
-
 /*
  *  cmd_write_mgm
  */
@@ -325,6 +317,24 @@ static int cmd_map_icm_aux(struct map_icm_st *map_icm_aux_p)
        return rc;
 }
 
+
+/*
+ *  cmd_unmap_icm_aux
+ */
+static int cmd_unmap_icm_aux(void)
+{
+       int rc;
+       command_fields_t cmd_desc;
+
+       memset(&cmd_desc, 0, sizeof cmd_desc);
+
+       cmd_desc.opcode = MEMFREE_CMD_UNMAP_ICM_AUX;
+
+       rc = cmd_invoke(&cmd_desc);
+
+       return rc;
+}
+
 /*
  *  cmd_map_icm
  */
@@ -371,6 +381,31 @@ static int cmd_map_icm(struct map_icm_st *map_icm_p)
        return rc;
 }
 
+
+
+/*
+ *  cmd_unmap_icm
+ */
+static int cmd_unmap_icm(struct map_icm_st *map_icm_p)
+{
+       int rc;
+       command_fields_t cmd_desc;
+       __u32 iprm[2];
+
+       memset(&cmd_desc, 0, sizeof cmd_desc);
+
+       cmd_desc.opcode = MEMFREE_CMD_UNMAP_ICM;
+       iprm[0] = map_icm_p->vpm_arr[0].va_h;
+       iprm[1] = map_icm_p->vpm_arr[0].va_l;
+       cmd_desc.in_param = iprm;
+       cmd_desc.in_trans = TRANS_IMMEDIATE;
+       cmd_desc.input_modifier = 1 << map_icm_p->vpm_arr[0].log2_size;
+
+       rc = cmd_invoke(&cmd_desc);
+
+       return rc;
+}
+
 /*
  *  cmd_query_dev_lim
  */
index 0773862..062abd3 100644 (file)
@@ -92,13 +92,11 @@ files with .mlx extension also available from Mellanox's web site.
 
 6. Preparing the DHCP Server
 -----------------------------
-DHCP messages over IP Over IB are transmitted as broadcasts. In order to 
-distinguish between messages belonging to a certain DHCP session, the messages 
-must carry the client identifier option (see ietf documentation        referred to 
-above). As of November 2005, ISC DHCP servers do not support this feature. 
-They are expected to support this at the end of 2005. In order to work this 
-out, the appropriate patch must be applied (see patches directory). It has 
-been tested on version isc-dhcpd-V3.0.4b2.
+The DHCP server may need to be modified in order to work on IPOIB. Some
+distributuions alreay support this (Some SUSE distributuions) while others
+do not. If the pre-installed server does not support IPOIB, the user can download
+the sources from ISC http://www.isc.org/ and apply the appropriate patch in
+the patches directory.
 
 The DHCP server must run on a machine which supports IP Over IB. The Mellanox 
 IBGD package (gen1 or gen2) can be used to provide this.
@@ -171,6 +169,14 @@ PXE_IB_PORT.
 
 14. Installing a package from Mellanox
 --------------------------------------
+The package comes as a compressed file with extension .bz2 or .gz. Follow 
+these steps:
+1. Create a directory
+2. cd to this directory
+3. tar jxf <package file name>  for .bz2 files or
+   tar zxf <package file name>  for .gz files
+
+The binaries can be found under src/bin
 When using a package obtained from Mellanox Technologies' web site, the
 directory src/bin will contain the driver binary files. The files have a .bin
 extension and are equivalent to the same files with .zrom extension.
index a46db7f..a3015ba 100644 (file)
@@ -248,12 +248,10 @@ static int ib_driver_close(int fw_fatal)
                ret = 1;
        }
 
-       if (!fw_fatal) {
-               rc = cmd_sys_dis();
-               if (rc) {
-                       eprintf("");
-                       ret = 1;
-               }
+       rc = unset_hca();
+       if (rc) {
+               eprintf("");
+               ret = 1;
        }
 
        return ret;
index 3e263a5..73b49f2 100644 (file)
@@ -158,7 +158,7 @@ static int join_mc_group(__u32 * qkey_p, __u16 * mlid_p, __u8 join)
                eprintf("");
                return -1;
        }
-       tprintf("allocated snd_wqe=0x%lx", snd_wqe);
+       tprintf("allocated snd_wqe=%p", snd_wqe);
 
        mad = get_send_wqe_buf(snd_wqe, 0);
        memset(mad, 0, 256);
index ca3abb1..d9261b9 100644 (file)
@@ -92,7 +92,12 @@ static int find_mlx_bridge(__u8 hca_bus, __u8 * br_bus_p, __u8 * br_devfn_p)
        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;
@@ -100,7 +105,7 @@ static int find_mlx_bridge(__u8 hca_bus, __u8 * br_bus_p, __u8 * br_devfn_p)
                        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;
@@ -108,7 +113,7 @@ static int find_mlx_bridge(__u8 hca_bus, __u8 * br_bus_p, __u8 * br_devfn_p)
                        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)
@@ -161,7 +166,7 @@ static int ib_device_init(struct pci_device *dev)
        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) {
@@ -175,7 +180,12 @@ static int ib_device_init(struct pci_device *dev)
                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) {
@@ -203,7 +213,7 @@ static int ib_device_init(struct pci_device *dev)
                eprintf("");
                return -1;
        }
-       tprintf("uar_base (pa:va) = 0x%lx 0x%lx",
+       tprintf("uar_base (pa:va) = 0x%lx %p",
                tavor_pci_dev.dev.bar[2] + UAR_IDX * 0x1000, tavor_pci_dev.uar);
 
        tprintf("");
@@ -225,7 +235,7 @@ static int init_dev_data(void)
 
        dev_buffers_p = bus_to_virt(tmp);
        memreg_size = (__u32) (&memreg_size) - (__u32) dev_buffers_p;
-       tprintf("src_buf=0x%lx, dev_buffers_p=0x%lx, memreg_size=0x%x", src_buf,
+       tprintf("src_buf=%p, dev_buffers_p=%p, memreg_size=0x%lx", src_buf,
                dev_buffers_p, memreg_size);
 
        return 0;
@@ -236,10 +246,14 @@ static int restore_config(void)
        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]);
@@ -551,9 +565,9 @@ static int setup_hca(__u8 port, void **eq_p)
                tprintf("fw_rev_major=%d", qfw.fw_rev_major);
                tprintf("fw_rev_minor=%d", qfw.fw_rev_minor);
                tprintf("fw_rev_subminor=%d", qfw.fw_rev_subminor);
-               tprintf("error_buf_start_h=0x%x", qfw.error_buf_start_h);
-               tprintf("error_buf_start_l=0x%x", qfw.error_buf_start_l);
-               tprintf("error_buf_size=%d", qfw.error_buf_size);
+               tprintf("error_buf_start_h=0x%lx", qfw.error_buf_start_h);
+               tprintf("error_buf_start_l=0x%lx", qfw.error_buf_start_l);
+               tprintf("error_buf_size=%ld", qfw.error_buf_size);
        }
 
        if (qfw.error_buf_start_h) {
@@ -799,6 +813,20 @@ static int setup_hca(__u8 port, void **eq_p)
        return ret;
 }
 
+
+static int unset_hca(void)
+{
+       int rc = 0;
+
+       if (!fw_fatal) {
+               rc = cmd_sys_dis();
+               if (rc)
+                       eprintf("");
+       }
+
+       return rc;
+}
+
 static void *get_inprm_buf(void)
 {
        return dev_buffers_p->inprm_buf;
@@ -930,7 +958,7 @@ static int post_send_req(void *qph, void *wqeh, __u8 num_gather)
        __u32 *psrc, *pdst;
        __u32 nds;
 
-       tprintf("snd_wqe=0x%lx, virt_to_bus(snd_wqe)=0x%lx", snd_wqe,
+       tprintf("snd_wqe=%p, virt_to_bus(snd_wqe)=0x%lx", snd_wqe,
                virt_to_bus(snd_wqe));
 
        memset(&dbell, 0, sizeof dbell);
@@ -1054,7 +1082,7 @@ static int create_ipoib_qp(void **qp_pp,
                /* update data */
                qp->rcv_wq[i].wqe_cont.qp = qp;
                qp->rcv_bufs[i] = ib_buffers.ipoib_rcv_buf[i];
-               tprintf("rcv_buf=%lx", qp->rcv_bufs[i]);
+               tprintf("rcv_buf=%p", qp->rcv_bufs[i]);
        }
 
        /* init send queue WQEs list */
@@ -1387,7 +1415,7 @@ static int ib_poll_cq(void *cqh, struct ib_cqe_st *ib_cqe_p, u8 * num_cqes)
                eprintf("syndrome=0x%lx",
                        EX_FLD(cqe.error_cqe, tavorprm_completion_with_error_st,
                               syndrome));
-               eprintf("wqe_addr=0x%lx", wqe_p);
+               eprintf("wqe_addr=%p", wqe_p);
                eprintf("wqe_size=0x%lx",
                        EX_FLD(cqe.error_cqe, tavorprm_completion_with_error_st,
                               wqe_size));
@@ -1516,7 +1544,7 @@ static struct recv_wqe_st *alloc_rcv_wqe(struct udqp_st *qp)
        wqe->mpointer[1].lkey = dev_ib_data.mkey;
        wqe->mpointer[1].byte_count = qp->rcv_buf_sz;
 
-       tprintf("rcv_buf=%lx\n", qp->rcv_bufs[new_entry]);
+       tprintf("rcv_buf=%p\n", qp->rcv_bufs[new_entry]);
 
        /* we do it only on the data segment since the control
           segment is always owned by HW */
@@ -1643,7 +1671,7 @@ static int poll_eq(struct ib_eqe_st *ib_eqe_p, __u8 * num_eqes)
        struct eq_st *eq = &dev_ib_data.eq;
 
        ptr = (__u32 *) (&(eq->eq_buf[eq->cons_idx]));
-       tprintf("cons)idx=%d, addr(eqe)=%x, val=0x%x", eq->cons_idx, virt_to_bus(ptr), ptr[7]);
+       tprintf("cons)idx=%ld, addr(eqe)=%lx, val=0x%lx", eq->cons_idx, virt_to_bus(ptr), ptr[7]);
        owner = (ptr[7] & 0x80000000) ? OWNER_HW : OWNER_SW;
        if (owner == OWNER_SW) {
         tprintf("got eqe");
index f16577f..8f3873e 100644 (file)
@@ -89,6 +89,10 @@ static struct dev_pci_struct memfree_pci_dev;
 static struct device_buffers_st *dev_buffers_p;
 static struct device_ib_data_st dev_ib_data;
 
+
+
+struct map_icm_st icm_map_obj;
+
 static int gw_write_cr(__u32 addr, __u32 data)
 {
        writel(htonl(data), memfree_pci_dev.cr_space + addr);
@@ -155,7 +159,7 @@ static int ib_device_init(struct pci_device *dev)
                eprintf("");
                return -1;
        }
-       tprintf("uar_base (pa:va) = 0x%lx 0x%lx",
+       tprintf("uar_base (pa:va) = 0x%lx %p",
                memfree_pci_dev.dev.bar[2] + UAR_IDX * 0x1000,
                memfree_pci_dev.uar);
 
@@ -170,6 +174,8 @@ static inline unsigned long lalign(unsigned long buf, unsigned long align)
                               (~(((unsigned long)align) - 1)));
 }
 
+#include <gpxe/umalloc.h>
+
 static int init_dev_data(void)
 {
        unsigned long tmp;
@@ -179,17 +185,21 @@ static int init_dev_data(void)
 
        dev_buffers_p = bus_to_virt(tmp);
        memreg_size = (__u32) (&memreg_size) - (__u32) dev_buffers_p;
-       tprintf("src_buf=0x%lx, dev_buffers_p=0x%lx, memreg_size=0x%x", src_buf,
+       tprintf("src_buf=%p, dev_buffers_p=%p, memreg_size=0x%lx", src_buf,
                dev_buffers_p, memreg_size);
 
-       tprintf("inprm: va=0x%lx, pa=0x%lx", dev_buffers_p->inprm_buf,
+       tprintf("inprm: va=%p, pa=0x%lx", dev_buffers_p->inprm_buf,
                virt_to_bus(dev_buffers_p->inprm_buf));
-       tprintf("outprm: va=0x%lx, pa=0x%lx", dev_buffers_p->outprm_buf,
+       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;
@@ -661,9 +671,9 @@ static int setup_hca(__u8 port, void **eq_p)
                tprintf("fw_rev_major=%d", qfw.fw_rev_major);
                tprintf("fw_rev_minor=%d", qfw.fw_rev_minor);
                tprintf("fw_rev_subminor=%d", qfw.fw_rev_subminor);
-               tprintf("error_buf_start_h=0x%x", qfw.error_buf_start_h);
-               tprintf("error_buf_start_l=0x%x", qfw.error_buf_start_l);
-               tprintf("error_buf_size=%d", qfw.error_buf_size);
+               tprintf("error_buf_start_h=0x%lx", qfw.error_buf_start_h);
+               tprintf("error_buf_start_l=0x%lx", qfw.error_buf_start_l);
+               tprintf("error_buf_size=%ld", qfw.error_buf_size);
        }
 
 
@@ -836,7 +846,7 @@ static int setup_hca(__u8 port, void **eq_p)
        uar_context_pa = phys_mem.base + phys_mem.offset +
            dev_ib_data.uar_idx * 4096;
        uar_context_va = phys_to_virt(uar_context_pa);
-       tprintf("uar_context: va=0x%lx, pa=0x%lx", uar_context_va,
+       tprintf("uar_context: va=%p, pa=0x%lx", uar_context_va,
                uar_context_pa);
        dev_ib_data.uar_context_base = uar_context_va;
 
@@ -850,10 +860,12 @@ static int setup_hca(__u8 port, void **eq_p)
                eprintf("");
                goto undo_map_fa;
        }
+       icm_map_obj = map_obj;
+
        phys_mem.offset += (1 << (map_obj.vpm_arr[0].log2_size + 12));
 
        init_hca.log_max_uars = log_max_uars;
-       tprintf("inprm: va=0x%lx, pa=0x%lx", inprm, virt_to_bus(inprm));
+       tprintf("inprm: va=%p, pa=0x%lx", inprm, virt_to_bus(inprm));
        prep_init_hca_buf(&init_hca, inprm);
        rc = cmd_init_hca(inprm, MT_STRUCT_SIZE(arbelprm_init_hca_st));
        if (rc) {
@@ -978,6 +990,30 @@ static int setup_hca(__u8 port, void **eq_p)
        return ret;
 }
 
+
+static int unset_hca(void)
+{
+       int rc, ret = 0;
+
+       rc = cmd_unmap_icm(&icm_map_obj);
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+
+       rc = cmd_unmap_icm_aux();
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+       rc = cmd_unmap_fa();
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+       return ret;
+}
+
 static void *get_inprm_buf(void)
 {
        return dev_buffers_p->inprm_buf;
@@ -1690,7 +1726,7 @@ static int ib_poll_cq(void *cqh, struct ib_cqe_st *ib_cqe_p, u8 * num_cqes)
                eprintf("vendor_syndrome=0x%lx",
                        EX_FLD(cqe.error_cqe, arbelprm_completion_with_error_st,
                               vendor_code));
-               eprintf("wqe_addr=0x%lx", wqe_p);
+               eprintf("wqe_addr=%p", wqe_p);
                eprintf("myqpn=0x%lx",
                        EX_FLD(cqe.error_cqe, arbelprm_completion_with_error_st,
                               myqpn));
index 85eaac7..d4124f2 100644 (file)
@@ -357,52 +357,12 @@ static void modify_dhcp_resp(void *buf, __u16 size)
        modify_udp_csum(buf, size);
 }
 
-static void get_my_client_id(__u8 * my_client_id)
-{
-
-       my_client_id[0] = 0;
-       qpn2buf(ipoib_data.ipoib_qpn, my_client_id + 1);
-       memcpy(my_client_id + 4, ipoib_data.port_gid_raw, 16);
-}
-
-static const __u8 *get_client_id(const void *buf, int len)
-{
-       const __u8 *ptr;
-       int delta;
-
-       if (len < 268)
-               return NULL;
-
-       /* pointer to just after magic cookie */
-       ptr = (const __u8 *)buf + 268;
-
-       /* find last client identifier option */
-       do {
-               if (ptr[0] == 255) {
-                       /* found end of options list */
-                       return NULL;
-               }
-
-               if (ptr[0] == 0x3d) {
-                       /* client identifer option */
-                       return ptr + 3;
-               }
-
-               delta = ptr[1] + 2;
-               ptr += delta;
-               len -= delta;
-       } while (len > 0);
-
-       return NULL;
-}
-
 static int handle_ipv4_packet(void *buf, void **out_buf_p,
                              unsigned int *new_size_p, int *is_bcast_p)
 {
        void *new_buf;
        __u16 new_size;
        __u8 msg_type;
-       __u8 my_client_id[20];
 
        new_buf = (void *)(((__u8 *) buf) + 4);
        new_size = (*new_size_p) - 4;
@@ -411,7 +371,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p,
 
        if (get_ip_protocl(new_buf) == IP_PROT_UDP) {
                __u16 udp_dst_port;
-               const __u8 *client_id;
 
                udp_dst_port = get_udp_dst_port(new_buf);
 
@@ -420,22 +379,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p,
                        *out_buf_p = 0;
                        return 0;
                }
-
-               if (udp_dst_port == 68) {
-                       get_my_client_id(my_client_id);
-
-                       /* packet client id */
-                       client_id = get_client_id(new_buf, new_size);
-                       if (!client_id) {
-                               *out_buf_p = 0;
-                               return 0;
-                       }
-
-                       if (memcmp(client_id, my_client_id, 20)) {
-                               *out_buf_p = 0;
-                               return 0;
-                       }
-               }
        }
 
        msg_type = get_dhcp_msg_type(new_buf);
@@ -515,8 +458,9 @@ static int ipoib_handle_rcv(void *buf, void **out_buf_p,
                rc = handle_ipv4_packet(buf, out_buf_p, new_size_p, is_bcast_p);
                return rc;
        }
-       eprintf("prot=0x%x", prot_type);
-       return -1;
+       tprintf("prot=0x%x", prot_type);
+    *out_buf_p = NULL;
+       return 0;
 }
 
 static int is_null_mac(const __u8 * mac)
@@ -953,7 +897,7 @@ static int ipoib_read_packet(__u16 * prot_p, void *data, unsigned int *size_p,
 
        new_size = ib_cqe.count - GRH_SIZE;
        buf = get_rcv_wqe_buf(ib_cqe.wqe, 1);
-       tprintf("buf=%lx", buf);
+       tprintf("buf=%p", buf);
        rc = ipoib_handle_rcv(buf, &out_buf, &new_size, is_bcast_p);
        if (rc) {
                eprintf("");
@@ -1000,7 +944,7 @@ static int ipoib_init(struct pci_device *pci)
        ipoib_data.ipoib_qpn = ib_get_qpn(qph);
 
        if(print_info)
-               printf("local ipoib qpn=0x%x\n", ipoib_data.ipoib_qpn);
+               printf("local ipoib qpn=0x%lx\n", ipoib_data.ipoib_qpn);
 
        ipoib_data.bcast_av = ib_data.bcast_av;
        ipoib_data.port_gid_raw = ib_data.port_gid.raw;
index 492bc90..37947a8 100644 (file)
@@ -14,10 +14,6 @@ Skeleton NIC driver for Etherboot
 #include "etherboot.h"
 /* to get the interface to the body of the program */
 #include "nic.h"
-/* to get the PCI support functions, if this is a PCI NIC */
-#include <gpxe/pci.h>
-/* to get the ISA support functions, if this is an ISA NIC */
-#include <gpxe/isa.h>
 
 #include "mt_version.c"
 #include "mt23108_imp.c"
@@ -152,7 +148,7 @@ static void tavor_transmit(struct nic *nic, const char *dest,       /* Destination */
 /**************************************************************************
 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.
@@ -164,18 +160,24 @@ static void tavor_disable(struct dev *dev)
         * 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;
 
@@ -219,10 +221,7 @@ static int tavor_probe(struct dev *dev, struct pci_device *pci)
                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;
        }
@@ -230,16 +229,12 @@ static int tavor_probe(struct dev *dev, struct pci_device *pci)
        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"),
 };
 
-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 );
index 4e60166..d2bdf46 100644 (file)
@@ -91,10 +91,12 @@ static int transmit_imp(const char *dest,   /* Destination */
        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; 
        }
 
@@ -106,7 +108,7 @@ static void hd(void *where, int n)
        int i;
 
        while (n > 0) {
-               printf("%X ", where);
+               printf("%p ", where);
                for (i = 0; i < ((n > 16) ? 16 : n); i++)
                        printf(" %hhX", ((char *)where)[i]);
                printf("\n");
@@ -222,9 +224,11 @@ static int poll_imp(struct nic *nic, int retrieve, unsigned int *size_p)
 
 fatal_handling:
        printf("restarting Etherboot\n");
+#if 0
        sleep(1);
        longjmp(restart_etherboot, -1);
        /* we should not be here ... */
+#endif
        return -1; 
        
 }
index a603cde..11a35c2 100644 (file)
@@ -14,10 +14,6 @@ Skeleton NIC driver for Etherboot
 #include "etherboot.h"
 /* to get the interface to the body of the program */
 #include "nic.h"
-/* to get the PCI support functions, if this is a PCI NIC */
-#include <gpxe/pci.h>
-/* to get the ISA support functions, if this is an ISA NIC */
-#include <gpxe/isa.h>
 
 #include "mt_version.c"
 #include "mt25218_imp.c"
@@ -152,7 +148,7 @@ static void mt25218_transmit(struct nic *nic, const char *dest,     /* Destination *
 /**************************************************************************
 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.
@@ -164,18 +160,24 @@ static void mt25218_disable(struct dev *dev)
         * 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;
 
@@ -219,10 +221,11 @@ static int mt25218_probe(struct dev *dev, struct pci_device *pci)
                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;
+
+               uint8_t fixed_node_addr[ETH_ALEN] = { 0x00, 0x02, 0xc9,
+                                                     0x20, 0xf5, 0x95 };
+               memcpy ( nic->node_addr, fixed_node_addr, ETH_ALEN );
 
                return 1;
        }
@@ -230,16 +233,12 @@ static int mt25218_probe(struct dev *dev, struct pci_device *pci)
        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"),
 };
 
-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 );
index 15a3fea..1e7c8d8 100644 (file)
@@ -26,7 +26,9 @@
 #define MEMFREE_CMD_RUN_FW                     0xff6
 #define MEMFREE_CMD_SET_ICM_SIZE       0xffd
 #define MEMFREE_CMD_MAP_ICM_AUX                0xffc
+#define MEMFREE_CMD_UNMAP_ICM_AUX              0xffb
 #define MEMFREE_CMD_MAP_ICM                    0xffa
+#define MEMFREE_CMD_UNMAP_ICM                  0xff9
 #define MEMFREE_CMD_QUERY_DEV_LIM   0x003
 
 /*
index fe40704..301f31d 100644 (file)
@@ -91,10 +91,12 @@ static int transmit_imp(const char *dest,   /* Destination */
        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; 
        }
 
@@ -106,7 +108,7 @@ static void hd(void *where, int n)
        int i;
 
        while (n > 0) {
-               printf("%X ", where);
+               printf("%p ", where);
                for (i = 0; i < ((n > 16) ? 16 : n); i++)
                        printf(" %hhX", ((char *)where)[i]);
                printf("\n");
@@ -221,10 +223,12 @@ static int poll_imp(struct nic *nic, int retrieve, unsigned int *size_p)
        return 0;
 
 fatal_handling:
+#if 0
        printf("restarting Etherboot\n");
        sleep(1);
        longjmp(restart_etherboot, -1);
        /* we should not be here ... */
+#endif
        return -1; 
        
 }
index 2dbd67a..bae860c 100644 (file)
@@ -20,4 +20,4 @@
 */
 
 /* definition of the build version goes here */
-const char *build_revision= "113";
+const char *build_revision= "191";
index e2d0a20..3f6269b 100644 (file)
@@ -1,17 +1,7 @@
-diff -ru ../../orig/dhcp-3.0.4b2/common/options.c ./common/options.c
---- ../../orig/dhcp-3.0.4b2/common/options.c   2005-11-02 01:19:03.000000000 +0200
-+++ ./common/options.c 2005-12-06 14:38:17.000000000 +0200
-@@ -537,6 +537,7 @@
-       priority_list [priority_len++] = DHO_DHCP_LEASE_TIME;
-       priority_list [priority_len++] = DHO_DHCP_MESSAGE;
-       priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
-+      priority_list [priority_len++] = DHO_DHCP_CLIENT_IDENTIFIER;
-       priority_list [priority_len++] = DHO_FQDN;
-       if (prl && prl -> len > 0) {
-diff -ru ../../orig/dhcp-3.0.4b2/includes/site.h ./includes/site.h
---- ../../orig/dhcp-3.0.4b2/includes/site.h    2002-03-12 20:33:39.000000000 +0200
-+++ ./includes/site.h  2005-12-06 14:36:55.000000000 +0200
+Index: dhcp-3.0.4b3/includes/site.h
+===================================================================
+--- dhcp-3.0.4b3.orig/includes/site.h  2002-03-12 20:33:39.000000000 +0200
++++ dhcp-3.0.4b3/includes/site.h       2006-03-15 12:50:00.000000000 +0200
 @@ -135,7 +135,7 @@
     the aforementioned problems do not matter to you, or if no other
     API is supported for your system, you may want to go with it. */