mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 23:05:57 +07:00
5a6681e22c
Rationale: The differences between Falcon and Siena are in many ways larger than those between Siena and EF10 (despite Siena being nominally "Falcon- architecture"); for instance, Falcon has no MCPU, so there is no MCDI. Removing Falcon support from the sfc driver should simplify the latter, and avoid the possibility of Falcon support being broken by changes to sfc (which are rarely if ever tested on Falcon, it being end-of-lifed hardware). The sfc-falcon driver created in this changeset is essentially a copy of the sfc driver, but with Siena- and EF10-specific code, including MCDI, removed and with the "efx_" identifier prefix changed to "ef4_" (for "EFX 4000- series") to avoid collisions when both drivers are built-in. This changeset removes Falcon from the sfc driver's PCI ID table; then in sfc I've removed obvious Falcon-related code: I removed the Falcon NIC functions, Falcon PHY code, and EFX_REV_FALCON_*, then fixed up everything that referenced them. Also, increment minor version of both drivers (to 4.1). For now, CONFIG_SFC selects CONFIG_SFC_FALCON, so that updating old configs doesn't cause Falcon support to disappear; but that should be undone at some point in the future. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
134 lines
3.0 KiB
C
134 lines
3.0 KiB
C
/****************************************************************************
|
|
* Driver for Solarflare network controllers and boards
|
|
* Copyright 2005-2006 Fen Systems Ltd.
|
|
* Copyright 2006-2013 Solarflare Communications Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
* by the Free Software Foundation, incorporated herein by reference.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include "net_driver.h"
|
|
#include "efx.h"
|
|
|
|
#define to_ef4_mtd_partition(mtd) \
|
|
container_of(mtd, struct ef4_mtd_partition, mtd)
|
|
|
|
/* MTD interface */
|
|
|
|
static int ef4_mtd_erase(struct mtd_info *mtd, struct erase_info *erase)
|
|
{
|
|
struct ef4_nic *efx = mtd->priv;
|
|
int rc;
|
|
|
|
rc = efx->type->mtd_erase(mtd, erase->addr, erase->len);
|
|
if (rc == 0) {
|
|
erase->state = MTD_ERASE_DONE;
|
|
} else {
|
|
erase->state = MTD_ERASE_FAILED;
|
|
erase->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
|
|
}
|
|
mtd_erase_callback(erase);
|
|
return rc;
|
|
}
|
|
|
|
static void ef4_mtd_sync(struct mtd_info *mtd)
|
|
{
|
|
struct ef4_mtd_partition *part = to_ef4_mtd_partition(mtd);
|
|
struct ef4_nic *efx = mtd->priv;
|
|
int rc;
|
|
|
|
rc = efx->type->mtd_sync(mtd);
|
|
if (rc)
|
|
pr_err("%s: %s sync failed (%d)\n",
|
|
part->name, part->dev_type_name, rc);
|
|
}
|
|
|
|
static void ef4_mtd_remove_partition(struct ef4_mtd_partition *part)
|
|
{
|
|
int rc;
|
|
|
|
for (;;) {
|
|
rc = mtd_device_unregister(&part->mtd);
|
|
if (rc != -EBUSY)
|
|
break;
|
|
ssleep(1);
|
|
}
|
|
WARN_ON(rc);
|
|
list_del(&part->node);
|
|
}
|
|
|
|
int ef4_mtd_add(struct ef4_nic *efx, struct ef4_mtd_partition *parts,
|
|
size_t n_parts, size_t sizeof_part)
|
|
{
|
|
struct ef4_mtd_partition *part;
|
|
size_t i;
|
|
|
|
for (i = 0; i < n_parts; i++) {
|
|
part = (struct ef4_mtd_partition *)((char *)parts +
|
|
i * sizeof_part);
|
|
|
|
part->mtd.writesize = 1;
|
|
|
|
part->mtd.owner = THIS_MODULE;
|
|
part->mtd.priv = efx;
|
|
part->mtd.name = part->name;
|
|
part->mtd._erase = ef4_mtd_erase;
|
|
part->mtd._read = efx->type->mtd_read;
|
|
part->mtd._write = efx->type->mtd_write;
|
|
part->mtd._sync = ef4_mtd_sync;
|
|
|
|
efx->type->mtd_rename(part);
|
|
|
|
if (mtd_device_register(&part->mtd, NULL, 0))
|
|
goto fail;
|
|
|
|
/* Add to list in order - ef4_mtd_remove() depends on this */
|
|
list_add_tail(&part->node, &efx->mtd_list);
|
|
}
|
|
|
|
return 0;
|
|
|
|
fail:
|
|
while (i--) {
|
|
part = (struct ef4_mtd_partition *)((char *)parts +
|
|
i * sizeof_part);
|
|
ef4_mtd_remove_partition(part);
|
|
}
|
|
/* Failure is unlikely here, but probably means we're out of memory */
|
|
return -ENOMEM;
|
|
}
|
|
|
|
void ef4_mtd_remove(struct ef4_nic *efx)
|
|
{
|
|
struct ef4_mtd_partition *parts, *part, *next;
|
|
|
|
WARN_ON(ef4_dev_registered(efx));
|
|
|
|
if (list_empty(&efx->mtd_list))
|
|
return;
|
|
|
|
parts = list_first_entry(&efx->mtd_list, struct ef4_mtd_partition,
|
|
node);
|
|
|
|
list_for_each_entry_safe(part, next, &efx->mtd_list, node)
|
|
ef4_mtd_remove_partition(part);
|
|
|
|
kfree(parts);
|
|
}
|
|
|
|
void ef4_mtd_rename(struct ef4_nic *efx)
|
|
{
|
|
struct ef4_mtd_partition *part;
|
|
|
|
ASSERT_RTNL();
|
|
|
|
list_for_each_entry(part, &efx->mtd_list, node)
|
|
efx->type->mtd_rename(part);
|
|
}
|