# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/09/18 12:12:06-03:00 dledford@redhat.com # [PATCH] RAID1 error handling locking fix # # OK, basic problem is that if you use mdadm to fail a device in a raid1 # array and then immediately remove that device, you can end up triggering # a race condition in the raid1 code. This only shows up on SMP systems # (and the one I have here which is a 2 physical, 4 logical processor # system shows it very easily, but for some reason nmi_watchdog didn't # ever help and the system always just locked hard and refused to do # anything, so I didn't have an oops to work from, just a hardlock). # # In the raid1 code, we keep an array of devices that are part of the # raid1 array. Each of these devices can have multiple states, but for # the most part we check the operational bit of a device before deciding # to use it. If we decide to use that device, then we grab the device # number from the array (kdev_t, aka this is the device's major/minor and # is what we are going to pass to generic_make_request in order to pass # the buffer head on to the underlying device). # # When we fail a device, we set that operational bit to 0. When we remove # a device, we also set the dev item in the struct to MKDEV(0,0). # # There is no locking whatsoever between the failing of a device (setting # the operational bit to 0) and the make_request functions in the raid1 # code. So, even though it's safe to fail a device without this locking, # before we can safely remove the device we need to know that every # possible context that might be checking that operational bit has in fact # seen the failed operational bit. If not, then we can end up setting the # dev to 0, then the other context grabs it and tries to pass that off to # generic_make_request, unnice things ensue. # # So, this patch does these things: # # 1. Whenever we are calling mark_disk_bad(), hold the # conf->device_lock # 2. Whenever we are walking the device array looking for an # operational device, always grab the conf->device_lock first and # hold it until after we have gotten not only the operational bit # but also the dev number for the device # 3. Correct an accounting problem in the superblock. If we fail a # device and it's currently counted as a spare device instead of # an active device, then we failed to decrement the superblocks # spare disk count. This accounting error is preserved across # shutdown and restart of the array, and although it doesn't oops # the kernel (the kernel will refuse to try and read beyond disk # 26 even if the spare count indicates it should, although I'm not # sure it doesn't try and write past 26 so this could be a disk # corruptor when the spare count + active counts exceeds the # amount of space available in the on disk superblock format) it # does in fact cause mdadm to segfault on trying to read the # superblock. # # So, that's the description. Testing. Well, without this patch, my test # machine dies on the following command *very* quickly: # # while true; do mdadm /dev/md0 -f /dev/sdc1 -r /dev/sdc1 -a /dev/sdc1; # sleep 1; done # # In addition, without the patch you can watch the superblock's spare # count go up with every single invocation of that command. # # With my patch, the same machine survived the above command running over # the weekend, and in addition I mounted the raid1 array and ran a # continuous loop of bonnie++ sessions to generate as much load as # possible. I've verified that the spare count stays consistent when # failing a spare device, and I've verfied that once a device is synced up # then the spare count is also decremented as the device is switched to # being accounted as an active device. # TAG: MailDone # # drivers/md/raid1.c # 2004/06/24 00:41:54-03:00 dledford@redhat.com +30 -6 # RAID1 error handling locking fix # # ChangeSet # 2004/09/18 12:05:11-03:00 vda@port.imtp.ilyichevsk.odessa.ua # [PATCH] trivial patch for 2.4: always inline __constant_* # # Of these, at least the following were intended to be always inlined: # # 12 __constant_c_and_count_memset # 6 __constant_memcpy # # Prolly #include is missing in some files, # or included too late to have desired effect. # Let's find them: # # find -name '*.o' | xargs grep -lF '__constant_c_and_count_memset' # find -name '*.o' | xargs grep -lF '__constant_memcpy' # } | sort | uniq # # Redoing this with allyesconfig revealed some more files. # # Most of them can be fixed with a single #include # in . Along the way, I fixed some non-compilation buglets. # I will submit those patches as replies now. # # include/linux/string.h # 2004/09/17 20:19:23-03:00 vda@port.imtp.ilyichevsk.odessa.ua +1 -0 # trivial patch for 2.4: always inline __constant_* # # ChangeSet # 2004/09/15 16:05:33-03:00 marcelo@logos.cnet # Merge bk://kernel.bkbits.net/jgarzik/libata-upstream-2.4 # into logos.cnet:/home/marcelo/bk/linux-2.4 # TAG: MailDone # # ChangeSet # 2004/09/15 05:46:57-07:00 davem@kernel.bkbits.net # Merge davem@nuts.davemloft.net:/disk1/BK/tg3-2.4 # into kernel.bkbits.net:/home/davem/tg3-2.4 # TAG: MailDone # # ChangeSet # 2004/09/14 22:13:08-07:00 davem@nuts.davemloft.net # [TG3]: Update driver version and reldate. # # drivers/net/tg3.c # 2004/09/14 22:13:00-07:00 davem@nuts.davemloft.net +2 -2 # [TG3]: Update driver version and reldate. # # ChangeSet # 2004/09/14 22:12:20-07:00 davem@nuts.davemloft.net # [TG3]: Recognize all onboard Sun variants, not just 5704. # # Based upon a report from Matthias Merz. # # Signed-off-by: David S. Miller # # drivers/net/tg3.h # 2004/09/14 22:12:15-07:00 davem@nuts.davemloft.net +1 -1 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # Based upon a report from Matthias Merz. # # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/09/14 22:12:15-07:00 davem@nuts.davemloft.net +14 -20 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # Based upon a report from Matthias Merz. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:06:21-07:00 michael.waychison@sun.com # [TG3]: Fix thinko in 5704 fibre hw autoneg code. # # Signed-off-by: Mike Waychison # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/09/14 22:06:15-07:00 michael.waychison@sun.com +1 -1 # [TG3]: Fix thinko in 5704 fibre hw autoneg code. # # Signed-off-by: Mike Waychison # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:40:21-04:00 ananth@broadcom.com # [libata sata_svw] race condition fix, new device support # # * address race condition WRT order of DMA-start and ATA command issue # (see code comment for more details) # # * Add support for Frodo 4/8 # # drivers/scsi/sata_svw.c # 2004/09/14 22:40:18-04:00 ananth@broadcom.com +70 -2 # [libata sata_svw] race condition fix, new device support # # * address race condition WRT order of DMA-start and ATA command issue # (see code comment for more details) # # * Add support for Frodo 4/8 # # ChangeSet # 2004/09/14 22:40:04-04:00 jgarzik@pobox.com # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/sata_nv.c # 2004/09/14 22:40:02-04:00 jgarzik@pobox.com +0 -2 # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/libata-core.c # 2004/09/14 22:40:02-04:00 jgarzik@pobox.com +13 -13 # [libata] minor comment updates, preparing for iomap merge # # Documentation/i2c/writing-clients # 2004/09/14 17:15:14-03:00 khali@linux-fr.org +15 -14 # Update Documentation/i2c/writing-clients # # ChangeSet # 2004/09/14 16:01:44-03:00 khali@linux-fr.org # [PATCH] Update Documentation/i2c/writing-clients # # Hi Marcelo, # # This is a quick update to the Documentation/i2c/writing-clients file. A # similar change was accepted by Greg KH in 2.6 and was also applied to # the i2c CVS repository. # # The changes are about i2c client driver IDs. It used to say that chip # driver writers should ask for a unique ID. It now explains that such an # ID is not required and they can go without it. The patch additionally # features CodingStyle updates. # # Fell free to apply it if you want, # thanks. # # Signed-off-by: Jean Delvare # TAG: MailDone # # ChangeSet # 2004/09/14 16:01:13-03:00 mikpe@csd.uu.se # [PATCH] matrox framebuffer driver gcc-3.4 fix # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's matrox framebuffer driver. The changes are backports from # the 2.6 kernel. The warnings don't appear for x86, but they do appear # for ppc32. # # /Mikael # # drivers/video/matrox/matroxfb_base.h # 2004/09/12 16:32:52-03:00 mikpe@csd.uu.se +4 -4 # matrox framebuffer driver gcc-3.4 fix # # ChangeSet # 2004/09/14 16:00:45-03:00 mikpe@csd.uu.se # [PATCH] PPC32 PReP residual data gcc-3.4 fix # # This patch fixes a gcc-3.4 cast-as-lvalue warning in the 2.4.28-pre3 # kernel's arch/ppc/platform/residual.c. The change is a backport from # the 2.6 kernel. # # /Mikael # # arch/ppc/platforms/residual.c # 2004/09/12 16:32:52-03:00 mikpe@csd.uu.se +1 -1 # PPC32 PReP residual data gcc-3.4 fix # # ChangeSet # 2004/09/14 16:00:25-03:00 mikpe@csd.uu.se # [PATCH] E100 driver gcc-3.4 fixes # # This patch fixes gcc-3.4 "`__packed__' attribute ignored" warnings # in the 2.4.28-pre3 kernel's E100 ethernet driver. The changes are # new since the 2.6 E100 driver is different. # # /Mikael # # drivers/net/e100/e100.h # 2004/09/11 21:06:57-03:00 mikpe@csd.uu.se +15 -15 # E100 driver gcc-3.4 fixes # # ChangeSet # 2004/09/14 15:59:43-03:00 mikpe@csd.uu.se # [PATCH] RIVA driver gcc-3.4 fix # # This patch fixes a gcc-3.4 cast-as-lvalue warning in the 2.4.28-pre3 # kernel's RIVA video driver. The change is new since the 2.6 code is # different. # # /Mikael # # drivers/video/riva/accel.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +4 -2 # RIVA driver gcc-3.4 fix # # ChangeSet # 2004/09/14 15:26:04-03:00 mikpe@csd.uu.se # [PATCH] MTD drivers gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's MTD drivers. The elan-104nc.c and sbc_gxx.c changes are # backports from the 2.6 kernel. The cfi_cmdset_0001.c and cfi_cmdset_0020.c # changes are new since the 2.6 code is different. # # /Mikael # # drivers/mtd/maps/sbc_gxx.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +1 -1 # MTD drivers gcc-3.4 fixes # # drivers/mtd/maps/elan-104nc.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +1 -1 # MTD drivers gcc-3.4 fixes # # drivers/mtd/chips/cfi_cmdset_0020.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +6 -3 # MTD drivers gcc-3.4 fixes # # drivers/mtd/chips/cfi_cmdset_0001.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +8 -4 # MTD drivers gcc-3.4 fixes # # ChangeSet # 2004/09/14 15:24:16-03:00 zaitcev@redhat.com # [PATCH] USB drivers gcc-3.4 fixes # # drivers/usb/uss720.c # 2004/09/13 00:48:13-03:00 zaitcev@redhat.com +15 -10 # [PATCH][2.4.28-pre3] USB drivers gcc-3.4 fixes # # drivers/usb/microtek.c # 2004/09/12 21:23:58-03:00 zaitcev@redhat.com +1 -1 # [PATCH][2.4.28-pre3] USB drivers gcc-3.4 fixes # # drivers/usb/hpusbscsi.c # 2004/09/12 21:23:57-03:00 zaitcev@redhat.com +1 -1 # [PATCH][2.4.28-pre3] USB drivers gcc-3.4 fixes # # drivers/usb/audio.c # 2004/09/12 21:49:35-03:00 zaitcev@redhat.com +12 -8 # [PATCH][2.4.28-pre3] USB drivers gcc-3.4 fixes # # ChangeSet # 2004/09/14 15:21:26-03:00 mikpe@csd.uu.se # [PATCH] ISDN drivers gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's ISDN drivers. With the exception of eicon_idi.c, which # doesn't seem to be in the 2.6 kernel, the changes are all backports # from the 2.6 kernel. # # /Mikael # # drivers/isdn/hysdn/hysdn_proclog.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +3 -3 # ISDN drivers gcc-3.4 fixes # # drivers/isdn/hisax/hfc_pci.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +1 -1 # ISDN drivers gcc-3.4 fixes # # drivers/isdn/hisax/avm_pci.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +4 -2 # ISDN drivers gcc-3.4 fixes # # drivers/isdn/eicon/eicon_idi.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +2 -1 # ISDN drivers gcc-3.4 fixes # # ChangeSet # 2004/09/14 15:06:34-03:00 mikpe@csd.uu.se # [PATCH] IBM PCI hotplug controller driver gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's IBM PCI hotplug controller driver. The changes are all # backports from the 2.6 kernel. # # /Mikael # # drivers/hotplug/ibmphp_hpc.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +11 -11 # IBM PCI hotplug controller driver gcc-3.4 fixes # # ChangeSet # 2004/09/14 15:01:22-03:00 mikpe@csd.uu.se # [PATCH] ATM drivers gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's ATM drivers. The changes are backports from the 2.6 kernel. # Where the 2.4 and 2.6 kernels differ (->dev_data or ->phy_data for # private data), I have chosen to preserve 2.4's behaviour. # # /Mikael # # drivers/atm/zatm.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +4 -4 # ATM drivers gcc-3.4 fixes # # drivers/atm/uPD98402.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +1 -1 # ATM drivers gcc-3.4 fixes # # drivers/atm/iphase.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +5 -5 # ATM drivers gcc-3.4 fixes # # drivers/atm/idt77105.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +2 -2 # ATM drivers gcc-3.4 fixes # # drivers/atm/he.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +2 -2 # ATM drivers gcc-3.4 fixes # # drivers/atm/fore200e.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +4 -4 # ATM drivers gcc-3.4 fixes # # drivers/atm/atmtcp.c # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +2 -2 # ATM drivers gcc-3.4 fixes # # ChangeSet # 2004/09/14 14:55:33-03:00 mikpe@csd.uu.se # [PATCH] pcmcia mem_op.h gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel caused by include/pcmcia/mem_op.h. The changes are all # backports from the 2.6 kernel. # # /Mikael # # include/pcmcia/mem_op.h # 2004/09/11 20:56:20-03:00 mikpe@csd.uu.se +12 -4 # pcmcia mem_op.h gcc-3.4 fixes # # ChangeSet # 2004/09/14 14:46:24-03:00 mikpe@csd.uu.se # [PATCH] 53c700 scsi driver gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3 # kernel's drivers/scsi/53c700.h. With the exception of NCR_700_set_SXFER(), # the changes are all backports from the 2.6 kernel. # # /Mikael # # drivers/scsi/53c700.h # 2004/09/11 21:09:09-03:00 mikpe@csd.uu.se +12 -6 # 53c700 scsi driver gcc-3.4 fixes # # ChangeSet # 2004/09/14 14:20:22-03:00 Jack_Hammer@adaptec.com # [PATCH] broken ips update # # This patch replaces the patch I submitted ( and then rescinded ) earlier # today. It fixes the compilation problem in 2.4.28 and includes the # changes recommended by Arjan on my earlier proposal for this. # # drivers/scsi/ips.h # 2004/09/14 14:19:15-03:00 Jack_Hammer@adaptec.com +4 -6 # 2.4.28-pre3: broken ips update # # ChangeSet # 2004/09/13 23:31:21-04:00 jgarzik@pobox.com # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # include/linux/libata.h # 2004/09/13 23:31:19-04:00 jgarzik@pobox.com +4 -0 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_via.c # 2004/09/13 23:31:19-04:00 jgarzik@pobox.com +13 -28 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_sis.c # 2004/09/13 23:31:19-04:00 jgarzik@pobox.com +15 -31 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_nv.c # 2004/09/13 23:31:19-04:00 jgarzik@pobox.com +15 -35 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/libata-core.c # 2004/09/13 23:31:19-04:00 jgarzik@pobox.com +109 -77 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # ChangeSet # 2004/09/13 22:35:25-04:00 jgarzik@pobox.com # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # include/linux/libata.h # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +6 -12 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_vsc.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_via.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sx4.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_svw.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +3 -3 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sis.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sil.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_promise.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_nv.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/libata-core.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +71 -30 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/ata_piix.c # 2004/09/13 22:35:23-04:00 jgarzik@pobox.com +12 -12 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # ChangeSet # 2004/09/13 22:15:08-04:00 jgarzik@pobox.com # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_vsc.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_via.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_sx4.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_svw.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_sis.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_sil.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_promise.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/sata_nv.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # drivers/scsi/ata_piix.c # 2004/09/13 22:15:06-04:00 jgarzik@pobox.com +1 -1 # [libata] resync with 2.6.x # # Only whitespace changes. # # ChangeSet # 2004/09/13 21:47:35-04:00 jgarzik@pobox.com # linux/compiler.h: dummy __iomem macro (an sparse annotation) # # include/linux/compiler.h # 2004/09/13 21:47:33-04:00 jgarzik@pobox.com +1 -0 # linux/compiler.h: dummy __iomem macro (an sparse annotation) # # ChangeSet # 2004/09/13 21:46:53-04:00 torvalds@ppc970.osdl.org # libata: initial PCI memory annotations # # include/linux/libata.h # 2004/09/13 21:46:51-04:00 torvalds@ppc970.osdl.org +9 -9 # libata: initial PCI memory annotations # # drivers/scsi/libata-core.c # 2004/09/13 21:46:51-04:00 torvalds@ppc970.osdl.org +44 -44 # libata: initial PCI memory annotations # # ChangeSet # 2004/09/13 16:09:23-07:00 martin.wilck@fujitsu-siemens.com # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # drivers/net/tg3.h # 2004/09/13 16:09:12-07:00 martin.wilck@fujitsu-siemens.com +0 -2 # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/09/13 16:09:12-07:00 martin.wilck@fujitsu-siemens.com +34 -27 # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/08/30 22:45:54-07:00 jgarzik@pobox.com # [TG3]: Kill all on-chip send BD support code. # # People can resurrect from the revision history if # we ever want to investigate using this again and # it kills tests from several fast paths. # # Signed-off-by: Jeff Garzik # Signed-off-by: David S. Miller # # drivers/net/tg3.h # 2004/08/30 22:45:41-07:00 jgarzik@pobox.com +1 -3 # [TG3]: Kill all on-chip send BD support code. # # People can resurrect from the revision history if # we ever want to investigate using this again and # it kills tests from several fast paths. # # Signed-off-by: Jeff Garzik # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/08/30 22:45:41-07:00 jgarzik@pobox.com +20 -103 # [TG3]: Kill all on-chip send BD support code. # # People can resurrect from the revision history if # we ever want to investigate using this again and # it kills tests from several fast paths. # # Signed-off-by: Jeff Garzik # Signed-off-by: David S. Miller # diff -Nru a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients --- a/Documentation/i2c/writing-clients 2004-09-18 10:04:02 -07:00 +++ b/Documentation/i2c/writing-clients 2004-09-18 10:04:02 -07:00 @@ -24,24 +24,25 @@ routines, a client structure specific information like the actual I2C address. - struct i2c_driver foo_driver - { - /* name */ "Foo version 2.3 and later driver", - /* id */ I2C_DRIVERID_FOO, - /* flags */ I2C_DF_NOTIFY, - /* attach_adapter */ &foo_attach_adapter, - /* detach_client */ &foo_detach_client, - /* command */ &foo_command, /* May be NULL */ - /* inc_use */ &foo_inc_use, /* May be NULL */ - /* dec_use */ &foo_dec_use /* May be NULL */ - } +static struct i2c_driver foo_driver = { + .name = "Foo version 2.3 driver", + .id = I2C_DRIVERID_FOO, /* from i2c-id.h, optional */ + .flags = I2C_DF_NOTIFY, + .attach_adapter = &foo_attach_adapter, + .detach_client = &foo_detach_client, + .command = &foo_command, /* may be NULL */ + .inc_use = &foo_inc_use, /* May be NULL */ + .dec_use = &foo_dec_use, /* May be NULL */ +} The name can be chosen freely, and may be upto 40 characters long. Please use something descriptive here. -The id should be a unique ID. The range 0xf000 to 0xffff is reserved for -local use, and you can use one of those until you start distributing the -driver. Before you do that, contact the i2c authors to get your own ID(s). +If used, the id should be a unique ID. The range 0xf000 to 0xffff is +reserved for local use, and you can use one of those until you start +distributing the driver, at which time you should contact the i2c authors +to get your own ID(s). Note that most of the time you don't need an ID +at all so you can just omit it. Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This means that your driver will be notified when new adapters are found. diff -Nru a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c --- a/arch/ppc/platforms/residual.c 2004-09-18 10:04:02 -07:00 +++ b/arch/ppc/platforms/residual.c 2004-09-18 10:04:02 -07:00 @@ -493,7 +493,7 @@ size=tag_small_count(pkt->S1_Pack.Tag)+1; printsmallpacket(pkt, size); } - (unsigned char *) pkt+=size; + pkt = (PnP_TAG_PACKET *)((unsigned char *) pkt + size); } while (pkt->S1_Pack.Tag != END_TAG); } diff -Nru a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c --- a/drivers/atm/atmtcp.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/atmtcp.c 2004-09-18 10:04:02 -07:00 @@ -246,7 +246,7 @@ dev_data = PRIV(atmtcp_dev); dev_data->vcc = NULL; if (dev_data->persist) return; - PRIV(atmtcp_dev) = NULL; + atmtcp_dev->dev_data = NULL; kfree(dev_data); shutdown_atm_dev(atmtcp_dev); vcc->dev_data = NULL; @@ -362,7 +362,7 @@ } dev->ci_range.vpi_bits = MAX_VPI_BITS; dev->ci_range.vci_bits = MAX_VCI_BITS; - PRIV(dev) = dev_data; + dev->dev_data = dev_data; PRIV(dev)->vcc = NULL; PRIV(dev)->persist = persist; if (result) *result = dev; diff -Nru a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c --- a/drivers/atm/fore200e.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/fore200e.c 2004-09-18 10:04:02 -07:00 @@ -1621,7 +1621,7 @@ set_bit(ATM_VF_PARTIAL,&vcc->flags); set_bit(ATM_VF_ADDR, &vcc->flags); - FORE200E_VCC(vcc) = fore200e_vcc; + vcc->dev_data = fore200e_vcc; if (fore200e_activate_vcin(fore200e, 1, vcc, vcc->qos.rxtp.max_sdu) < 0) { @@ -1630,7 +1630,7 @@ clear_bit(ATM_VF_ADDR, &vcc->flags); clear_bit(ATM_VF_PARTIAL,&vcc->flags); - FORE200E_VCC(vcc) = NULL; + vcc->dev_data = NULL; fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; @@ -1692,7 +1692,7 @@ vcc->itf = vcc->vci = vcc->vpi = 0; fore200e_vcc = FORE200E_VCC(vcc); - FORE200E_VCC(vcc) = NULL; + vcc->dev_data = NULL; spin_unlock_irqrestore(&fore200e->q_lock, flags); @@ -2739,7 +2739,7 @@ return -ENODEV; } - FORE200E_DEV(atm_dev) = fore200e; + atm_dev->dev_data = fore200e; fore200e->atm_dev = atm_dev; atm_dev->ci_range.vpi_bits = FORE200E_VPI_BITS; diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c --- a/drivers/atm/he.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/he.c 2004-09-18 10:04:02 -07:00 @@ -378,7 +378,7 @@ he_dev->pci_dev = pci_dev; he_dev->atm_dev = atm_dev; he_dev->atm_dev->dev_data = he_dev; - HE_DEV(atm_dev) = he_dev; + atm_dev->dev_data = he_dev; he_dev->number = atm_dev->number; if (he_start(atm_dev)) { he_stop(he_dev); @@ -2347,7 +2347,7 @@ init_waitqueue_head(&he_vcc->rx_waitq); init_waitqueue_head(&he_vcc->tx_waitq); - HE_VCC(vcc) = he_vcc; + vcc->dev_data = he_vcc; if (vcc->qos.txtp.traffic_class != ATM_NONE) { int pcr_goal; diff -Nru a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c --- a/drivers/atm/idt77105.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/idt77105.c 2004-09-18 10:04:02 -07:00 @@ -267,7 +267,7 @@ { unsigned long flags; - if (!(PRIV(dev) = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL))) + if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL))) return -ENOMEM; PRIV(dev)->dev = dev; spin_lock_irqsave(&idt77105_priv_lock, flags); @@ -345,7 +345,7 @@ else idt77105_all = walk->next; dev->phy = NULL; - PRIV(dev) = NULL; + dev->phy_data = NULL; kfree(walk); break; } diff -Nru a/drivers/atm/iphase.c b/drivers/atm/iphase.c --- a/drivers/atm/iphase.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/iphase.c 2004-09-18 10:04:02 -07:00 @@ -1782,7 +1782,7 @@ (iadev->tx_buf_sz - sizeof(struct cpcs_trailer))){ printk("IA: SDU size over (%d) the configured SDU size %d\n", vcc->qos.txtp.max_sdu,iadev->tx_buf_sz); - INPH_IA_VCC(vcc) = NULL; + vcc->dev_data = NULL; kfree(ia_vcc); return -EINVAL; } @@ -2707,7 +2707,7 @@ } kfree(INPH_IA_VCC(vcc)); ia_vcc = NULL; - INPH_IA_VCC(vcc) = NULL; + vcc->dev_data = NULL; clear_bit(ATM_VF_ADDR,&vcc->flags); return; } @@ -2720,7 +2720,7 @@ if (!test_bit(ATM_VF_PARTIAL,&vcc->flags)) { IF_EVENT(printk("ia: not partially allocated resources\n");) - INPH_IA_VCC(vcc) = NULL; + vcc->dev_data = NULL; } iadev = INPH_IA_DEV(vcc->dev); error = atm_find_ci(vcc, &vpi, &vci); @@ -2744,7 +2744,7 @@ /* Device dependent initialization */ ia_vcc = kmalloc(sizeof(*ia_vcc), GFP_KERNEL); if (!ia_vcc) return -ENOMEM; - INPH_IA_VCC(vcc) = ia_vcc; + vcc->dev_data = ia_vcc; if ((error = open_rx(vcc))) { @@ -3256,7 +3256,7 @@ ret = -ENOMEM; goto err_out_disable_dev; } - INPH_IA_DEV(dev) = iadev; + dev->dev_data = iadev; IF_INIT(printk(DEV_LABEL "registered at (itf :%d)\n", dev->number);) IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev, iadev->LineRate);) diff -Nru a/drivers/atm/uPD98402.c b/drivers/atm/uPD98402.c --- a/drivers/atm/uPD98402.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/uPD98402.c 2004-09-18 10:04:02 -07:00 @@ -212,7 +212,7 @@ static int uPD98402_start(struct atm_dev *dev) { DPRINTK("phy_start\n"); - if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL))) + if (!(dev->phy_data = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL))) return -ENOMEM; memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats)); (void) GET(PCR); /* clear performance events */ diff -Nru a/drivers/atm/zatm.c b/drivers/atm/zatm.c --- a/drivers/atm/zatm.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/atm/zatm.c 2004-09-18 10:04:02 -07:00 @@ -1565,7 +1565,7 @@ DPRINTK("zatm_close: done waiting\n"); /* deallocate memory */ kfree(ZATM_VCC(vcc)); - ZATM_VCC(vcc) = NULL; + vcc->dev_data = NULL; clear_bit(ATM_VF_ADDR,&vcc->flags); } @@ -1578,7 +1578,7 @@ DPRINTK(">zatm_open\n"); zatm_dev = ZATM_DEV(vcc->dev); - if (!test_bit(ATM_VF_PARTIAL,&vcc->flags)) ZATM_VCC(vcc) = NULL; + if (!test_bit(ATM_VF_PARTIAL,&vcc->flags)) vcc->dev_data = NULL; error = atm_find_ci(vcc,&vpi,&vci); if (error) return error; vcc->vpi = vpi; @@ -1594,7 +1594,7 @@ clear_bit(ATM_VF_ADDR,&vcc->flags); return -ENOMEM; } - ZATM_VCC(vcc) = zatm_vcc; + vcc->dev_data = zatm_vcc; ZATM_VCC(vcc)->tx_chan = 0; /* for zatm_close after open_rx */ if ((error = open_rx_first(vcc))) { zatm_close(vcc); @@ -1828,7 +1828,7 @@ dev = atm_dev_register(DEV_LABEL,&ops,-1,NULL); if (!dev) break; zatm_dev->pci_dev = pci_dev; - ZATM_DEV(dev) = zatm_dev; + dev->dev_data = zatm_dev; zatm_dev->copper = type; if (zatm_init(dev) || zatm_start(dev)) { atm_dev_deregister(dev); diff -Nru a/drivers/hotplug/ibmphp_hpc.c b/drivers/hotplug/ibmphp_hpc.c --- a/drivers/hotplug/ibmphp_hpc.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/hotplug/ibmphp_hpc.c 2004-09-18 10:04:02 -07:00 @@ -184,14 +184,14 @@ } wpg_data = swab32 (data); // swap data before writing - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMOSUP_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- // READ - step 2 : clear the message buffer data = 0x00000000; wpg_data = swab32 (data); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- @@ -199,7 +199,7 @@ // 2020 : [20] OR operation at [20] offset 0x20 data = WPG_I2CMCNTL_STARTOP_MASK; wpg_data = swab32 (data); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET + (ulong) WPG_I2C_OR; + wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- @@ -207,7 +207,7 @@ i = CMD_COMPLETE_TOUT_SEC; while (i) { long_delay (1 * HZ / 100); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; wpg_data = readl (wpg_addr); data = swab32 (wpg_data); if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) @@ -223,7 +223,7 @@ i = CMD_COMPLETE_TOUT_SEC; while (i) { long_delay (1 * HZ / 100); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CSTAT_OFFSET; + wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; wpg_data = readl (wpg_addr); data = swab32 (wpg_data); if (HPC_I2CSTATUS_CHECK (data)) @@ -237,7 +237,7 @@ //-------------------------------------------------------------------- // READ - step 6 : get DATA - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; wpg_data = readl (wpg_addr); data = swab32 (wpg_data); @@ -295,14 +295,14 @@ } wpg_data = swab32 (data); // swap data before writing - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMOSUP_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- // WRITE - step 2 : clear the message buffer data = 0x00000000 | (ulong) cmd; wpg_data = swab32 (data); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMBUFL_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- @@ -310,7 +310,7 @@ // 2020 : [20] OR operation at [20] offset 0x20 data = WPG_I2CMCNTL_STARTOP_MASK; wpg_data = swab32 (data); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET + (ulong) WPG_I2C_OR; + wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; writel (wpg_data, wpg_addr); //-------------------------------------------------------------------- @@ -318,7 +318,7 @@ i = CMD_COMPLETE_TOUT_SEC; while (i) { long_delay (1 * HZ / 100); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CMCNTL_OFFSET; + wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; wpg_data = readl (wpg_addr); data = swab32 (wpg_data); if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) @@ -335,7 +335,7 @@ i = CMD_COMPLETE_TOUT_SEC; while (i) { long_delay (1 * HZ / 100); - (ulong) wpg_addr = (ulong) WPGBbar + (ulong) WPG_I2CSTAT_OFFSET; + wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; wpg_data = readl (wpg_addr); data = swab32 (wpg_data); if (HPC_I2CSTATUS_CHECK (data)) diff -Nru a/drivers/isdn/eicon/eicon_idi.c b/drivers/isdn/eicon/eicon_idi.c --- a/drivers/isdn/eicon/eicon_idi.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/isdn/eicon/eicon_idi.c 2004-09-18 10:04:02 -07:00 @@ -2054,7 +2054,8 @@ OutBuf.Len++; } else { *OutBuf.Next++ = 0; - *((__u16 *) OutBuf.Next)++ = (__u16) LineBuf.Len; + *(__u16 *) OutBuf.Next = (__u16) LineBuf.Len; + OutBuf.Next += sizeof(__u16); OutBuf.Len += 3; } memcpy(OutBuf.Next, LineBuf.Data, LineBuf.Len); diff -Nru a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c --- a/drivers/isdn/hisax/avm_pci.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/isdn/hisax/avm_pci.c 2004-09-18 10:04:02 -07:00 @@ -291,7 +291,8 @@ debugl1(cs, "hdlc_empty_fifo: incoming packet too large"); return; } - ptr = (u_int *) p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx; + p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx; + ptr = (u_int *)p; bcs->hw.hdlc.rcvidx += count; if (cs->subtyp == AVM_FRITZ_PCI) { outl(idx, cs->hw.avm.cfg_reg + 4); @@ -352,7 +353,8 @@ } if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) debugl1(cs, "hdlc_fill_fifo %d/%ld", count, bcs->tx_skb->len); - ptr = (u_int *) p = bcs->tx_skb->data; + p = bcs->tx_skb->data; + ptr = (u_int *)p; skb_pull(bcs->tx_skb, count); bcs->tx_cnt -= count; bcs->hw.hdlc.count += count; diff -Nru a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c --- a/drivers/isdn/hisax/hfc_pci.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/isdn/hisax/hfc_pci.c 2004-09-18 10:04:02 -07:00 @@ -1746,7 +1746,7 @@ printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); return 0; } - (ulong) cs->hw.hfcpci.fifos = + cs->hw.hfcpci.fifos = (void *) (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000; pcibios_write_config_dword(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, 0x80, diff -Nru a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c --- a/drivers/isdn/hysdn/hysdn_proclog.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/isdn/hysdn/hysdn_proclog.c 2004-09-18 10:04:02 -07:00 @@ -235,7 +235,7 @@ return (0); inf->usage_cnt--; /* new usage count */ - (struct log_data **) file->private_data = &inf->next; /* next structure */ + file->private_data = &inf->next; /* next structure */ if ((len = strlen(inf->log_start)) <= count) { if (copy_to_user(buf, inf->log_start, len)) return -EFAULT; @@ -278,9 +278,9 @@ cli(); pd->if_used++; if (pd->log_head) - (struct log_data **) filep->private_data = &(pd->log_tail->next); + filep->private_data = &(pd->log_tail->next); else - (struct log_data **) filep->private_data = &(pd->log_head); + filep->private_data = &(pd->log_head); restore_flags(flags); } else { /* simultaneous read/write access forbidden ! */ unlock_kernel(); diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c --- a/drivers/md/raid1.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/md/raid1.c 2004-09-18 10:04:02 -07:00 @@ -325,18 +325,22 @@ { raid1_conf_t *conf = mddev_to_conf(mddev); int i, disks = MD_SB_DISKS; + unsigned long flags; /* * Later we do read balancing on the read side * now we use the first available disk. */ + md_spin_lock_irqsave(&conf->device_lock, flags); for (i = 0; i < disks; i++) { if (conf->mirrors[i].operational) { *rdev = conf->mirrors[i].dev; + md_spin_unlock_irqrestore(&conf->device_lock, flags); return (0); } } + md_spin_unlock_irqrestore(&conf->device_lock, flags); printk (KERN_ERR "raid1_map(): huh, no more operational devices?\n"); return (-1); @@ -592,6 +596,7 @@ int disks = MD_SB_DISKS; int i, sum_bhs = 0; struct mirror_info *mirror; + kdev_t dev; if (!buffer_locked(bh)) BUG(); @@ -635,13 +640,16 @@ /* * read balancing logic: */ + spin_lock_irq(&conf->device_lock); mirror = conf->mirrors + raid1_read_balance(conf, bh); + dev = mirror->dev; + spin_unlock_irq(&conf->device_lock); bh_req = &r1_bh->bh_req; memcpy(bh_req, bh, sizeof(*bh)); bh_req->b_blocknr = bh->b_rsector; - bh_req->b_dev = mirror->dev; - bh_req->b_rdev = mirror->dev; + bh_req->b_dev = dev; + bh_req->b_rdev = dev; /* bh_req->b_rsector = bh->n_rsector; */ bh_req->b_end_io = raid1_end_request; bh_req->b_private = r1_bh; @@ -654,6 +662,7 @@ */ bhl = raid1_alloc_bh(conf, conf->raid_disks); + spin_lock_irq(&conf->device_lock); for (i = 0; i < disks; i++) { struct buffer_head *mbh; if (!conf->mirrors[i].operational) @@ -702,6 +711,7 @@ r1_bh->mirror_bh_list = mbh; sum_bhs++; } + spin_unlock_irq(&conf->device_lock); if (bhl) raid1_free_bh(conf,bhl); if (!sum_bhs) { /* Gag - all mirrors non-operational.. */ @@ -771,6 +781,8 @@ mark_disk_inactive(sb->disks+mirror->number); if (!mirror->write_only) sb->active_disks--; + else + sb->spare_disks--; sb->working_disks--; sb->failed_disks++; mddev->sb_dirty = 1; @@ -787,6 +799,7 @@ struct mirror_info * mirrors = conf->mirrors; int disks = MD_SB_DISKS; int i; + unsigned long flags; /* Find the drive. * If it is not operational, then we have already marked it as dead @@ -808,7 +821,9 @@ return 1; } + md_spin_lock_irqsave(&conf->device_lock, flags); mark_disk_bad(mddev, i); + md_spin_unlock_irqrestore(&conf->device_lock, flags); return 0; } @@ -876,7 +891,6 @@ mdp_disk_t *failed_desc, *spare_desc, *added_desc; mdk_rdev_t *spare_rdev, *failed_rdev; - print_raid1_conf(conf); switch (state) { case DISKOP_SPARE_ACTIVE: @@ -887,6 +901,10 @@ md_spin_lock_irq(&conf->device_lock); /* + * Need the conf lock when printing out state else we get BUG()s + */ + print_raid1_conf(conf); + /* * find the disk ... */ switch (state) { @@ -1136,12 +1154,12 @@ goto abort; } abort: + print_raid1_conf(conf); md_spin_unlock_irq(&conf->device_lock); if (state == DISKOP_SPARE_ACTIVE || state == DISKOP_SPARE_INACTIVE) /* should move to "END_REBUILD" when such exists */ raid1_shrink_buffers(conf); - print_raid1_conf(conf); return err; } @@ -1196,6 +1214,7 @@ conf = mddev_to_conf(mddev); bhl = raid1_alloc_bh(conf, conf->raid_disks); /* don't really need this many */ + spin_lock_irq(&conf->device_lock); for (i = 0; i < disks ; i++) { if (!conf->mirrors[i].operational) continue; @@ -1238,6 +1257,7 @@ sum_bhs++; } + spin_unlock_irq(&conf->device_lock); md_atomic_set(&r1_bh->remaining, sum_bhs); if (bhl) raid1_free_bh(conf, bhl); mbh = r1_bh->mirror_bh_list; @@ -1373,6 +1393,7 @@ int disk; int block_nr; int buffs; + kdev_t dev; if (!sector_nr) { /* we want enough buffers to hold twice the window of 128*/ @@ -1426,6 +1447,7 @@ * could dedicate one to rebuild and others to * service read requests .. */ + spin_lock_irq(&conf->device_lock); disk = conf->last_used; /* make sure disk is operational */ while (!conf->mirrors[disk].operational) { @@ -1437,6 +1459,8 @@ conf->last_used = disk; mirror = conf->mirrors+conf->last_used; + dev = mirror->dev; + spin_unlock_irq(&conf->device_lock); r1_bh = raid1_alloc_buf (conf); r1_bh->master_bh = NULL; @@ -1453,8 +1477,8 @@ } bh->b_size = bsize; bh->b_list = BUF_LOCKED; - bh->b_dev = mirror->dev; - bh->b_rdev = mirror->dev; + bh->b_dev = dev; + bh->b_rdev = dev; bh->b_state = (1<b_page) BUG(); diff -Nru a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c --- a/drivers/mtd/chips/cfi_cmdset_0001.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/mtd/chips/cfi_cmdset_0001.c 2004-09-18 10:04:02 -07:00 @@ -1201,13 +1201,17 @@ /* Write data */ for (z = 0; z < len; z += CFIDEV_BUSWIDTH) { if (cfi_buswidth_is_1()) { - map->write8 (map, *((__u8*)buf)++, adr+z); + map->write8 (map, *(__u8*)buf, adr+z); + buf += sizeof(__u8); } else if (cfi_buswidth_is_2()) { - map->write16 (map, *((__u16*)buf)++, adr+z); + map->write16 (map, *(__u16*)buf, adr+z); + buf += sizeof(__u16); } else if (cfi_buswidth_is_4()) { - map->write32 (map, *((__u32*)buf)++, adr+z); + map->write32 (map, *(__u32*)buf, adr+z); + buf += sizeof(__u32); } else if (cfi_buswidth_is_8()) { - map->write64 (map, *((__u64*)buf)++, adr+z); + map->write64 (map, *(__u64*)buf, adr+z); + buf += sizeof(__u64); } else { DISABLE_VPP(map); ret = -EINVAL; diff -Nru a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c --- a/drivers/mtd/chips/cfi_cmdset_0020.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/mtd/chips/cfi_cmdset_0020.c 2004-09-18 10:04:02 -07:00 @@ -540,11 +540,14 @@ /* Write data */ for (z = 0; z < len; z += CFIDEV_BUSWIDTH) { if (cfi_buswidth_is_1()) { - map->write8 (map, *((__u8*)buf)++, adr+z); + map->write8 (map, *(__u8*)buf, adr+z); + buf += sizeof(__u8); } else if (cfi_buswidth_is_2()) { - map->write16 (map, *((__u16*)buf)++, adr+z); + map->write16 (map, *(__u16*)buf, adr+z); + buf += sizeof(__u16); } else if (cfi_buswidth_is_4()) { - map->write32 (map, *((__u32*)buf)++, adr+z); + map->write32 (map, *(__u32*)buf, adr+z); + buf += sizeof(__u32); } else { DISABLE_VPP(map); return -EINVAL; diff -Nru a/drivers/mtd/maps/elan-104nc.c b/drivers/mtd/maps/elan-104nc.c --- a/drivers/mtd/maps/elan-104nc.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/mtd/maps/elan-104nc.c 2004-09-18 10:04:02 -07:00 @@ -147,7 +147,7 @@ elan_104nc_page(map, from); memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen); spin_unlock(&elan_104nc_spin); - (__u8*)to += thislen; + to += thislen; from += thislen; len -= thislen; } diff -Nru a/drivers/mtd/maps/sbc_gxx.c b/drivers/mtd/maps/sbc_gxx.c --- a/drivers/mtd/maps/sbc_gxx.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/mtd/maps/sbc_gxx.c 2004-09-18 10:04:02 -07:00 @@ -155,7 +155,7 @@ sbc_gxx_page(map, from); memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen); spin_unlock(&sbc_gxx_spin); - (__u8*)to += thislen; + to += thislen; from += thislen; len -= thislen; } diff -Nru a/drivers/net/e100/e100.h b/drivers/net/e100/e100.h --- a/drivers/net/e100/e100.h 2004-09-18 10:04:02 -07:00 +++ b/drivers/net/e100/e100.h 2004-09-18 10:04:02 -07:00 @@ -501,7 +501,7 @@ u8 scb_fc_thld; /* Flow Control threshold */ u8 scb_fc_xon_xoff; /* Flow Control XON/XOFF values */ u8 scb_pmdr; /* Power Mgmt. Driver Reg */ -} d101_scb_ext __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) d101_scb_ext; /* Changed for 82559 enhancement */ typedef struct _d101m_scb_ext_t { @@ -517,7 +517,7 @@ u32 scb_function_event_mask; /* Cardbus Function Mask */ u32 scb_function_present_state; /* Cardbus Function state */ u32 scb_force_event; /* Cardbus Force Event */ -} d101m_scb_ext __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) d101m_scb_ext; /* Changed for 82550 enhancement */ typedef struct _d102_scb_ext_t { @@ -536,7 +536,7 @@ u32 scb_function_event_mask; /* Cardbus Function Mask */ u32 scb_function_present_state; /* Cardbus Function state */ u32 scb_force_event; /* Cardbus Force Event */ -} d102_scb_ext __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) d102_scb_ext; /* * 82557 status control block. this will be memory mapped & will hang of the @@ -558,7 +558,7 @@ d101m_scb_ext d101m_scb; /* 82559 specific fields */ d102_scb_ext d102_scb; } scb_ext; -} scb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) scb_t; /* Self test * This is used to dump results of the self test @@ -566,7 +566,7 @@ typedef struct _self_test_t { u32 st_sign; /* Self Test Signature */ u32 st_result; /* Self Test Results */ -} self_test_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) self_test_t; /* * Statistical Counters @@ -649,39 +649,39 @@ u16 cb_status; /* Command Block Status */ u16 cb_cmd; /* Command Block Command */ u32 cb_lnk_ptr; /* Link To Next CB */ -} cb_header_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) cb_header_t; //* Individual Address Command Block (IA_CB)*/ typedef struct _ia_cb_t { cb_header_t ia_cb_hdr; u8 ia_addr[ETH_ALEN]; -} ia_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) ia_cb_t; /* Configure Command Block (CONFIG_CB)*/ typedef struct _config_cb_t { cb_header_t cfg_cbhdr; u8 cfg_byte[CB_CFIG_BYTE_COUNT + CB_CFIG_D102_BYTE_COUNT]; -} config_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) config_cb_t; /* MultiCast Command Block (MULTICAST_CB)*/ typedef struct _multicast_cb_t { cb_header_t mc_cbhdr; u16 mc_count; /* Number of multicast addresses */ u8 mc_addr[(ETH_ALEN * MAX_MULTICAST_ADDRS)]; -} mltcst_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) mltcst_cb_t; #define UCODE_MAX_DWORDS 134 /* Load Microcode Command Block (LOAD_UCODE_CB)*/ typedef struct _load_ucode_cb_t { cb_header_t load_ucode_cbhdr; u32 ucode_dword[UCODE_MAX_DWORDS]; -} load_ucode_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) load_ucode_cb_t; /* Load Programmable Filter Data*/ typedef struct _filter_cb_t { cb_header_t filter_cb_hdr; u32 filter_data[MAX_FILTER]; -} filter_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) filter_cb_t; /* NON_TRANSMIT_CB -- Generic Non-Transmit Command Block */ @@ -693,7 +693,7 @@ mltcst_cb_t multicast; filter_cb_t filter; } ntcb; -} nxmit_cb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) nxmit_cb_t; /*Block for queuing for postponed execution of the non-transmit commands*/ typedef struct _nxmit_cb_entry_t { @@ -724,7 +724,7 @@ u32 tbd_buf_addr; /* Physical Transmit Buffer Address */ u16 tbd_buf_cnt; /* Actual Count Of Bytes */ u16 padd; -} tbd_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) tbd_t; /* d102 specific fields */ typedef struct _tcb_ipcb_t { @@ -743,7 +743,7 @@ u16 tbd_zero_size; } tbd_sec_size; u16 total_tcp_payload; -} tcb_ipcb_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) tcb_ipcb_t; #define E100_TBD_ARRAY_SIZE (2+MAX_SKB_FRAGS) @@ -806,7 +806,7 @@ u32 rbd_rcb_addr; /* Receive Buffer Address */ u16 rbd_sz; /* Receive Buffer Size */ u16 rbd_filler1; -} rbd_t __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) rbd_t; /* * This structure is used to maintain a FIFO access to a resource that is diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c --- a/drivers/net/tg3.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/net/tg3.c 2004-09-18 10:04:02 -07:00 @@ -59,8 +59,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.9" -#define DRV_MODULE_RELDATE "August 30, 2004" +#define DRV_MODULE_VERSION "3.10" +#define DRV_MODULE_RELDATE "September 14, 2004" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -1121,29 +1121,33 @@ u32 old_rx_mode = tp->rx_mode; u32 old_tx_mode = tp->tx_mode; - if (local_adv & ADVERTISE_PAUSE_CAP) { - if (local_adv & ADVERTISE_PAUSE_ASYM) { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); - else if (remote_adv & LPA_PAUSE_ASYM) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE); - } else { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); + if (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) { + if (local_adv & ADVERTISE_PAUSE_CAP) { + if (local_adv & ADVERTISE_PAUSE_ASYM) { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + else if (remote_adv & LPA_PAUSE_ASYM) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE); + } else { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + } + } else if (local_adv & ADVERTISE_PAUSE_ASYM) { + if ((remote_adv & LPA_PAUSE_CAP) && + (remote_adv & LPA_PAUSE_ASYM)) + new_tg3_flags |= TG3_FLAG_TX_PAUSE; } - } else if (local_adv & ADVERTISE_PAUSE_ASYM) { - if ((remote_adv & LPA_PAUSE_CAP) && - (remote_adv & LPA_PAUSE_ASYM)) - new_tg3_flags |= TG3_FLAG_TX_PAUSE; - } - tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); - tp->tg3_flags |= new_tg3_flags; + tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); + tp->tg3_flags |= new_tg3_flags; + } else { + new_tg3_flags = tp->tg3_flags; + } if (new_tg3_flags & TG3_FLAG_RX_PAUSE) tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; @@ -2167,7 +2171,7 @@ else val |= 0x4010880; - tw32_f(MAC_SERDES_CFG, serdes_cfg); + tw32_f(MAC_SERDES_CFG, val); } tw32_f(SG_DIG_CTRL, 0x01388400); @@ -2954,6 +2958,7 @@ dma_addr_t mapping, int len, u32 flags, u32 mss_and_is_end) { + struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry]; int is_end = (mss_and_is_end & 0x1); u32 mss = (mss_and_is_end >> 1); u32 vlan_tag = 0; @@ -2965,35 +2970,11 @@ flags &= 0xffff; } vlan_tag |= (mss << TXD_MSS_SHIFT); - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) { - struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry]; - - txd->addr_hi = ((u64) mapping >> 32); - txd->addr_lo = ((u64) mapping & 0xffffffff); - txd->len_flags = (len << TXD_LEN_SHIFT) | flags; - txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; - } else { - struct tx_ring_info *txr = &tp->tx_buffers[entry]; - unsigned long txd; - txd = (tp->regs + - NIC_SRAM_WIN_BASE + - NIC_SRAM_TX_BUFFER_DESC); - txd += (entry * TXD_SIZE); - - /* Save some PIOs */ - if (sizeof(dma_addr_t) != sizeof(u32)) - writel(((u64) mapping >> 32), - txd + TXD_ADDR + TG3_64BIT_REG_HIGH); - - writel(((u64) mapping & 0xffffffff), - txd + TXD_ADDR + TG3_64BIT_REG_LOW); - writel(len << TXD_LEN_SHIFT | flags, txd + TXD_LEN_FLAGS); - if (txr->prev_vlan_tag != vlan_tag) { - writel(vlan_tag << TXD_VLAN_TAG_SHIFT, txd + TXD_VLAN_TAG); - txr->prev_vlan_tag = vlan_tag; - } - } + txd->addr_hi = ((u64) mapping >> 32); + txd->addr_lo = ((u64) mapping & 0xffffffff); + txd->len_flags = (len << TXD_LEN_SHIFT) | flags; + txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; } static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) @@ -3182,19 +3163,7 @@ } /* Packets are ready, update Tx producer idx local and on card. */ - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) { - tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + - TG3_64BIT_REG_LOW), entry); - } else { - /* First, make sure tg3 sees last descriptor fully - * in SRAM. - */ - if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) - tr32(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW); - - tw32_tx_mbox((MAILBOX_SNDNIC_PROD_IDX_0 + - TG3_64BIT_REG_LOW), entry); - } + tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); tp->tx_prod = entry; if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1)) @@ -3333,7 +3302,6 @@ */ static void tg3_init_rings(struct tg3 *tp) { - unsigned long start, end; u32 i; /* Free up all the SKBs. */ @@ -3343,21 +3311,7 @@ memset(tp->rx_std, 0, TG3_RX_RING_BYTES); memset(tp->rx_jumbo, 0, TG3_RX_JUMBO_RING_BYTES); memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); - - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) { - memset(tp->tx_ring, 0, TG3_TX_RING_BYTES); - } else { - start = (tp->regs + - NIC_SRAM_WIN_BASE + - NIC_SRAM_TX_BUFFER_DESC); - end = start + TG3_TX_RING_BYTES; - while (start < end) { - writel(0, start); - start += 4; - } - for (i = 0; i < TG3_TX_RING_SIZE; i++) - tp->tx_buffers[i].prev_vlan_tag = 0; - } + memset(tp->tx_ring, 0, TG3_TX_RING_BYTES); /* Initialize invariants of the rings, we only set this * stuff once. This works because the card does not @@ -3488,15 +3442,10 @@ if (!tp->rx_rcb) goto err_out; - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) { - tp->tx_ring = pci_alloc_consistent(tp->pdev, TG3_TX_RING_BYTES, - &tp->tx_desc_mapping); - if (!tp->tx_ring) - goto err_out; - } else { - tp->tx_ring = NULL; - tp->tx_desc_mapping = 0; - } + tp->tx_ring = pci_alloc_consistent(tp->pdev, TG3_TX_RING_BYTES, + &tp->tx_desc_mapping); + if (!tp->tx_ring) + goto err_out; tp->hw_status = pci_alloc_consistent(tp->pdev, TG3_HW_STATUS_SIZE, @@ -3747,7 +3696,7 @@ u32 flags_save; int i; - if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) tg3_nvram_lock(tp); /* @@ -3878,7 +3827,7 @@ udelay(10); } if (i >= 100000 && - !(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { + !(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " "firmware will not restart magic=%08x\n", tp->dev->name, val); @@ -4960,10 +4909,7 @@ GRC_MODE_4X_NIC_SEND_RINGS | GRC_MODE_NO_TX_PHDR_CSUM | GRC_MODE_NO_RX_PHDR_CSUM); - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) - tp->grc_mode |= GRC_MODE_HOST_SENDBDS; - else - tp->grc_mode |= GRC_MODE_4X_NIC_SEND_RINGS; + tp->grc_mode |= GRC_MODE_HOST_SENDBDS; if (tp->tg3_flags & TG3_FLAG_NO_TX_PSEUDO_CSUM) tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM; if (tp->tg3_flags & TG3_FLAG_NO_RX_PSEUDO_CSUM) @@ -5116,18 +5062,11 @@ tw32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); tw32_tx_mbox(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0); - if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) { - tg3_set_bdinfo(tp, NIC_SRAM_SEND_RCB, - tp->tx_desc_mapping, - (TG3_TX_RING_SIZE << - BDINFO_FLAGS_MAXLEN_SHIFT), - NIC_SRAM_TX_BUFFER_DESC); - } else { - tg3_set_bdinfo(tp, NIC_SRAM_SEND_RCB, - 0, - BDINFO_FLAGS_DISABLED, - NIC_SRAM_TX_BUFFER_DESC); - } + tg3_set_bdinfo(tp, NIC_SRAM_SEND_RCB, + tp->tx_desc_mapping, + (TG3_TX_RING_SIZE << + BDINFO_FLAGS_MAXLEN_SHIFT), + NIC_SRAM_TX_BUFFER_DESC); /* There is only one receive return ring on 5705/5750, no need * to explicitly disable the others. @@ -5673,8 +5612,8 @@ spin_unlock(&tp->tx_lock); spin_unlock_irq(&tp->lock); - /* If you move this call, make sure TG3_FLAG_HOST_TXDS in - * tp->tg3_flags is accurate at that new place. + /* The placement of this call is tied + * to the setup and use of Host TX descriptors. */ err = tg3_alloc_consistent(tp); if (err) @@ -6642,8 +6581,8 @@ struct tg3 *tp = netdev_priv(dev); epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; - epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0; - epause->tx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_TX) != 0; + epause->rx_pause = (tp->tg3_flags & TG3_FLAG_RX_PAUSE) != 0; + epause->tx_pause = (tp->tg3_flags & TG3_FLAG_TX_PAUSE) != 0; } static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) @@ -6658,13 +6597,13 @@ else tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG; if (epause->rx_pause) - tp->tg3_flags |= TG3_FLAG_PAUSE_RX; + tp->tg3_flags |= TG3_FLAG_RX_PAUSE; else - tp->tg3_flags &= ~TG3_FLAG_PAUSE_RX; + tp->tg3_flags &= ~TG3_FLAG_RX_PAUSE; if (epause->tx_pause) - tp->tg3_flags |= TG3_FLAG_PAUSE_TX; + tp->tg3_flags |= TG3_FLAG_TX_PAUSE; else - tp->tg3_flags &= ~TG3_FLAG_PAUSE_TX; + tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE; tg3_halt(tp); tg3_init_hw(tp); tg3_netif_start(tp); @@ -6856,7 +6795,7 @@ { int j; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) return; tw32_f(GRC_EEPROM_ADDR, @@ -6943,8 +6882,8 @@ { int i; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) { - printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 5704\n"); + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n"); return -EINVAL; } @@ -7279,11 +7218,11 @@ unsigned char vpd_data[256]; int i; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) { + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { /* Sun decided not to put the necessary bits in the * NVRAM of their onboard tg3 parts :( */ - strcpy(tp->board_part_number, "Sun 5704"); + strcpy(tp->board_part_number, "Sun 570X"); return; } @@ -7344,27 +7283,21 @@ } #ifdef CONFIG_SPARC64 -static int __devinit tg3_is_sun_5704(struct tg3 *tp) +static int __devinit tg3_is_sun_570X(struct tg3 *tp) { struct pci_dev *pdev = tp->pdev; struct pcidev_cookie *pcp = pdev->sysdata; if (pcp != NULL) { int node = pcp->prom_node; - u32 venid, devid; + u32 venid; int err; err = prom_getproperty(node, "subsystem-vendor-id", (char *) &venid, sizeof(venid)); if (err == 0 || err == -1) return 0; - err = prom_getproperty(node, "subsystem-id", - (char *) &devid, sizeof(devid)); - if (err == 0 || err == -1) - return 0; - - if (venid == PCI_VENDOR_ID_SUN && - devid == PCI_DEVICE_ID_TIGON3_5704) + if (venid == PCI_VENDOR_ID_SUN) return 1; } return 0; @@ -7381,8 +7314,8 @@ int err; #ifdef CONFIG_SPARC64 - if (tg3_is_sun_5704(tp)) - tp->tg3_flags2 |= TG3_FLG2_SUN_5704; + if (tg3_is_sun_570X(tp)) + tp->tg3_flags2 |= TG3_FLG2_SUN_570X; #endif /* If we have an AMD 762 or Intel ICH/ICH0/ICH2 chipset, write @@ -7627,23 +7560,6 @@ udelay(50); tg3_nvram_init(tp); - /* Always use host TXDs, it performs better in particular - * with multi-frag packets. The tests below are kept here - * as documentation should we change this decision again - * in the future. - */ - tp->tg3_flags |= TG3_FLAG_HOST_TXDS; - -#if 0 - /* Determine if TX descriptors will reside in - * main memory or in the chip SRAM. - */ - if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0 || - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 || - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) - tp->tg3_flags |= TG3_FLAG_HOST_TXDS; -#endif - grc_misc_cfg = tr32(GRC_MISC_CFG); grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; @@ -7781,7 +7697,7 @@ mac_offset = 0x7c; if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && - !(tp->tg3_flags & TG3_FLG2_SUN_5704)) { + !(tp->tg3_flags & TG3_FLG2_SUN_570X)) { if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) mac_offset = 0xcc; if (tg3_nvram_lock(tp)) @@ -7803,7 +7719,7 @@ dev->dev_addr[5] = (lo >> 0) & 0xff; } /* Next, try NVRAM. */ - else if (!(tp->tg3_flags & TG3_FLG2_SUN_5704) && + else if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && !tg3_nvram_read(tp, mac_offset + 0, &hi) && !tg3_nvram_read(tp, mac_offset + 4, &lo)) { dev->dev_addr[0] = ((hi >> 16) & 0xff); @@ -8408,6 +8324,9 @@ if (tp->tg3_flags2 & TG3_FLG2_IS_5788) dev->features &= ~NETIF_F_HIGHDMA; + /* flow control autonegotiation is default behavior */ + tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; + err = register_netdev(dev); if (err) { printk(KERN_ERR PFX "Cannot register net device, " @@ -8439,11 +8358,10 @@ printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); - printk(KERN_INFO "%s: HostTXDS[%d] RXcsums[%d] LinkChgREG[%d] " + printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] " "MIirq[%d] ASF[%d] Split[%d] WireSpeed[%d] " "TSOcap[%d] \n", dev->name, - (tp->tg3_flags & TG3_FLAG_HOST_TXDS) != 0, (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, diff -Nru a/drivers/net/tg3.h b/drivers/net/tg3.h --- a/drivers/net/tg3.h 2004-09-18 10:04:02 -07:00 +++ b/drivers/net/tg3.h 2004-09-18 10:04:02 -07:00 @@ -1549,7 +1549,7 @@ * exist only in the cards on-chip SRAM. All 16 send bds are under * the same mode, they may not be configured individually. * - * The mode we use is controlled by TG3_FLAG_HOST_TXDS in tp->tg3_flags. + * This driver always uses host memory TX descriptors. * * To use host memory TX descriptors: * 1) Set GRC_MODE_HOST_SENDBDS in GRC_MODE register. @@ -2005,7 +2005,6 @@ spinlock_t tx_lock; - /* TX descs are only used if TG3_FLAG_HOST_TXDS is set. */ struct tg3_tx_buffer_desc *tx_ring; struct tx_ring_info *tx_buffers; dma_addr_t tx_desc_mapping; @@ -2041,7 +2040,6 @@ u32 rx_offset; u32 tg3_flags; -#define TG3_FLAG_HOST_TXDS 0x00000001 #define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 #define TG3_FLAG_RX_CHECKSUMS 0x00000004 #define TG3_FLAG_USE_LINKCHG_REG 0x00000008 @@ -2071,15 +2069,13 @@ #define TG3_FLAG_JUMBO_ENABLE 0x00800000 #define TG3_FLAG_10_100_ONLY 0x01000000 #define TG3_FLAG_PAUSE_AUTONEG 0x02000000 -#define TG3_FLAG_PAUSE_RX 0x04000000 -#define TG3_FLAG_PAUSE_TX 0x08000000 #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 #define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 #define TG3_FLAG_SPLIT_MODE 0x40000000 #define TG3_FLAG_INIT_COMPLETE 0x80000000 u32 tg3_flags2; #define TG3_FLG2_RESTART_TIMER 0x00000001 -#define TG3_FLG2_SUN_5704 0x00000002 +#define TG3_FLG2_SUN_570X 0x00000002 #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 #define TG3_FLG2_IS_5788 0x00000008 #define TG3_FLG2_MAX_RXPEND_64 0x00000010 diff -Nru a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h --- a/drivers/scsi/53c700.h 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/53c700.h 2004-09-18 10:04:02 -07:00 @@ -109,8 +109,11 @@ static inline void NCR_700_set_SXFER(Scsi_Device *SDp, __u8 sxfer) { - ((unsigned long)SDp->hostdata) &= 0xffffff00; - ((unsigned long)SDp->hostdata) |= sxfer & 0xff; + long l = (long)SDp->hostdata; + + l &= 0xffffff00; + l |= sxfer & 0xff; + SDp->hostdata = (void *)l; } static inline __u8 NCR_700_get_SXFER(Scsi_Device *SDp) { @@ -119,8 +122,11 @@ static inline void NCR_700_set_depth(Scsi_Device *SDp, __u8 depth) { - ((unsigned long)SDp->hostdata) &= 0xffff00ff; - ((unsigned long)SDp->hostdata) |= (0xff00 & (depth << 8)); + long l = (long)SDp->hostdata; + + l &= 0xffff00ff; + l |= 0xff00 & (depth << 8); + SDp->hostdata = (void *)l; } static inline __u8 NCR_700_get_depth(Scsi_Device *SDp) @@ -140,12 +146,12 @@ static inline void NCR_700_set_flag(Scsi_Device *SDp, __u32 flag) { - ((unsigned long)SDp->hostdata) |= (flag & 0xffff0000); + SDp->hostdata = (void *)((long)SDp->hostdata | (flag & 0xffff0000)); } static inline void NCR_700_clear_flag(Scsi_Device *SDp, __u32 flag) { - ((unsigned long)SDp->hostdata) &= ~(flag & 0xffff0000); + SDp->hostdata = (void *)((long)SDp->hostdata & ~(flag & 0xffff0000)); } /* These represent the Nexus hashing functions. A Nexus in SCSI terms diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c --- a/drivers/scsi/ata_piix.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/ata_piix.c 2004-09-18 10:04:02 -07:00 @@ -106,7 +106,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -126,15 +126,15 @@ .set_piomode = piix_set_piomode, .set_dmamode = piix_set_dmamode, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, .phy_reset = piix_pata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, @@ -150,15 +150,15 @@ static struct ata_port_operations piix_sata_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, .phy_reset = piix_sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, diff -Nru a/drivers/scsi/ips.h b/drivers/scsi/ips.h --- a/drivers/scsi/ips.h 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/ips.h 2004-09-18 10:04:02 -07:00 @@ -95,15 +95,13 @@ #define scsi_set_pci_device(sh,dev) (0) #endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - - #ifndef irqreturn_t - typedef void irqreturn_t; - #endif - + #ifndef IRQ_NONE + typedef void irqreturn_t; #define IRQ_NONE #define IRQ_HANDLED #define IRQ_RETVAL(x) + #endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT) #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT) #define IPS_ADD_HOST(shost,device) diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c --- a/drivers/scsi/libata-core.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/libata-core.c 2004-09-18 10:04:02 -07:00 @@ -90,17 +90,17 @@ } /** - * ata_tf_load_pio - send taskfile registers to host controller + * ata_tf_load - send taskfile registers to host controller * @ap: Port to which output is sent * @tf: ATA taskfile register set * - * Outputs ATA taskfile to standard ATA host controller using PIO. + * Outputs ATA taskfile to standard ATA host controller. * * LOCKING: * Inherited from caller. */ -void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; @@ -158,23 +158,23 @@ * Inherited from caller. */ -void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; if (tf->ctl != ap->last_ctl) { - writeb(tf->ctl, ap->ioaddr.ctl_addr); + writeb(tf->ctl, (void __iomem *) ap->ioaddr.ctl_addr); ap->last_ctl = tf->ctl; ata_wait_idle(ap); } if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { - writeb(tf->hob_feature, (void *) ioaddr->feature_addr); - writeb(tf->hob_nsect, (void *) ioaddr->nsect_addr); - writeb(tf->hob_lbal, (void *) ioaddr->lbal_addr); - writeb(tf->hob_lbam, (void *) ioaddr->lbam_addr); - writeb(tf->hob_lbah, (void *) ioaddr->lbah_addr); + writeb(tf->hob_feature, (void __iomem *) ioaddr->feature_addr); + writeb(tf->hob_nsect, (void __iomem *) ioaddr->nsect_addr); + writeb(tf->hob_lbal, (void __iomem *) ioaddr->lbal_addr); + writeb(tf->hob_lbam, (void __iomem *) ioaddr->lbam_addr); + writeb(tf->hob_lbah, (void __iomem *) ioaddr->lbah_addr); VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", tf->hob_feature, tf->hob_nsect, @@ -184,11 +184,11 @@ } if (is_addr) { - writeb(tf->feature, (void *) ioaddr->feature_addr); - writeb(tf->nsect, (void *) ioaddr->nsect_addr); - writeb(tf->lbal, (void *) ioaddr->lbal_addr); - writeb(tf->lbam, (void *) ioaddr->lbam_addr); - writeb(tf->lbah, (void *) ioaddr->lbah_addr); + writeb(tf->feature, (void __iomem *) ioaddr->feature_addr); + writeb(tf->nsect, (void __iomem *) ioaddr->nsect_addr); + writeb(tf->lbal, (void __iomem *) ioaddr->lbal_addr); + writeb(tf->lbam, (void __iomem *) ioaddr->lbam_addr); + writeb(tf->lbah, (void __iomem *) ioaddr->lbah_addr); VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", tf->feature, tf->nsect, @@ -198,26 +198,34 @@ } if (tf->flags & ATA_TFLAG_DEVICE) { - writeb(tf->device, (void *) ioaddr->device_addr); + writeb(tf->device, (void __iomem *) ioaddr->device_addr); VPRINTK("device 0x%X\n", tf->device); } ata_wait_idle(ap); } +void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_tf_load_mmio(ap, tf); + else + ata_tf_load_pio(ap, tf); +} + /** - * ata_exec_command_pio - issue ATA command to host controller + * ata_exec_command - issue ATA command to host controller * @ap: port to which command is being issued * @tf: ATA taskfile register set * - * Issues PIO write to ATA command register, with proper + * Issues PIO/MMIO write to ATA command register, with proper * synchronization with interrupt handler / other threads. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) { DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); @@ -238,20 +246,28 @@ * spin_lock_irqsave(host_set lock) */ -void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) { DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); - writeb(tf->command, (void *) ap->ioaddr.command_addr); + writeb(tf->command, (void __iomem *) ap->ioaddr.command_addr); ata_pause(ap); } +void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_exec_command_mmio(ap, tf); + else + ata_exec_command_pio(ap, tf); +} + /** * ata_exec - issue ATA command to host controller * @ap: port to which command is being issued * @tf: ATA taskfile register set * - * Issues PIO write to ATA command register, with proper + * Issues PIO/MMIO write to ATA command register, with proper * synchronization with interrupt handler / other threads. * * LOCKING: @@ -274,7 +290,7 @@ * @tf: ATA taskfile register set * * Issues ATA taskfile register set to ATA host controller, - * via PIO, with proper synchronization with interrupt handler and + * with proper synchronization with interrupt handler and * other threads. * * LOCKING: @@ -294,7 +310,7 @@ * @tf: ATA taskfile register set * * Issues ATA taskfile register set to ATA host controller, - * via PIO, with proper synchronization with interrupt handler and + * with proper synchronization with interrupt handler and * other threads. * * LOCKING: @@ -308,18 +324,18 @@ } /** - * ata_tf_read_pio - input device's ATA taskfile shadow registers + * ata_tf_read - input device's ATA taskfile shadow registers * @ap: Port from which input is read * @tf: ATA taskfile register set for storing input * * Reads ATA taskfile registers for currently-selected device - * into @tf via PIO. + * into @tf. * * LOCKING: * Inherited from caller. */ -void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; @@ -351,38 +367,46 @@ * Inherited from caller. */ -void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; - tf->nsect = readb((void *)ioaddr->nsect_addr); - tf->lbal = readb((void *)ioaddr->lbal_addr); - tf->lbam = readb((void *)ioaddr->lbam_addr); - tf->lbah = readb((void *)ioaddr->lbah_addr); - tf->device = readb((void *)ioaddr->device_addr); + tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); + tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); + tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); + tf->lbah = readb((void __iomem *)ioaddr->lbah_addr); + tf->device = readb((void __iomem *)ioaddr->device_addr); if (tf->flags & ATA_TFLAG_LBA48) { - writeb(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr); - tf->hob_feature = readb((void *)ioaddr->error_addr); - tf->hob_nsect = readb((void *)ioaddr->nsect_addr); - tf->hob_lbal = readb((void *)ioaddr->lbal_addr); - tf->hob_lbam = readb((void *)ioaddr->lbam_addr); - tf->hob_lbah = readb((void *)ioaddr->lbah_addr); + writeb(tf->ctl | ATA_HOB, (void __iomem *) ap->ioaddr.ctl_addr); + tf->hob_feature = readb((void __iomem *)ioaddr->error_addr); + tf->hob_nsect = readb((void __iomem *)ioaddr->nsect_addr); + tf->hob_lbal = readb((void __iomem *)ioaddr->lbal_addr); + tf->hob_lbam = readb((void __iomem *)ioaddr->lbam_addr); + tf->hob_lbah = readb((void __iomem *)ioaddr->lbah_addr); } } +void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_tf_read_mmio(ap, tf); + else + ata_tf_read_pio(ap, tf); +} + /** - * ata_check_status_pio - Read device status reg & clear interrupt + * ata_check_status - Read device status reg & clear interrupt * @ap: port where the device is * * Reads ATA taskfile status register for currently-selected device - * via PIO and return it's value. This also clears pending interrupts + * and return it's value. This also clears pending interrupts * from this device * * LOCKING: * Inherited from caller. */ -u8 ata_check_status_pio(struct ata_port *ap) +static u8 ata_check_status_pio(struct ata_port *ap) { return inb(ap->ioaddr.status_addr); } @@ -398,9 +422,16 @@ * LOCKING: * Inherited from caller. */ -u8 ata_check_status_mmio(struct ata_port *ap) +static u8 ata_check_status_mmio(struct ata_port *ap) { - return readb((void *) ap->ioaddr.status_addr); + return readb((void __iomem *) ap->ioaddr.status_addr); +} + +u8 ata_check_status(struct ata_port *ap) +{ + if (ap->flags & ATA_FLAG_MMIO) + return ata_check_status_mmio(ap); + return ata_check_status_pio(ap); } /** @@ -674,17 +705,17 @@ __ata_dev_select(ap, device); - writeb(0x55, (void *) ioaddr->nsect_addr); - writeb(0xaa, (void *) ioaddr->lbal_addr); + writeb(0x55, (void __iomem *) ioaddr->nsect_addr); + writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); - writeb(0xaa, (void *) ioaddr->nsect_addr); - writeb(0x55, (void *) ioaddr->lbal_addr); + writeb(0xaa, (void __iomem *) ioaddr->nsect_addr); + writeb(0x55, (void __iomem *) ioaddr->lbal_addr); - writeb(0x55, (void *) ioaddr->nsect_addr); - writeb(0xaa, (void *) ioaddr->lbal_addr); + writeb(0x55, (void __iomem *) ioaddr->nsect_addr); + writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); - nsect = readb((void *) ioaddr->nsect_addr); - lbal = readb((void *) ioaddr->lbal_addr); + nsect = readb((void __iomem *) ioaddr->nsect_addr); + lbal = readb((void __iomem *) ioaddr->lbal_addr); if ((nsect == 0x55) && (lbal == 0xaa)) return 1; /* we found a device */ @@ -693,7 +724,7 @@ } /** - * ata_dev_devchk - PATA device presence detection + * ata_devchk - PATA device presence detection * @ap: ATA channel to examine * @device: Device to examine (starting at zero) * @@ -705,7 +736,7 @@ * caller. */ -static unsigned int ata_dev_devchk(struct ata_port *ap, +static unsigned int ata_devchk(struct ata_port *ap, unsigned int device) { if (ap->flags & ATA_FLAG_MMIO) @@ -863,7 +894,7 @@ tmp = ATA_DEVICE_OBS | ATA_DEV1; if (ap->flags & ATA_FLAG_MMIO) { - writeb(tmp, (void *) ap->ioaddr.device_addr); + writeb(tmp, (void __iomem *) ap->ioaddr.device_addr); } else { outb(tmp, ap->ioaddr.device_addr); } @@ -1461,13 +1492,13 @@ unsigned int dev1 = devmask & (1 << 1); unsigned long timeout; - /* if device 0 was found in ata_dev_devchk, wait for its + /* if device 0 was found in ata_devchk, wait for its * BSY bit to clear */ if (dev0) ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); - /* if device 1 was found in ata_dev_devchk, wait for + /* if device 1 was found in ata_devchk, wait for * register access, then wait for BSY to clear */ timeout = jiffies + ATA_TMOUT_BOOT; @@ -1476,8 +1507,8 @@ __ata_dev_select(ap, 1); if (ap->flags & ATA_FLAG_MMIO) { - nsect = readb((void *) ioaddr->nsect_addr); - lbal = readb((void *) ioaddr->lbal_addr); + nsect = readb((void __iomem *) ioaddr->nsect_addr); + lbal = readb((void __iomem *) ioaddr->lbal_addr); } else { nsect = inb(ioaddr->nsect_addr); lbal = inb(ioaddr->lbal_addr); @@ -1541,11 +1572,11 @@ /* software reset. causes dev0 to be selected */ if (ap->flags & ATA_FLAG_MMIO) { - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); udelay(20); /* FIXME: flush */ - writeb(ap->ctl | ATA_SRST, ioaddr->ctl_addr); + writeb(ap->ctl | ATA_SRST, (void __iomem *) ioaddr->ctl_addr); udelay(20); /* FIXME: flush */ - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); } else { outb(ap->ctl, ioaddr->ctl_addr); udelay(10); @@ -1602,9 +1633,9 @@ if (ap->flags & ATA_FLAG_SATA_RESET) dev0 = 1; else { - dev0 = ata_dev_devchk(ap, 0); + dev0 = ata_devchk(ap, 0); if (slave_possible) - dev1 = ata_dev_devchk(ap, 1); + dev1 = ata_devchk(ap, 1); } if (dev0) @@ -1621,7 +1652,7 @@ else if ((ap->flags & ATA_FLAG_SATA_RESET) == 0) { /* set up device control */ if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); rc = ata_bus_edd(ap); @@ -1654,7 +1685,7 @@ if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { /* set up device control for ATA_FLAG_SATA_RESET */ if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); } @@ -2101,7 +2132,7 @@ unsigned int i; unsigned int words = buflen >> 1; u16 *buf16 = (u16 *) buf; - void *mmio = (void *)ap->ioaddr.data_addr; + void __iomem *mmio = (void __iomem *)ap->ioaddr.data_addr; if (write_data) { for (i = 0; i < words; i++) @@ -2182,7 +2213,7 @@ /* shall be cleared to zero, indicating xfer of data */ if (ireason & (1 << 0)) goto err_out; - + /* make sure transfer direction matches expected */ i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0; if (do_write != i_write) @@ -2198,7 +2229,7 @@ for (i = 0; i < (bytes >> 9); i++) ata_pio_sector(qc); - + return; err_out: @@ -2627,19 +2658,19 @@ } /** - * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO) + * ata_bmdma_setup - Set up PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) +static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); u8 dmactl; - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; /* load PRD table addr. */ mb(); /* make sure PRD table writes are visible to controller */ @@ -2657,17 +2688,17 @@ } /** - * ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO) + * ata_bmdma_start - Start a PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) +static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; u8 dmactl; /* start host DMA transaction */ @@ -2695,7 +2726,7 @@ * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) +static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); @@ -2723,7 +2754,7 @@ * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_start_pio (struct ata_queued_cmd *qc) +static void ata_bmdma_start_pio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; u8 dmactl; @@ -2734,6 +2765,22 @@ ap->ioaddr.bmdma_addr + ATA_DMA_CMD); } +void ata_bmdma_start(struct ata_queued_cmd *qc) +{ + if (qc->ap->flags & ATA_FLAG_MMIO) + ata_bmdma_start_mmio(qc); + else + ata_bmdma_start_pio(qc); +} + +void ata_bmdma_setup(struct ata_queued_cmd *qc) +{ + if (qc->ap->flags & ATA_FLAG_MMIO) + ata_bmdma_setup_mmio(qc); + else + ata_bmdma_setup_pio(qc); +} + void ata_bmdma_irq_clear(struct ata_port *ap) { ata_bmdma_ack_irq(ap); @@ -3244,6 +3291,95 @@ ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD; } +static struct ata_probe_ent * +ata_probe_ent_alloc(int n, struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent; + int i; + + probe_ent = kmalloc(sizeof(*probe_ent) * n, GFP_KERNEL); + if (!probe_ent) { + printk(KERN_ERR DRV_NAME "(%s): out of memory\n", + pci_name(pdev)); + return NULL; + } + + memset(probe_ent, 0, sizeof(*probe_ent) * n); + + for (i = 0; i < n; i++) { + INIT_LIST_HEAD(&probe_ent[i].node); + probe_ent[i].pdev = pdev; + + probe_ent[i].sht = port[i]->sht; + probe_ent[i].host_flags = port[i]->host_flags; + probe_ent[i].pio_mask = port[i]->pio_mask; + probe_ent[i].mwdma_mask = port[i]->mwdma_mask; + probe_ent[i].udma_mask = port[i]->udma_mask; + probe_ent[i].port_ops = port[i]->port_ops; + + } + + return probe_ent; +} + +struct ata_probe_ent * +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent = ata_probe_ent_alloc(1, pdev, port); + if (!probe_ent) + return NULL; + + probe_ent->n_ports = 2; + probe_ent->irq = pdev->irq; + probe_ent->irq_flags = SA_SHIRQ; + + probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); + probe_ent->port[0].altstatus_addr = + probe_ent->port[0].ctl_addr = + pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; + probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); + + probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); + probe_ent->port[1].altstatus_addr = + probe_ent->port[1].ctl_addr = + pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; + probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; + + ata_std_ports(&probe_ent->port[0]); + ata_std_ports(&probe_ent->port[1]); + + return probe_ent; +} + +struct ata_probe_ent * +ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent = ata_probe_ent_alloc(2, pdev, port); + if (!probe_ent) + return NULL; + + probe_ent[0].n_ports = 1; + probe_ent[0].irq = 14; + + probe_ent[1].n_ports = 1; + probe_ent[1].irq = 15; + + probe_ent[0].port[0].cmd_addr = 0x1f0; + probe_ent[0].port[0].altstatus_addr = + probe_ent[0].port[0].ctl_addr = 0x3f6; + probe_ent[0].port[0].bmdma_addr = pci_resource_start(pdev, 4); + + probe_ent[1].port[0].cmd_addr = 0x170; + probe_ent[1].port[0].altstatus_addr = + probe_ent[1].port[0].ctl_addr = 0x376; + probe_ent[1].port[0].bmdma_addr = pci_resource_start(pdev, 4)+8; + + ata_std_ports(&probe_ent[0].port[0]); + ata_std_ports(&probe_ent[1].port[0]); + + return probe_ent; +} + /** * ata_pci_init_one - Initialize/register PCI IDE host controller * @pdev: Controller to be initialized @@ -3261,20 +3397,20 @@ unsigned int n_ports) { struct ata_probe_ent *probe_ent, *probe_ent2 = NULL; - struct ata_port_info *port0, *port1; + struct ata_port_info *port[2]; u8 tmp8, mask; unsigned int legacy_mode = 0; int rc; DPRINTK("ENTER\n"); - port0 = port_info[0]; + port[0] = port_info[0]; if (n_ports > 1) - port1 = port_info[1]; + port[1] = port_info[1]; else - port1 = port0; + port[1] = port[0]; - if ((port0->host_flags & ATA_FLAG_NO_LEGACY) == 0) { + if ((port[0]->host_flags & ATA_FLAG_NO_LEGACY) == 0) { /* TODO: support transitioning to native mode? */ pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); mask = (1 << 2) | (1 << 0); @@ -3318,89 +3454,32 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + if (legacy_mode) { + probe_ent = ata_pci_init_legacy_mode(pdev, port); + if (probe_ent) + probe_ent2 = &probe_ent[1]; + } else + probe_ent = ata_pci_init_native_mode(pdev, port); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - probe_ent->pdev = pdev; - INIT_LIST_HEAD(&probe_ent->node); - - if (legacy_mode) { - probe_ent2 = kmalloc(sizeof(*probe_ent), GFP_KERNEL); - if (!probe_ent2) { - rc = -ENOMEM; - goto err_out_free_ent; - } - - memset(probe_ent2, 0, sizeof(*probe_ent)); - probe_ent2->pdev = pdev; - INIT_LIST_HEAD(&probe_ent2->node); - } - - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); - probe_ent->sht = port0->sht; - probe_ent->host_flags = port0->host_flags; - probe_ent->pio_mask = port0->pio_mask; - probe_ent->mwdma_mask = port0->mwdma_mask; - probe_ent->udma_mask = port0->udma_mask; - probe_ent->port_ops = port0->port_ops; - - if (legacy_mode) { - probe_ent->port[0].cmd_addr = 0x1f0; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x3f6; - probe_ent->n_ports = 1; - probe_ent->irq = 14; - ata_std_ports(&probe_ent->port[0]); - - probe_ent2->port[0].cmd_addr = 0x170; - probe_ent2->port[0].altstatus_addr = - probe_ent2->port[0].ctl_addr = 0x376; - probe_ent2->port[0].bmdma_addr = pci_resource_start(pdev, 4)+8; - probe_ent2->n_ports = 1; - probe_ent2->irq = 15; - ata_std_ports(&probe_ent2->port[0]); - - probe_ent2->sht = port1->sht; - probe_ent2->host_flags = port1->host_flags; - probe_ent2->pio_mask = port1->pio_mask; - probe_ent2->mwdma_mask = port1->mwdma_mask; - probe_ent2->udma_mask = port1->udma_mask; - probe_ent2->port_ops = port1->port_ops; - } else { - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; - - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - } - pci_set_master(pdev); spin_lock(&ata_module_lock); if (legacy_mode) { + int free = 0; if (legacy_mode & (1 << 0)) list_add_tail(&probe_ent->node, &ata_probe_list); else - kfree(probe_ent); + free++; if (legacy_mode & (1 << 1)) list_add_tail(&probe_ent2->node, &ata_probe_list); else - kfree(probe_ent2); + free++; + if (free > 1) + kfree(probe_ent); } else { list_add_tail(&probe_ent->node, &ata_probe_list); } @@ -3408,8 +3487,6 @@ return 0; -err_out_free_ent: - kfree(probe_ent); err_out_regions: if (legacy_mode & (1 << 0)) release_region(0x1f0, 8); @@ -3567,24 +3644,20 @@ EXPORT_SYMBOL_GPL(ata_qc_complete); EXPORT_SYMBOL_GPL(ata_qc_issue_prot); EXPORT_SYMBOL_GPL(ata_eng_timeout); -EXPORT_SYMBOL_GPL(ata_tf_load_pio); -EXPORT_SYMBOL_GPL(ata_tf_load_mmio); -EXPORT_SYMBOL_GPL(ata_tf_read_pio); -EXPORT_SYMBOL_GPL(ata_tf_read_mmio); +EXPORT_SYMBOL_GPL(ata_tf_load); +EXPORT_SYMBOL_GPL(ata_tf_read); EXPORT_SYMBOL_GPL(ata_tf_to_fis); EXPORT_SYMBOL_GPL(ata_tf_from_fis); -EXPORT_SYMBOL_GPL(ata_check_status_pio); -EXPORT_SYMBOL_GPL(ata_check_status_mmio); -EXPORT_SYMBOL_GPL(ata_exec_command_pio); -EXPORT_SYMBOL_GPL(ata_exec_command_mmio); +EXPORT_SYMBOL_GPL(ata_pci_init_legacy_mode); +EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); +EXPORT_SYMBOL_GPL(ata_check_status); +EXPORT_SYMBOL_GPL(ata_exec_command); EXPORT_SYMBOL_GPL(ata_port_start); EXPORT_SYMBOL_GPL(ata_port_stop); EXPORT_SYMBOL_GPL(ata_interrupt); EXPORT_SYMBOL_GPL(ata_qc_prep); -EXPORT_SYMBOL_GPL(ata_bmdma_setup_pio); -EXPORT_SYMBOL_GPL(ata_bmdma_start_pio); -EXPORT_SYMBOL_GPL(ata_bmdma_setup_mmio); -EXPORT_SYMBOL_GPL(ata_bmdma_start_mmio); +EXPORT_SYMBOL_GPL(ata_bmdma_setup); +EXPORT_SYMBOL_GPL(ata_bmdma_start); EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); EXPORT_SYMBOL_GPL(ata_port_probe); EXPORT_SYMBOL_GPL(sata_phy_reset); diff -Nru a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c --- a/drivers/scsi/sata_nv.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_nv.c 2004-09-18 10:04:02 -07:00 @@ -50,8 +50,6 @@ #define NV_PIO_MASK 0x1f #define NV_MWDMA_MASK 0x07 #define NV_UDMA_MASK 0x7f -#define NV_PORT0_BMDMA_REG_OFFSET 0x00 -#define NV_PORT1_BMDMA_REG_OFFSET 0x08 #define NV_PORT0_SCR_REG_OFFSET 0x00 #define NV_PORT1_SCR_REG_OFFSET 0x40 @@ -184,7 +182,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -201,13 +199,13 @@ static struct ata_port_operations nv_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .exec_command = ata_exec_command_pio, - .check_status = ata_check_status_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .exec_command = ata_exec_command, + .check_status = ata_check_status, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -220,6 +218,18 @@ .host_stop = nv_host_stop, }; +static struct ata_port_info nv_port_info = { + .sht = &nv_sht, + .host_flags = ATA_FLAG_SATA | + ATA_FLAG_SATA_RESET | + ATA_FLAG_SRST | + ATA_FLAG_NO_LEGACY, + .pio_mask = NV_PIO_MASK, + .mwdma_mask = NV_MWDMA_MASK, + .udma_mask = NV_UDMA_MASK, + .port_ops = &nv_ops, +}; + MODULE_AUTHOR("NVIDIA"); MODULE_DESCRIPTION("low-level driver for NVIDIA nForce SATA controller"); MODULE_LICENSE("GPL"); @@ -300,6 +310,7 @@ { static int printed_version = 0; struct nv_host *host; + struct ata_port_info *ppi; struct ata_probe_ent *probe_ent = NULL; int rc; @@ -318,7 +329,8 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &nv_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; @@ -331,40 +343,6 @@ } host->host_desc = &nv_device_tbl[ent->driver_data]; - - memset(probe_ent, 0, sizeof(*probe_ent)); - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->pdev = pdev; - probe_ent->sht = &nv_sht; - probe_ent->host_flags = ATA_FLAG_SATA | - ATA_FLAG_SATA_RESET | - ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY; - - probe_ent->port_ops = &nv_ops; - probe_ent->n_ports = NV_PORTS; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->pio_mask = NV_PIO_MASK; - probe_ent->mwdma_mask = NV_MWDMA_MASK; - probe_ent->udma_mask = NV_UDMA_MASK; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = - pci_resource_start(pdev, 4) | NV_PORT0_BMDMA_REG_OFFSET; - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = - pci_resource_start(pdev, 4) | NV_PORT1_BMDMA_REG_OFFSET; probe_ent->private_data = host; diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c --- a/drivers/scsi/sata_promise.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_promise.c 2004-09-18 10:04:02 -07:00 @@ -91,7 +91,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -109,8 +109,8 @@ static struct ata_port_operations pdc_sata_ops = { .port_disable = ata_port_disable, .tf_load = pdc_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, + .tf_read = ata_tf_read, + .check_status = ata_check_status, .exec_command = pdc_exec_command_mmio, .phy_reset = pdc_phy_reset, .qc_prep = pdc_qc_prep, @@ -470,7 +470,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_tf_load_mmio(ap, tf); + ata_tf_load(ap, tf); } @@ -478,7 +478,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_exec_command_mmio(ap, tf); + ata_exec_command(ap, tf); } diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c --- a/drivers/scsi/sata_sil.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_sil.c 2004-09-18 10:04:02 -07:00 @@ -108,7 +108,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -126,14 +126,14 @@ static struct ata_port_operations sil_ops = { .port_disable = ata_port_disable, .dev_config = sil_dev_config, - .tf_load = ata_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, - .exec_command = ata_exec_command_mmio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, .phy_reset = sata_phy_reset, .post_set_mode = sil_post_set_mode, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, diff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c --- a/drivers/scsi/sata_sis.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_sis.c 2004-09-18 10:04:02 -07:00 @@ -78,7 +78,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -95,13 +95,13 @@ static struct ata_port_operations sis_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -113,6 +113,16 @@ .port_stop = ata_port_stop, }; +static struct ata_port_info sis_port_info = { + .sht = &sis_sht, + .host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET | + ATA_FLAG_NO_LEGACY, + .pio_mask = 0x1f, + .mwdma_mask = 0x7, + .udma_mask = 0x7f, + .port_ops = &sis_ops, +}; + MODULE_AUTHOR("Uwe Koziolek"); MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); @@ -186,6 +196,7 @@ struct ata_probe_ent *probe_ent = NULL; int rc; u32 genctl; + struct ata_port_info *ppi; rc = pci_enable_device(pdev); if (rc) @@ -199,20 +210,13 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &sis_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - probe_ent->pdev = pdev; - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->sht = &sis_sht; - probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET | - ATA_FLAG_NO_LEGACY; - /* check and see if the SCRs are in IO space or PCI cfg space */ pci_read_config_dword(pdev, SIS_GENCTL, &genctl); if ((genctl & GENCTL_IOMAPPED_SCR) == 0) @@ -229,32 +233,12 @@ probe_ent->host_flags |= SIS_FLAG_CFGSCR; } - probe_ent->pio_mask = 0x1f; - probe_ent->mwdma_mask = 0x7; - probe_ent->udma_mask = 0x7f; - probe_ent->port_ops = &sis_ops; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); - if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) + if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) { probe_ent->port[0].scr_addr = pci_resource_start(pdev, SIS_SCR_PCI_BAR); - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; - if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) probe_ent->port[1].scr_addr = pci_resource_start(pdev, SIS_SCR_PCI_BAR) + 64; - - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + } pci_set_master(pdev); pci_enable_intx(pdev); diff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c --- a/drivers/scsi/sata_svw.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_svw.c 2004-09-18 10:04:02 -07:00 @@ -148,7 +148,73 @@ } } +/** + * k2_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO) + * @qc: Info associated with this ATA transaction. + * + * LOCKING: + * spin_lock_irqsave(host_set lock) + */ + +void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) +{ + struct ata_port *ap = qc->ap; + unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); + u8 dmactl; + void *mmio = (void *) ap->ioaddr.bmdma_addr; + /* load PRD table addr. */ + mb(); /* make sure PRD table writes are visible to controller */ + writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); + + /* specify data direction, triple-check start bit is clear */ + dmactl = readb(mmio + ATA_DMA_CMD); + dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); + if (!rw) + dmactl |= ATA_DMA_WR; + writeb(dmactl, mmio + ATA_DMA_CMD); + + /* issue r/w command if this is not a ATA DMA command*/ + if (qc->tf.protocol != ATA_PROT_DMA) + ap->ops->exec_command(ap, &qc->tf); +} + +/** + * k2_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO) + * @qc: Info associated with this ATA transaction. + * + * LOCKING: + * spin_lock_irqsave(host_set lock) + */ + +void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) +{ + struct ata_port *ap = qc->ap; + void *mmio = (void *) ap->ioaddr.bmdma_addr; + u8 dmactl; + + /* start host DMA transaction */ + dmactl = readb(mmio + ATA_DMA_CMD); + writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); + /* There is a race condition in certain SATA controllers that can + be seen when the r/w command is given to the controller before the + host DMA is started. On a Read command, the controller would initiate + the command to the drive even before it sees the DMA start. When there + are very fast drives connected to the controller, or when the data request + hits in the drive cache, there is the possibility that the drive returns a part + or all of the requested data to the controller before the DMA start is issued. + In this case, the controller would become confused as to what to do with the data. + In the worst case when all the data is returned back to the controller, the + controller could hang. In other cases it could return partial data returning + in data corruption. This problem has been seen in PPC systems and can also appear + on an system with very fast disks, where the SATA controller is sitting behind a + number of bridges, and hence there is significant latency between the r/w command + and the start command. */ + /* issue r/w command if the access is to ATA*/ + if (qc->tf.protocol == ATA_PROT_DMA) + ap->ops->exec_command(ap, &qc->tf); +} + static u8 k2_stat_check_status(struct ata_port *ap) { return readl((void *) ap->ioaddr.status_addr); @@ -207,7 +273,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -231,10 +297,10 @@ .tf_load = k2_sata_tf_load, .tf_read = k2_sata_tf_read, .check_status = k2_stat_check_status, - .exec_command = ata_exec_command_mmio, + .exec_command = ata_exec_command, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = k2_bmdma_setup_mmio, + .bmdma_start = k2_bmdma_start_mmio, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -369,6 +435,8 @@ static struct pci_device_id k2_sata_pci_tbl[] = { { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { } }; diff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c --- a/drivers/scsi/sata_sx4.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_sx4.c 2004-09-18 10:04:02 -07:00 @@ -176,7 +176,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -194,8 +194,8 @@ static struct ata_port_operations pdc_20621_ops = { .port_disable = ata_port_disable, .tf_load = pdc_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, + .tf_read = ata_tf_read, + .check_status = ata_check_status, .exec_command = pdc_exec_command_mmio, .phy_reset = pdc_20621_phy_reset, .qc_prep = pdc20621_qc_prep, @@ -888,7 +888,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_tf_load_mmio(ap, tf); + ata_tf_load(ap, tf); } @@ -896,7 +896,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_exec_command_mmio(ap, tf); + ata_exec_command(ap, tf); } diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c --- a/drivers/scsi/sata_via.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_via.c 2004-09-18 10:04:02 -07:00 @@ -83,7 +83,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -101,15 +101,15 @@ static struct ata_port_operations svia_sata_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, @@ -125,6 +125,15 @@ .port_stop = ata_port_stop, }; +static struct ata_port_info svia_port_info = { + .sht = &svia_sht, + .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | ATA_FLAG_NO_LEGACY, + .pio_mask = 0x1f, + .mwdma_mask = 0x07, + .udma_mask = 0x7f, + .port_ops = &svia_sata_ops, +}; + MODULE_AUTHOR("Jeff Garzik"); MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); MODULE_LICENSE("GPL"); @@ -158,6 +167,7 @@ static int printed_version; unsigned int i; int rc; + struct ata_port_info *ppi; struct ata_probe_ent *probe_ent; u8 tmp8; @@ -195,42 +205,17 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &svia_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { printk(KERN_ERR DRV_NAME "(%s): out of memory\n", pci_name(pdev)); rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - INIT_LIST_HEAD(&probe_ent->node); - probe_ent->pdev = pdev; - probe_ent->sht = &svia_sht; - probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY; - probe_ent->port_ops = &svia_sata_ops; - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->pio_mask = 0x1f; - probe_ent->mwdma_mask = 0x07; - probe_ent->udma_mask = 0x7f; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); + probe_ent->port[0].scr_addr = svia_scr_addr(pci_resource_start(pdev, 5), 0); - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; probe_ent->port[1].scr_addr = svia_scr_addr(pci_resource_start(pdev, 5), 1); diff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c --- a/drivers/scsi/sata_vsc.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/scsi/sata_vsc.c 2004-09-18 10:04:02 -07:00 @@ -192,7 +192,7 @@ .name = DRV_NAME, .detect = ata_scsi_detect, .release = ata_scsi_release, - .ioctl = ata_scsi_ioctl, + .ioctl = ata_scsi_ioctl, .queuecommand = ata_scsi_queuecmd, .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, @@ -212,11 +212,11 @@ .port_disable = ata_port_disable, .tf_load = vsc_sata_tf_load, .tf_read = vsc_sata_tf_read, - .exec_command = ata_exec_command_mmio, - .check_status = ata_check_status_mmio, + .exec_command = ata_exec_command, + .check_status = ata_check_status, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, diff -Nru a/drivers/usb/audio.c b/drivers/usb/audio.c --- a/drivers/usb/audio.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/usb/audio.c 2004-09-18 10:04:02 -07:00 @@ -593,9 +593,10 @@ return 0; } -static void dmabuf_copyin(struct dmabuf *db, const void *buffer, unsigned int size) +static void dmabuf_copyin(struct dmabuf *db, const void *_buffer, unsigned int size) { unsigned int pgrem, rem; + const char *buffer = _buffer; db->total_bytes += size; for (;;) { @@ -609,16 +610,17 @@ pgrem = rem; memcpy((db->sgbuf[db->wrptr >> PAGE_SHIFT]) + (db->wrptr & (PAGE_SIZE-1)), buffer, pgrem); size -= pgrem; - (char *)buffer += pgrem; + buffer += pgrem; db->wrptr += pgrem; if (db->wrptr >= db->dmasize) db->wrptr = 0; } } -static void dmabuf_copyout(struct dmabuf *db, void *buffer, unsigned int size) +static void dmabuf_copyout(struct dmabuf *db, void *_buffer, unsigned int size) { unsigned int pgrem, rem; + char *buffer = _buffer; db->total_bytes += size; for (;;) { @@ -632,16 +634,17 @@ pgrem = rem; memcpy(buffer, (db->sgbuf[db->rdptr >> PAGE_SHIFT]) + (db->rdptr & (PAGE_SIZE-1)), pgrem); size -= pgrem; - (char *)buffer += pgrem; + buffer += pgrem; db->rdptr += pgrem; if (db->rdptr >= db->dmasize) db->rdptr = 0; } } -static int dmabuf_copyin_user(struct dmabuf *db, unsigned int ptr, const void *buffer, unsigned int size) +static int dmabuf_copyin_user(struct dmabuf *db, unsigned int ptr, const void *_buffer, unsigned int size) { unsigned int pgrem, rem; + const char *buffer = _buffer; if (!db->ready || db->mapped) return -EINVAL; @@ -657,16 +660,17 @@ if (copy_from_user((db->sgbuf[ptr >> PAGE_SHIFT]) + (ptr & (PAGE_SIZE-1)), buffer, pgrem)) return -EFAULT; size -= pgrem; - (char *)buffer += pgrem; + buffer += pgrem; ptr += pgrem; if (ptr >= db->dmasize) ptr = 0; } } -static int dmabuf_copyout_user(struct dmabuf *db, unsigned int ptr, void *buffer, unsigned int size) +static int dmabuf_copyout_user(struct dmabuf *db, unsigned int ptr, void *_buffer, unsigned int size) { unsigned int pgrem, rem; + char *buffer = _buffer; if (!db->ready || db->mapped) return -EINVAL; @@ -682,7 +686,7 @@ if (copy_to_user(buffer, (db->sgbuf[ptr >> PAGE_SHIFT]) + (ptr & (PAGE_SIZE-1)), pgrem)) return -EFAULT; size -= pgrem; - (char *)buffer += pgrem; + buffer += pgrem; ptr += pgrem; if (ptr >= db->dmasize) ptr = 0; diff -Nru a/drivers/usb/hpusbscsi.c b/drivers/usb/hpusbscsi.c --- a/drivers/usb/hpusbscsi.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/usb/hpusbscsi.c 2004-09-18 10:04:02 -07:00 @@ -182,7 +182,7 @@ memcpy (&(new->ctempl), &hpusbscsi_scsi_host_template, sizeof (hpusbscsi_scsi_host_template)); - (struct hpusbscsi *) new->ctempl.proc_dir = new; + new->ctempl.proc_dir = (void *) new; new->ctempl.module = THIS_MODULE; if (scsi_register_module (MODULE_SCSI_HA, &(new->ctempl))) diff -Nru a/drivers/usb/microtek.c b/drivers/usb/microtek.c --- a/drivers/usb/microtek.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/usb/microtek.c 2004-09-18 10:04:02 -07:00 @@ -987,7 +987,7 @@ /* Initialize the host template based on the default one */ memcpy(&(new_desc->ctempl), &mts_scsi_host_template, sizeof(mts_scsi_host_template)); /* HACK from usb-storage - this is needed for scsi detection */ - (struct mts_desc *)new_desc->ctempl.proc_dir = new_desc; /* FIXME */ + new_desc->ctempl.proc_dir = (void *)new_desc; /* FIXME */ MTS_DEBUG("registering SCSI module\n"); diff -Nru a/drivers/usb/uss720.c b/drivers/usb/uss720.c --- a/drivers/usb/uss720.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/usb/uss720.c 2004-09-18 10:04:02 -07:00 @@ -327,13 +327,14 @@ { struct parport_uss720_private *priv = pp->private_data; size_t got = 0; + char *buff = buf; if (change_mode(pp, ECR_EPP)) return 0; for (; got < length; got++) { - if (get_1284_register(pp, 4, (char *)buf)) + if (get_1284_register(pp, 4, buff)) break; - ((char*)buf)++; + buff++; if (priv->reg[0] & 0x01) { clear_epp_timeout(pp); break; @@ -348,13 +349,14 @@ #if 0 struct parport_uss720_private *priv = pp->private_data; size_t written = 0; + const char *buff = buf; if (change_mode(pp, ECR_EPP)) return 0; for (; written < length; written++) { - if (set_1284_register(pp, 4, (char *)buf)) + if (set_1284_register(pp, 4, *buff)) break; - ((char*)buf)++; + buff++; if (get_1284_register(pp, 1, NULL)) break; if (priv->reg[0] & 0x01) { @@ -386,13 +388,14 @@ { struct parport_uss720_private *priv = pp->private_data; size_t got = 0; + char *buff = buf; if (change_mode(pp, ECR_EPP)) return 0; for (; got < length; got++) { - if (get_1284_register(pp, 3, (char *)buf)) + if (get_1284_register(pp, 3, buff)) break; - ((char*)buf)++; + buff++; if (priv->reg[0] & 0x01) { clear_epp_timeout(pp); break; @@ -406,13 +409,14 @@ { struct parport_uss720_private *priv = pp->private_data; size_t written = 0; + const char *buff = buf; if (change_mode(pp, ECR_EPP)) return 0; for (; written < length; written++) { - if (set_1284_register(pp, 3, *(char *)buf)) + if (set_1284_register(pp, 3, *buff)) break; - ((char*)buf)++; + buff++; if (get_1284_register(pp, 1, NULL)) break; if (priv->reg[0] & 0x01) { @@ -463,13 +467,14 @@ static size_t parport_uss720_ecp_write_addr(struct parport *pp, const void *buffer, size_t len, int flags) { size_t written = 0; + const char *buff = buffer; if (change_mode(pp, ECR_ECP)) return 0; for (; written < len; written++) { - if (set_1284_register(pp, 5, *(char *)buffer)) + if (set_1284_register(pp, 5, *buff)) break; - ((char*)buffer)++; + buff++; } change_mode(pp, ECR_PS2); return written; diff -Nru a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h --- a/drivers/video/matrox/matroxfb_base.h 2004-09-18 10:04:02 -07:00 +++ b/drivers/video/matrox/matroxfb_base.h 2004-09-18 10:04:02 -07:00 @@ -253,21 +253,21 @@ #ifdef MEMCPYTOIO_WORKS memcpy_toio(va.vaddr + offs, src, len); #elif defined(MEMCPYTOIO_WRITEL) -#define srcd ((const u_int32_t*)src) if (offs & 3) { while (len >= 4) { - mga_writel(va, offs, get_unaligned(srcd++)); + mga_writel(va, offs, get_unaligned((u32 *)src)); offs += 4; len -= 4; + src += 4; } } else { while (len >= 4) { - mga_writel(va, offs, *srcd++); + mga_writel(va, offs, *(u32 *)src); offs += 4; len -= 4; + src += 4; } } -#undef srcd if (len) { u_int32_t tmp; diff -Nru a/drivers/video/riva/accel.c b/drivers/video/riva/accel.c --- a/drivers/video/riva/accel.c 2004-09-18 10:04:02 -07:00 +++ b/drivers/video/riva/accel.c 2004-09-18 10:04:02 -07:00 @@ -153,8 +153,10 @@ for (j = 0; j < cnt; j++) { if (w <= 8) cdat2 = *cdat++; - else - cdat2 = *((u16*)cdat)++; + else { + cdat2 = *(u16*)cdat; + cdat += sizeof(u16); + } fbcon_reverse_order(&cdat2); d[j] = cdat2; } diff -Nru a/include/linux/compiler.h b/include/linux/compiler.h --- a/include/linux/compiler.h 2004-09-18 10:04:02 -07:00 +++ b/include/linux/compiler.h 2004-09-18 10:04:02 -07:00 @@ -37,5 +37,6 @@ /* no checker support, so we unconditionally define this as (null) */ #define __user +#define __iomem #endif /* __LINUX_COMPILER_H */ diff -Nru a/include/linux/libata.h b/include/linux/libata.h --- a/include/linux/libata.h 2004-09-18 10:04:02 -07:00 +++ b/include/linux/libata.h 2004-09-18 10:04:02 -07:00 @@ -197,7 +197,7 @@ unsigned long irq; unsigned int irq_flags; unsigned long host_flags; - void *mmio_base; + void __iomem *mmio_base; void *private_data; }; @@ -205,7 +205,7 @@ spinlock_t lock; struct pci_dev *pdev; unsigned long irq; - void *mmio_base; + void __iomem *mmio_base; unsigned int n_ports; void *private_data; struct ata_port_operations *ops; @@ -380,19 +380,19 @@ /* * Default driver ops implementations */ -extern void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf); +extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf); +extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp); extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); -extern u8 ata_check_status_pio(struct ata_port *ap); -extern u8 ata_check_status_mmio(struct ata_port *ap); -extern void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); +extern u8 ata_check_status(struct ata_port *ap); +extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); extern int ata_port_start (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap); extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); +extern struct ata_probe_ent * +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); +extern struct ata_probe_ent * +ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port); extern void ata_qc_prep(struct ata_queued_cmd *qc); extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, @@ -401,10 +401,8 @@ unsigned int n_elem); extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s, unsigned int ofs, unsigned int len); -extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc); -extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc); -extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc); -extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc); +extern void ata_bmdma_setup (struct ata_queued_cmd *qc); +extern void ata_bmdma_start (struct ata_queued_cmd *qc); extern void ata_bmdma_irq_clear(struct ata_port *ap); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); @@ -433,7 +431,7 @@ static inline u8 ata_chk_err(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - return readb((void *) ap->ioaddr.error_addr); + return readb((void __iomem *) ap->ioaddr.error_addr); } return inb(ap->ioaddr.error_addr); } @@ -446,7 +444,7 @@ static inline u8 ata_altstatus(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) - return readb(ap->ioaddr.altstatus_addr); + return readb((void __iomem *)ap->ioaddr.altstatus_addr); return inb(ap->ioaddr.altstatus_addr); } @@ -517,7 +515,7 @@ ap->last_ctl = ap->ctl; if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); tmp = ata_wait_idle(ap); @@ -538,7 +536,7 @@ /* get controller status; clear intr, err bits */ if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; host_stat = readb(mmio + ATA_DMA_STATUS); writeb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, mmio + ATA_DMA_STATUS); @@ -576,7 +574,7 @@ static inline void ata_bmdma_stop(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; /* clear start/stop bit */ writeb(readb(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, @@ -594,7 +592,7 @@ static inline void ata_bmdma_ack_irq(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = ((void *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; + void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; writeb(readb(mmio), mmio); } else { unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; @@ -606,7 +604,7 @@ { u8 host_stat; if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; host_stat = readb(mmio + ATA_DMA_STATUS); } else host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); diff -Nru a/include/linux/string.h b/include/linux/string.h --- a/include/linux/string.h 2004-09-18 10:04:02 -07:00 +++ b/include/linux/string.h 2004-09-18 10:04:02 -07:00 @@ -7,6 +7,7 @@ #include /* for size_t */ #include /* for NULL */ +#include /* for inline ((always_inline)) */ #ifdef __cplusplus extern "C" { diff -Nru a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h --- a/include/pcmcia/mem_op.h 2004-09-18 10:04:02 -07:00 +++ b/include/pcmcia/mem_op.h 2004-09-18 10:04:02 -07:00 @@ -81,7 +81,9 @@ n -= odd; while (n) { *(u_short *)to = __raw_readw(from); - (char *)to += 2; (char *)from += 2; n -= 2; + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) *(u_char *)to = readb(from); @@ -93,7 +95,9 @@ n -= odd; while (n) { __raw_writew(*(u_short *)from, to); - (char *)to += 2; (char *)from += 2; n -= 2; + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) writeb(*(u_char *)from, to); @@ -105,7 +109,9 @@ n -= odd; while (n) { put_user(__raw_readw(from), (short *)to); - (char *)to += 2; (char *)from += 2; n -= 2; + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) put_user(readb(from), (char *)to); @@ -120,7 +126,9 @@ while (n) { get_user(s, (short *)from); __raw_writew(s, to); - (char *)to += 2; (char *)from += 2; n -= 2; + to = (void *)((long)to + 2); + from = (const void *)((long)from + 2); + n -= 2; } if (odd) { get_user(c, (char *)from);