mpr_mapping.c (26c1d774b55c4db79bca772941883244986e6f44) mpr_mapping.c (ac2fffa4b74cd83963f0d462c379c7f50eeabf20)
1/*-
2 * Copyright (c) 2011-2015 LSI Corp.
3 * Copyright (c) 2013-2016 Avago Technologies
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 2127 unchanged lines hidden (view full) ---

2136 *
2137 * Return 0 on success or non-zero on failure.
2138 */
2139int
2140mpr_mapping_allocate_memory(struct mpr_softc *sc)
2141{
2142 uint32_t dpm_pg0_sz;
2143
1/*-
2 * Copyright (c) 2011-2015 LSI Corp.
3 * Copyright (c) 2013-2016 Avago Technologies
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 2127 unchanged lines hidden (view full) ---

2136 *
2137 * Return 0 on success or non-zero on failure.
2138 */
2139int
2140mpr_mapping_allocate_memory(struct mpr_softc *sc)
2141{
2142 uint32_t dpm_pg0_sz;
2143
2144 sc->mapping_table = mallocarray(sc->max_devices,
2145 sizeof(struct dev_mapping_table), M_MPR, M_ZERO|M_NOWAIT);
2144 sc->mapping_table = malloc((sizeof(struct dev_mapping_table) *
2145 sc->max_devices), M_MPR, M_ZERO|M_NOWAIT);
2146 if (!sc->mapping_table)
2147 goto free_resources;
2148
2146 if (!sc->mapping_table)
2147 goto free_resources;
2148
2149 sc->removal_table = mallocarray(sc->max_devices,
2150 sizeof(struct map_removal_table), M_MPR, M_ZERO|M_NOWAIT);
2149 sc->removal_table = malloc((sizeof(struct map_removal_table) *
2150 sc->max_devices), M_MPR, M_ZERO|M_NOWAIT);
2151 if (!sc->removal_table)
2152 goto free_resources;
2153
2151 if (!sc->removal_table)
2152 goto free_resources;
2153
2154 sc->enclosure_table = mallocarray(sc->max_enclosures,
2155 sizeof(struct enc_mapping_table), M_MPR, M_ZERO|M_NOWAIT);
2154 sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) *
2155 sc->max_enclosures), M_MPR, M_ZERO|M_NOWAIT);
2156 if (!sc->enclosure_table)
2157 goto free_resources;
2158
2156 if (!sc->enclosure_table)
2157 goto free_resources;
2158
2159 sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8),
2159 sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries),
2160 M_MPR, M_ZERO|M_NOWAIT);
2161 if (!sc->dpm_entry_used)
2162 goto free_resources;
2163
2160 M_MPR, M_ZERO|M_NOWAIT);
2161 if (!sc->dpm_entry_used)
2162 goto free_resources;
2163
2164 sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8),
2164 sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries),
2165 M_MPR, M_ZERO|M_NOWAIT);
2166 if (!sc->dpm_flush_entry)
2167 goto free_resources;
2168
2169 dpm_pg0_sz = sizeof(MPI2_CONFIG_EXTENDED_PAGE_HEADER) +
2170 (sc->max_dpm_entries * sizeof(MPI2_CONFIG_PAGE_DRIVER_MAP0_ENTRY));
2171
2172 sc->dpm_pg0 = malloc(dpm_pg0_sz, M_MPR, M_ZERO|M_NOWAIT);

--- 734 unchanged lines hidden (view full) ---

2907 topo_change.start_phy_num = event_data->StartPhyNum;
2908 topo_change.num_phys = event_data->NumPhys;
2909 topo_change.exp_status = event_data->ExpStatus;
2910 event_phy_change = event_data->PHY;
2911 topo_change.phy_details = NULL;
2912
2913 if (!num_entries)
2914 goto out;
2165 M_MPR, M_ZERO|M_NOWAIT);
2166 if (!sc->dpm_flush_entry)
2167 goto free_resources;
2168
2169 dpm_pg0_sz = sizeof(MPI2_CONFIG_EXTENDED_PAGE_HEADER) +
2170 (sc->max_dpm_entries * sizeof(MPI2_CONFIG_PAGE_DRIVER_MAP0_ENTRY));
2171
2172 sc->dpm_pg0 = malloc(dpm_pg0_sz, M_MPR, M_ZERO|M_NOWAIT);

--- 734 unchanged lines hidden (view full) ---

2907 topo_change.start_phy_num = event_data->StartPhyNum;
2908 topo_change.num_phys = event_data->NumPhys;
2909 topo_change.exp_status = event_data->ExpStatus;
2910 event_phy_change = event_data->PHY;
2911 topo_change.phy_details = NULL;
2912
2913 if (!num_entries)
2914 goto out;
2915 phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change),
2915 phy_change = malloc(sizeof(struct _map_phy_change) * num_entries,
2916 M_MPR, M_NOWAIT|M_ZERO);
2917 topo_change.phy_details = phy_change;
2918 if (!phy_change)
2919 goto out;
2920 for (i = 0; i < num_entries; i++, event_phy_change++, phy_change++) {
2921 phy_change->dev_handle = le16toh(event_phy_change->
2922 AttachedDevHandle);
2923 phy_change->reason = event_phy_change->PhyStatus &

--- 34 unchanged lines hidden (view full) ---

2958 topo_change.start_port_num = event_data->StartPortNum;
2959 topo_change.num_ports = event_data->NumPorts;
2960 topo_change.switch_status = event_data->SwitchStatus;
2961 event_port_change = event_data->PortEntry;
2962 topo_change.port_details = NULL;
2963
2964 if (!num_entries)
2965 goto out;
2916 M_MPR, M_NOWAIT|M_ZERO);
2917 topo_change.phy_details = phy_change;
2918 if (!phy_change)
2919 goto out;
2920 for (i = 0; i < num_entries; i++, event_phy_change++, phy_change++) {
2921 phy_change->dev_handle = le16toh(event_phy_change->
2922 AttachedDevHandle);
2923 phy_change->reason = event_phy_change->PhyStatus &

--- 34 unchanged lines hidden (view full) ---

2958 topo_change.start_port_num = event_data->StartPortNum;
2959 topo_change.num_ports = event_data->NumPorts;
2960 topo_change.switch_status = event_data->SwitchStatus;
2961 event_port_change = event_data->PortEntry;
2962 topo_change.port_details = NULL;
2963
2964 if (!num_entries)
2965 goto out;
2966 port_change = mallocarray(num_entries, sizeof(struct _map_port_change),
2966 port_change = malloc(sizeof(struct _map_port_change) * num_entries,
2967 M_MPR, M_NOWAIT|M_ZERO);
2968 topo_change.port_details = port_change;
2969 if (!port_change)
2970 goto out;
2971 for (i = 0; i < num_entries; i++, event_port_change++, port_change++) {
2972 port_change->dev_handle = le16toh(event_port_change->
2973 AttachedDevHandle);
2974 port_change->reason = event_port_change->PortStatus;

--- 23 unchanged lines hidden (view full) ---

2998{
2999 Mpi2EventIrConfigElement_t *element;
3000 int i;
3001 u64 *wwid_table;
3002 u32 map_idx, flags;
3003 struct dev_mapping_table *mt_entry;
3004 u16 element_flags;
3005
2967 M_MPR, M_NOWAIT|M_ZERO);
2968 topo_change.port_details = port_change;
2969 if (!port_change)
2970 goto out;
2971 for (i = 0; i < num_entries; i++, event_port_change++, port_change++) {
2972 port_change->dev_handle = le16toh(event_port_change->
2973 AttachedDevHandle);
2974 port_change->reason = event_port_change->PortStatus;

--- 23 unchanged lines hidden (view full) ---

2998{
2999 Mpi2EventIrConfigElement_t *element;
3000 int i;
3001 u64 *wwid_table;
3002 u32 map_idx, flags;
3003 struct dev_mapping_table *mt_entry;
3004 u16 element_flags;
3005
3006 wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPR,
3006 wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPR,
3007 M_NOWAIT | M_ZERO);
3008 if (!wwid_table)
3009 goto out;
3010 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
3011 flags = le32toh(event_data->Flags);
3012
3013 /*
3014 * For volume changes, get the WWID for the volume and put it in a

--- 117 unchanged lines hidden ---
3007 M_NOWAIT | M_ZERO);
3008 if (!wwid_table)
3009 goto out;
3010 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
3011 flags = le32toh(event_data->Flags);
3012
3013 /*
3014 * For volume changes, get the WWID for the volume and put it in a

--- 117 unchanged lines hidden ---