[Midnightbsd-cvs] src: dev/aic7xxx:
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 15 10:02:30 EDT 2009
Log Message:
-----------
Modified Files:
--------------
src/sys/dev/aic7xxx:
aic79xx.c (r1.2 -> r1.3)
aic79xx_osm.h (r1.2 -> r1.3)
aic7xxx.c (r1.2 -> r1.3)
aic7xxx_osm.h (r1.2 -> r1.3)
aic_osm_lib.c (r1.2 -> r1.3)
aic_osm_lib.h (r1.2 -> r1.3)
-------------- next part --------------
Index: aic_osm_lib.c
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic_osm_lib.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic_osm_lib.c -L sys/dev/aic7xxx/aic_osm_lib.c -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic_osm_lib.c
+++ sys/dev/aic7xxx/aic_osm_lib.c
@@ -131,6 +131,23 @@
void
aic_calc_geometry(struct ccb_calc_geometry *ccg, int extended)
{
+#if __FreeBSD_version >= 500000
cam_calc_geometry(ccg, extended);
+#else
+ uint32_t size_mb;
+ uint32_t secs_per_cylinder;
+
+ size_mb = ccg->volume_size / ((1024L * 1024L) / ccg->block_size);
+ if (size_mb > 1024 && extended) {
+ ccg->heads = 255;
+ ccg->secs_per_track = 63;
+ } else {
+ ccg->heads = 64;
+ ccg->secs_per_track = 32;
+ }
+ secs_per_cylinder = ccg->heads * ccg->secs_per_track;
+ ccg->cylinders = ccg->volume_size / secs_per_cylinder;
+ ccg->ccb_h.status = CAM_REQ_CMP;
+#endif
}
Index: aic79xx_osm.h
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic79xx_osm.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic79xx_osm.h -L sys/dev/aic7xxx/aic79xx_osm.h -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic79xx_osm.h
+++ sys/dev/aic7xxx/aic79xx_osm.h
@@ -43,7 +43,9 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h> /* For device_t */
+#if __FreeBSD_version >= 500000
#include <sys/endian.h>
+#endif
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -57,8 +59,13 @@
#include <sys/rman.h>
+#if __FreeBSD_version >= 500000
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
+#else
+#include <pci/pcireg.h>
+#include <pci/pcivar.h>
+#endif
#include <cam/cam.h>
#include <cam/cam_ccb.h>
Index: aic7xxx_osm.h
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic7xxx_osm.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic7xxx_osm.h -L sys/dev/aic7xxx/aic7xxx_osm.h -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic7xxx_osm.h
+++ sys/dev/aic7xxx/aic7xxx_osm.h
@@ -42,14 +42,20 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h> /* For device_t */
+#if __FreeBSD_version >= 500000
#include <sys/endian.h>
+#endif
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/queue.h>
+#if __FreeBSD_version < 500000
+#include <pci.h>
+#else
#define NPCI 1
+#endif
#if NPCI > 0
#define AIC_PCI_CONFIG 1
@@ -61,8 +67,13 @@
#include <sys/rman.h>
#if NPCI > 0
+#if __FreeBSD_version >= 500000
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
+#else
+#include <pci/pcireg.h>
+#include <pci/pcivar.h>
+#endif
#endif
#include <cam/cam.h>
Index: aic79xx.c
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic79xx.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic79xx.c -L sys/dev/aic7xxx/aic79xx.c -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic79xx.c
+++ sys/dev/aic7xxx/aic79xx.c
@@ -2234,6 +2234,7 @@
printerror = 0;
} else if (ahd_sent_msg(ahd, AHDMSG_1B,
MSG_BUS_DEV_RESET, TRUE)) {
+#ifdef __FreeBSD__
/*
* Don't mark the user's request for this BDR
* as completing with CAM_BDR_SENT. CAM3
@@ -2245,6 +2246,7 @@
CAM_LUN_WILDCARD, SCB_LIST_NULL,
ROLE_INITIATOR))
aic_set_transaction_status(scb, CAM_REQ_CMP);
+#endif
ahd_handle_devreset(ahd, &devinfo, CAM_LUN_WILDCARD,
CAM_BDR_SENT, "Bus Device Reset",
/*verbose_level*/0);
@@ -5223,11 +5225,23 @@
{
struct ahd_softc *ahd;
+#ifndef __FreeBSD__
+ ahd = malloc(sizeof(*ahd), M_DEVBUF, M_NOWAIT);
+ if (!ahd) {
+ printf("aic7xxx: cannot malloc softc!\n");
+ free(name, M_DEVBUF);
+ return NULL;
+ }
+#else
ahd = device_get_softc((device_t)platform_arg);
+#endif
memset(ahd, 0, sizeof(*ahd));
ahd->seep_config = malloc(sizeof(*ahd->seep_config),
M_DEVBUF, M_NOWAIT);
if (ahd->seep_config == NULL) {
+#ifndef __FreeBSD__
+ free(ahd, M_DEVBUF);
+#endif
free(name, M_DEVBUF);
return (NULL);
}
@@ -5413,6 +5427,9 @@
free(ahd->seep_config, M_DEVBUF);
if (ahd->saved_stack != NULL)
free(ahd->saved_stack, M_DEVBUF);
+#ifndef __FreeBSD__
+ free(ahd, M_DEVBUF);
+#endif
return;
}
Index: aic7xxx.c
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic7xxx.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic7xxx.c -L sys/dev/aic7xxx/aic7xxx.c -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic7xxx.c
+++ sys/dev/aic7xxx/aic7xxx.c
@@ -1280,6 +1280,7 @@
printerror = 0;
} else if (ahc_sent_msg(ahc, AHCMSG_1B,
MSG_BUS_DEV_RESET, TRUE)) {
+#ifdef __FreeBSD__
/*
* Don't mark the user's request for this BDR
* as completing with CAM_BDR_SENT. CAM3
@@ -1293,6 +1294,7 @@
ROLE_INITIATOR)) {
aic_set_transaction_status(scb, CAM_REQ_CMP);
}
+#endif
ahc_compile_devinfo(&devinfo,
initiator_role_id,
target,
@@ -3901,11 +3903,23 @@
struct ahc_softc *ahc;
int i;
+#ifndef __FreeBSD__
+ ahc = malloc(sizeof(*ahc), M_DEVBUF, M_NOWAIT);
+ if (!ahc) {
+ printf("aic7xxx: cannot malloc softc!\n");
+ free(name, M_DEVBUF);
+ return NULL;
+ }
+#else
ahc = device_get_softc((device_t)platform_arg);
+#endif
memset(ahc, 0, sizeof(*ahc));
ahc->seep_config = malloc(sizeof(*ahc->seep_config),
M_DEVBUF, M_NOWAIT);
if (ahc->seep_config == NULL) {
+#ifndef __FreeBSD__
+ free(ahc, M_DEVBUF);
+#endif
free(name, M_DEVBUF);
return (NULL);
}
@@ -4098,6 +4112,9 @@
free(ahc->name, M_DEVBUF);
if (ahc->seep_config != NULL)
free(ahc->seep_config, M_DEVBUF);
+#ifndef __FreeBSD__
+ free(ahc, M_DEVBUF);
+#endif
return;
}
Index: aic_osm_lib.h
===================================================================
RCS file: /home/cvs/src/sys/dev/aic7xxx/aic_osm_lib.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/aic7xxx/aic_osm_lib.h -L sys/dev/aic7xxx/aic_osm_lib.h -u -r1.2 -r1.3
--- sys/dev/aic7xxx/aic_osm_lib.h
+++ sys/dev/aic7xxx/aic_osm_lib.h
@@ -36,7 +36,9 @@
*/
/******************************** OS Includes *********************************/
+#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
+#endif
/*************************** Library Symbol Mapping ***************************/
#define AIC_LIB_ENTRY_CONCAT(x, prefix) prefix ## x
@@ -69,6 +71,7 @@
#define AIC_SHUTDOWN_RECOVERY AIC_CONST_ENTRY(_SHUTDOWN_RECOVERY)
/********************************* Byte Order *********************************/
+#if __FreeBSD_version >= 500000
#define aic_htobe16(x) htobe16(x)
#define aic_htobe32(x) htobe32(x)
#define aic_htobe64(x) htobe64(x)
@@ -82,6 +85,21 @@
#define aic_le16toh(x) le16toh(x)
#define aic_le32toh(x) le32toh(x)
#define aic_le64toh(x) le64toh(x)
+#else
+#define aic_htobe16(x) (x)
+#define aic_htobe32(x) (x)
+#define aic_htobe64(x) (x)
+#define aic_htole16(x) (x)
+#define aic_htole32(x) (x)
+#define aic_htole64(x) (x)
+
+#define aic_be16toh(x) (x)
+#define aic_be32toh(x) (x)
+#define aic_be64toh(x) (x)
+#define aic_le16toh(x) (x)
+#define aic_le32toh(x) (x)
+#define aic_le64toh(x) (x)
+#endif
/************************* Forward Declarations *******************************/
typedef device_t aic_dev_softc_t;
@@ -107,11 +125,17 @@
}
/****************************** Kernel Threads ********************************/
+#if __FreeBSD_version > 500005
#define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
+#else
+#define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
+ kthread_create(func, farg, proc_ptr, fmtstr, arg)
+#endif
/******************************* Bus Space/DMA ********************************/
+#if __FreeBSD_version >= 501102
#define aic_dma_tag_create(aic, parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
@@ -121,6 +145,16 @@
maxsize, nsegments, maxsegsz, flags, \
busdma_lock_mutex, &aic->platform_data->mtx, \
dma_tagp)
+#else
+#define aic_dma_tag_create(aic, parent_tag, alignment, boundary, \
+ lowaddr, highaddr, filter, filterarg, \
+ maxsize, nsegments, maxsegsz, flags, \
+ dma_tagp) \
+ bus_dma_tag_create(parent_tag, alignment, boundary, \
+ lowaddr, highaddr, filter, filterarg, \
+ maxsize, nsegments, maxsegsz, flags, \
+ dma_tagp)
+#endif
#define aic_dma_tag_destroy(aic, tag) \
bus_dma_tag_destroy(tag)
@@ -152,7 +186,11 @@
#include AIC_CORE_INCLUDE
/***************************** Timer Facilities *******************************/
+#if __FreeBSD_version >= 500000
#define aic_timer_init(timer) callout_init(timer, /*mpsafe*/1)
+#else
+#define aic_timer_init callout_init
+#endif
#define aic_timer_stop callout_stop
static __inline void aic_timer_reset(aic_timer_t *, u_int,
More information about the Midnightbsd-cvs
mailing list