From fc800962a76e0d7509647c05f71c373fef3a9352 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Mon, 23 Aug 2004 16:13:03 +0000 Subject: [PATCH] Remove pre-FreeBSD4 compability code. --- sys/dev/raid/asr/asr.c | 238 +---------------------------------------- 1 file changed, 1 insertion(+), 237 deletions(-) diff --git a/sys/dev/raid/asr/asr.c b/sys/dev/raid/asr/asr.c index 55c4071fbf..b7defe5f26 100644 --- a/sys/dev/raid/asr/asr.c +++ b/sys/dev/raid/asr/asr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/asr/asr.c,v 1.3.2.2 2001/08/23 05:21:29 scottl Exp $ */ -/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.16 2004/08/23 15:11:44 joerg Exp $ */ +/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.17 2004/08/23 16:13:03 joerg Exp $ */ /* * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000-2001 Adaptec Corporation @@ -333,12 +333,10 @@ typedef struct Asr_softc { LIST_HEAD(,ccb_hdr) ha_ccb; /* ccbs in use */ struct cam_path * ha_path[MAX_CHANNEL+1]; struct cam_sim * ha_sim[MAX_CHANNEL+1]; -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 struct resource * ha_mem_res; struct resource * ha_mes_res; struct resource * ha_irq_res; void * ha_intr; -#endif PI2O_LCT ha_LCT; /* Complete list of devices */ # define le_type IdentityTag[0] # define I2O_BSA 0x20 @@ -381,7 +379,6 @@ STATIC Asr_softc_t * Asr_softc; */ /* Externally callable routines */ -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 #define PROBE_ARGS IN device_t tag #define PROBE_RET int #define PROBE_SET() u_long id = (pci_get_device(tag)<<16)|pci_get_vendor(tag) @@ -390,16 +387,6 @@ STATIC Asr_softc_t * Asr_softc; #define ATTACH_RET int #define ATTACH_SET() int unit = device_get_unit(tag) #define ATTACH_RETURN(retval) return(retval) -#else -#define PROBE_ARGS IN pcici_t tag, IN pcidi_t id -#define PROBE_RET const char * -#define PROBE_SET() -#define PROBE_RETURN(retval) return(retval) -#define ATTACH_ARGS IN pcici_t tag, IN int unit -#define ATTACH_RET void -#define ATTACH_SET() -#define ATTACH_RETURN(retval) return -#endif /* I2O HDM interface */ STATIC PROBE_RET asr_probe (PROBE_ARGS); STATIC ATTACH_RET asr_attach (ATTACH_ARGS); @@ -448,7 +435,6 @@ STATIC void asr_poll ( * Here is the auto-probe structure used to nest our tests appropriately * during the startup phase of the operating system. */ -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 STATIC device_method_t asr_methods[] = { DEVMETHOD(device_probe, asr_probe), DEVMETHOD(device_attach, asr_attach), @@ -497,37 +483,6 @@ STATIC driver_t mode0_driver = { STATIC devclass_t mode0_devclass; DRIVER_MODULE(mode0, pci, mode0_driver, mode0_devclass, 0, 0); -#else -STATIC u_long asr_pcicount = 0; -STATIC struct pci_device asr_pcidev = { - "asr", - asr_probe, - asr_attach, - &asr_pcicount, - NULL -}; -DATA_SET (asr_pciset, asr_pcidev); - -STATIC u_long domino_pcicount = 0; -STATIC struct pci_device domino_pcidev = { - "domino", - domino_probe, - domino_attach, - &domino_pcicount, - NULL -}; -DATA_SET (domino_pciset, domino_pcidev); - -STATIC u_long mode0_pcicount = 0; -STATIC struct pci_device mode0_pcidev = { - "mode0", - mode0_probe, - mode0_attach, - &mode0_pcicount, - NULL -}; -DATA_SET (mode0_pciset, mode0_pcidev); -#endif /* * devsw for asr hba driver @@ -2483,17 +2438,12 @@ asr_hbareset( */ STATIC int asr_pci_map_mem ( -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 IN device_t tag, -#else - IN pcici_t tag, -#endif IN Asr_softc_t * sc) { int rid; u_int32_t p, l, s; -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 /* * I2O specification says we must find first *memory* mapped BAR */ @@ -2571,162 +2521,6 @@ asr_pci_map_mem ( } else { sc->ha_Fvirt = (U8 *)(sc->ha_Virt); } -#else - vm_size_t psize, poffs; - - /* - * I2O specification says we must find first *memory* mapped BAR - */ - for (rid = PCI_MAP_REG_START; - rid < (PCI_MAP_REG_START + 4 * sizeof(u_int32_t)); - rid += sizeof(u_int32_t)) { - p = pci_conf_read (tag, rid); - if ((p & 1) == 0) { - break; - } - } - if (rid >= (PCI_MAP_REG_START + 4 * sizeof(u_int32_t))) { - rid = PCI_MAP_REG_START; - } - /* - ** save old mapping, get size and type of memory - ** - ** type is in the lowest four bits. - ** If device requires 2^n bytes, the next - ** n-4 bits are read as 0. - */ - - sc->ha_Base = (void *)((p = pci_conf_read (tag, rid)) - & PCI_MAP_MEMORY_ADDRESS_MASK); - pci_conf_write (tag, rid, 0xfffffffful); - l = pci_conf_read (tag, rid); - pci_conf_write (tag, rid, p); - - /* - ** check the type - */ - - if (!((l & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_32BIT_1M - && ((u_long)sc->ha_Base & ~0xfffff) == 0) - && ((l & PCI_MAP_MEMORY_TYPE_MASK) != PCI_MAP_MEMORY_TYPE_32BIT)) { - debug_asr_printf ( - "asr_pci_map_mem failed: bad memory type=0x%x\n", - (unsigned) l); - return (0); - }; - - /* - ** get the size. - */ - - psize = -(l & PCI_MAP_MEMORY_ADDRESS_MASK); - if (psize > MAX_MAP) { - psize = MAX_MAP; - } - /* - * The 2005S Zero Channel RAID solution is not a perfect PCI - * citizen. It asks for 4MB on BAR0, and 0MB on BAR1, once - * enabled it rewrites the size of BAR0 to 2MB, sets BAR1 to - * BAR0+2MB and sets it's size to 2MB. The IOP registers are - * accessible via BAR0, the messaging registers are accessible - * via BAR1. If the subdevice code is 50 to 59 decimal. - */ - s = pci_read_config(tag, PCIR_DEVVENDOR, sizeof(s)); - if (s != 0xA5111044) { - s = pci_conf_read (tag, PCIR_SUBVEND_0) - if ((((ADPTDOMINATOR_SUB_ID_START ^ s) & 0xF000FFFF) == 0) - && (ADPTDOMINATOR_SUB_ID_START <= s) - && (s <= ADPTDOMINATOR_SUB_ID_END)) { - psize = MAX_MAP; - } - } - - if ((sc->ha_Base == (void *)NULL) - || (sc->ha_Base == (void *)PCI_MAP_MEMORY_ADDRESS_MASK)) { - debug_asr_printf ("asr_pci_map_mem: not configured by bios.\n"); - return (0); - }; - - /* - ** Truncate sc->ha_Base to page boundary. - ** (Or does pmap_mapdev the job?) - */ - - poffs = (u_long)sc->ha_Base - trunc_page ((u_long)sc->ha_Base); - sc->ha_Virt = (i2oRegs_t *)pmap_mapdev ((u_long)sc->ha_Base - poffs, - psize + poffs); - - if (sc->ha_Virt == (i2oRegs_t *)NULL) { - return (0); - } - - sc->ha_Virt = (i2oRegs_t *)((u_long)sc->ha_Virt + poffs); - if (s == 0xA5111044) { - if ((rid += sizeof(u_int32_t)) - >= (PCI_MAP_REG_START + 4 * sizeof(u_int32_t))) { - return (0); - } - - /* - ** save old mapping, get size and type of memory - ** - ** type is in the lowest four bits. - ** If device requires 2^n bytes, the next - ** n-4 bits are read as 0. - */ - - if ((((p = pci_conf_read (tag, rid)) - & PCI_MAP_MEMORY_ADDRESS_MASK) == 0L) - || ((p & PCI_MAP_MEMORY_ADDRESS_MASK) - == PCI_MAP_MEMORY_ADDRESS_MASK)) { - debug_asr_printf ("asr_pci_map_mem: not configured by bios.\n"); - } - pci_conf_write (tag, rid, 0xfffffffful); - l = pci_conf_read (tag, rid); - pci_conf_write (tag, rid, p); - p &= PCI_MAP_MEMORY_TYPE_MASK; - - /* - ** check the type - */ - - if (!((l & PCI_MAP_MEMORY_TYPE_MASK) - == PCI_MAP_MEMORY_TYPE_32BIT_1M - && (p & ~0xfffff) == 0) - && ((l & PCI_MAP_MEMORY_TYPE_MASK) - != PCI_MAP_MEMORY_TYPE_32BIT)) { - debug_asr_printf ( - "asr_pci_map_mem failed: bad memory type=0x%x\n", - (unsigned) l); - return (0); - }; - - /* - ** get the size. - */ - - psize = -(l & PCI_MAP_MEMORY_ADDRESS_MASK); - if (psize > MAX_MAP) { - psize = MAX_MAP; - } - - /* - ** Truncate p to page boundary. - ** (Or does pmap_mapdev the job?) - */ - - poffs = p - trunc_page (p); - sc->ha_Fvirt = (U8 *)pmap_mapdev (p - poffs, psize + poffs); - - if (sc->ha_Fvirt == (U8 *)NULL) { - return (0); - } - - sc->ha_Fvirt = (U8 *)((u_long)sc->ha_Fvirt + poffs); - } else { - sc->ha_Fvirt = (U8 *)(sc->ha_Virt); - } -#endif return (1); } /* asr_pci_map_mem */ @@ -2736,14 +2530,9 @@ asr_pci_map_mem ( */ STATIC int asr_pci_map_int ( -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 IN device_t tag, -#else - IN pcici_t tag, -#endif IN Asr_softc_t * sc) { -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 int rid = 0; sc->ha_irq_res = bus_alloc_resource(tag, SYS_RES_IRQ, &rid, @@ -2756,13 +2545,6 @@ asr_pci_map_int ( return (0); } sc->ha_irq = pci_read_config(tag, PCIR_INTLINE, sizeof(char)); -#else - if (!pci_map_int(tag, (pci_inthand_t *)asr_intr, - (void *)sc, &cam_imask)) { - return (0); - } - sc->ha_irq = pci_conf_read(tag, PCIR_INTLINE); -#endif return (1); } /* asr_pci_map_int */ @@ -2809,7 +2591,6 @@ asr_attach (ATTACH_ARGS) ATTACH_RETURN(ENXIO); } /* Enable if not formerly enabled */ -#if defined(__DragonFly__) || __FreeBSD_version >= 400000 pci_write_config (tag, PCIR_COMMAND, pci_read_config (tag, PCIR_COMMAND, sizeof(char)) | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN, sizeof(char)); @@ -2824,23 +2605,6 @@ asr_attach (ATTACH_ARGS) sc->ha_pciDeviceNum = (dinfo->cfg.slot << 3) | dinfo->cfg.func; } -#else - pci_conf_write (tag, PCIR_COMMAND, - pci_conf_read (tag, PCIR_COMMAND) - | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - /* Knowledge is power, responsibility is direct */ - switch (pci_mechanism) { - - case 1: - sc->ha_pciBusNum = tag.cfg1 >> 16; - sc->ha_pciDeviceNum = tag.cfg1 >> 8; - - case 2: - sc->ha_pciBusNum = tag.cfg2.forward; - sc->ha_pciDeviceNum = ((tag.cfg2.enable >> 1) & 7) - | (tag.cfg2.port >> 5); - } -#endif /* Check if the device is there? */ if ((ASR_resetIOP(sc->ha_Virt, sc->ha_Fvirt) == 0) || ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc ( -- 2.41.0