summaryrefslogtreecommitdiffstats
path: root/sys/dev/ips
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2004-05-30 04:01:29 +0000
committerscottl <scottl@FreeBSD.org>2004-05-30 04:01:29 +0000
commit2eab4ae5796c568d661137261d76912268e4eb24 (patch)
tree9b223c5dcef5860eae485a1661660f07f6b99f58 /sys/dev/ips
parentf3ff3c1aefc91455d73d3aa4c364eb5c652986e4 (diff)
downloadFreeBSD-src-2eab4ae5796c568d661137261d76912268e4eb24.zip
FreeBSD-src-2eab4ae5796c568d661137261d76912268e4eb24.tar.gz
Use a unique malloc type rather than M_DEVBUF.
Diffstat (limited to 'sys/dev/ips')
-rw-r--r--sys/dev/ips/ips.c10
-rw-r--r--sys/dev/ips/ips.h2
-rw-r--r--sys/dev/ips/ips_commands.c42
-rw-r--r--sys/dev/ips/ips_ioctl.c12
4 files changed, 35 insertions, 31 deletions
diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c
index 20f5c31..b2532e9 100644
--- a/sys/dev/ips/ips.c
+++ b/sys/dev/ips/ips.c
@@ -37,6 +37,8 @@ static d_open_t ips_open;
static d_close_t ips_close;
static d_ioctl_t ips_ioctl;
+MALLOC_DEFINE(M_IPSBUF, "ipsbuf","IPS driver buffer");
+
static struct cdevsw ips_cdevsw = {
.d_version = D_VERSION,
.d_flags = D_NEEDGIANT,
@@ -170,13 +172,13 @@ static int ips_add_waiting_command(ips_softc_t *sc, int (*callback)(ips_command_
unsigned long memflags = 0;
if(IPS_NOWAIT_FLAG & flags)
memflags = M_NOWAIT;
- waiter = malloc(sizeof(ips_wait_list_t), M_DEVBUF, memflags);
+ waiter = malloc(sizeof(ips_wait_list_t), M_IPSBUF, memflags);
if(!waiter)
return ENOMEM;
mask = splbio();
if(sc->state & IPS_OFFLINE){
splx(mask);
- free(waiter, M_DEVBUF);
+ free(waiter, M_IPSBUF);
return EIO;
}
command = SLIST_FIRST(&sc->free_cmd_list);
@@ -186,7 +188,7 @@ static int ips_add_waiting_command(ips_softc_t *sc, int (*callback)(ips_command_
splx(mask);
clear_ips_command(command);
bzero(command->command_buffer, IPS_COMMAND_LEN);
- free(waiter, M_DEVBUF);
+ free(waiter, M_IPSBUF);
command->arg = data;
return callback(command);
}
@@ -221,7 +223,7 @@ static void ips_run_waiting_command(ips_softc_t *sc)
bzero(command->command_buffer, IPS_COMMAND_LEN);
command->arg = waiter->data;
callback = waiter->callback;
- free(waiter, M_DEVBUF);
+ free(waiter, M_IPSBUF);
callback(command);
return;
}
diff --git a/sys/dev/ips/ips.h b/sys/dev/ips/ips.h
index 27946da..5ebc548 100644
--- a/sys/dev/ips/ips.h
+++ b/sys/dev/ips/ips.h
@@ -50,6 +50,8 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
+MALLOC_DECLARE(M_IPSBUF);
+
/*
* IPS CONSTANTS
*/
diff --git a/sys/dev/ips/ips_commands.c b/sys/dev/ips/ips_commands.c
index b139287..d9bc5b7 100644
--- a/sys/dev/ips/ips_commands.c
+++ b/sys/dev/ips/ips_commands.c
@@ -272,19 +272,19 @@ int ips_get_adapter_info(ips_softc_t *sc)
{
int error = 0;
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
if(ips_get_free_cmd(sc, ips_send_adapter_info_cmd, status,
IPS_NOWAIT_FLAG) > 0){
device_printf(sc->dev, "unable to get adapter configuration\n");
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return ENXIO;
}
if (COMMAND_ERROR(status)){
error = ENXIO;
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return error;
}
@@ -378,19 +378,19 @@ int ips_get_drive_info(ips_softc_t *sc)
{
int error = 0;
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
if(ips_get_free_cmd(sc, ips_send_drive_info_cmd, status,
IPS_NOWAIT_FLAG) > 0){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "unable to get drive configuration\n");
return ENXIO;
}
if(COMMAND_ERROR(status)){
error = ENXIO;
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return error;
}
@@ -419,19 +419,19 @@ static int ips_send_flush_cache_cmd(ips_command_t *command)
int ips_flush_cache(ips_softc_t *sc)
{
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
device_printf(sc->dev, "flushing cache\n");
if(ips_get_free_cmd(sc, ips_send_flush_cache_cmd, status,
IPS_NOWAIT_FLAG)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: unable to get a command! can't flush cache!\n");
}
if(COMMAND_ERROR(status)){
device_printf(sc->dev, "ERROR: cache flush command failed!\n");
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return 0;
}
@@ -505,18 +505,18 @@ static int ips_send_ffdc_reset_cmd(ips_command_t *command)
int ips_ffdc_reset(ips_softc_t *sc)
{
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
if(ips_get_free_cmd(sc, ips_send_ffdc_reset_cmd, status,
IPS_NOWAIT_FLAG)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: unable to get a command! can't send ffdc reset!\n");
}
if(COMMAND_ERROR(status)){
device_printf(sc->dev, "ERROR: ffdc reset command failed!\n");
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return 0;
}
@@ -626,18 +626,18 @@ exit:
int ips_update_nvram(ips_softc_t *sc)
{
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
if(ips_get_free_cmd(sc, ips_read_nvram, status, IPS_NOWAIT_FLAG)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: unable to get a command! can't update nvram\n");
return 1;
}
if(COMMAND_ERROR(status)){
device_printf(sc->dev, "ERROR: nvram update command failed!\n");
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return 0;
@@ -690,18 +690,18 @@ static int ips_send_error_table_cmd(ips_command_t *command)
int ips_clear_adapter(ips_softc_t *sc)
{
ips_cmd_status_t *status;
- status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO);
+ status = malloc(sizeof(ips_cmd_status_t), M_IPSBUF, M_NOWAIT|M_ZERO);
if(!status)
return ENOMEM;
device_printf(sc->dev, "syncing config\n");
if(ips_get_free_cmd(sc, ips_send_config_sync_cmd, status,
IPS_NOWAIT_FLAG)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n");
return 1;
}
if(COMMAND_ERROR(status)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: cache sync command failed!\n");
return 1;
}
@@ -709,16 +709,16 @@ int ips_clear_adapter(ips_softc_t *sc)
device_printf(sc->dev, "clearing error table\n");
if(ips_get_free_cmd(sc, ips_send_error_table_cmd, status,
IPS_NOWAIT_FLAG)){
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
device_printf(sc->dev, "ERROR: unable to get a command! can't sync cache!\n");
return 1;
}
if(COMMAND_ERROR(status)){
device_printf(sc->dev, "ERROR: etable command failed!\n");
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return 1;
}
- free(status, M_DEVBUF);
+ free(status, M_IPSBUF);
return 0;
}
diff --git a/sys/dev/ips/ips_ioctl.c b/sys/dev/ips/ips_ioctl.c
index de52b3f..fa4ff36 100644
--- a/sys/dev/ips/ips_ioctl.c
+++ b/sys/dev/ips/ips_ioctl.c
@@ -139,20 +139,20 @@ int ips_ioctl_request(ips_softc_t *sc, u_long ioctl_request, caddr_t addr, int32
switch(ioctl_request){
case IPS_USER_CMD:
user_request = (ips_user_request *)addr;
- ioctl_cmd = malloc(sizeof(ips_ioctl_t), M_DEVBUF, M_WAITOK);
+ ioctl_cmd = malloc(sizeof(ips_ioctl_t), M_IPSBUF, M_WAITOK);
ioctl_cmd->command_buffer = malloc(sizeof(ips_generic_cmd),
- M_DEVBUF, M_WAITOK);
+ M_IPSBUF, M_WAITOK);
if(copyin(user_request->command_buffer,
ioctl_cmd->command_buffer, sizeof(ips_generic_cmd))){
- free(ioctl_cmd->command_buffer, M_DEVBUF);
- free(ioctl_cmd, M_DEVBUF);
+ free(ioctl_cmd->command_buffer, M_IPSBUF);
+ free(ioctl_cmd, M_IPSBUF);
break;
}
ioctl_cmd->readwrite = IPS_IOCTL_READ | IPS_IOCTL_WRITE;
ioctl_cmd->datasize = IPS_IOCTL_BUFFER_SIZE;
error = ips_ioctl_cmd(sc, ioctl_cmd, user_request);
- free(ioctl_cmd->command_buffer, M_DEVBUF);
- free(ioctl_cmd, M_DEVBUF);
+ free(ioctl_cmd->command_buffer, M_IPSBUF);
+ free(ioctl_cmd, M_IPSBUF);
break;
}
OpenPOWER on IntegriCloud