Commit 6293d56c authored by Linus Torvalds's avatar Linus Torvalds

v2.4.14.6 -> v2.4.14.7

  - Jeff Garzik: network driver updates
  - Christoph Hellwig: UFS filesystem byteorder cleanups
  - me: modified Andrea VM page allocator tuning
parent 5fc4bcde
...@@ -35,11 +35,18 @@ Default video modes ...@@ -35,11 +35,18 @@ Default video modes
At the moment, there are two kernel command line arguments supported: At the moment, there are two kernel command line arguments supported:
mode:640x480 mode:640x480
mode:800x600
or or
mode:1024x768 mode:1024x768
Full support for startup video modes (modedb) will be integrated soon. Full support for startup video modes (modedb) will be integrated soon.
Version 1.9.9.1
---------------
* Fix memory detection for 512kB case
* 800x600 mode
* Fixed timings
* Hint for AXP: Use -accel false -vyres -1 when changing resolution
Version 1.9.4.4 Version 1.9.4.4
......
D-Link DL2000-based Gigabit Ethernet Adapter Installation D-Link DL2000-based Gigabit Ethernet Adapter Installation
for Linux for Linux
July 5, 2001 Nov 12, 2001
Contents Contents
======== ========
...@@ -14,20 +14,22 @@ Contents ...@@ -14,20 +14,22 @@ Contents
- Troubleshooting - Troubleshooting
Compatiblity List Compatibility List
================= =================
Adapter Support: Adapter Support:
D-Link DGE-550T Gigabit Ethernet Adapter. D-Link DGE-550T Gigabit Ethernet Adapter.
D-Link DGE-550SX Gigabit Ethernet Adapter.
D-Link DL2000-based Gigabit Ethernet Adapter. D-Link DL2000-based Gigabit Ethernet Adapter.
The driver support Linux kernal 2.4.x later. We had tested it The driver support Linux kernel 2.4.7 later. We had tested it
on the environments below. on the environments below.
. Red Hat v6.2 (update to kernel 2.4.4) . Red Hat v6.2 (update kernel to 2.4.7)
. Red Hat v7.0 (update to kernel 2.4.4) . Red Hat v7.0 (update kernel to 2.4.7)
. Red Hat v7.1 (kernel 2.4.2-2) . Red Hat v7.1 (kernel 2.4.7)
. Red Hat v7.2 (kernel 2.4.7-10)
Quick Install Quick Install
...@@ -35,16 +37,16 @@ Quick Install ...@@ -35,16 +37,16 @@ Quick Install
Install linux driver as following command: Install linux driver as following command:
1. make all 1. make all
2. insmod dl2x.o 2. insmod dl2k.o
3. ifconfig eth0 up 10.xxx.xxx.xxx netmask 255.0.0.0 3. ifconfig eth0 up 10.xxx.xxx.xxx netmask 255.0.0.0
^^^^^^^^^^^^^^^\ ^^^^^^^^\ ^^^^^^^^^^^^^^^\ ^^^^^^^^\
IP NETMASK IP NETMASK
Now eth0 bring up, you can test it by "ping" or get more information by Now eth0 should active, you can test it by "ping" or get more information by
"ifconfig". If test ok, then continue next step. "ifconfig". If tested ok, continue the next step.
4. cp dl2x.o /lib/modules/`uname -r`/kernel/drivers/net 4. cp dl2k.o /lib/modules/`uname -r`/kernel/drivers/net
5. Add the following lines to /etc/modules.conf: 5. Add the following lines to /etc/modules.conf:
alias eth0 dl2x alias eth0 dl2k
6. Run "netconfig" or "netconf" to create configuration script ifcfg-eth0 6. Run "netconfig" or "netconf" to create configuration script ifcfg-eth0
located at /etc/sysconfig/network-scripts or create it manually. located at /etc/sysconfig/network-scripts or create it manually.
[see - Configuration Script Sample] [see - Configuration Script Sample]
...@@ -61,10 +63,10 @@ source instead of relying on a precompiled version. This approach provides ...@@ -61,10 +63,10 @@ source instead of relying on a precompiled version. This approach provides
better reliability since a precompiled driver might depend on libraries or better reliability since a precompiled driver might depend on libraries or
kernel features that are not present in a given Linux installation. kernel features that are not present in a given Linux installation.
The 3 files necessary to build Linux device driver are dl2x.c, dl2x.h and The 3 files necessary to build Linux device driver are dl2k.c, dl2k.h and
Makefile. To compile, the Linux installation must include the gcc compiler, Makefile. To compile, the Linux installation must include the gcc compiler,
the kernel source, and the kernel headers. The Linux driver supports Linux the kernel source, and the kernel headers. The Linux driver supports Linux
Kernels 2.4.x. Copy the files to a directory and enter the following command Kernels 2.4.7. Copy the files to a directory and enter the following command
to compile and link the driver: to compile and link the driver:
CD-ROM drive CD-ROM drive
...@@ -73,21 +75,21 @@ CD-ROM drive ...@@ -73,21 +75,21 @@ CD-ROM drive
[root@XXX /] mkdir cdrom [root@XXX /] mkdir cdrom
[root@XXX /] mount -r -t iso9660 -o conv=auto /dev/cdrom /cdrom [root@XXX /] mount -r -t iso9660 -o conv=auto /dev/cdrom /cdrom
[root@XXX /] cd root [root@XXX /] cd root
[root@XXX /root] mkdir dl2x [root@XXX /root] mkdir dl2k
[root@XXX /root] cd dl2x [root@XXX /root] cd dl2k
[root@XXX dl2x] cp /cdrom/linux/dl2x.tgz /root/dl2x [root@XXX dl2k] cp /cdrom/linux/dl2k.tgz /root/dl2k
[root@XXX dl2x] tar xfvz dl2x.tgz [root@XXX dl2k] tar xfvz dl2k.tgz
[root@XXX dl2x] make all [root@XXX dl2k] make all
Floppy disc drive Floppy disc drive
----------------- -----------------
[root@XXX /] cd root [root@XXX /] cd root
[root@XXX /root] mkdir dl2x [root@XXX /root] mkdir dl2k
[root@XXX /root] cd dl2x [root@XXX /root] cd dl2k
[root@XXX dl2x] mcopy a:/linux/dl2x.tgz /root/dl2x [root@XXX dl2k] mcopy a:/linux/dl2k.tgz /root/dl2k
[root@XXX dl2x] tar xfvz dl2x.tgz [root@XXX dl2k] tar xfvz dl2k.tgz
[root@XXX dl2x] make all [root@XXX dl2k] make all
Installing the Driver Installing the Driver
===================== =====================
...@@ -98,17 +100,16 @@ Installing the Driver ...@@ -98,17 +100,16 @@ Installing the Driver
to a protocol stack in order to establish network connectivity. To load a to a protocol stack in order to establish network connectivity. To load a
module enter the command: module enter the command:
insmod dl2x.o insmod dl2k.o
or or
insmod dl2x.o <optional parameter> ; add parameter insmod dl2k.o <optional parameter> ; add parameter
=============================================================== ===============================================================
example: insmod dl2x.o media=100mbps_hd example: insmod dl2k.o media=100mbps_hd
or insmod dl2x.o media=3 or insmod dl2k.o media=3
or insmod dl2x.o media=3 2 ; for 2 cards or insmod dl2k.o media=3,2 ; for 2 cards
=============================================================== ===============================================================
Please reference the list of the command line parameters supported by Please reference the list of the command line parameters supported by
...@@ -133,7 +134,7 @@ Installing the Driver ...@@ -133,7 +134,7 @@ Installing the Driver
ifdown eth0 ifdown eth0
ifconfig eth0 down ifconfig eth0 down
rmmod dl2x.o rmmod dl2k.o
The following are the commands to list the currently loaded modules and The following are the commands to list the currently loaded modules and
to see the current network configuration. to see the current network configuration.
...@@ -151,13 +152,13 @@ Installing the Driver ...@@ -151,13 +152,13 @@ Installing the Driver
Red Hat v6.x/v7.x Red Hat v6.x/v7.x
----------------- -----------------
1. Copy dl2x.o to the network modules directory, typically 1. Copy dl2k.o to the network modules directory, typically
/lib/modules/2.x.x-xx/net or /lib/modules/2.x.x/kernel/drivers/net. /lib/modules/2.x.x-xx/net or /lib/modules/2.x.x/kernel/drivers/net.
2. Locate the boot module configuration file, most commonly modules.conf 2. Locate the boot module configuration file, most commonly modules.conf
or conf.modules in the /etc directory. Add the following lines: or conf.modules in the /etc directory. Add the following lines:
alias ethx dl2x alias ethx dl2k
options dl2x <optional parameters> options dl2k <optional parameters>
where ethx will be eth0 if the NIC is the only ethernet adapter, eth1 if where ethx will be eth0 if the NIC is the only ethernet adapter, eth1 if
one other ethernet adapter is installed, etc. Refer to the table in the one other ethernet adapter is installed, etc. Refer to the table in the
...@@ -187,12 +188,19 @@ media=xxxxxxxxx - Specifies the media type the NIC operates at. ...@@ -187,12 +188,19 @@ media=xxxxxxxxx - Specifies the media type the NIC operates at.
10mbps_fd 10Mbps full duplex. 10mbps_fd 10Mbps full duplex.
100mbps_hd 100Mbps half duplex. 100mbps_hd 100Mbps half duplex.
100mbps_fd 100Mbps full duplex. 100mbps_fd 100Mbps full duplex.
1000mbps_fd 1000Mbps full duplex.
1000mbps_hd 1000Mbps half duplex.
0 Autosensing active media. 0 Autosensing active media.
1 10Mbps half duplex. 1 10Mbps half duplex.
2 10Mbps full duplex. 2 10Mbps full duplex.
3 100Mbps half duplex. 3 100Mbps half duplex.
4 100Mbps full duplex. 4 100Mbps full duplex.
5 1000Mbps full duplex.
6 1000Mbps half duplex.
By default, the NIC operates at autosense. By default, the NIC operates at autosense.
Note that only 1000mbps_fd and 1000mbps_hd
types are available for fiber adapter.
vlan=x - Specifies the VLAN ID. If vlan=0, the vlan=x - Specifies the VLAN ID. If vlan=0, the
Virtual Local Area Network (VLAN) function is Virtual Local Area Network (VLAN) function is
...@@ -208,9 +216,8 @@ int_count - Rx frame count each interrupt. ...@@ -208,9 +216,8 @@ int_count - Rx frame count each interrupt.
int_timeout - Rx DMA wait time for an interrupt. Proper int_timeout - Rx DMA wait time for an interrupt. Proper
values of int_count and int_timeout bring values of int_count and int_timeout bring
a conspicuous performance in the fast machine. a conspicuous performance in the fast machine.
For P4 1.5GHz systems, a setting of Ex. int_count=5 and int_timeout=750
int_count=5 and int_timeout=750 is
recommendable.
Configuration Script Sample Configuration Script Sample
=========================== ===========================
Here is a sample of a simple configuration script: Here is a sample of a simple configuration script:
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 15 SUBLEVEL = 15
EXTRAVERSION =-pre6 EXTRAVERSION =-pre7
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
......
...@@ -378,14 +378,15 @@ fi ...@@ -378,14 +378,15 @@ fi
mainmenu_option next_comment mainmenu_option next_comment
comment 'Kernel hacking' comment 'Kernel hacking'
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool 'Legacy kernel start address' CONFIG_ALPHA_LEGACY_START_ADDRESS
tristate 'Kernel FP software completion' CONFIG_MATHEMU
bool 'Kernel debugging' CONFIG_DEBUG_KERNEL
if [ "$CONFIG_DEBUG_KERNEL" != "n" ]; then
tristate ' Kernel FP software completion' CONFIG_MATHEMU
bool ' Debug memory allocations' CONFIG_DEBUG_SLAB
bool ' Magic SysRq key' CONFIG_MAGIC_SYSRQ
else else
define_tristate CONFIG_MATHEMU y define_tristate CONFIG_MATHEMU y
fi fi
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
bool 'Legacy kernel start address' CONFIG_ALPHA_LEGACY_START_ADDRESS
endmenu endmenu
This diff is collapsed.
...@@ -1233,13 +1233,12 @@ static int __init init_amd(struct cpuinfo_x86 *c) ...@@ -1233,13 +1233,12 @@ static int __init init_amd(struct cpuinfo_x86 *c)
} }
/* K6 with old style WHCR */ /* K6 with old style WHCR */
if( c->x86_model < 8 || if (c->x86_model < 8 ||
(c->x86_model== 8 && c->x86_mask < 8)) (c->x86_model== 8 && c->x86_mask < 8)) {
{
/* We can only write allocate on the low 508Mb */ /* We can only write allocate on the low 508Mb */
if(mbytes>508) if(mbytes>508)
mbytes=508; mbytes=508;
rdmsr(MSR_K6_WHCR, l, h); rdmsr(MSR_K6_WHCR, l, h);
if ((l&0x0000FFFF)==0) { if ((l&0x0000FFFF)==0) {
unsigned long flags; unsigned long flags;
...@@ -1250,14 +1249,14 @@ static int __init init_amd(struct cpuinfo_x86 *c) ...@@ -1250,14 +1249,14 @@ static int __init init_amd(struct cpuinfo_x86 *c)
local_irq_restore(flags); local_irq_restore(flags);
printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n", printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n",
mbytes); mbytes);
} }
break; break;
} }
if (c->x86_model == 8 || c->x86_model == 9 || c->x86_model == 13)
{ if ((c->x86_model == 8 && c->x86_mask >7) ||
c->x86_model == 9 || c->x86_model == 13) {
/* The more serious chips .. */ /* The more serious chips .. */
if(mbytes>4092) if(mbytes>4092)
mbytes=4092; mbytes=4092;
...@@ -1274,10 +1273,8 @@ static int __init init_amd(struct cpuinfo_x86 *c) ...@@ -1274,10 +1273,8 @@ static int __init init_amd(struct cpuinfo_x86 *c)
} }
/* Set MTRR capability flag if appropriate */ /* Set MTRR capability flag if appropriate */
if ( (c->x86_model == 13) || if (c->x86_model == 13 || c->x86_model == 9 ||
(c->x86_model == 9) || (c->x86_model == 8 && c->x86_mask >= 8))
((c->x86_model == 8) &&
(c->x86_mask >= 8)) )
set_bit(X86_FEATURE_K6_MTRR, &c->x86_capability); set_bit(X86_FEATURE_K6_MTRR, &c->x86_capability);
break; break;
} }
......
...@@ -180,6 +180,7 @@ static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize, ...@@ -180,6 +180,7 @@ static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize,
unsigned size, offset; unsigned size, offset;
int len; int len;
down(&mapping->host->i_sem);
index = pos >> PAGE_CACHE_SHIFT; index = pos >> PAGE_CACHE_SHIFT;
offset = pos & (PAGE_CACHE_SIZE - 1); offset = pos & (PAGE_CACHE_SIZE - 1);
len = bh->b_size; len = bh->b_size;
...@@ -220,12 +221,14 @@ static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize, ...@@ -220,12 +221,14 @@ static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize,
UnlockPage(page); UnlockPage(page);
page_cache_release(page); page_cache_release(page);
} }
up(&mapping->host->i_sem);
return 0; return 0;
unlock: unlock:
UnlockPage(page); UnlockPage(page);
page_cache_release(page); page_cache_release(page);
fail: fail:
up(&mapping->host->i_sem);
return -1; return -1;
} }
......
...@@ -359,6 +359,7 @@ struct file_operations lvm_chr_fops = { ...@@ -359,6 +359,7 @@ struct file_operations lvm_chr_fops = {
/* block device operations structure needed for 2.3.38? and above */ /* block device operations structure needed for 2.3.38? and above */
struct block_device_operations lvm_blk_dops = struct block_device_operations lvm_blk_dops =
{ {
owner: THIS_MODULE,
open: lvm_blk_open, open: lvm_blk_open,
release: lvm_blk_close, release: lvm_blk_close,
ioctl: lvm_blk_ioctl, ioctl: lvm_blk_ioctl,
......
...@@ -625,6 +625,10 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -625,6 +625,10 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
len = skb->len; len = skb->len;
mapping = pci_map_single(cp->pdev, skb->data, len, PCI_DMA_TODEVICE); mapping = pci_map_single(cp->pdev, skb->data, len, PCI_DMA_TODEVICE);
eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
txd->opts2 = 0;
txd->addr_lo = cpu_to_le32(mapping);
wmb();
#ifdef CP_TX_CHECKSUM #ifdef CP_TX_CHECKSUM
txd->opts1 = cpu_to_le32(eor | len | DescOwn | FirstFrag | txd->opts1 = cpu_to_le32(eor | len | DescOwn | FirstFrag |
LastFrag | IPCS | UDPCS | TCPCS); LastFrag | IPCS | UDPCS | TCPCS);
...@@ -632,13 +636,11 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -632,13 +636,11 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
txd->opts1 = cpu_to_le32(eor | len | DescOwn | FirstFrag | txd->opts1 = cpu_to_le32(eor | len | DescOwn | FirstFrag |
LastFrag); LastFrag);
#endif #endif
txd->opts2 = 0; wmb();
txd->addr_lo = cpu_to_le32(mapping);
cp->tx_skb[entry].skb = skb; cp->tx_skb[entry].skb = skb;
cp->tx_skb[entry].mapping = mapping; cp->tx_skb[entry].mapping = mapping;
cp->tx_skb[entry].frag = 0; cp->tx_skb[entry].frag = 0;
wmb();
entry = NEXT_TX(entry); entry = NEXT_TX(entry);
} else { } else {
struct cp_desc *txd; struct cp_desc *txd;
...@@ -676,24 +678,29 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -676,24 +678,29 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
ctrl |= LastFrag; ctrl |= LastFrag;
txd = &cp->tx_ring[entry]; txd = &cp->tx_ring[entry];
txd->opts1 = cpu_to_le32(ctrl);
txd->opts2 = 0; txd->opts2 = 0;
txd->addr_lo = cpu_to_le32(mapping); txd->addr_lo = cpu_to_le32(mapping);
wmb();
txd->opts1 = cpu_to_le32(ctrl);
wmb();
cp->tx_skb[entry].skb = skb; cp->tx_skb[entry].skb = skb;
cp->tx_skb[entry].mapping = mapping; cp->tx_skb[entry].mapping = mapping;
cp->tx_skb[entry].frag = frag + 2; cp->tx_skb[entry].frag = frag + 2;
wmb();
entry = NEXT_TX(entry); entry = NEXT_TX(entry);
} }
txd = &cp->tx_ring[first_entry]; txd = &cp->tx_ring[first_entry];
txd->opts2 = 0;
txd->addr_lo = cpu_to_le32(first_mapping);
wmb();
#ifdef CP_TX_CHECKSUM #ifdef CP_TX_CHECKSUM
txd->opts1 = cpu_to_le32(first_len | FirstFrag | DescOwn | IPCS | UDPCS | TCPCS); txd->opts1 = cpu_to_le32(first_len | FirstFrag | DescOwn | IPCS | UDPCS | TCPCS);
#else #else
txd->opts1 = cpu_to_le32(first_len | FirstFrag | DescOwn); txd->opts1 = cpu_to_le32(first_len | FirstFrag | DescOwn);
#endif #endif
txd->opts2 = 0;
txd->addr_lo = cpu_to_le32(first_mapping);
wmb(); wmb();
} }
cp->tx_head = entry; cp->tx_head = entry;
......
...@@ -188,6 +188,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then ...@@ -188,6 +188,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
tristate ' TI ThunderLAN support' CONFIG_TLAN tristate ' TI ThunderLAN support' CONFIG_TLAN
fi fi
dep_tristate ' VIA Rhine support' CONFIG_VIA_RHINE $CONFIG_PCI dep_tristate ' VIA Rhine support' CONFIG_VIA_RHINE $CONFIG_PCI
dep_mbool ' Use MMIO instead of PIO (EXPERIMENTAL)' CONFIG_VIA_RHINE_MMIO $CONFIG_VIA_RHINE $CONFIG_EXPERIMENTAL
dep_tristate ' Winbond W89c840 Ethernet support' CONFIG_WINBOND_840 $CONFIG_PCI dep_tristate ' Winbond W89c840 Ethernet support' CONFIG_WINBOND_840 $CONFIG_PCI
if [ "$CONFIG_OBSOLETE" = "y" ]; then if [ "$CONFIG_OBSOLETE" = "y" ]; then
dep_bool ' Zenith Z-Note support (EXPERIMENTAL)' CONFIG_ZNET $CONFIG_ISA dep_bool ' Zenith Z-Note support (EXPERIMENTAL)' CONFIG_ZNET $CONFIG_ISA
......
This diff is collapsed.
...@@ -582,11 +582,13 @@ struct ace_info { ...@@ -582,11 +582,13 @@ struct ace_info {
aceaddr stats2_ptr; aceaddr stats2_ptr;
}; };
struct ring_info { struct ring_info {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping; dma_addr_t mapping;
}; };
/* /*
* Funny... As soon as we add maplen on alpha, it starts to work * Funny... As soon as we add maplen on alpha, it starts to work
* much slower. Hmm... is it because struct does not fit to one cacheline? * much slower. Hmm... is it because struct does not fit to one cacheline?
...@@ -598,6 +600,7 @@ struct tx_ring_info { ...@@ -598,6 +600,7 @@ struct tx_ring_info {
int maplen; int maplen;
}; };
/* /*
* struct ace_skb holding the rings of skb's. This is an awful lot of * struct ace_skb holding the rings of skb's. This is an awful lot of
* pointers, but I don't see any other smart mode to do this in an * pointers, but I don't see any other smart mode to do this in an
......
This diff is collapsed.
...@@ -209,6 +209,11 @@ enum MACCtrl_bits { ...@@ -209,6 +209,11 @@ enum MACCtrl_bits {
RxDisable = 0x10000000, RxDisable = 0x10000000,
RxEnabled = 0x20000000, RxEnabled = 0x20000000,
}; };
enum ASICCtrl_LoWord_bits {
PhyMedia = 0x0080,
};
enum ASICCtrl_HiWord_bits { enum ASICCtrl_HiWord_bits {
GlobalReset = 0x0001, GlobalReset = 0x0001,
RxReset = 0x0002, RxReset = 0x0002,
...@@ -277,6 +282,17 @@ enum _mii_reg { ...@@ -277,6 +282,17 @@ enum _mii_reg {
MII_ESR = 15, MII_ESR = 15,
MII_PHY_SCR = 16, MII_PHY_SCR = 16,
}; };
/* PCS register */
enum _pcs_reg {
PCS_BMCR = 0,
PCS_BMSR = 1,
PCS_ANAR = 4,
PCS_ANLPAR = 5,
PCS_ANER = 6,
PCS_ANNPT = 7,
PCS_ANLPRNP = 8,
PCS_ESR = 15,
};
/* Basic Mode Control Register */ /* Basic Mode Control Register */
typedef union t_MII_BMCR { typedef union t_MII_BMCR {
...@@ -533,6 +549,58 @@ typedef enum t_MII_ADMIN_STATUS { ...@@ -533,6 +549,58 @@ typedef enum t_MII_ADMIN_STATUS {
adm_isolate adm_isolate
} MII_ADMIN_t, *PMII_ADMIN_t; } MII_ADMIN_t, *PMII_ADMIN_t;
/* Physical Coding Sublayer Management (PCS) */
/* PCS control and status registers bitmap as the same as MII */
/* PCS Extended Status register bitmap as the same as MII */
/* PCS ANAR */
typedef union t_PCS_ANAR {
u16 image;
struct {
u16 _bit_4_0:5; // bit 4:0
u16 full_duplex:1; // bit 5
u16 half_duplex:1; // bit 6
u16 asymmetric:1; // bit 7
u16 pause:1; // bit 8
u16 _bit_11_9:3; // bit 11:9
u16 remote_fault:2; // bit 13:12
u16 _bit_14:1; // bit 14
u16 next_page:1; // bit 15
} bits;
} ANAR_PCS_t, *PANAR_PCS_t;
enum _pcs_anar {
PCS_ANAR_NEXT_PAGE = 0x8000,
PCS_ANAR_REMOTE_FAULT = 0x3000,
PCS_ANAR_ASYMMETRIC = 0x0100,
PCS_ANAR_PAUSE = 0x0080,
PCS_ANAR_HALF_DUPLEX = 0x0040,
PCS_ANAR_FULL_DUPLEX = 0x0020,
};
/* PCS ANLPAR */
typedef union t_PCS_ANLPAR {
u16 image;
struct {
u16 _bit_4_0:5; // bit 4:0
u16 full_duplex:1; // bit 5
u16 half_duplex:1; // bit 6
u16 asymmetric:1; // bit 7
u16 pause:1; // bit 8
u16 _bit_11_9:3; // bit 11:9
u16 remote_fault:2; // bit 13:12
u16 _bit_14:1; // bit 14
u16 next_page:1; // bit 15
} bits;
} ANLPAR_PCS_t, *PANLPAR_PCS_t;
enum _pcs_anlpar {
PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE,
PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT,
PCS_ANLPAR_ASYMMETRIC = PCS_ANAR_ASYMMETRIC,
PCS_ANLPAR_PAUSE = PCS_ANAR_PAUSE,
PCS_ANLPAR_HALF_DUPLEX = PCS_ANAR_HALF_DUPLEX,
PCS_ANLPAR_FULL_DUPLEX = PCS_ANAR_FULL_DUPLEX,
};
typedef struct t_SROM { typedef struct t_SROM {
u16 config_param; /* 0x00 */ u16 config_param; /* 0x00 */
u16 asic_ctrl; /* 0x02 */ u16 asic_ctrl; /* 0x02 */
...@@ -582,16 +650,19 @@ struct netdev_private { ...@@ -582,16 +650,19 @@ struct netdev_private {
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats; struct net_device_stats stats;
unsigned int rx_buf_sz; /* Based on MTU+slack. */ unsigned int rx_buf_sz; /* Based on MTU+slack. */
unsigned int tx_full:1; /* The Tx queue is full. */
unsigned int full_duplex:1; /* Full-duplex operation requested. */
unsigned int speed; /* Operating speed */ unsigned int speed; /* Operating speed */
unsigned int vlan; /* VLAN Id */ unsigned int vlan; /* VLAN Id */
unsigned int an_enable; /* Auto-Negotiated Enable */
unsigned int chip_id; /* PCI table chip id */ unsigned int chip_id; /* PCI table chip id */
unsigned int jumbo; unsigned int int_count; /* Maximum frames each RxDMAComplete intr */
unsigned int int_count; unsigned int int_timeout; /* Wait time between RxDMAComplete intr */
unsigned int int_timeout; unsigned int tx_full:1; /* The Tx queue is full. */
unsigned int coalesce:1; unsigned int full_duplex:1; /* Full-duplex operation requested. */
unsigned int an_enable:2; /* Auto-Negotiated Enable */
unsigned int jumbo:1; /* Jumbo frame enable */
unsigned int coalesce:1; /* Rx coalescing enable */
unsigned int tx_flow:1; /* Tx flow control enable */
unsigned int rx_flow:1; /* Rx flow control enable */
unsigned int phy_media:1; /* 1: fiber, 0: copper */
struct netdev_desc *last_tx; /* Last Tx descriptor used. */ struct netdev_desc *last_tx; /* Last Tx descriptor used. */
unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */ unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */
unsigned long cur_tx, old_tx; unsigned long cur_tx, old_tx;
......
This diff is collapsed.
...@@ -431,7 +431,7 @@ static void set_rx_mode(struct net_device *dev); ...@@ -431,7 +431,7 @@ static void set_rx_mode(struct net_device *dev);
static struct net_device_stats *get_stats(struct net_device *dev); static struct net_device_stats *get_stats(struct net_device *dev);
static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int netdev_close(struct net_device *dev); static int netdev_close(struct net_device *dev);
static void reset_rx_descriptors(struct net_device *dev);
void stop_nic_tx(long ioaddr, long crvalue) void stop_nic_tx(long ioaddr, long crvalue)
{ {
...@@ -887,7 +887,8 @@ static int netdev_open(struct net_device *dev) ...@@ -887,7 +887,8 @@ static int netdev_open(struct net_device *dev)
1 1 0 128 1 1 0 128
1 1 1 256 1 1 1 256
Wait the specified 50 PCI cycles after a reset by initializing Wait the specified 50 PCI cycles after a reset by initializing
Tx and Rx queues and the address filter list. */ Tx and Rx queues and the address filter list.
FIXME (Ueimor): optimistic for alpha + posted writes ? */
#if defined(__powerpc__) || defined(__sparc__) #if defined(__powerpc__) || defined(__sparc__)
// 89/9/1 modify, // 89/9/1 modify,
// np->bcrvalue=0x04 | 0x0x38; /* big-endian, 256 burst length */ // np->bcrvalue=0x04 | 0x0x38; /* big-endian, 256 burst length */
...@@ -1164,12 +1165,12 @@ static void tx_timeout(struct net_device *dev) ...@@ -1164,12 +1165,12 @@ static void tx_timeout(struct net_device *dev)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
int i;
printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," printk(KERN_WARNING "%s: Transmit timed out, status %8.8x,"
" resetting...\n", dev->name, readl(ioaddr + ISR)); " resetting...\n", dev->name, readl(ioaddr + ISR));
{ {
int i;
printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring);
for (i = 0; i < RX_RING_SIZE; i++) for (i = 0; i < RX_RING_SIZE; i++)
...@@ -1180,12 +1181,41 @@ static void tx_timeout(struct net_device *dev) ...@@ -1180,12 +1181,41 @@ static void tx_timeout(struct net_device *dev)
printk("\n"); printk("\n");
} }
/* Perhaps we should reinitialize the hardware here. Just trigger a + dev->if_port = np->default_port;
Tx demand for now. */ /* Reinit. Gross */
/* Reset the chip's Tx and Rx processes. */
stop_nic_tx(ioaddr, 0);
reset_rx_descriptors(dev);
/* Disable interrupts by clearing the interrupt mask. */
writel(0x0000, ioaddr + IMR);
/* Reset the chip to erase previous misconfiguration. */
writel(0x00000001, ioaddr + BCR);
/* Ueimor: wait for 50 PCI cycles (and flush posted writes btw).
We surely wait too long (address+data phase). Who cares ? */
for (i = 0; i < 50; i++) {
readl(ioaddr + BCR);
rmb();
}
writel((np->cur_tx - np->tx_ring)*sizeof(struct fealnx_desc) +
np->tx_ring_dma, ioaddr + TXLBA);
writel((np->cur_rx - np->rx_ring)*sizeof(struct fealnx_desc) +
np->rx_ring_dma, ioaddr + RXLBA);
writel(np->bcrvalue, ioaddr + BCR);
writel(0, dev->base_addr + RXPDR);
set_rx_mode(dev);
/* Clear and Enable interrupts by setting the interrupt mask. */
writel(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);
writel(np->imrvalue, ioaddr + IMR);
writel(0, dev->base_addr + TXPDR); writel(0, dev->base_addr + TXPDR);
dev->if_port = 0;
/* Stop and restart the chip's Tx processes . */
dev->trans_start = jiffies; dev->trans_start = jiffies;
np->stats.tx_errors++; np->stats.tx_errors++;
......
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
version 1.0.12: version 1.0.12:
* ETHTOOL_* further support (Tim Hockin) * ETHTOOL_* further support (Tim Hockin)
version 1.0.13:
* ETHTOOL_[GS]EEPROM support (Tim Hockin)
TODO: TODO:
* big endian support with CFG:BEM instead of cpu_to_le32 * big endian support with CFG:BEM instead of cpu_to_le32
* support for an external PHY * support for an external PHY
...@@ -106,7 +109,7 @@ ...@@ -106,7 +109,7 @@
*/ */
#define DRV_NAME "natsemi" #define DRV_NAME "natsemi"
#define DRV_VERSION "1.07+LK1.0.12" #define DRV_VERSION "1.07+LK1.0.13"
#define DRV_RELDATE "Oct 19, 2001" #define DRV_RELDATE "Oct 19, 2001"
/* Updated to recommendations in pci-skeleton v2.03. */ /* Updated to recommendations in pci-skeleton v2.03. */
...@@ -167,8 +170,13 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; ...@@ -167,8 +170,13 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
#define NATSEMI_HW_TIMEOUT 400 #define NATSEMI_HW_TIMEOUT 400
#define NATSEMI_TIMER_FREQ 3*HZ #define NATSEMI_TIMER_FREQ 3*HZ
#define NATSEMI_PG0_NREGS 64 #define NATSEMI_PG0_NREGS 64
#define NATSEMI_RFDR_NREGS 8
#define NATSEMI_PG1_NREGS 4 #define NATSEMI_PG1_NREGS 4
#define NATSEMI_NREGS (NATSEMI_PG0_NREGS + NATSEMI_PG1_NREGS) #define NATSEMI_NREGS (NATSEMI_PG0_NREGS + NATSEMI_RFDR_NREGS + \
NATSEMI_PG1_NREGS)
#define NATSEMI_REGS_VER 1 /* v1 added RFDR registers */
#define NATSEMI_REGS_SIZE (NATSEMI_NREGS * sizeof(u32))
#define NATSEMI_EEPROM_SIZE 24 /* 12 16-bit values */
#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */
...@@ -654,7 +662,8 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd); ...@@ -654,7 +662,8 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd);
static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd); static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd);
static void enable_wol_mode(struct net_device *dev, int enable_intr); static void enable_wol_mode(struct net_device *dev, int enable_intr);
static int netdev_close(struct net_device *dev); static int netdev_close(struct net_device *dev);
static int netdev_get_regs(struct net_device *dev, u32 *buf); static int netdev_get_regs(struct net_device *dev, u8 *buf);
static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
static int __devinit natsemi_probe1 (struct pci_dev *pdev, static int __devinit natsemi_probe1 (struct pci_dev *pdev,
...@@ -1820,7 +1829,8 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1820,7 +1829,8 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
info.fw_version[0] = '\0'; info.fw_version[0] = '\0';
strncpy(info.bus_info, np->pci_dev->slot_name, strncpy(info.bus_info, np->pci_dev->slot_name,
ETHTOOL_BUSINFO_LEN); ETHTOOL_BUSINFO_LEN);
info.regdump_len = NATSEMI_NREGS; info.eedump_len = NATSEMI_EEPROM_SIZE;
info.regdump_len = NATSEMI_REGS_SIZE;
if (copy_to_user(useraddr, &info, sizeof(info))) if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1872,16 +1882,16 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1872,16 +1882,16 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
/* get registers */ /* get registers */
case ETHTOOL_GREGS: { case ETHTOOL_GREGS: {
struct ethtool_regs regs; struct ethtool_regs regs;
u32 regbuf[NATSEMI_NREGS]; u8 regbuf[NATSEMI_REGS_SIZE];
int r; int r;
if (copy_from_user(&regs, useraddr, sizeof(regs))) if (copy_from_user(&regs, useraddr, sizeof(regs)))
return -EFAULT; return -EFAULT;
if (regs.len > NATSEMI_NREGS) { if (regs.len > NATSEMI_REGS_SIZE) {
regs.len = NATSEMI_NREGS; regs.len = NATSEMI_REGS_SIZE;
} }
regs.version = 0; regs.version = NATSEMI_REGS_VER;
if (copy_to_user(useraddr, &regs, sizeof(regs))) if (copy_to_user(useraddr, &regs, sizeof(regs)))
return -EFAULT; return -EFAULT;
...@@ -1893,7 +1903,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1893,7 +1903,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
if (r) if (r)
return r; return r;
if (copy_to_user(useraddr, regbuf, regs.len*sizeof(u32))) if (copy_to_user(useraddr, regbuf, regs.len))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1934,6 +1944,34 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1934,6 +1944,34 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* get EEPROM */
case ETHTOOL_GEEPROM: {
struct ethtool_eeprom eeprom;
u8 eebuf[NATSEMI_EEPROM_SIZE];
int r;
if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
return -EFAULT;
if ((eeprom.offset+eeprom.len) > NATSEMI_EEPROM_SIZE) {
eeprom.len = NATSEMI_EEPROM_SIZE-eeprom.offset;
}
eeprom.magic = PCI_VENDOR_ID_NS | (PCI_DEVICE_ID_NS_83815<<16);
if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
return -EFAULT;
useraddr += offsetof(struct ethtool_eeprom, data);
spin_lock_irq(&np->lock);
r = netdev_get_eeprom(dev, eebuf);
spin_unlock_irq(&np->lock);
if (r)
return r;
if (copy_to_user(useraddr, eebuf+eeprom.offset, eeprom.len))
return -EFAULT;
return 0;
}
} }
...@@ -2172,33 +2210,69 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -2172,33 +2210,69 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
return 0; return 0;
} }
static int netdev_get_regs(struct net_device *dev, u32 *buf) static int netdev_get_regs(struct net_device *dev, u8 *buf)
{ {
int i; int i;
int j;
u32 rfcr;
u32 *rbuf = (u32 *)buf;
/* read all of page 0 of registers */ /* read all of page 0 of registers */
for (i = 0; i < NATSEMI_PG0_NREGS; i++) { for (i = 0; i < NATSEMI_PG0_NREGS; i++) {
buf[i] = readl(dev->base_addr + i*4); rbuf[i] = readl(dev->base_addr + i*4);
} }
/* read only the 'magic' registers from page 1 */ /* read only the 'magic' registers from page 1 */
writew(1, dev->base_addr + PGSEL); writew(1, dev->base_addr + PGSEL);
buf[i++] = readw(dev->base_addr + PMDCSR); rbuf[i++] = readw(dev->base_addr + PMDCSR);
buf[i++] = readw(dev->base_addr + TSTDAT); rbuf[i++] = readw(dev->base_addr + TSTDAT);
buf[i++] = readw(dev->base_addr + DSPCFG); rbuf[i++] = readw(dev->base_addr + DSPCFG);
buf[i++] = readw(dev->base_addr + SDCFG); rbuf[i++] = readw(dev->base_addr + SDCFG);
writew(0, dev->base_addr + PGSEL); writew(0, dev->base_addr + PGSEL);
/* read RFCR indexed registers */
rfcr = readl(dev->base_addr + RxFilterAddr);
for (j = 0; j < NATSEMI_RFDR_NREGS; j++) {
writel(j*2, dev->base_addr + RxFilterAddr);
rbuf[i++] = readw(dev->base_addr + RxFilterData);
}
writel(rfcr, dev->base_addr + RxFilterAddr);
/* the interrupt status is clear-on-read - see if we missed any */ /* the interrupt status is clear-on-read - see if we missed any */
if (buf[4] & buf[5]) { if (rbuf[4] & rbuf[5]) {
printk(KERN_WARNING printk(KERN_WARNING
"%s: shoot, we dropped an interrupt (0x%x)\n", "%s: shoot, we dropped an interrupt (0x%x)\n",
dev->name, buf[4] & buf[5]); dev->name, rbuf[4] & rbuf[5]);
} }
return 0; return 0;
} }
#define SWAP_BITS(x) ( (((x) & 0x0001) << 15) | (((x) & 0x0002) << 13) \
| (((x) & 0x0004) << 11) | (((x) & 0x0008) << 9) \
| (((x) & 0x0010) << 7) | (((x) & 0x0020) << 5) \
| (((x) & 0x0040) << 3) | (((x) & 0x0080) << 1) \
| (((x) & 0x0100) >> 1) | (((x) & 0x0200) >> 3) \
| (((x) & 0x0400) >> 5) | (((x) & 0x0800) >> 7) \
| (((x) & 0x1000) >> 9) | (((x) & 0x2000) >> 11) \
| (((x) & 0x4000) >> 13) | (((x) & 0x8000) >> 15) )
static int netdev_get_eeprom(struct net_device *dev, u8 *buf)
{
int i;
u16 *ebuf = (u16 *)buf;
/* eeprom_read reads 16 bits, and indexes by 16 bits */
for (i = 0; i < NATSEMI_EEPROM_SIZE/2; i++) {
ebuf[i] = eeprom_read(dev->base_addr, i);
/* The EEPROM itself stores data bit-swapped, but eeprom_read
* reads it back "sanely". So we swap it back here in order to
* present it to userland as it is stored. */
ebuf[i] = SWAP_BITS(ebuf[i]);
}
return 0;
}
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
......
2001-11-13 David S. Miller <davem@redhat.com>
* tulip_core.c (tulip_mwi_config): Kill unused label early_out.
2001-11-06 Richard Mortimer <richm@oldelvet.netscapeonline.co.uk> 2001-11-06 Richard Mortimer <richm@oldelvet.netscapeonline.co.uk>
* tulip_core.c: Correct set of values to mask out of csr0, * tulip_core.c: Correct set of values to mask out of csr0,
......
...@@ -1328,7 +1328,6 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev, ...@@ -1328,7 +1328,6 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
tp->csr0 = csr0; tp->csr0 = csr0;
goto out; goto out;
early_out:
if (csr0 & MWI) { if (csr0 & MWI) {
pci_command &= ~PCI_COMMAND_INVALIDATE; pci_command &= ~PCI_COMMAND_INVALIDATE;
pci_write_config_word(pdev, PCI_COMMAND, pci_command); pci_write_config_word(pdev, PCI_COMMAND, pci_command);
......
...@@ -2428,6 +2428,8 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi ...@@ -2428,6 +2428,8 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
goto out_free; goto out_free;
} }
pci_set_master(pcidev);
printk(KERN_INFO "ymfpci: %s at 0x%lx IRQ %d\n", printk(KERN_INFO "ymfpci: %s at 0x%lx IRQ %d\n",
(char *)ent->driver_data, pci_resource_start(pcidev, 0), pcidev->irq); (char *)ent->driver_data, pci_resource_start(pcidev, 0), pcidev->irq);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
*/ */
#define CLGEN_VERSION "1.9.9" #define CLGEN_VERSION "1.9.9.1"
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -86,7 +86,6 @@ ...@@ -86,7 +86,6 @@
/* disable runtime assertions? */ /* disable runtime assertions? */
/* #define CLGEN_NDEBUG */ /* #define CLGEN_NDEBUG */
/* debug output */ /* debug output */
#ifdef CLGEN_DEBUG #ifdef CLGEN_DEBUG
#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
...@@ -115,6 +114,7 @@ ...@@ -115,6 +114,7 @@
#define FALSE 0 #define FALSE 0
#define MB_ (1024*1024) #define MB_ (1024*1024)
#define KB_ (1024)
#define MAX_NUM_BOARDS 7 #define MAX_NUM_BOARDS 7
...@@ -439,11 +439,23 @@ static const struct { ...@@ -439,11 +439,23 @@ static const struct {
{0, 8, 0}, {0, 8, 0},
{0, 8, 0}, {0, 8, 0},
{0, 0, 0}, {0, 0, 0},
0, 0, -1, -1, FB_ACCEL_NONE, 40000, 32, 32, 33, 10, 96, 2, 0, 0, -1, -1, FB_ACCEL_NONE, 40000, 48, 16, 32, 8, 96, 4,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
} }
}, },
{"800x600", /* 800x600, 48 kHz, 76 Hz, 50 MHz PixClock */
{
800, 600, 800, 600, 0, 0, 8, 0,
{0, 8, 0},
{0, 8, 0},
{0, 8, 0},
{0, 0, 0},
0, 0, -1, -1, FB_ACCEL_NONE, 20000, 128, 16, 24, 2, 96, 6,
0, FB_VMODE_NONINTERLACED
}
},
/* /*
Modeline from XF86Config: Modeline from XF86Config:
Mode "1024x768" 80 1024 1136 1340 1432 768 770 774 805 Mode "1024x768" 80 1024 1136 1340 1432 768 770 774 805
...@@ -455,8 +467,8 @@ static const struct { ...@@ -455,8 +467,8 @@ static const struct {
{0, 8, 0}, {0, 8, 0},
{0, 8, 0}, {0, 8, 0},
{0, 0, 0}, {0, 0, 0},
0, 0, -1, -1, FB_ACCEL_NONE, 12500, 92, 112, 31, 2, 204, 4, 0, 0, -1, -1, FB_ACCEL_NONE, 12500, 144, 32, 30, 2, 192, 6,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED 0, FB_VMODE_NONINTERLACED
} }
} }
}; };
...@@ -2404,22 +2416,27 @@ static void __init get_prep_addrs (unsigned long *display, unsigned long *regist ...@@ -2404,22 +2416,27 @@ static void __init get_prep_addrs (unsigned long *display, unsigned long *regist
* seem to have. */ * seem to have. */
static unsigned int __init clgen_get_memsize (caddr_t regbase) static unsigned int __init clgen_get_memsize (caddr_t regbase)
{ {
unsigned long mem = 1 * MB_; unsigned long mem;
unsigned char SRF; unsigned char SRF;
DPRINTK ("ENTER\n"); DPRINTK ("ENTER\n");
SRF = vga_rseq (regbase, CL_SEQRF); SRF = vga_rseq (regbase, CL_SEQRF);
if ((SRF & 0x18) == 0x18) { switch ((SRF & 0x18)) {
case 0x08: mem = 512 * 1024; break;
case 0x10: mem = 1024 * 1024; break;
/* 64-bit DRAM data bus width; assume 2MB. Also indicates 2MB memory /* 64-bit DRAM data bus width; assume 2MB. Also indicates 2MB memory
* on the 5430. */ * on the 5430. */
mem *= 2; case 0x18: mem = 2048 * 1024; break;
default: printk ("CLgenfb: Unknown memory size!\n");
mem = 1024 * 1024;
} }
if (SRF & 0x80) { if (SRF & 0x80) {
/* If DRAM bank switching is enabled, there must be twice as much /* If DRAM bank switching is enabled, there must be twice as much
* memory installed. (4MB on the 5434) */ * memory installed. (4MB on the 5434) */
mem *= 2; mem *= 2;
} }
/* TODO: Handling of GD5446/5480 (see XF86 sources ...) */
return mem; return mem;
DPRINTK ("EXIT\n"); DPRINTK ("EXIT\n");
...@@ -2562,9 +2579,9 @@ static int __init clgen_pci_setup (struct clgenfb_info *info, ...@@ -2562,9 +2579,9 @@ static int __init clgen_pci_setup (struct clgenfb_info *info,
info->fbmem_phys = board_addr; info->fbmem_phys = board_addr;
info->size = board_size; info->size = board_size;
printk (" RAM (%lu MB) at 0x%lx, ", info->size / MB_, board_addr); printk (" RAM (%lu kB) at 0x%lx, ", info->size / KB_, board_addr);
printk (KERN_INFO "Cirrus Logic chipset on PCI bus\n"); printk ("Cirrus Logic chipset on PCI bus\n");
DPRINTK ("EXIT, returning 0\n"); DPRINTK ("EXIT, returning 0\n");
return 0; return 0;
......
...@@ -678,11 +678,11 @@ void prune_icache(int goal) ...@@ -678,11 +678,11 @@ void prune_icache(int goal)
entry = entry->prev; entry = entry->prev;
inode = INODE(tmp); inode = INODE(tmp);
if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK)) if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK))
BUG(); continue;
if (!CAN_UNUSE(inode)) if (!CAN_UNUSE(inode))
continue; continue;
if (atomic_read(&inode->i_count)) if (atomic_read(&inode->i_count))
BUG(); continue;
list_del(tmp); list_del(tmp);
list_del(&inode->i_hash); list_del(&inode->i_hash);
INIT_LIST_HEAD(&inode->i_hash); INIT_LIST_HEAD(&inode->i_hash);
......
This diff is collapsed.
...@@ -41,10 +41,8 @@ static void ufs_read_cylinder (struct super_block * sb, ...@@ -41,10 +41,8 @@ static void ufs_read_cylinder (struct super_block * sb,
struct ufs_cg_private_info * ucpi; struct ufs_cg_private_info * ucpi;
struct ufs_cylinder_group * ucg; struct ufs_cylinder_group * ucg;
unsigned i, j; unsigned i, j;
unsigned swab;
UFSD(("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr)) UFSD(("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr))
swab = sb->u.ufs_sb.s_swab;
uspi = sb->u.ufs_sb.s_uspi; uspi = sb->u.ufs_sb.s_uspi;
ucpi = sb->u.ufs_sb.s_ucpi[bitmap_nr]; ucpi = sb->u.ufs_sb.s_ucpi[bitmap_nr];
ucg = (struct ufs_cylinder_group *)sb->u.ufs_sb.s_ucg[cgno]->b_data; ucg = (struct ufs_cylinder_group *)sb->u.ufs_sb.s_ucg[cgno]->b_data;
...@@ -60,21 +58,21 @@ static void ufs_read_cylinder (struct super_block * sb, ...@@ -60,21 +58,21 @@ static void ufs_read_cylinder (struct super_block * sb,
goto failed; goto failed;
sb->u.ufs_sb.s_cgno[bitmap_nr] = cgno; sb->u.ufs_sb.s_cgno[bitmap_nr] = cgno;
ucpi->c_cgx = SWAB32(ucg->cg_cgx); ucpi->c_cgx = fs32_to_cpu(sb, ucg->cg_cgx);
ucpi->c_ncyl = SWAB16(ucg->cg_ncyl); ucpi->c_ncyl = fs16_to_cpu(sb, ucg->cg_ncyl);
ucpi->c_niblk = SWAB16(ucg->cg_niblk); ucpi->c_niblk = fs16_to_cpu(sb, ucg->cg_niblk);
ucpi->c_ndblk = SWAB32(ucg->cg_ndblk); ucpi->c_ndblk = fs32_to_cpu(sb, ucg->cg_ndblk);
ucpi->c_rotor = SWAB32(ucg->cg_rotor); ucpi->c_rotor = fs32_to_cpu(sb, ucg->cg_rotor);
ucpi->c_frotor = SWAB32(ucg->cg_frotor); ucpi->c_frotor = fs32_to_cpu(sb, ucg->cg_frotor);
ucpi->c_irotor = SWAB32(ucg->cg_irotor); ucpi->c_irotor = fs32_to_cpu(sb, ucg->cg_irotor);
ucpi->c_btotoff = SWAB32(ucg->cg_btotoff); ucpi->c_btotoff = fs32_to_cpu(sb, ucg->cg_btotoff);
ucpi->c_boff = SWAB32(ucg->cg_boff); ucpi->c_boff = fs32_to_cpu(sb, ucg->cg_boff);
ucpi->c_iusedoff = SWAB32(ucg->cg_iusedoff); ucpi->c_iusedoff = fs32_to_cpu(sb, ucg->cg_iusedoff);
ucpi->c_freeoff = SWAB32(ucg->cg_freeoff); ucpi->c_freeoff = fs32_to_cpu(sb, ucg->cg_freeoff);
ucpi->c_nextfreeoff = SWAB32(ucg->cg_nextfreeoff); ucpi->c_nextfreeoff = fs32_to_cpu(sb, ucg->cg_nextfreeoff);
ucpi->c_clustersumoff = SWAB32(ucg->cg_u.cg_44.cg_clustersumoff); ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff);
ucpi->c_clusteroff = SWAB32(ucg->cg_u.cg_44.cg_clusteroff); ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff);
ucpi->c_nclusterblks = SWAB32(ucg->cg_u.cg_44.cg_nclusterblks); ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks);
UFSD(("EXIT\n")) UFSD(("EXIT\n"))
return; return;
...@@ -95,11 +93,9 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) ...@@ -95,11 +93,9 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
struct ufs_cg_private_info * ucpi; struct ufs_cg_private_info * ucpi;
struct ufs_cylinder_group * ucg; struct ufs_cylinder_group * ucg;
unsigned i; unsigned i;
unsigned swab;
UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr)) UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr))
swab = sb->u.ufs_sb.s_swab;
uspi = sb->u.ufs_sb.s_uspi; uspi = sb->u.ufs_sb.s_uspi;
if (sb->u.ufs_sb.s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) { if (sb->u.ufs_sb.s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) {
UFSD(("EXIT\n")) UFSD(("EXIT\n"))
...@@ -116,9 +112,9 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) ...@@ -116,9 +112,9 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
* rotor is not so important data, so we put it to disk * rotor is not so important data, so we put it to disk
* at the end of working with cylinder * at the end of working with cylinder
*/ */
ucg->cg_rotor = SWAB32(ucpi->c_rotor); ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor);
ucg->cg_frotor = SWAB32(ucpi->c_frotor); ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor);
ucg->cg_irotor = SWAB32(ucpi->c_irotor); ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor);
ubh_mark_buffer_dirty (UCPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH);
for (i = 1; i < UCPI_UBH->count; i++) { for (i = 1; i < UCPI_UBH->count; i++) {
brelse (UCPI_UBH->bh[i]); brelse (UCPI_UBH->bh[i]);
......
This diff is collapsed.
...@@ -66,12 +66,10 @@ void ufs_free_inode (struct inode * inode) ...@@ -66,12 +66,10 @@ void ufs_free_inode (struct inode * inode)
struct ufs_cylinder_group * ucg; struct ufs_cylinder_group * ucg;
int is_directory; int is_directory;
unsigned ino, cg, bit; unsigned ino, cg, bit;
unsigned swab;
UFSD(("ENTER, ino %lu\n", inode->i_ino)) UFSD(("ENTER, ino %lu\n", inode->i_ino))
sb = inode->i_sb; sb = inode->i_sb;
swab = sb->u.ufs_sb.s_swab;
uspi = sb->u.ufs_sb.s_uspi; uspi = sb->u.ufs_sb.s_uspi;
usb1 = ubh_get_usb_first(USPI_UBH); usb1 = ubh_get_usb_first(USPI_UBH);
...@@ -93,10 +91,10 @@ void ufs_free_inode (struct inode * inode) ...@@ -93,10 +91,10 @@ void ufs_free_inode (struct inode * inode)
return; return;
} }
ucg = ubh_get_ucg(UCPI_UBH); ucg = ubh_get_ucg(UCPI_UBH);
if (!ufs_cg_chkmagic(ucg)) if (!ufs_cg_chkmagic(sb, ucg))
ufs_panic (sb, "ufs_free_fragments", "internal error, bad cg magic number"); ufs_panic (sb, "ufs_free_fragments", "internal error, bad cg magic number");
ucg->cg_time = SWAB32(CURRENT_TIME); ucg->cg_time = cpu_to_fs32(sb, CURRENT_TIME);
is_directory = S_ISDIR(inode->i_mode); is_directory = S_ISDIR(inode->i_mode);
...@@ -111,16 +109,17 @@ void ufs_free_inode (struct inode * inode) ...@@ -111,16 +109,17 @@ void ufs_free_inode (struct inode * inode)
ubh_clrbit (UCPI_UBH, ucpi->c_iusedoff, bit); ubh_clrbit (UCPI_UBH, ucpi->c_iusedoff, bit);
if (ino < ucpi->c_irotor) if (ino < ucpi->c_irotor)
ucpi->c_irotor = ino; ucpi->c_irotor = ino;
INC_SWAB32(ucg->cg_cs.cs_nifree); fs32_add(sb, &ucg->cg_cs.cs_nifree, 1);
INC_SWAB32(usb1->fs_cstotal.cs_nifree); fs32_add(sb, &usb1->fs_cstotal.cs_nifree, 1);
INC_SWAB32(sb->fs_cs(cg).cs_nifree); fs32_add(sb, &sb->fs_cs(cg).cs_nifree, 1);
if (is_directory) { if (is_directory) {
DEC_SWAB32(ucg->cg_cs.cs_ndir); fs32_sub(sb, &ucg->cg_cs.cs_ndir, 1);
DEC_SWAB32(usb1->fs_cstotal.cs_ndir); fs32_sub(sb, &usb1->fs_cstotal.cs_ndir, 1);
DEC_SWAB32(sb->fs_cs(cg).cs_ndir); fs32_sub(sb, &sb->fs_cs(cg).cs_ndir, 1);
} }
} }
ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (USPI_UBH);
ubh_mark_buffer_dirty (UCPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH);
if (sb->s_flags & MS_SYNCHRONOUS) { if (sb->s_flags & MS_SYNCHRONOUS) {
...@@ -152,7 +151,6 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -152,7 +151,6 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
struct ufs_cylinder_group * ucg; struct ufs_cylinder_group * ucg;
struct inode * inode; struct inode * inode;
unsigned cg, bit, i, j, start; unsigned cg, bit, i, j, start;
unsigned swab;
UFSD(("ENTER\n")) UFSD(("ENTER\n"))
...@@ -163,7 +161,6 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -163,7 +161,6 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
inode = new_inode(sb); inode = new_inode(sb);
if (!inode) if (!inode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
swab = sb->u.ufs_sb.s_swab;
uspi = sb->u.ufs_sb.s_uspi; uspi = sb->u.ufs_sb.s_uspi;
usb1 = ubh_get_usb_first(USPI_UBH); usb1 = ubh_get_usb_first(USPI_UBH);
...@@ -173,7 +170,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -173,7 +170,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
* Try to place the inode in its parent directory * Try to place the inode in its parent directory
*/ */
i = ufs_inotocg(dir->i_ino); i = ufs_inotocg(dir->i_ino);
if (SWAB32(sb->fs_cs(i).cs_nifree)) { if (sb->fs_cs(i).cs_nifree) {
cg = i; cg = i;
goto cg_found; goto cg_found;
} }
...@@ -185,7 +182,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -185,7 +182,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
i += j; i += j;
if (i >= uspi->s_ncg) if (i >= uspi->s_ncg)
i -= uspi->s_ncg; i -= uspi->s_ncg;
if (SWAB32(sb->fs_cs(i).cs_nifree)) { if (sb->fs_cs(i).cs_nifree) {
cg = i; cg = i;
goto cg_found; goto cg_found;
} }
...@@ -199,7 +196,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -199,7 +196,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
i++; i++;
if (i >= uspi->s_ncg) if (i >= uspi->s_ncg)
i = 0; i = 0;
if (SWAB32(sb->fs_cs(i).cs_nifree)) { if (sb->fs_cs(i).cs_nifree) {
cg = i; cg = i;
goto cg_found; goto cg_found;
} }
...@@ -212,7 +209,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -212,7 +209,7 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
if (!ucpi) if (!ucpi)
goto failed; goto failed;
ucg = ubh_get_ucg(UCPI_UBH); ucg = ubh_get_ucg(UCPI_UBH);
if (!ufs_cg_chkmagic(ucg)) if (!ufs_cg_chkmagic(sb, ucg))
ufs_panic (sb, "ufs_new_inode", "internal error, bad cg magic number"); ufs_panic (sb, "ufs_new_inode", "internal error, bad cg magic number");
start = ucpi->c_irotor; start = ucpi->c_irotor;
...@@ -233,14 +230,14 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode) ...@@ -233,14 +230,14 @@ struct inode * ufs_new_inode (const struct inode * dir, int mode)
goto failed; goto failed;
} }
DEC_SWAB32(ucg->cg_cs.cs_nifree); fs32_sub(sb, &ucg->cg_cs.cs_nifree, 1);
DEC_SWAB32(usb1->fs_cstotal.cs_nifree); fs32_sub(sb, &usb1->fs_cstotal.cs_nifree, 1);
DEC_SWAB32(sb->fs_cs(cg).cs_nifree); fs32_sub(sb, &sb->fs_cs(cg).cs_nifree, 1);
if (S_ISDIR(mode)) { if (S_ISDIR(mode)) {
INC_SWAB32(ucg->cg_cs.cs_ndir); fs32_add(sb, &ucg->cg_cs.cs_ndir, 1);
INC_SWAB32(usb1->fs_cstotal.cs_ndir); fs32_add(sb, &usb1->fs_cstotal.cs_ndir, 1);
INC_SWAB32(sb->fs_cs(cg).cs_ndir); fs32_add(sb, &sb->fs_cs(cg).cs_ndir, 1);
} }
ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (USPI_UBH);
......
This diff is collapsed.
This diff is collapsed.
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (C) 1997, 1998 Francois-Rene Rideau <fare@tunes.org> * Copyright (C) 1997, 1998 Francois-Rene Rideau <fare@tunes.org>
* Copyright (C) 1998 Jakub Jelinek <jj@ultra.linux.cz> * Copyright (C) 1998 Jakub Jelinek <jj@ultra.linux.cz>
* Copyright (C) 2001 Christoph Hellwig <hch@caldera.de>
*/ */
#ifndef _UFS_SWAB_H #ifndef _UFS_SWAB_H
...@@ -14,124 +15,119 @@ ...@@ -14,124 +15,119 @@
* in case there are ufs implementations that have strange bytesexes, * in case there are ufs implementations that have strange bytesexes,
* you'll need to modify code here as well as in ufs_super.c and ufs_fs.h * you'll need to modify code here as well as in ufs_super.c and ufs_fs.h
* to support them. * to support them.
*
* WE ALSO ASSUME A REMOTELY SANE ARCHITECTURE BYTESEX.
* We are not ready to confront insane bytesexual perversions where
* conversion to/from little/big-endian is not an involution.
* That is, we require that XeYZ_to_cpu(x) == cpu_to_XeYZ(x)
*
* NOTE that swab macros depend on a variable (or macro) swab being in
* scope and properly initialized (usually from sb->u.ufs_sb.s_swab).
* Its meaning depends on whether the architecture is sane-endian or not.
* For sane architectures, it's a flag taking values UFS_NATIVE_ENDIAN (0)
* or UFS_SWABBED_ENDIAN (1), indicating whether to swab or not.
* For pervert architectures, it's either UFS_LITTLE_ENDIAN or
* UFS_BIG_ENDIAN whose meaning you'll have to guess.
*
* It is important to keep these conventions in synch with ufs_fs.h
* and super.c. Failure to do so (initializing swab to 0 both for
* NATIVE_ENDIAN and LITTLE_ENDIAN) led to nasty crashes on big endian
* machines reading little endian UFSes. Search for "swab =" in super.c.
*
* I also suspect the whole UFS code to trust the on-disk structures
* much too much, which might lead to losing badly when mounting
* inconsistent partitions as UFS filesystems. fsck required (but of
* course, no fsck.ufs has yet to be ported from BSD to Linux as of 199808).
*/ */
#include <linux/ufs_fs.h> enum {
#include <asm/byteorder.h> BYTESEX_LE,
BYTESEX_BE
/* };
* These are only valid inside ufs routines,
* after swab has been initialized to sb->u.ufs_sb.s_swab
*/
#define SWAB16(x) ufs_swab16(swab,x)
#define SWAB32(x) ufs_swab32(swab,x)
#define SWAB64(x) ufs_swab64(swab,x)
/* static __inline u64
* We often use swabing, when we want to increment/decrement some value, fs64_to_cpu(struct super_block *sbp, u64 n)
* so these macros might become handy and increase readability. (Daniel) {
*/ if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
#define INC_SWAB16(x) ((x)=ufs_swab16_add(swab,x,1)) return le64_to_cpu(n);
#define INC_SWAB32(x) ((x)=ufs_swab32_add(swab,x,1))
#define INC_SWAB64(x) ((x)=ufs_swab64_add(swab,x,1))
#define DEC_SWAB16(x) ((x)=ufs_swab16_add(swab,x,-1))
#define DEC_SWAB32(x) ((x)=ufs_swab32_add(swab,x,-1))
#define DEC_SWAB64(x) ((x)=ufs_swab64_add(swab,x,-1))
#define ADD_SWAB16(x,y) ((x)=ufs_swab16_add(swab,x,y))
#define ADD_SWAB32(x,y) ((x)=ufs_swab32_add(swab,x,y))
#define ADD_SWAB64(x,y) ((x)=ufs_swab64_add(swab,x,y))
#define SUB_SWAB16(x,y) ((x)=ufs_swab16_add(swab,x,-(y)))
#define SUB_SWAB32(x,y) ((x)=ufs_swab32_add(swab,x,-(y)))
#define SUB_SWAB64(x,y) ((x)=ufs_swab64_add(swab,x,-(y)))
#if defined(__LITTLE_ENDIAN) || defined(__BIG_ENDIAN) /* sane bytesex */
extern __inline__ __const__ __u16 ufs_swab16(unsigned swab, __u16 x) {
if (swab)
return swab16(x);
else else
return x; return be64_to_cpu(n);
} }
extern __inline__ __const__ __u32 ufs_swab32(unsigned swab, __u32 x) {
if (swab) static __inline u64
return swab32(x); cpu_to_fs64(struct super_block *sbp, u64 n)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return cpu_to_le64(n);
else else
return x; return cpu_to_be64(n);
} }
extern __inline__ __const__ __u64 ufs_swab64(unsigned swab, __u64 x) {
if (swab) static __inline u32
return swab64(x); fs64_add(struct super_block *sbp, u32 *n, int d)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le64(le64_to_cpu(*n)+d);
else else
return x; return *n = cpu_to_be64(be64_to_cpu(*n)+d);
} }
extern __inline__ __const__ __u16 ufs_swab16_add(unsigned swab, __u16 x, __u16 y) {
if (swab) static __inline u32
return swab16(swab16(x)+y); fs64_sub(struct super_block *sbp, u32 *n, int d)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le64(le64_to_cpu(*n)-d);
else else
return x + y; return *n = cpu_to_be64(be64_to_cpu(*n)-d);
} }
extern __inline__ __const__ __u32 ufs_swab32_add(unsigned swab, __u32 x, __u32 y) {
if (swab) static __inline u32
return swab32(swab32(x)+y); fs32_to_cpu(struct super_block *sbp, u32 n)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return le32_to_cpu(n);
else else
return x + y; return be32_to_cpu(n);
} }
extern __inline__ __const__ __u64 ufs_swab64_add(unsigned swab, __u64 x, __u64 y) {
if (swab) static __inline u32
return swab64(swab64(x)+y); cpu_to_fs32(struct super_block *sbp, u32 n)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return cpu_to_le32(n);
else else
return x + y; return cpu_to_be32(n);
} }
#else /* bytesexual perversion -- BEWARE! Read note at top of file! */
extern __inline__ __const__ __u16 ufs_swab16(unsigned swab, __u16 x) { static __inline u32
if (swab == UFS_LITTLE_ENDIAN) fs32_add(struct super_block *sbp, u32 *n, int d)
return le16_to_cpu(x); {
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le32(le32_to_cpu(*n)+d);
else else
return be16_to_cpu(x); return *n = cpu_to_be32(be32_to_cpu(*n)+d);
} }
extern __inline__ __const__ __u32 ufs_swab32(unsigned swab, __u32 x) {
if (swab == UFS_LITTLE_ENDIAN) static __inline u32
return le32_to_cpu(x); fs32_sub(struct super_block *sbp, u32 *n, int d)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le32(le32_to_cpu(*n)-d);
else else
return be32_to_cpu(x); return *n = cpu_to_be32(be32_to_cpu(*n)-d);
} }
extern __inline__ __const__ __u64 ufs_swab64(unsigned swab, __u64 x) {
if (swab == UFS_LITTLE_ENDIAN) static __inline u16
return le64_to_cpu(x); fs16_to_cpu(struct super_block *sbp, u16 n)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return le16_to_cpu(n);
else else
return be64_to_cpu(x); return be16_to_cpu(n);
} }
extern __inline__ __const__ __u16 ufs_swab16_add(unsigned swab, __u16 x, __u16 y) {
return ufs_swab16(swab, ufs_swab16(swab, x) + y); static __inline u16
cpu_to_fs16(struct super_block *sbp, u16 n)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return cpu_to_le16(n);
else
return cpu_to_be16(n);
} }
extern __inline__ __const__ __u32 ufs_swab32_add(unsigned swab, __u32 x, __u32 y) {
return ufs_swab32(swab, ufs_swab32(swab, x) + y); static __inline u16
fs16_add(struct super_block *sbp, u16 *n, int d)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le16(le16_to_cpu(*n)+d);
else
return *n = cpu_to_be16(be16_to_cpu(*n)+d);
} }
extern __inline__ __const__ __u64 ufs_swab64_add(unsigned swab, __u64 x, __u64 y) {
return ufs_swab64(swab, ufs_swab64(swab, x) + y); static __inline u16
fs16_sub(struct super_block *sbp, u16 *n, int d)
{
if (sbp->u.ufs_sb.s_bytesex == BYTESEX_LE)
return *n = cpu_to_le16(le16_to_cpu(*n)-d);
else
return *n = cpu_to_be16(be16_to_cpu(*n)-d);
} }
#endif /* byte sexuality */
#endif /* _UFS_SWAB_H */ #endif /* _UFS_SWAB_H */
This diff is collapsed.
This diff is collapsed.
...@@ -127,7 +127,4 @@ extern size_t strlen(const char *); ...@@ -127,7 +127,4 @@ extern size_t strlen(const char *);
/* Don't build bcopy at all ... */ /* Don't build bcopy at all ... */
#define __HAVE_ARCH_BCOPY #define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMSCAN
#define memscan memchr
#endif /* __ASM_SH_STRING_H */ #endif /* __ASM_SH_STRING_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment