http://linux.bkbits.net/linux-2.5 viro@www.linux.org.uk[torvalds]|ChangeSet|20040922041654|14882 viro # This is a BitKeeper generated diff -Nru style patch. # # drivers/pci/hotplug/rpaphp_pci.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/21 16:53:11-07:00 viro@www.linux.org.uk # [PATCH] cifs: IPv4-related endianness annotations and bugfixes # # missing htons() in assigning .sin_port for reconnect # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:59-07:00 viro@www.linux.org.uk # [PATCH] cifs: assorted endianness bugfixes # # a) Flags2 left little-endian. SMBFLG2_... definitions switched to # cpu_to_le16(...), which kills the need of conversions in ->Flags2. # b) FILE_SYSTEM_UNIX_INFO (never used anywhere) is left little-endian; # when users appear, they can convert themselves. # c) bugfix: in CIFSSessSetup() we used SecurityBlobLength of response # without conversion. That would screw bigendian clients with servers that # give wcnt=4. # d) bugfix: in CIFSNTLMSSPNegotiateSessSetup() we use # SecurityBlob2->NegotiateFlags without conversion. Again, problem on # big-endian. # e) bugfix: SecurityBlob->MessageType is *not* host-endian. # f) bugfix: ->sendmsg() expects its last argument to be equal to sum # of iovec lengths, so the value passed to kernel_sendmsg()/sock_sendmsg() # would better be correct... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:48-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate SESSION_SETUP_ANX # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:36-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TCONX_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:24-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate smb_hdr # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:11-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:02-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:50-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_SYSTEM_DEVICE_INFO # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:38-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:26-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate stat-related structures # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:14-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate fea{,list}, endianness bugfix # # in CIFSSMSetEA() ->list_len got (__u32)cpu_to_le16() instead of cpu_to_le32(). # Broken on big-endian... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:03-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:51-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate file_..._info # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:39-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:27-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # missing le..._to_cpu() in debugging printk # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:16-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:04-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # in CIFSSMBFindSingle() pSMB->TotalParameterCount got wrong value due to typo. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:52-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACT_IOCTL_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:40-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:28-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate NT_RENAME_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:16-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:05-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # missing le16_to_cpu() in debugging printk # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:50-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:38-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate RENAME_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:26-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate LOCK_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:14-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate WRITE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:02-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate READ_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:49-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # in assignment to OPEN_REQ ->SecurityFlags we did u8 = cpu_to_le32(v8), which # breaks on big-endian. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:37-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:25-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:13-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate DELETE_FILE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:01-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate NEGOTIATE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # fs/cifs/netmisc.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +2 -2 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/misc.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +7 -8 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/connect.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +4 -4 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/transport.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +12 -17 # cifs: assorted endianness bugfixes # # fs/cifs/ntlmssp.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +4 -4 # cifs: assorted endianness bugfixes # # fs/cifs/misc.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +2 -2 # cifs: assorted endianness bugfixes # # fs/cifs/connect.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +6 -7 # cifs: assorted endianness bugfixes # # fs/cifs/cifssmb.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +1 -7 # cifs: assorted endianness bugfixes # # fs/cifs/cifspdu.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +10 -10 # cifs: assorted endianness bugfixes # # fs/cifs/cifsencrypt.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +1 -1 # cifs: assorted endianness bugfixes # # fs/cifs/ntlmssp.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +9 -9 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/connect.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +102 -103 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/cifspdu.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +26 -26 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/connect.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +11 -10 # cifs: annotate TCONX_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +7 -7 # cifs: annotate TCONX_{REQ,RESP} # # fs/cifs/transport.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +0 -5 # cifs: annotate smb_hdr # # fs/cifs/netmisc.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +4 -7 # cifs: annotate smb_hdr # # fs/cifs/misc.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +2 -5 # cifs: annotate smb_hdr # # fs/cifs/connect.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate smb_hdr # # fs/cifs/cifssmb.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +2 -6 # cifs: annotate smb_hdr # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +5 -5 # cifs: annotate smb_hdr # # fs/cifs/cifsencrypt.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +1 -3 # cifs: annotate smb_hdr # # fs/cifs/file.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +12 -9 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifssmb.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +0 -9 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +8 -8 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifssmb.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +0 -5 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +3 -3 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifs_debug.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +3 -2 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifssmb.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +0 -4 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/cifs_debug.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +6 -5 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/file.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +24 -29 # cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +9 -9 # cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # fs/cifs/inode.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +20 -21 # cifs: annotate stat-related structures # # fs/cifs/file.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +12 -12 # cifs: annotate stat-related structures # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +46 -46 # cifs: annotate stat-related structures # # fs/cifs/cifssmb.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +14 -16 # cifs: annotate fea{,list}, endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate fea{,list}, endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +0 -1 # cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +19 -19 # cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate file_..._info # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +37 -33 # cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +28 -28 # cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +20 -18 # cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +33 -33 # cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +9 -7 # cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +12 -10 # cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +25 -25 # cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +20 -20 # cifs: annotate TRANSACT_IOCTL_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +56 -56 # cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +22 -22 # cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -3 # cifs: annotate NT_RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -4 # cifs: annotate NT_RENAME_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +89 -85 # cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +21 -21 # cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +6 -7 # cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -4 # cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +28 -28 # cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +4 -3 # cifs: annotate RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +12 -12 # cifs: annotate LOCK_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +11 -10 # cifs: annotate WRITE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +13 -13 # cifs: annotate WRITE_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +7 -7 # cifs: annotate READ_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +15 -15 # cifs: annotate READ_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +10 -10 # cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate DELETE_FILE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate DELETE_FILE_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +5 -4 # cifs: annotate NEGOTIATE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +11 -11 # cifs: annotate NEGOTIATE_{REQ,RESP} # # ChangeSet # 2004/09/21 14:59:49-07:00 chas@cmf.nrl.navy.mil # [ATM]: [he] Make code more readable with list_for_each_entry # # From Domen Puncer # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:59:32-07:00 chas@cmf.nrl.navy.mil +2 -3 # [ATM]: [he] Make code more readable with list_for_each_entry # # From Domen Puncer # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 14:58:34-07:00 chas@cmf.nrl.navy.mil # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/lanai.c # 2004/09/21 14:58:17-07:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +3 -3 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +2 -3 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/firestream.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +1 -2 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 14:28:56-07:00 davem@nuts.davemloft.net # [ATM]: Use __iomem where appropriate. # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/nicstar.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/lanai.c # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/idt77252.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +2 -2 # [ATM]: Use __iomem where appropriate. # # drivers/atm/he.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/firestream.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # ChangeSet # 2004/09/21 14:25:10-07:00 chas@cmd.nrl.navy.mil # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.h # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.c # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstar.h # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstar.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +3 -2 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/lanai.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +5 -5 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +2 -2 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +3 -4 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/he.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +4 -3 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/firestream.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/firestream.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 13:44:36-07:00 davem@nuts.davemloft.net # [SPARC64]: Update compat code for sys_waitid changes. # # Signed-off-by: David S. Miller # # arch/sparc64/kernel/sys_sparc32.c # 2004/09/21 13:44:19-07:00 davem@nuts.davemloft.net +12 -3 # [SPARC64]: Update compat code for sys_waitid changes. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 13:35:49-07:00 davem@nuts.davemloft.net # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_rules.c # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -2 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -10 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/Kconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -10 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/mips/configs/tb0229_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/mips/configs/tb0226_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/arm/configs/ixp4xx_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/arm/configs/ebsa110_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 13:29:32-07:00 davem@nuts.davemloft.net # [IPV4]: Clean up fib_hash.c list handling. # # 1) Use linux/list.h facilities instead of by-hand # list implementation. # # 2) Use fib_alias structure, hung off of fib_node, # to represent routes which all have the same # destination prefix, yet have different TOS and # priority values. # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/21 13:29:03-07:00 davem@nuts.davemloft.net +435 -358 # [IPV4]: Clean up fib_hash.c list handling. # # 1) Use linux/list.h facilities instead of by-hand # list implementation. # # 2) Use fib_alias structure, hung off of fib_node, # to represent routes which all have the same # destination prefix, yet have different TOS and # priority values. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 19:47:47+00:00 jbarnes@sgi.com # [IA64] sn2_defconfig update take 2 # # Please apply this one instead. It turns on mmtimer and increases the number # of sg entries for the LSI driver. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/configs/sn2_defconfig # 2004/09/21 19:45:15+00:00 aegl@agluck-lia64.sc.intel.com +10 -7 # cleanup: turn on mmtimer, increase the number of sg entries for LSI driver # # ChangeSet # 2004/09/21 19:41:02+00:00 gordon.jin@intel.com # [IA64] ia32compat: Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # To emulate these 2 syscalls correctly, we need to guarantee uncached # memory attributes on ia64, which is difficult. The only user of this # interface that we know of is X. So we think it's better to disable it. # # Signed-off-by: Gordon Jin # Signed-off-by: Arun Sharma # Signed-off-by: Tony Luck # # arch/ia64/ia32/sys_ia32.c # 2004/09/21 19:39:33+00:00 aegl@agluck-lia64.sc.intel.com +0 -67 # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # arch/ia64/ia32/ia32_entry.S # 2004/09/21 19:39:32+00:00 aegl@agluck-lia64.sc.intel.com +2 -2 # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # ChangeSet # 2004/09/21 19:38:16+00:00 kevin.tian@intel.com # [IA64] ia32compat: Put signal restorer code on a gate page # # When userland doesn't specify sigaction->sa_restorer, we try to put # the restorer code on the stack. But this breaks ia32 binaries with # non-executable stacks. We now put the restorer code on a gate page. # # Signed-off-by: Kevin Tian # Signed-off-by: Arun Sharma # Signed-off-by: Tony Luck # # include/asm-ia64/ia32.h # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Put signal restorer code on a gate page # # arch/ia64/mm/init.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32priv.h # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +8 -3 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32_support.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +25 -3 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32_signal.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +22 -11 # Put signal restorer code on a gate page # # arch/ia64/ia32/binfmt_elf32.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +39 -0 # Put signal restorer code on a gate page # # ChangeSet # 2004/09/21 07:43:51-07:00 roland@redhat.com # [PATCH] x86-64: waitid fallout # # This patch updates the x86-64's compat code to handle the new argument # to waitid. # # Sorry for the oversight. # # include/linux/syscalls.h # 2004/09/20 12:55:29-07:00 roland@redhat.com +2 -1 # x86-64: waitid fallout # # arch/x86_64/ia32/sys_ia32.c # 2004/09/20 13:01:06-07:00 roland@redhat.com +9 -2 # x86-64: waitid fallout # # ChangeSet # 2004/09/21 07:40:31-07:00 rusty@au1.ibm.com # [PATCH] Warn that ipchains and ipfwadm are going away # # At the recent netfilter workshop in Erlangen, we was decided to remove # the backwards compatibility code for ipchains and ipfwadm. This will # allow significant cleanup of interfaces, since we had to have a # mid-level interface for the backwards compatibility layer to use. # # Start off with a warning for 2.6.9, so any remaining users have a chance # to migrate. Their firewall scripts might not check return values, and # they might get a nasty surprise when this goes away. # # net/ipv4/netfilter/ipfwadm_core.c # 2004/09/20 16:06:18-07:00 rusty@au1.ibm.com +2 -0 # Warn that ipchains and ipfwadm are going away # # net/ipv4/netfilter/ipchains_core.c # 2004/09/20 16:06:07-07:00 rusty@au1.ibm.com +2 -0 # Warn that ipchains and ipfwadm are going away # # ChangeSet # 2004/09/21 07:40:19-07:00 rusty@au1.ibm.com # [PATCH] Another ip_conntrack seq fix: ip_conntrack_expect # # /proc/net/ip_conntrack_expect was changed over to seq_file, but a \n # is missing. # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/19 13:03:50-07:00 rusty@au1.ibm.com +3 -2 # Another ip_conntrack seq fix: ip_conntrack_expect # # ChangeSet # 2004/09/21 07:11:36-07:00 benh@kernel.crashing.org # [PATCH] ppc64: Fix __raw_* IO accessors # # Linus removed the "volatile" statement from the definition of the # __raw_* IO accessors on ppc64, which cause some real bad optisations to # happen in some fbdev's like matroxfb to happen (just imagine that # matroxfb loops reading an IO register waiting for a bit to change). # # The __raw_xxxx() functions still want ordered accesses (they avoid the # byteswap, though) # # Signed-off-by: Benjamin Herrenschmidt # # include/asm-ppc64/io.h # 2004/09/21 02:14:10-07:00 benh@kernel.crashing.org +8 -8 # ppc64: Fix __raw_* IO accessors # # ChangeSet # 2004/09/21 00:55:21-07:00 rth@kanga.twiddle.home # [ALPHA] Add compile-time assert concerning rt_sigframe layout. # # arch/alpha/kernel/signal.c # 2004/09/21 00:55:01-07:00 rth@kanga.twiddle.home +6 -0 # Add compile-time assert concerning rt_sigframe layout. # # ChangeSet # 2004/09/21 00:53:57-07:00 rth@kanga.twiddle.home # Correct prototypes for sys_wait4 and sys_waitpid. # # kernel/exit.c # 2004/09/21 00:53:37-07:00 rth@kanga.twiddle.home +3 -3 # Correct prototypes for sys_wait4 and sys_waitpid. # # include/linux/syscalls.h # 2004/09/21 00:53:37-07:00 rth@kanga.twiddle.home +2 -2 # Correct prototypes for sys_wait4 and sys_waitpid. # # ChangeSet # 2004/09/21 00:53:02-07:00 rth@kanga.twiddle.home # [ALPHA] Fix some compiler warnings from gcc 4. # # include/asm-alpha/unistd.h # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +1 -1 # Fix execve prototype. # # include/asm-alpha/tlbflush.h # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +1 -1 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/srmcons.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +6 -6 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/ptrace.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +10 -9 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/osf_sys.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +4 -4 # Use offsetof for NAME_OFFSET. # Fix some signed/unsigned mismatches. # # ChangeSet # 2004/09/20 13:46:20-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # drivers/serial/sunzilog.c # 2004/09/20 13:46:03-07:00 davem@nuts.davemloft.net +1 -2 # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # drivers/serial/sunsu.c # 2004/09/20 13:46:03-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/20 13:45:14-07:00 davem@nuts.davemloft.net # [SPARC64]: Improve kernel stack backtraces. # # In particular, handle init_task backtraces. # # Signed-off-by: David S. Miller # # arch/sparc64/kernel/traps.c # 2004/09/20 13:44:57-07:00 davem@nuts.davemloft.net +36 -8 # [SPARC64]: Improve kernel stack backtraces. # # In particular, handle init_task backtraces. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/20 21:11:41+01:00 rmk@flint.arm.linux.org.uk # [MMC] Ensure semaphores are initialised before use. Gah. # # drivers/mmc/mmc_queue.c # 2004/09/20 21:08:47+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Ensure semaphores are initialised. # # ChangeSet # 2004/09/20 20:44:59+01:00 rmk@flint.arm.linux.org.uk # [MMC] PXAMCI: enable use of platform specific data. # # This allows platforms to hook in their card detection, power control # and power availability information. # # include/asm-arm/arch-pxa/mmc.h # 2004/09/20 20:42:31+01:00 rmk@flint.arm.linux.org.uk +19 -0 # # include/asm-arm/arch-pxa/mmc.h # 2004/09/20 20:42:31+01:00 rmk@flint.arm.linux.org.uk +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-mmc/include/asm-arm/arch-pxa/mmc.h # # drivers/mmc/pxamci.c # 2004/09/20 20:42:30+01:00 rmk@flint.arm.linux.org.uk +23 -4 # Use platform specific data for initialisation/exit/power setting, etc. # # arch/arm/mach-pxa/generic.c # 2004/09/20 20:42:30+01:00 rmk@flint.arm.linux.org.uk +7 -0 # Add pxa_set_mci_info() to set PXA MMC interface platform specific # data. # # ChangeSet # 2004/09/20 11:47:58-07:00 torvalds@ppc970.osdl.org # ppc32: merge network card Kconfig duplication # # drivers/net/Kconfig # 2004/09/20 11:47:53-07:00 torvalds@ppc970.osdl.org +0 -2 # ppc32: merge network card Kconfig duplication # # ChangeSet # 2004/09/20 14:14:46-04:00 achirica@telefonica.net # [PATCH] Compatibility fixes for different card versions # # drivers/net/wireless/airo.c # 2004/09/15 14:46:09-04:00 achirica@telefonica.net +80 -59 # Compatibility fixes for different card versions # # ChangeSet # 2004/09/20 14:05:51-04:00 romieu@fr.zoreil.com # [PATCH] r8169: default on disabling PCIDAC # # Default to disabling PCI DAC as this option appears unsafe on amd64 # (original suggestion by Hans-Frieder Vogt ). # # The driver will typically report PCI System error when something goes # wrong. The relevant interrupt is not masked any more and the driver # can thus be disabled. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/19 18:16:02-04:00 romieu@fr.zoreil.com +14 -2 # r8169: default on disabling PCIDAC # # ChangeSet # 2004/09/20 18:22:26+01:00 rmk@flint.arm.linux.org.uk # [ARM] Prevent state machine leakage in ARM APM emulation. # # Don't allow threads which are acking a suspend request to leave # the APM ioctl call. This prevents the state machine breaking. # # arch/arm/kernel/apm.c # 2004/09/20 18:19:32+01:00 rmk@flint.arm.linux.org.uk +10 -2 # Don't allow threads which are acking a suspend request to leave # the APM ioctl call. This prevents the state machine breaking. # # ChangeSet # 2004/09/20 21:39:18+10:00 airlied@starflyer.(none) # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/sis.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -2 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +5 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/mga.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -5 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +6 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i915.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +5 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +6 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i810.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +10 -40 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/20 20:07:23+10:00 airlied@starflyer.(none) # drm: complete fix for drm_scatter.h # # Another issue from the macro conversion. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_scatter.h # 2004/09/20 20:02:52+10:00 airlied@starflyer.(none) +1 -1 # drm: complete fix for drm_scatter.h # # Another issue from the macro conversion. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/20 10:21:45+01:00 rmk@flint.arm.linux.org.uk # [MMC] Ensure PXA MMC interrupts are disabled on chip. # # drivers/mmc/pxamci.c # 2004/09/20 10:18:10+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Ensure PXA MMC interrupts are disabled on chip. # # ChangeSet # 2004/09/20 10:07:54+01:00 rmk@flint.arm.linux.org.uk # [MMC] Fix mmc_block suspend/resume handling (again). # # The previous change is not the whole story - the mmc queue # thread may be handling a request. We must wait for outstanding # requests to complete before allowing the suspend to proceed, # otherwise we may suffer loss of data. # # drivers/mmc/mmc_queue.c # 2004/09/20 10:01:42+01:00 rmk@flint.arm.linux.org.uk +55 -10 # Add suspend and resume handling from mmc_block. # Wait for mmcqd to sleep before allowing suspend to complete. # # drivers/mmc/mmc_queue.h # 2004/09/20 09:55:15+01:00 rmk@flint.arm.linux.org.uk +4 -1 # Add mmc_queue_suspend() and mmc_queue_resume() prototypes. # # drivers/mmc/mmc_block.c # 2004/09/20 09:54:15+01:00 rmk@flint.arm.linux.org.uk +2 -10 # Move suspend and resume handling into mmc_queue. # # ChangeSet # 2004/09/19 18:56:22+01:00 rmk@flint.arm.linux.org.uk # [MMC] Fix suspend/resume buglet. # # Block wants the queue spinlock and interrupts disabled for # blk_stop_queue() and blk_start_queue(). # # drivers/mmc/mmc_block.c # 2004/09/19 18:53:20+01:00 rmk@flint.arm.linux.org.uk +8 -0 # block wants the spinlock and interrupts disabled for # blk_stop_queue() and blk_start_queue(). # # ChangeSet # 2004/09/18 12:17:07-07:00 torvalds@ppc970.osdl.org # usb: add host controller __iomem annotations # # drivers/usb/host/ohci.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-hub.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-hcd.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-dbg.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ehci.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ehci-hcd.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +3 -3 # usb: add host controller __iomem annotations # # drivers/usb/core/hcd.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/core/hcd-pci.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # ChangeSet # 2004/09/18 17:47:23+01:00 rmk@flint.arm.linux.org.uk # [MMC] Add v2.x and v3.x CID parsing. # # include/linux/mmc/card.h # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +4 -3 # Add OEM ID. # Make "year" an unsigned short. # Rename mmc_prot to mmca_vsn. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +8 -5 # Manufacturer IDs are 3 bytes. # cid.year is now the real year value. # serial may be full 32-bits. # Add OEM id. # # drivers/mmc/mmc.c # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +86 -27 # Add macro to unstuff bits from CID/CSD. # Add v2.x and v3.x CID parsing. # # ChangeSet # 2004/09/18 09:35:55-07:00 nickpiggin@yahoo.com.au # [PATCH] fix missing unlock_page in mm/rmap.c # # A required unlock_page will be missed in a very rare (but possible) race # condition. Acked by Hugh, who says: # # It'll be hard to hit because of the additional page_mapped test above, # with truncate unmapping ptes from mms before it advances to removing # pages from cache; but nothing to prevent it happening. # # Signed-off-by: Nick Piggin # Signed-off-by: Hugh Dickins # Signed-off-by: Linus Torvalds # # mm/rmap.c # 2004/09/18 03:46:41-07:00 nickpiggin@yahoo.com.au +3 -2 # fix missing unlock_page in mm/rmap.c # # ChangeSet # 2004/09/18 16:32:07+01:00 rmk@flint.arm.linux.org.uk # [MMC] Clean up MMC card CID/CSD decoding, stage 1. # # Now that the raw CSD and CID information are available in mmc_card, # there's little point not passing the mmc_card structure into the # decode functions themselves. # # This will be necessary, since there's several different formats of # CID decode, and the format appears to depend on data in the CSD. # # If we are unable to decode the CID or CSD, we can mark the card bad # and refuse to bind it to any drivers. Users can then retrieve the # raw undecoded CID and CSD from sysfs for debugging purposes. # # include/linux/mmc/card.h # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +9 -3 # Add MMC_STATE_BAD. # Document MMC_STATE_xxx. # Add mmc_card_set_XXX() macros. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +3 -2 # Don't allow "bad" cards to match with drivers. # # drivers/mmc/mmc.c # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +14 -9 # Use mmc_card_set_XXX macros. # Only pass mmc_card pointer into mmc_decode_XXX functions. # # ChangeSet # 2004/09/18 16:06:51+01:00 rmk@flint.arm.linux.org.uk # [MMC] Export raw MMC card CID and CSD registers via device model. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 16:04:14+01:00 rmk@flint.arm.linux.org.uk +8 -2 # Export raw MMC card CID and CSD registers. # # ChangeSet # 2004/09/18 15:38:44+01:00 rmk@flint.arm.linux.org.uk # [MMC] Save MMC card raw CSD structure. # # include/linux/mmc/card.h # 2004/09/18 15:36:34+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Add raw_csd. # # drivers/mmc/mmc.c # 2004/09/18 15:36:33+01:00 rmk@flint.arm.linux.org.uk +2 -0 # Save MMC raw CSD. # # ChangeSet # 2004/09/18 10:50:57+01:00 rmk@flint.arm.linux.org.uk # [MMC] Use raw CID rather than decoded CID # # Save the raw CID information, and use this to match cards # with their corresponding mmc_card structure. Different # protocol revisions have different CID formats. # # include/linux/mmc/card.h # 2004/09/18 10:47:27+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Add raw_cid to save the cards raw CID information. # # drivers/mmc/mmc.c # 2004/09/18 10:46:47+01:00 rmk@flint.arm.linux.org.uk +9 -12 # Save the raw CID information, and use this to match # cards with their corresponding mmc_card structure. # # ChangeSet # 2004/09/17 23:20:35-07:00 herbert@gondor.apana.org.au # [IPV4]: Size fib_info_devhash[] correctly. # # There is a thinko in the allocation for the devindex hash. We're # only giving it 8 elements when it should be 1<<8 elements. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 23:20:17-07:00 herbert@gondor.apana.org.au +3 -2 # [IPV4]: Size fib_info_devhash[] correctly. # # There is a thinko in the allocation for the devindex hash. We're # only giving it 8 elements when it should be 1<<8 elements. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 23:17:16-07:00 davem@nuts.davemloft.net # [IPV4]: Fix BUG triggered in fib_sync_down() # # If you modload then unload a network device, # without creating any ipv4 routes, it is possible # for the laddr hash to be not allocated yet # in fib_semantics. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 23:16:44-07:00 davem@nuts.davemloft.net +1 -3 # [IPV4]: Fix BUG triggered in fib_sync_down() # # If you modload then unload a network device, # without creating any ipv4 routes, it is possible # for the laddr hash to be not allocated yet # in fib_semantics. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 15:17:53-07:00 davem@nuts.davemloft.net # [XFRM] make xfrm_lookup() fully af-independent. # # Simplified from 2 patches by Hideaki YOSHIFUJI # # # Signed-off-by: David S. Miller # # net/xfrm/xfrm_policy.c # 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +6 -20 # [XFRM] make xfrm_lookup() fully af-independent. # # net/ipv4/route.c # 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +13 -8 # [XFRM] make xfrm_lookup() fully af-independent. # # ChangeSet # 2004/09/17 14:27:00-07:00 torvalds@ppc970.osdl.org # fb: add __iomem annotations to cfbfillrect # # drivers/video/cfbfillrect.c # 2004/09/17 14:26:53-07:00 torvalds@ppc970.osdl.org +8 -8 # fb: add __iomem annotations to cfbfillrect # # ChangeSet # 2004/09/17 13:54:21-07:00 torvalds@ppc970.osdl.org # fb: add __iomem annotations to cfbcopyarea # # drivers/video/cfbcopyarea.c # 2004/09/17 13:54:15-07:00 torvalds@ppc970.osdl.org +7 -6 # fb: add __iomem annotations to cfbcopyarea # # ChangeSet # 2004/09/17 13:52:54-07:00 torvalds@ppc970.osdl.org # sym53c8xx_2: remove unnecessary IO pointer casts # # They just meant that the __iomem annotation couldn't shine # through. # # drivers/scsi/sym53c8xx_2/sym_glue.h # 2004/09/17 13:52:48-07:00 torvalds@ppc970.osdl.org +17 -17 # sym53c8xx_2: remove unnecessary IO pointer casts # # They just meant that the __iomem annotation couldn't shine # through. # # ChangeSet # 2004/09/17 13:36:24-07:00 torvalds@ppc970.osdl.org # Do __iomem annotations on VGA state handling # # include/video/vga.h # 2004/09/17 13:36:17-07:00 torvalds@ppc970.osdl.org +23 -23 # Do __iomem annotations on VGA state handling # # drivers/video/vgastate.c # 2004/09/17 13:36:17-07:00 torvalds@ppc970.osdl.org +6 -6 # Do __iomem annotations on VGA state handling # # ChangeSet # 2004/09/17 13:20:32-07:00 torvalds@ppc970.osdl.org # ppc64: Need to define HPAGE_SHIFT even when HUGETLB_PAGE not configured. # # Required for the recent removal of LARGE_PAGE_SHIFT. # # include/asm-ppc64/page.h # 2004/09/17 13:20:26-07:00 torvalds@ppc970.osdl.org +3 -2 # ppc64: Need to define HPAGE_SHIFT even when HUGETLB_PAGE not configured. # # Required for the recent removal of LARGE_PAGE_SHIFT. # # ChangeSet # 2004/09/17 13:00:30-07:00 trond.myklebust@fys.uio.no # [PATCH] __iomem fixups for atiixp soundcards # # Signed-off-by: Trond Myklebust # Signed-off-by: Linus Torvalds # # sound/pci/atiixp_modem.c # 2004/09/17 12:35:39-07:00 trond.myklebust@fys.uio.no +4 -4 # __iomem fixups for atiixp soundcards # # sound/pci/atiixp.c # 2004/09/17 12:36:56-07:00 trond.myklebust@fys.uio.no +4 -4 # __iomem fixups for atiixp soundcards # # ChangeSet # 2004/09/17 20:47:08+01:00 rmk@flint.arm.linux.org.uk # [ARM] i8042 is available on many footbridge hosts, not just ARCH_EBSA285 # # drivers/input/serio/Kconfig # 2004/09/17 20:44:36+01:00 rmk@flint.arm.linux.org.uk +1 -1 # i8042 is available on many footbridge hosts, not just ARCH_EBSA285 # # ChangeSet # 2004/09/17 12:31:05-07:00 torvalds@ppc970.osdl.org # remove i2o_core.c # # It is unused and obsolete. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-i2o_core.c~f0bce42e2ab89fa2 # 2004/09/17 12:30:26-07:00 torvalds@ppc970.osdl.org +0 -0 # Delete: drivers/message/i2o/i2o_core.c # # ChangeSet # 2004/09/17 12:17:54-07:00 wli@holomorphy.com # [PATCH] sparc32: vmalloc address fix # # Resolves the framebuffer errors on some older sparc32s (we triggered it on # a SparcStation 2). # # Signed-off-by: William Irwin # Signed-off-by: Tom 'spot' Callaway # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/vaddrs.h # 2004/09/17 00:08:17-07:00 wli@holomorphy.com +2 -2 # sparc32: vmalloc address fix # # ChangeSet # 2004/09/17 12:17:43-07:00 akpm@osdl.org # [PATCH] remove sh64 smplock.h # # It is unused and obsolete. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-smplock.h~91780a6b9e38c552 # 2004/09/17 12:17:36-07:00 akpm@osdl.org +0 -0 # Delete: include/asm-sh64/smplock.h # # ChangeSet # 2004/09/17 12:17:28-07:00 holt@sgi.com # [PATCH] Fix write() return values for reiserfs. # # This patch fixes the direct I/O return value for reiserfs writes to be # ssize_t instead of int. # # Signed-off-by: Robin Holt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/reiserfs/file.c # 2004/09/17 00:08:17-07:00 holt@sgi.com +2 -2 # Fix write() return values for reiserfs. # # ChangeSet # 2004/09/17 12:17:17-07:00 holt@sgi.com # [PATCH] Fix write() return values for tmpfs. # # This patch makes the return from the write() syscall actually an ssize_t # instead of an int. # # Signed-off-by: Robin Holt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/17 00:08:17-07:00 holt@sgi.com +1 -1 # Fix write() return values for tmpfs. # # ChangeSet # 2004/09/17 12:17:02-07:00 mingo@elte.hu # [PATCH] tune vmalloc size # # There are a few devices that use lots of ioremap space. vmalloc space is a # showstopper problem for them. # # this patch adds the vmalloc= boot parameter to override # __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m # doubles the size. # # Signed-off-by: Ingo Molnar # Signed-off-by: Arjan van de Ven # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/vmalloc.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +2 -0 # tune vmalloc size # # include/asm-i386/page.h # 2004/09/17 00:07:34-07:00 mingo@elte.hu +3 -3 # tune vmalloc size # # arch/i386/mm/init.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +2 -0 # tune vmalloc size # # arch/i386/kernel/setup.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +8 -0 # tune vmalloc size # # arch/i386/boot/setup.S # 2004/09/17 00:07:34-07:00 mingo@elte.hu +1 -1 # tune vmalloc size # # Documentation/kernel-parameters.txt # 2004/09/17 00:07:36-07:00 mingo@elte.hu +11 -0 # tune vmalloc size # # ChangeSet # 2004/09/17 12:16:50-07:00 akpm@osdl.org # [PATCH] bio_alloc() cleanup # # de-spaghettify this function. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/bio.c # 2004/09/17 00:07:33-07:00 akpm@osdl.org +17 -21 # bio_alloc() cleanup # # ChangeSet # 2004/09/17 12:16:36-07:00 dsaxena@plexity.net # [PATCH] Add MTD map driver for Intel IXP2000 NPU # # The following patch adds the MTD map driver for Intel's IXP2000 NPU. The # driver is already in MTD CVS and I've gotten the OK from David to push it # upstream. # # Missing Kconfig bits from Lennert Buytenhek # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/mtd/maps/ixp2000.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +281 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/Makefile # 2004/09/17 00:07:07-07:00 dsaxena@plexity.net +1 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/Kconfig # 2004/09/17 00:07:11-07:00 dsaxena@plexity.net +9 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/ixp2000.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/drivers/mtd/maps/ixp2000.c # # ChangeSet # 2004/09/17 12:16:21-07:00 dsaxena@plexity.net # [PATCH] Update IXP4xx MTD driver from CVS MTD # # The following patch updates the IXP4xx MTD driver with a compile fix from # the CVS repository. David has given me the OK to push this upstream. # # Signed-off-by: Deepak Saxena # Signed-off-by: David Woodhouse # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/mtd/maps/ixp4xx.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +4 -2 # Update IXP4xx MTD driver from CVS MTD # # ChangeSet # 2004/09/17 12:16:07-07:00 dsaxena@plexity.net # [PATCH] Document ARM pci=firmware option # # Added a new pci= command line option specific to ARM systems in # -rc2 and it should be added to kernel-parameters.txt. # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # Documentation/kernel-parameters.txt # 2004/09/17 00:27:56-07:00 dsaxena@plexity.net +7 -0 # Document ARM pci=firmware option # # ChangeSet # 2004/09/17 12:15:53-07:00 clameter@sgi.com # [PATCH] time interpolators logic fix # # Report the resolution of the time source correctly for time interpolators # with a frequency over 1 Ghz. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/timer.c # 2004/09/17 00:07:06-07:00 clameter@sgi.com +4 -1 # time interpolators logic fix # # ChangeSet # 2004/09/17 12:15:40-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed do_signal in arch/mips/kernel/signal.c # # The change of get_signal_to_deliver() is followed. # # Signed-off-by: Yoichi Yuasa # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/mips/kernel/signal.c # 2004/09/17 00:07:06-07:00 yuasa@hh.iij4u.or.jp +4 -5 # mips: fixed do_signal in arch/mips/kernel/signal.c # # ChangeSet # 2004/09/17 12:15:26-07:00 killekulla@rdrz.de # [PATCH] ide: remove obsolete CONFIG_BLK_DEV_ADMA # # In drivers/ide/Kconfig there's a hidden config-item named BLK_DEV_ADMA. # Nowhere in the sources are any references to this item, so this option # simply is obsolete. # # This patch removes the according item from drivers/ide/Kconfig. # # Signed-off-by: Raphael Zimmerer # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/ide/Kconfig # 2004/09/17 00:07:05-07:00 killekulla@rdrz.de +0 -5 # ide: remove obsolete CONFIG_BLK_DEV_ADMA # # ChangeSet # 2004/09/17 12:15:12-07:00 jdike@addtoit.com # [PATCH] uml: update defconfig # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/defconfig # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +12 -4 # uml: update defconfig # # ChangeSet # 2004/09/17 12:14:58-07:00 jdike@addtoit.com # [PATCH] uml: code cleanup # # Here's another batch of "obviously harmless" changes: # comments # unsigned long -> __u32 changes for some data that needs to be 32 bits # cleanups # removal of an unused declaration # rearrangement of includes # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/user_util.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +1 -1 # uml: code cleanup # # arch/um/kernel/um_arch.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -1 # uml: code cleanup # # arch/um/kernel/uaccess_user.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +1 -1 # uml: code cleanup # # arch/um/include/user_util.h # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -1 # uml: code cleanup # # arch/um/drivers/hostaudio_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +18 -29 # uml: code cleanup # # arch/um/drivers/cow_user.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -2 # uml: code cleanup # # arch/um/drivers/chan_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -0 # uml: code cleanup # # ChangeSet # 2004/09/17 12:14:45-07:00 jdike@addtoit.com # [PATCH] uml: remove useless ioctls # # The UML block driver had some useless ioctls in it somehow. This gets rid of # them. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/ubd_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -27 # uml: remove useless ioctls # # ChangeSet # 2004/09/17 12:14:33-07:00 jdike@addtoit.com # [PATCH] uml: network driver fixes # # This is from Gerd Knorr. It fixes a network hang caused by the host side of # an interface being full when the UML interface is brought up, preventing any # SIGIOs from happening. It also implements an ioctl needed for ethtool. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/net_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +33 -1 # uml: network driver fixes # # ChangeSet # 2004/09/17 12:14:19-07:00 jdike@addtoit.com # [PATCH] uml: mconsole fixes and cleanups # # This patch # makes a couple of functions static # tidies code a bit # sends a response on shutdown before the shutdown happens # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/mconsole_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +8 -8 # uml: mconsole fixes and cleanups # # ChangeSet # 2004/09/17 12:14:08-07:00 jdike@addtoit.com # [PATCH] uml: more EINTR protection # # This adds retrying on EINTR to a couple more places. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/helper.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -2 # uml: more EINTR protection # # ChangeSet # 2004/09/17 12:13:53-07:00 jdike@addtoit.com # [PATCH] uml: get rid of the arch EXTRAVERSION # # I thought this was gone already. It was only intended for my own patch # numbering, and never intended for any other trees. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Makefile # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +0 -2 # uml: get rid of the arch EXTRAVERSION # # ChangeSet # 2004/09/17 12:13:41-07:00 jdike@addtoit.com # [PATCH] uml: clean up terminal state handling # # This patch cleans up UML's handling of terminal state with better error # handling, interface cleanup, and some code tidying. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/user_util.c # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +4 -13 # uml: clean up terminal state handling # # arch/um/kernel/sigio_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -1 # uml: clean up terminal state handling # # arch/um/include/user_util.h # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +3 -4 # uml: clean up terminal state handling # # arch/um/drivers/xterm.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +13 -2 # uml: clean up terminal state handling # # arch/um/drivers/tty.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +8 -3 # uml: clean up terminal state handling # # arch/um/drivers/pty.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +17 -6 # uml: clean up terminal state handling # # arch/um/drivers/port_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +8 -3 # uml: clean up terminal state handling # # arch/um/drivers/fd.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +14 -3 # uml: clean up terminal state handling # # ChangeSet # 2004/09/17 12:13:30-07:00 jdike@addtoit.com # [PATCH] uml: restrict tlb flushing # # One of UML's tlb flushing routines was ignoring the address range passed in by # its callers. This patch fixes that. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/tlb.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +1 -1 # uml: restrict tlb flushing # # ChangeSet # 2004/09/17 12:13:18-07:00 jdike@addtoit.com # [PATCH] uml: export memmove # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/user_syms.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -0 # uml: export memmove # # ChangeSet # 2004/09/17 12:13:02-07:00 jdike@addtoit.com # [PATCH] uml: comment UML's signal handling # # This adds a couple of comments so that people don't get confused into making # misguided fixes, and I don't get confused into applying them. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/signal_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +11 -0 # uml: comment UML's signal handling # # ChangeSet # 2004/09/17 12:12:48-07:00 jdike@addtoit.com # [PATCH] uml: copy_user fixes # # This patch fixes some copy_user bugs: # # - kernelspace page faults that happen on behalf of a process are now # correctly handled # # - add copy_user treatment so a fault handler which looks at the faulting # instruction # # - added a note to do the same with the ldt stuff some day # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/ldt.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -0 # uml: copy_user fixes # # arch/um/sys-i386/bugs.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +4 -3 # uml: copy_user fixes # # arch/um/kernel/user_util.c # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +16 -0 # uml: copy_user fixes # # arch/um/kernel/skas/uaccess.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +44 -13 # uml: copy_user fixes # # arch/um/include/user_util.h # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +1 -0 # uml: copy_user fixes # # ChangeSet # 2004/09/17 12:12:33-07:00 jdike@addtoit.com # [PATCH] uml: fix call to sys_clone # # This patch changes the calling convention of clone on i386 to match that of # the host by leaving the fourth argument unused. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/syscalls.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +22 -0 # uml: fix call to sys_clone # # arch/um/kernel/syscall_kern.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +0 -11 # uml: fix call to sys_clone # # ChangeSet # 2004/09/17 12:12:22-07:00 jdike@addtoit.com # [PATCH] uml: iomem fix # # This patch rounds up the size of a file used for iomem emulation up to the # nearest page. This makes mmap work much better on the last page of the # file. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/mem_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +4 -2 # uml: iomem fix # # ChangeSet # 2004/09/17 12:12:07-07:00 jdike@addtoit.com # [PATCH] uml: eliminate signal order delivery dependency # # On 2.4 hosts signals are delivered in numeric order when there are multiple # pending at a given time. UML developed a subtle dependency on this # ordering, which broke on 2.6 hosts and the separate process and thread # signal queues. # # This patch eliminates that dependency. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -4 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/trap_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -2 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/process_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +17 -1 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/exec_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +3 -0 # uml: eliminate signal order delivery dependency # # arch/um/kernel/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -1 # uml: eliminate signal order delivery dependency # # ChangeSet # 2004/09/17 12:11:55-07:00 jdike@addtoit.com # [PATCH] uml: let page faults always be delivered immediately # # This allows page faults to be delivered when they happen. Without this, it # can happen that a page fault will occur when SIGSEGV is disabled, and the # host will then just kill UML because it can't invoke the handler. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/tt/trap_user.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +7 -0 # uml: let page faults always be delivered immediately # # arch/um/kernel/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +1 -5 # uml: let page faults always be delivered immediately # # ChangeSet # 2004/09/17 12:11:41-07:00 jdike@addtoit.com # [PATCH] uml: cleaning up # # This patch is a whole lot of "obviously won't break anything" changes, # including # renaming the UML console functions more consistently # notes to myself # code movement # making some functions static # error path cleanup # printk fixes # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/ptrace_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/os-Linux/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +2 -2 # uml: cleaning up # # arch/um/os-Linux/file.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/kernel/user_util.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +6 -6 # uml: cleaning up # # arch/um/kernel/umid.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +6 -3 # uml: cleaning up # # arch/um/kernel/tt/tracer.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/kernel/tt/process_kern.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +17 -0 # uml: cleaning up # # arch/um/kernel/skas/process_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +23 -0 # uml: cleaning up # # arch/um/kernel/skas/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -22 # uml: cleaning up # # arch/um/kernel/sigio_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +8 -4 # uml: cleaning up # # arch/um/kernel/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +0 -10 # uml: cleaning up # # arch/um/drivers/xterm.c # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +1 -0 # uml: cleaning up # # arch/um/drivers/stdio_console.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +6 -6 # uml: cleaning up # # ChangeSet # 2004/09/17 12:11:29-07:00 jdike@addtoit.com # [PATCH] uml: convert the real-time clock to gettimeofday from rdtsc # # There are a whole bunch of reasons to use gettimeofday rather than rdtsc, # so this patch does just that. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/Makefile # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -1 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/os-Linux/time.c # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +21 -0 # # arch/um/os-Linux/Makefile # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -2 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/kernel/time_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +16 -14 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/kernel/time.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -38 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/include/os.h # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -0 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/os-Linux/time.c # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/um/os-Linux/time.c # # BitKeeper/deleted/.del-time.c~800319bd3e32c1aa # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +0 -0 # Delete: arch/um/sys-i386/time.c # # ChangeSet # 2004/09/17 12:10:46-07:00 jdike@addtoit.com # [PATCH] uml: enable the timer *after* the timer handler # # Otherwise, we'll sometimes get timer interrupts that we can't handle. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/process_kern.c # 2004/09/17 12:10:40-07:00 jdike@addtoit.com +1 -1 # uml: enable the timer *after* the timer handler # # ChangeSet # 2004/09/17 12:10:32-07:00 jdike@addtoit.com # [PATCH] uml: fix a signal race # # This patch saves and restores UML's idea of user mode across an interrupt. # Without this, an interrupt arriving at the wrong time can cause UML to lose # track of whether an interrupted handler is handing a userspace interrupt. # # From: Ingo Molnar # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/trap_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +3 -0 # uml: fix a signal race # # ChangeSet # 2004/09/17 12:10:21-07:00 jdike@addtoit.com # [PATCH] uml: finish the signals across a reboot fix # # Due to me not refreshing this patch earlier, the last reboot signals patch was # missing the actual fix. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/main.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +14 -0 # uml: finish the signals across a reboot fix # # ChangeSet # 2004/09/17 12:10:06-07:00 jdike@addtoit.com # [PATCH] uml: finish conversion to sigjmp_buf/siglongjmp # # UML needs to use siglongjmp instead of longjmp everywhere. This patch fixes # the remaining longjmp/jmp_buf occurrences. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/uaccess_user.c # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/tt/uaccess_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/trap_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/skas/process.c # 2004/09/17 12:09:59-07:00 jdike@addtoit.com +7 -7 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/process.c # 2004/09/17 12:09:59-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # ChangeSet # 2004/09/17 12:09:54-07:00 jdike@addtoit.com # [PATCH] uml: update handle_IRQ_event # # A small update to make UML's handle_IRQ_event look like the i386 version. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/irq.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +3 -2 # uml: update handle_IRQ_event # # ChangeSet # 2004/09/17 12:09:41-07:00 jbarnes@engr.sgi.com # [PATCH] fix sysrq handling bug in sn_console.c # # Fix a stupid bug in the sysrq handling in sn_console.c. Instead of eating # all characters in the sysrq string (preventing them from getting to the tty # layer), only eat those following 'ESC' since that's a pretty important # character for various things. Please apply before 2.6.9 is released as the # console is very unfriendly to use without it. # # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/serial/sn_console.c # 2004/09/17 00:07:02-07:00 jbarnes@engr.sgi.com +7 -4 # fix sysrq handling bug in sn_console.c # # ChangeSet # 2004/09/17 12:09:26-07:00 paulmck@us.ibm.com # [PATCH] Updates to RCU documentation # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # Documentation/RCU/rcu.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +22 -11 # Updates to RCU documentation # # Documentation/RCU/listRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +9 -3 # Updates to RCU documentation # # Documentation/RCU/arrayRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +141 -0 # Updates to RCU documentation # # Documentation/RCU/UP.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +2 -2 # Updates to RCU documentation # # Documentation/RCU/RTFP.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +36 -1 # Updates to RCU documentation # # Documentation/RCU/arrayRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/Documentation/RCU/arrayRCU.txt # # ChangeSet # 2004/09/17 12:09:12-07:00 zwane@linuxpower.ca # [PATCH] Close race with preempt and modular pm_idle callbacks # # The following patch from Shaohua Li fixes a race with preempt enabled when # a module containing a pm_idle callback is unloaded. Cached values in local # variables need to be protected as RCU critical sections so that the # synchronize_kernel() call in the unload path waits for all processors. # There original bugzilla entry can be found at # # Shaohua, i had to make a small change (variable declaration after code in # code block) so that it compiles with geriatric compilers such as the ones # Andrew is attached to ;) # # http://bugzilla.kernel.org/show_bug.cgi?id=1716 # # Signed-off-by: Li Shaohua # Signed-off-by: Zwane Mwaikambo # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/acpi/processor.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +5 -0 # Close race with preempt and modular pm_idle callbacks # # arch/x86_64/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +13 -4 # Close race with preempt and modular pm_idle callbacks # # arch/ia64/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +12 -4 # Close race with preempt and modular pm_idle callbacks # # arch/i386/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +9 -1 # Close race with preempt and modular pm_idle callbacks # # arch/i386/kernel/apm.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +8 -1 # Close race with preempt and modular pm_idle callbacks # # ChangeSet # 2004/09/17 12:08:57-07:00 clameter@sgi.com # [PATCH] device driver for the SGI system clock, mmtimer # # SGI has been using this driver under Linux since 2001 but it was # never included in the upstream kernel. SuSE did include the patch for mmtimer # in SLES 9. The driver has been widely used for applications on the Altix # platform. # # The timer hardware was designed around the multimedia timer specification by # Intel but to my knowledge only SGI has implemented that standard. The driver # was written by Jesse Barnes. # # The second revision has interrupt support removed and was somewhat simplified # by removing one include file. # # Signed-off-by: Christoph Lameter # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/mmtimer.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +140 -0 # device driver for the SGI system clock, mmtimer # # include/linux/mmtimer.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/linux/mmtimer.h # # include/linux/miscdevice.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +1 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/mmtimer.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +198 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/Makefile # 2004/09/17 00:07:02-07:00 clameter@sgi.com +1 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/Kconfig # 2004/09/17 00:07:01-07:00 clameter@sgi.com +8 -0 # device driver for the SGI system clock, mmtimer # # arch/ia64/sn/kernel/setup.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +2 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/mmtimer.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/drivers/char/mmtimer.c # # ChangeSet # 2004/09/17 12:08:43-07:00 takata@linux-m32r.org # [PATCH] m32r: fix to build SMP kernel # # Here is a patch to fix compile errors to build SMP kernel for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +2 -26 # m32r: fix to build SMP kernel # # arch/m32r/kernel/smp.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +15 -6 # m32r: fix to build SMP kernel # # ChangeSet # 2004/09/17 12:08:28-07:00 takata.hirokazu@renesas.com # [PATCH] m32r: upgrade include/asm-m32r/atomic.h # # Upgrade include/asm-m32r/atomic.h. # # * include/asm-m32r/atomic.h # # - Change atomic_add(), atomic_sub(), atomic_inc() and atomic_dec() from # function to macro. # # - Change not to use fixed woking register in atomic_clear_mask() and # atomic_set_mask(). # # - Update comments: "return" to "return it", and so on. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/atomic.h # 2004/09/17 00:07:01-07:00 takata.hirokazu@renesas.com +53 -127 # m32r: upgrade include/asm-m32r/atomic.h # # ChangeSet # 2004/09/17 12:08:15-07:00 takata@linux-m32r.org # [PATCH] m32r: slim arch/m32r/Kconfig # # Here is a patch to slim arch/m32r/Kconfig. Useless CONFIG_ options are # removed for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/Kconfig # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +2 -180 # m32r: slim arch/m32r/Kconfig # # ChangeSet # 2004/09/17 12:08:01-07:00 takata@linux-m32r.org # [PATCH] m32r: modify drivers/net/ne.c for m32r # # This patch updates drivers/net/ne.c and merges m32r support to it. # # - Add m32r support. # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/ne.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +29 -1 # m32r: modify drivers/net/ne.c for m32r # # drivers/net/Kconfig # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # drivers/net/8390.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +10 -0 # m32r: modify drivers/net/ne.c for m32r # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # ChangeSet # 2004/09/17 12:07:47-07:00 takata@linux-m32r.org # [PATCH] m32r: modify drivers/net/smc91x.c for m32r # # This patch updates drivers/net/smc91x.c and merges m32r support to it. # # - Add m32r support. # # - Modify for SMP kernel. # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/smc91x.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -0 # m32r: modify drivers/net/smc91x.c for m32r # # drivers/net/smc91x.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +19 -10 # m32r: modify drivers/net/smc91x.c for m32r # # drivers/net/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_opsput.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_mappi2.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/io_mappi2.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -10 # m32r: modify drivers/net/smc91x.c for m32r # # ChangeSet # 2004/09/17 12:07:32-07:00 takata@linux-m32r.org # [PATCH] m32r: remove network drivers # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/drivers/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -2 # m32r: remove network drivers # # arch/m32r/drivers/Kconfig # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -8 # m32r: remove network drivers # # BitKeeper/deleted/.del-smc91111.readme.txt~3baef675d80c752a # 2004/09/17 12:07:26-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.readme.txt # # BitKeeper/deleted/.del-smc91111.h~dd904e77d0832d6f # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.h # # BitKeeper/deleted/.del-smc91111.c~bbd86edfa73a711f # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.c # # BitKeeper/deleted/.del-smc91111.copying~ff130d9d85afe5b4 # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.copying # # BitKeeper/deleted/.del-mappi_ne.c~60956c35ffc19393 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/mappi_ne.c # # BitKeeper/deleted/.del-8390.h~49ba18e09c7c1f97 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/8390.h # # BitKeeper/deleted/.del-8390.c~10decee4a025afd6 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/8390.c # # ChangeSet # 2004/09/17 12:07:16-07:00 takata@linux-m32r.org # [PATCH] m32r: modify IO routines for m32700ut CF access # # Here is a patch for M3T-M32700UT board. # # - Enable CF access through card-service if CONFIG_M32R_CFC is not defined. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/io_m32700ut.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -13 # m32r: modify IO routines for m32700ut CF access # # ChangeSet # 2004/09/17 12:07:00-07:00 takata@linux-m32r.org # [PATCH] m32r: support a new bootloader "m32r-g00ff" # # - Support new bootloader "m32r-g00ff". m32r-g00ff is newly written by # NIIBE Yutaka and is released under GPL. # http://www.gniibe.org/software/m32r-g00ff-20040729.tar.gz # # - arch/m32r/kernel/setup.c (parse_mem_cmdline): Fix to remove unused # region at the end of memory. # # - include/asm-m32r/uaccess.h (__put_user_u64): Fix to remove warnings in # compilation time. # # NOTE: (for m32r users) # From this version, the bootloader-kernel interface has changed. # - Section order is changed and rearranged for the new bootloader. # - Kernel's entry address is also changed : 0x08001000 --> 0x08002000. # - Paramter-passing method from bootloader to kernel is revised. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/uaccess.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +8 -12 # m32r: support a new bootloader "m32r-g00ff" # # include/asm-m32r/types.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +9 -2 # m32r: support a new bootloader "m32r-g00ff" # # include/asm-m32r/ide.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +11 -0 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +4 -19 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/traps.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +57 -110 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -3 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/setup.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -11 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +83 -5 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/head.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +2 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/entry.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +5 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/setup.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -68 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +1 -3 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/misc.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +3 -4 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +4 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/head.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +19 -106 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +8 -7 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +18 -2 # m32r: support a new bootloader "m32r-g00ff" # # ChangeSet # 2004/09/17 12:06:46-07:00 takata@linux-m32r.org # [PATCH] m32r: upgrade to 2.6.8.1 kernel # # Here is a patch for 2.6.8.1 kernel of Renesas M32R processor. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/unistd.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +5 -13 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/smp.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +44 -3 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/signal.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +11 -5 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/setup.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/resource.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -2 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/fcntl.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -0 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/delay.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +7 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/checksum.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +3 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/bitops.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +12 -12 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +16 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +14 -7 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mm/init.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mm/fault.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +41 -22 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +33 -5 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +33 -5 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +15 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +20 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +19 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/lib/delay.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -4 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -2 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/time.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +15 -15 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +12 -13 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +55 -38 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +18 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/module.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/irq.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +2 -3 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/init_task.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -0 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +74 -76 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/defconfig # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +20 -7 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -0 # m32r: upgrade to 2.6.8.1 kernel # # BitKeeper/deleted/.del-init.h~7ac4c9a8775db665 # 2004/09/17 12:06:40-07:00 takata@linux-m32r.org +0 -0 # Delete: include/asm-m32r/init.h # # BitKeeper/deleted/.del-cpumask.h~3f1857f2ffec8708 # 2004/09/17 12:06:40-07:00 takata@linux-m32r.org +0 -0 # Delete: include/asm-m32r/cpumask.h # # ChangeSet # 2004/09/17 12:06:30-07:00 takata.hirokazu@renesas.com # [PATCH] m32r: add ELF machine code # # Here is a patch for m32r's ELF machine code. And also change from "Hitachi # H8/300" to "Renesas H8/300"(*). # # (*) The SuperH, M32R and H8* - now these are all Renesas's products. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/elf.h # 2004/09/17 12:06:23-07:00 takata.hirokazu@renesas.com +6 -1 # m32r: add ELF machine code # # ChangeSet # 2004/09/17 12:06:18-07:00 takata@linux-m32r.org # [PATCH] m32r: modify sys_ipc() to remove useless iBCS2 support code # # The useless iBCS2 supporting code is removed. # # However, according to old_ syscalls, I would like to keep backward- # compatibility for a while, due to some old deb packages and # executables for m32r. # I'm struggling to rebuild and replace old packages to new ones. # http://debian.linux-m32r.org/ # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +10 -15 # m32r: modify sys_ipc() to remove useless iBCS2 support code # # ChangeSet # 2004/09/17 12:06:05-07:00 takata@linux-m32r.org # [PATCH] m32r: change from EXPORT_SYMBOL_NOVERS to EXPORT_SYMBOL # # arch/m32r/kernel/m32r_ksyms, EXPORT_SYMBOL_NOVERS is deprecated, use # EXPORT_SYMBOL. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +54 -54 # m32r: change from EXPORT_SYMBOL_NOVERS to EXPORT_SYMBOL # # ChangeSet # 2004/09/17 12:05:50-07:00 takata@linux-m32r.org # [PATCH] atomic_inc_return for m32r # # * include/asm-m32r/atomic.h: # - Add atomic_inc_return(), atomic_dec_return(), atomic_add_return(), # atomic_sub_return() and atomic_clear_mask(). # # - Change atomic_sub_and_test(), atomic_inc_and_test() and # atomic_dec_and_test() from functions to macros. # # - Update comments, etc. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/atomic.h # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +103 -61 # atomic_inc_return for m32r # # ChangeSet # 2004/09/17 12:05:37-07:00 takata@linux-m32r.org # [PATCH] m32r: update headers to remove useless iBCS2 support code # # Here's a patch to update headers, elf.h and poll.h, to remove useless # iBCS2/SVR4 support code for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/poll.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +7 -5 # m32r: update headers to remove useless iBCS2 support code # # include/asm-m32r/elf.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +34 -39 # m32r: update headers to remove useless iBCS2 support code # # ChangeSet # 2004/09/17 12:05:21-07:00 takata@linux-m32r.org # [PATCH] m32r: update CF/PCMCIA drivers # # This patch updates m32r-specific CF/PCMCIA drivers and # fixes compile errors. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +14 -11 # m32r: update CF/PCMCIA drivers # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +7 -7 # m32r: update CF/PCMCIA drivers # # ChangeSet # 2004/09/17 12:05:08-07:00 takata@linux-m32r.org # [PATCH] m32r: update checksum functions # # This patch update checksum routines. # And EXPORT_SYMBOL() is moved from m32r_ksyms.c to csum_partial_copy.c. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/checksum.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +39 -91 # m32r: update checksum functions # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +10 -29 # m32r: update checksum functions # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -2 # m32r: update checksum functions # # ChangeSet # 2004/09/17 12:04:53-07:00 takata@linux-m32r.org # [PATCH] m32r: update uaccess.h # # This patch updates asm-m32r/uaccess.h. # # * include/asm-m32r/uaccess.h: # (__copy_to_user_inatomic): Added. # (__copy_from_user_inatomic): Added. # Update comments. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +290 -59 # m32r: update uaccess.h # # ChangeSet # 2004/09/17 12:04:42-07:00 takata@linux-m32r.org # [PATCH] m32r: update to fix compile errors # # This patch updates code to fix compile errors, and so on. # # * arch/m32r/kernel/Makefile: # Change linker script's name from vmlinux.lds.s to vmlinux.lds. # # * arch/m32r/kernel/process.c (sys_clone): # Fix the first parameter of do_fork() call. # # * arch/m32r/kernel/signal.c: # (handle_signal): Add a new second argument, struct k_sigaction *ka. # (do_signal): Change get_signal_to_deliver() interface. # # * include/asm-m32r/hardirq.h: # Some declarations are moved to linux/hardirq.h. # # * include/asm-m32r/page.h: # Add devmem_is_allowed() macro. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/page.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +2 -2 # m32r: update to fix compile errors # # include/asm-m32r/hardirq.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +0 -18 # m32r: update to fix compile errors # # arch/m32r/kernel/signal.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +38 -30 # m32r: update to fix compile errors # # arch/m32r/kernel/process.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +2 -3 # m32r: update to fix compile errors # # arch/m32r/kernel/Makefile # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -1 # m32r: update to fix compile errors # # ChangeSet # 2004/09/17 12:04:27-07:00 takata@linux-m32r.org # [PATCH] m32r: update zone_sizes_init() # # This patch upgrades zone_sizes_init() function. # This patch is required because free_area_init_node()'s interface # has been changed. # # * arch/m32r/mm/discontig.c (zone_sizes_init): # Change free_area_init_node() interface. # # * arch/m32r/mm/init.c: ditto. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/mm/init.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -2 # m32r: update zone_sizes_init() # # arch/m32r/mm/discontig.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -1 # m32r: update zone_sizes_init() # # ChangeSet # 2004/09/17 12:04:10-07:00 takata@linux-m32r.org # [PATCH] m32r: update for profiling # # This patch is for profiling support. # profile_tick() is used instead of m32r_do_profile(). # # * arch/m32r/kernel/smp.c # (smp_local_timer_interrupt): Change profile API, use profile_tick() # instead of m32r_do_profile(). # # * arch/m32r/kernel/time.c: ditto. # # * include/asm-m32r/hw_irq.h (m32r_do_profile): Removed. # # * include/asm-m32r/ptrace.h (profile_pc): Add profile_pc() macro. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/ptrace.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +8 -6 # m32r: update for profiling # # include/asm-m32r/hw_irq.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -32 # m32r: update for profiling # # arch/m32r/kernel/time.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -3 # m32r: update for profiling # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +4 -6 # m32r: update for profiling # # ChangeSet # 2004/09/17 12:03:54-07:00 takata@linux-m32r.org # [PATCH] m32r architecture # # Add support for the m32r architecture # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/xor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/vga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/user.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/unistd.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +488 -0 # m32r architecture # # include/asm-m32r/unaligned.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # include/asm-m32r/ucontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +525 -0 # m32r architecture # # include/asm-m32r/types.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +57 -0 # m32r architecture # # include/asm-m32r/topology.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +53 -0 # m32r architecture # # include/asm-m32r/tlbflush.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +102 -0 # m32r architecture # # include/asm-m32r/tlb.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +20 -0 # m32r architecture # # include/asm-m32r/timex.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +36 -0 # m32r architecture # # include/asm-m32r/thread_info.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +149 -0 # m32r architecture # # include/asm-m32r/termios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +109 -0 # m32r architecture # # include/asm-m32r/termbits.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +175 -0 # m32r architecture # # include/asm-m32r/system.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +301 -0 # m32r architecture # # include/asm-m32r/syscall.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +11 -0 # m32r architecture # # include/asm-m32r/string.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +15 -0 # m32r architecture # # include/asm-m32r/statfs.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/stat.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +91 -0 # m32r architecture # # include/asm-m32r/spinlock.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +371 -0 # m32r architecture # # include/asm-m32r/sockios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/socket.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # include/asm-m32r/smp.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +78 -0 # m32r architecture # # include/asm-m32r/signal.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +194 -0 # m32r architecture # # include/asm-m32r/siginfo.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/sigcontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +50 -0 # m32r architecture # # include/asm-m32r/shmparam.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/shmbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +46 -0 # m32r architecture # # include/asm-m32r/setup.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +33 -0 # m32r architecture # # include/asm-m32r/serial.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +151 -0 # m32r architecture # # include/asm-m32r/xor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/xor.h # # include/asm-m32r/vga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/vga.h # # include/asm-m32r/user.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/user.h # # include/asm-m32r/unistd.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/unistd.h # # include/asm-m32r/unaligned.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/unaligned.h # # include/asm-m32r/ucontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ucontext.h # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/uaccess.h # # include/asm-m32r/types.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/types.h # # include/asm-m32r/topology.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/topology.h # # include/asm-m32r/tlbflush.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/tlbflush.h # # include/asm-m32r/tlb.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/tlb.h # # include/asm-m32r/timex.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/timex.h # # include/asm-m32r/thread_info.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/thread_info.h # # include/asm-m32r/termios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/termios.h # # include/asm-m32r/termbits.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/termbits.h # # include/asm-m32r/system.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/system.h # # include/asm-m32r/syscall.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/syscall.h # # include/asm-m32r/string.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/string.h # # include/asm-m32r/statfs.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/statfs.h # # include/asm-m32r/stat.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/stat.h # # include/asm-m32r/spinlock.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/spinlock.h # # include/asm-m32r/sockios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sockios.h # # include/asm-m32r/socket.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/socket.h # # include/asm-m32r/smp.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/smp.h # # include/asm-m32r/signal.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/signal.h # # include/asm-m32r/siginfo.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/siginfo.h # # include/asm-m32r/sigcontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sigcontext.h # # include/asm-m32r/shmparam.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/shmparam.h # # include/asm-m32r/shmbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/shmbuf.h # # include/asm-m32r/setup.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/setup.h # # include/asm-m32r/serial.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/serial.h # # include/asm-m32r/sembuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +29 -0 # m32r architecture # # include/asm-m32r/semaphore.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +266 -0 # m32r architecture # # include/asm-m32r/segment.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/sections.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/scatterlist.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +18 -0 # m32r architecture # # include/asm-m32r/rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # include/asm-m32r/resource.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +51 -0 # m32r architecture # # include/asm-m32r/ptrace.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +163 -0 # m32r architecture # # include/asm-m32r/processor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +157 -0 # m32r architecture # # include/asm-m32r/posix_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +126 -0 # m32r architecture # # include/asm-m32r/poll.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +29 -0 # m32r architecture # # include/asm-m32r/pgtable.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +422 -0 # m32r architecture # # include/asm-m32r/pgtable-2level.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +77 -0 # m32r architecture # # include/asm-m32r/pgalloc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +87 -0 # m32r architecture # # include/asm-m32r/percpu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/pci.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +10 -0 # m32r architecture # # include/asm-m32r/param.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +27 -0 # m32r architecture # # include/asm-m32r/page.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +112 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +259 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +56 -0 # m32r architecture # # include/asm-m32r/numnodes.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +15 -0 # m32r architecture # # include/asm-m32r/namei.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +21 -0 # m32r architecture # # include/asm-m32r/msgbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/module.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +13 -0 # m32r architecture # # include/asm-m32r/mmzone.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +80 -0 # m32r architecture # # include/asm-m32r/mmu_context.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +169 -0 # m32r architecture # # include/asm-m32r/mmu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/mman.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +45 -0 # m32r architecture # # include/asm-m32r/mc146818rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +32 -0 # m32r architecture # # include/asm-m32r/mappi2/mappi2_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +151 -0 # m32r architecture # # include/asm-m32r/m32r_mp_fpga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +313 -0 # m32r architecture # # include/asm-m32r/m32r.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +135 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +265 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +107 -0 # m32r architecture # # include/asm-m32r/m32102peri.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +468 -0 # m32r architecture # # include/asm-m32r/m32102.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +265 -0 # m32r architecture # # include/asm-m32r/local.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/linkage.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # include/asm-m32r/kmap_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +34 -0 # m32r architecture # # include/asm-m32r/irq.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +86 -0 # m32r architecture # # include/asm-m32r/ipcbuf.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +33 -0 # m32r architecture # # include/asm-m32r/ipc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/ioctls.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +88 -0 # m32r architecture # # include/asm-m32r/ioctl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +78 -0 # m32r architecture # # include/asm-m32r/io.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +201 -0 # m32r architecture # # include/asm-m32r/init.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # include/asm-m32r/ide.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +71 -0 # m32r architecture # # include/asm-m32r/hw_irq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +40 -0 # m32r architecture # # include/asm-m32r/hdreg.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # include/asm-m32r/hardirq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +103 -0 # m32r architecture # # include/asm-m32r/flat.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +145 -0 # m32r architecture # # include/asm-m32r/fcntl.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +91 -0 # m32r architecture # # include/asm-m32r/errno.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # include/asm-m32r/elf.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +177 -0 # m32r architecture # # include/asm-m32r/dma.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/dma-mapping.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +23 -0 # m32r architecture # # include/asm-m32r/div64.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +38 -0 # m32r architecture # # include/asm-m32r/delay.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/current.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +18 -0 # m32r architecture # # include/asm-m32r/cpumask.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # include/asm-m32r/checksum.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +256 -0 # m32r architecture # # include/asm-m32r/cacheflush.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +68 -0 # m32r architecture # # include/asm-m32r/cachectl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +26 -0 # m32r architecture # # include/asm-m32r/cache.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +12 -0 # m32r architecture # # include/asm-m32r/byteorder.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +19 -0 # m32r architecture # # include/asm-m32r/bugs.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +21 -0 # m32r architecture # # include/asm-m32r/bug.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/bitops.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +712 -0 # m32r architecture # # include/asm-m32r/atomic.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +337 -0 # m32r architecture # # include/asm-m32r/assembler.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +212 -0 # m32r architecture # # include/asm-m32r/addrspace.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +58 -0 # m32r architecture # # include/asm-m32r/a.out.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +28 -0 # m32r architecture # # arch/m32r/opsput/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +180 -0 # m32r architecture # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +588 -0 # m32r architecture # # arch/m32r/oprofile/init.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # arch/m32r/oprofile/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/oprofile/Kconfig # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +23 -0 # m32r architecture # # arch/m32r/oaks32r/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +155 -0 # m32r architecture # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +514 -0 # m32r architecture # # arch/m32r/mm/page.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +82 -0 # m32r architecture # # arch/m32r/mm/mmu.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +350 -0 # m32r architecture # # arch/m32r/mm/ioremap.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +188 -0 # m32r architecture # # arch/m32r/mm/ioremap-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +51 -0 # m32r architecture # # arch/m32r/mm/init.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +251 -0 # m32r architecture # # arch/m32r/mm/fault.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +553 -0 # m32r architecture # # arch/m32r/mm/fault-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +164 -0 # m32r architecture # # arch/m32r/mm/extable.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # arch/m32r/mm/discontig.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +170 -0 # m32r architecture # # arch/m32r/mm/cache.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +68 -0 # m32r architecture # # arch/m32r/mm/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +12 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +242 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit.smp # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +344 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +245 -0 # m32r architecture # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +614 -0 # m32r architecture # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +618 -0 # m32r architecture # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +522 -0 # m32r architecture # # arch/m32r/m32700ut/m32r-flash.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +227 -0 # m32r architecture # # arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +249 -0 # m32r architecture # # arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +249 -0 # m32r architecture # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +647 -0 # m32r architecture # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +649 -0 # m32r architecture # # arch/m32r/lib/usercopy.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +391 -0 # m32r architecture # # arch/m32r/lib/strlen.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +120 -0 # m32r architecture # # arch/m32r/lib/putuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +84 -0 # m32r architecture # # arch/m32r/lib/memset.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +178 -0 # m32r architecture # # arch/m32r/lib/memcpy.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +95 -0 # m32r architecture # # arch/m32r/lib/getuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +88 -0 # m32r architecture # # arch/m32r/lib/delay.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +124 -0 # m32r architecture # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +77 -0 # m32r architecture # # arch/m32r/lib/checksum.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +322 -0 # m32r architecture # # arch/m32r/lib/ashxdi3.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +297 -0 # m32r architecture # # arch/m32r/lib/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +160 -0 # m32r architecture # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +383 -0 # m32r architecture # # arch/m32r/kernel/time.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +318 -0 # m32r architecture # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +281 -0 # m32r architecture # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +660 -0 # m32r architecture # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +940 -0 # m32r architecture # # arch/m32r/kernel/signal.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +620 -0 # m32r architecture # # arch/m32r/kernel/setup_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +260 -0 # m32r architecture # # arch/m32r/kernel/setup_opsput.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +454 -0 # m32r architecture # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +147 -0 # m32r architecture # # arch/m32r/kernel/setup_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +186 -0 # m32r architecture # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +164 -0 # m32r architecture # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +453 -0 # m32r architecture # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +404 -0 # m32r architecture # # arch/m32r/kernel/semaphore.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +186 -0 # m32r architecture # # arch/m32r/kernel/ptrace.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +828 -0 # m32r architecture # # arch/m32r/kernel/process.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +357 -0 # m32r architecture # # arch/m32r/kernel/module.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +253 -0 # m32r architecture # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +143 -0 # m32r architecture # # arch/m32r/kernel/irq.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1019 -0 # m32r architecture # # arch/m32r/kernel/io_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +247 -0 # m32r architecture # # arch/m32r/kernel/io_opsput.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +377 -0 # m32r architecture # # arch/m32r/kernel/io_oaks32r.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +243 -0 # m32r architecture # # arch/m32r/kernel/io_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +367 -0 # m32r architecture # # arch/m32r/kernel/io_mappi.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +368 -0 # m32r architecture # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +377 -0 # m32r architecture # # arch/m32r/kernel/io_m32102.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +277 -0 # m32r architecture # # arch/m32r/kernel/init_task.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +40 -0 # m32r architecture # # arch/m32r/kernel/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +286 -0 # m32r architecture # # arch/m32r/kernel/entry.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +993 -0 # m32r architecture # # arch/m32r/kernel/align.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +585 -0 # m32r architecture # # arch/m32r/kernel/Makefile # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +20 -0 # m32r architecture # # arch/m32r/drivers/smc91111.readme.txt # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +561 -0 # m32r architecture # # arch/m32r/drivers/smc91111.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +570 -0 # m32r architecture # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +3896 -0 # m32r architecture # # arch/m32r/drivers/smc91111.copying # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +352 -0 # m32r architecture # # arch/m32r/drivers/mappi_ne.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +861 -0 # m32r architecture # # arch/m32r/drivers/m5drv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +664 -0 # m32r architecture # # arch/m32r/drivers/m5.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +73 -0 # m32r architecture # # arch/m32r/drivers/m5.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +913 -0 # m32r architecture # # arch/m32r/drivers/m32r_pcc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +818 -0 # m32r architecture # # arch/m32r/drivers/m32r_cfc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +85 -0 # m32r architecture # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +910 -0 # m32r architecture # # arch/m32r/drivers/m32r-pldsio.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +3067 -0 # m32r architecture # # arch/m32r/drivers/ds1302.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +432 -0 # m32r architecture # # arch/m32r/drivers/cs_internal.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +2 -0 # m32r architecture # # arch/m32r/drivers/Makefile # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/drivers/Kconfig # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +42 -0 # m32r architecture # # arch/m32r/drivers/8390.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # arch/m32r/drivers/8390.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # arch/m32r/defconfig # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +622 -0 # m32r architecture # # arch/m32r/boot/setup.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +217 -0 # m32r architecture # # arch/m32r/boot/compressed/vmlinux.scr # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # arch/m32r/boot/compressed/misc.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +224 -0 # m32r architecture # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +50 -0 # m32r architecture # # arch/m32r/boot/compressed/install.sh # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +57 -0 # m32r architecture # # arch/m32r/boot/compressed/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +202 -0 # m32r architecture # # arch/m32r/boot/compressed/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +37 -0 # m32r architecture # # arch/m32r/boot/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +19 -0 # m32r architecture # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +38 -0 # m32r architecture # # arch/m32r/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +621 -0 # m32r architecture # # include/asm-m32r/sembuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sembuf.h # # include/asm-m32r/semaphore.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/semaphore.h # # include/asm-m32r/segment.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/segment.h # # include/asm-m32r/sections.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sections.h # # include/asm-m32r/scatterlist.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/scatterlist.h # # include/asm-m32r/rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/rtc.h # # include/asm-m32r/resource.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/resource.h # # include/asm-m32r/ptrace.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ptrace.h # # include/asm-m32r/processor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/processor.h # # include/asm-m32r/posix_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/posix_types.h # # include/asm-m32r/poll.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/poll.h # # include/asm-m32r/pgtable.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgtable.h # # include/asm-m32r/pgtable-2level.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgtable-2level.h # # include/asm-m32r/pgalloc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgalloc.h # # include/asm-m32r/percpu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/percpu.h # # include/asm-m32r/pci.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pci.h # # include/asm-m32r/param.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/param.h # # include/asm-m32r/page.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/page.h # # include/asm-m32r/opsput/opsput_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_pld.h # # include/asm-m32r/opsput/opsput_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_lcd.h # # include/asm-m32r/opsput/opsput_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_lan.h # # include/asm-m32r/numnodes.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/numnodes.h # # include/asm-m32r/namei.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/namei.h # # include/asm-m32r/msgbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/msgbuf.h # # include/asm-m32r/module.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/module.h # # include/asm-m32r/mmzone.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmzone.h # # include/asm-m32r/mmu_context.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmu_context.h # # include/asm-m32r/mmu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmu.h # # include/asm-m32r/mman.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mman.h # # include/asm-m32r/mc146818rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mc146818rtc.h # # include/asm-m32r/mappi2/mappi2_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mappi2/mappi2_pld.h # # include/asm-m32r/m32r_mp_fpga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32r_mp_fpga.h # # include/asm-m32r/m32r.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32r.h # # include/asm-m32r/m32700ut/m32700ut_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_pld.h # # include/asm-m32r/m32700ut/m32700ut_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_lcd.h # # include/asm-m32r/m32700ut/m32700ut_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_lan.h # # include/asm-m32r/m32102peri.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32102peri.h # # include/asm-m32r/m32102.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32102.h # # include/asm-m32r/local.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/local.h # # include/asm-m32r/linkage.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/linkage.h # # include/asm-m32r/kmap_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/kmap_types.h # # include/asm-m32r/irq.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/irq.h # # include/asm-m32r/ipcbuf.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ipcbuf.h # # include/asm-m32r/ipc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ipc.h # # include/asm-m32r/ioctls.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ioctls.h # # include/asm-m32r/ioctl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ioctl.h # # include/asm-m32r/io.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/io.h # # include/asm-m32r/init.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/init.h # # include/asm-m32r/ide.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ide.h # # include/asm-m32r/hw_irq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hw_irq.h # # include/asm-m32r/hdreg.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hdreg.h # # include/asm-m32r/hardirq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hardirq.h # # include/asm-m32r/flat.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/flat.h # # include/asm-m32r/fcntl.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/fcntl.h # # include/asm-m32r/errno.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/errno.h # # include/asm-m32r/elf.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/elf.h # # include/asm-m32r/dma.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/dma.h # # include/asm-m32r/dma-mapping.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/dma-mapping.h # # include/asm-m32r/div64.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/div64.h # # include/asm-m32r/delay.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/delay.h # # include/asm-m32r/current.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/current.h # # include/asm-m32r/cpumask.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cpumask.h # # include/asm-m32r/checksum.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/checksum.h # # include/asm-m32r/cacheflush.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cacheflush.h # # include/asm-m32r/cachectl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cachectl.h # # include/asm-m32r/cache.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cache.h # # include/asm-m32r/byteorder.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/byteorder.h # # include/asm-m32r/bugs.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bugs.h # # include/asm-m32r/bug.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bug.h # # include/asm-m32r/bitops.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bitops.h # # include/asm-m32r/atomic.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/atomic.h # # include/asm-m32r/assembler.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/assembler.h # # include/asm-m32r/addrspace.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/addrspace.h # # include/asm-m32r/a.out.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/a.out.h # # arch/m32r/opsput/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/opsput/dot.gdbinit # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/opsput/defconfig.opsput # # arch/m32r/oprofile/init.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/init.c # # arch/m32r/oprofile/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/Makefile # # arch/m32r/oprofile/Kconfig # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/Kconfig # # arch/m32r/oaks32r/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oaks32r/dot.gdbinit.nommu # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oaks32r/defconfig.nommu # # arch/m32r/mm/page.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/page.S # # arch/m32r/mm/mmu.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/mmu.S # # arch/m32r/mm/ioremap.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/ioremap.c # # arch/m32r/mm/ioremap-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/ioremap-nommu.c # # arch/m32r/mm/init.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/init.c # # arch/m32r/mm/fault.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/fault.c # # arch/m32r/mm/fault-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/fault-nommu.c # # arch/m32r/mm/extable.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/extable.c # # arch/m32r/mm/discontig.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/discontig.c # # arch/m32r/mm/cache.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/cache.c # # arch/m32r/mm/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/Makefile # # arch/m32r/mappi/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit # # arch/m32r/mappi/dot.gdbinit.smp # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit.smp # # arch/m32r/mappi/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit.nommu # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.up # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.smp # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.nommu # # arch/m32r/m32700ut/m32r-flash.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/m32r-flash.c # # arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # # arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/defconfig.m32700ut.up # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/defconfig.m32700ut.smp # # arch/m32r/lib/usercopy.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/usercopy.c # # arch/m32r/lib/strlen.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/strlen.S # # arch/m32r/lib/putuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/putuser.S # # arch/m32r/lib/memset.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/memset.S # # arch/m32r/lib/memcpy.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/memcpy.S # # arch/m32r/lib/getuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/getuser.S # # arch/m32r/lib/delay.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/delay.c # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/csum_partial_copy.c # # arch/m32r/lib/checksum.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/checksum.S # # arch/m32r/lib/ashxdi3.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/ashxdi3.S # # arch/m32r/lib/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/Makefile # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/vmlinux.lds.S # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/traps.c # # arch/m32r/kernel/time.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/time.c # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/sys_m32r.c # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/smpboot.c # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/smp.c # # arch/m32r/kernel/signal.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/signal.c # # arch/m32r/kernel/setup_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_usrv.c # # arch/m32r/kernel/setup_opsput.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_opsput.c # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_oaks32r.c # # arch/m32r/kernel/setup_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_mappi2.c # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_mappi.c # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_m32700ut.c # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup.c # # arch/m32r/kernel/semaphore.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/semaphore.c # # arch/m32r/kernel/ptrace.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/ptrace.c # # arch/m32r/kernel/process.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/process.c # # arch/m32r/kernel/module.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/module.c # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/m32r_ksyms.c # # arch/m32r/kernel/irq.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/irq.c # # arch/m32r/kernel/io_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_usrv.c # # arch/m32r/kernel/io_opsput.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_opsput.c # # arch/m32r/kernel/io_oaks32r.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_oaks32r.c # # arch/m32r/kernel/io_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_mappi2.c # # arch/m32r/kernel/io_mappi.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_mappi.c # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_m32700ut.c # # arch/m32r/kernel/io_m32102.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_m32102.c # # arch/m32r/kernel/init_task.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/init_task.c # # arch/m32r/kernel/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/head.S # # arch/m32r/kernel/entry.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/entry.S # # arch/m32r/kernel/align.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/align.c # # arch/m32r/kernel/Makefile # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/Makefile # # arch/m32r/drivers/smc91111.readme.txt # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.readme.txt # # arch/m32r/drivers/smc91111.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.h # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.c # # arch/m32r/drivers/smc91111.copying # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.copying # # arch/m32r/drivers/mappi_ne.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/mappi_ne.c # # arch/m32r/drivers/m5drv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5drv.c # # arch/m32r/drivers/m5.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5.h # # arch/m32r/drivers/m5.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5.c # # arch/m32r/drivers/m32r_pcc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_pcc.h # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_pcc.c # # arch/m32r/drivers/m32r_cfc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_cfc.h # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_cfc.c # # arch/m32r/drivers/m32r-pldsio.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r-pldsio.c # # arch/m32r/drivers/ds1302.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/ds1302.c # # arch/m32r/drivers/cs_internal.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/cs_internal.h # # arch/m32r/drivers/Makefile # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/Makefile # # arch/m32r/drivers/Kconfig # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/Kconfig # # arch/m32r/drivers/8390.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/8390.h # # arch/m32r/drivers/8390.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/8390.c # # arch/m32r/defconfig # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/defconfig # # arch/m32r/boot/setup.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/setup.S # # arch/m32r/boot/compressed/vmlinux.scr # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/vmlinux.scr # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/vmlinux.lds.S # # arch/m32r/boot/compressed/misc.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/misc.c # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/m32r_sio.c # # arch/m32r/boot/compressed/install.sh # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/install.sh # # arch/m32r/boot/compressed/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/head.S # # arch/m32r/boot/compressed/boot.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # arch/m32r/boot/compressed/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/Makefile # # arch/m32r/boot/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/Makefile # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/Makefile # # arch/m32r/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/Kconfig # # arch/m32r/boot/compressed/boot.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/boot.h # # ChangeSet # 2004/09/17 12:03:36-07:00 alan@redhat.com # [PATCH] serial-cs and unusable port size ranges # # A couple of GSM GPRS PCMCIA cards advertise 16 rather than 8 port sized # windows for their serial interface. This breaks our current pcmcia serial # driver which ignores any windows that are not 8 bytes. # # To avoid any regressions on other cards given this driver contains a # certain amount of "magic" the patch below looks for 8 byte windows first so # will not break existing supported cards (I hope ;)) # # Patch-by: Alan Cox # OSDL Developer Certiticate Of Origin included herein by reference # # Acked by Russell King # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/serial/serial_cs.c # 2004/09/17 00:06:56-07:00 alan@redhat.com +24 -21 # serial-cs and unusable port size ranges # # ChangeSet # 2004/09/17 12:03:20-07:00 saw@saw.sw.com.sg # [PATCH] fix for fsync ignoring writing errors # # Currently metadata writing errors are ignored and not returned from # sys_fsync on ext2 and ext3 filesystems. That is, at least ext2 and ext3. # # Both ext2 and ext3 resort to sync_inode() in their ->sync_inode method, # which in turn calls ->write_inode. ->write_inode method has void type, and # any IO errors happening inside are lost. # # Make ->write_inode return the error code? # # Signed-off-by: Andrey Savochkin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/ufs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/reiserfs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/msdos_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/ext3_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/affs_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/xfs/linux-2.6/xfs_super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -1 # fix for fsync ignoring writing errors # # fs/umsdos/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/ufs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/udf/udfdecl.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/udf/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/sysv/sysv.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/sysv/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +2 -1 # fix for fsync ignoring writing errors # # fs/reiserfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -2 # fix for fsync ignoring writing errors # # fs/qnx4/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/ntfs/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/ntfs/inode.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +0 -1 # fix for fsync ignoring writing errors # # fs/ntfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +0 -24 # fix for fsync ignoring writing errors # # fs/nfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +7 -3 # fix for fsync ignoring writing errors # # fs/minix/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -2 # fix for fsync ignoring writing errors # # fs/jfs/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/jfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +6 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/hfsplus_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/hfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +8 -7 # fix for fsync ignoring writing errors # # fs/hfs/hfs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/fs-writeback.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +8 -4 # fix for fsync ignoring writing errors # # fs/fat/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/ext3/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -5 # fix for fsync ignoring writing errors # # fs/ext2/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +2 -2 # fix for fsync ignoring writing errors # # fs/ext2/ext2.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/bfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/affs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/adfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/adfs/adfs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # Documentation/filesystems/vfs.txt # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # Documentation/filesystems/Locking # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # ChangeSet # 2004/09/17 12:03:06-07:00 ak@muc.de # [PATCH] x86-64: copy ioperm bitmaps more efficiently at context switch # # Copy ioperm bitmaps more efficiently at context switch time. Only copy # upto the highest used port. # # Originally from Ingo Molnar # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/processor.h # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -0 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/setup64.c # 2004/09/16 23:58:42-07:00 ak@muc.de +5 -3 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/process.c # 2004/09/17 00:28:01-07:00 ak@muc.de +25 -19 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/ioport.c # 2004/09/16 23:58:42-07:00 ak@muc.de +26 -8 # x86-64: copy ioperm bitmaps more efficiently at context switch # # ChangeSet # 2004/09/17 12:02:51-07:00 ak@muc.de # [PATCH] x86-64: turn tss into per cpu data # # Turn per cpu TSS into per cpu data. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/processor.h # 2004/09/17 00:28:10-07:00 ak@muc.de +4 -3 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/traps.c # 2004/09/16 23:58:42-07:00 ak@muc.de +3 -2 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/suspend.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/smpboot.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/setup64.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/process.c # 2004/09/17 00:28:10-07:00 ak@muc.de +2 -2 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/ioport.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/init_task.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -2 # x86-64: turn tss into per cpu data # # ChangeSet # 2004/09/17 12:02:38-07:00 ak@muc.de # [PATCH] x86-64, x86: don't pass CR2 on alignment faults # # Don't pass CR2 address on alignment faults. They report the address of the # last page fault, which is a information leak. # # Fix this for i386 and x86-64 by passing 0 instead. # # Pointed out by Zachary Amsden # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/traps.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64, x86: don't pass CR2 on alignment faults # # arch/i386/kernel/traps.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64, x86: don't pass CR2 on alignment faults # # ChangeSet # 2004/09/17 12:02:24-07:00 ak@muc.de # [PATCH] x86-64: add read implies exec macro # # Add read implies exec personality. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/elf.h # 2004/09/16 23:58:41-07:00 ak@muc.de +7 -0 # x86-64: add read implies exec macro # # ChangeSet # 2004/09/17 12:02:13-07:00 ak@muc.de # [PATCH] x86-64: synchronize video.S with i386 # # Sync x86-64 video.S with i386 changes # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/boot/video.S # 2004/09/16 23:58:41-07:00 ak@muc.de +84 -2 # x86-64: synchronize video.S with i386 # # ChangeSet # 2004/09/17 12:01:58-07:00 ak@muc.de # [PATCH] x86-64: sibling map fix for clustered mode # # From: James Cleverdon # # The value that cpuinfo returns for command 1 in ebx is the physical APIC ID # latched when the system comes out of reset. # # Ordinarily, this is identical to the value in the local APIC's ID register, # because nearly all BIOSes accept the HW assigned value. # # Our systems, made up of individual building blocks, can't do that. Each # node boots as a separate system and is joined together by the BIOS. Thus, # the BIOS rewrites the local APIC ID register with a new value. # # Potomac and Nocona chips have a mechanism by which the BIOS writer can # change bits 7:5 to match the assigned cluster ID. Bits 2:0 come from the # thread ID. However, bits 4:3 are still those latched at reset. Oops! # # Summary: Large clustered systems can't use cpuid to derive the sibling # information. # # Fix: Use the local APIC ID. That's the value we use to online the CPUs, so # it had better be OK. For non-clustered systems, cpuid == local APIC, so # nothing but large boxes should be affected. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/setup.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64: sibling map fix for clustered mode # # ChangeSet # 2004/09/17 12:01:45-07:00 ak@muc.de # [PATCH] x86-64: fix for mem= on NUMA systems # # Fix bug that caused oops with mem= on certain NUMA configurations # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/k8topology.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -2 # x86-64: fix for mem= on NUMA systems # # ChangeSet # 2004/09/17 12:01:30-07:00 ak@muc.de # [PATCH] x86-64: add might_sleeps to more *_user functions # # Add might_sleep to more *_user functions. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/lib/usercopy.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -0 # x86-64: add might_sleeps to more *_user functions # # arch/x86_64/lib/csum-wrappers.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -0 # x86-64: add might_sleeps to more *_user functions # # ChangeSet # 2004/09/17 12:01:19-07:00 ak@muc.de # [PATCH] x86-64: print mce bank enable mask in hex # # Print mce bank enable mask in sysfs in hex # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/mce.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64: print mce bank enable mask in hex # # ChangeSet # 2004/09/17 12:01:06-07:00 ak@muc.de # [PATCH] x86-64: remove WARN_ON in smp_call_function # # Remove WARN_ON in smp_call_function. it breaks the machine check # handling and there is no good way to enable interrupts here. # # Call Trace:{smp_call_function+115} {smp_send_stop+25} # {panic+274} {do_machine_check+0} # {do_machine_check+1114} {machine_check+127} # {net_rx_action+215} {__do_softirq+83} # {do_softirq+53} {do_IRQ+317} # <{default_idle+0} {ret_from_intr+0} # {default_idle+32} {cpu_idle+26} # {start_kernel+502} {_sinittext+48 # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/smp.c # 2004/09/16 23:58:40-07:00 ak@muc.de +1 -3 # x86-64: remove WARN_ON in smp_call_function # # ChangeSet # 2004/09/17 12:00:51-07:00 ak@muc.de # [PATCH] x86-64: make machine check handler configurable # # Make the x86-64 machine check handler configurable when EMBEDDED # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/Kconfig # 2004/09/16 23:58:40-07:00 ak@muc.de +6 -1 # x86-64: make machine check handler configurable # # ChangeSet # 2004/09/17 12:00:40-07:00 ak@muc.de # [PATCH] x86-64: IO-APIC suspend/resume # # Do IO-APIC suspend/resume. # # Untested so far. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/io_apic.c # 2004/09/16 23:58:40-07:00 ak@muc.de +93 -0 # x86-64: IO-APIC suspend/resume # # ChangeSet # 2004/09/17 12:00:27-07:00 ak@muc.de # [PATCH] x86-64: avoid panic when APIC ID cannot be set # # Don't panic when io apic id cannot be set. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/io_apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +1 -1 # x86-64: avoid panic when APIC ID cannot be set # # ChangeSet # 2004/09/17 12:00:12-07:00 ak@muc.de # [PATCH] x86-64: avoid deadlock in page fault handler # # Avoid deadlock when kernel fault happens inside mmap sem. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/fault.c # 2004/09/16 23:58:40-07:00 ak@muc.de +21 -1 # x86-64: avoid deadlock in page fault handler # # ChangeSet # 2004/09/17 11:59:59-07:00 ak@muc.de # [PATCH] x86-64: update defconfig # # Update x86-64 defconfig # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/defconfig # 2004/09/16 23:58:40-07:00 ak@muc.de +46 -55 # x86-64: update defconfig # # ChangeSet # 2004/09/17 11:59:44-07:00 ak@muc.de # [PATCH] x86-64: add apic={verbose,quiet,debug} # # Ported from i386 # # Allow to quieten apic boot output on the command line using # apic={verbose,debug,quiet} # # Make it quiet by default # # Add extra #define for making apic print functions __init or not # __init (for easier debugging) # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/apic.h # 2004/09/16 23:58:40-07:00 ak@muc.de +21 -7 # x86-64: add apic={verbose,quiet,debug} # # arch/x86_64/kernel/io_apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +50 -40 # x86-64: add apic={verbose,quiet,debug} # # arch/x86_64/kernel/apic.c # 2004/09/16 23:58:40-07:00 ak@muc.de +38 -19 # x86-64: add apic={verbose,quiet,debug} # # ChangeSet # 2004/09/17 11:59:31-07:00 ak@muc.de # [PATCH] x86-64: make APIC errors KERN_DEBUG # # Make APIC errors KERN_DEBUG # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/i8259.c # 2004/09/16 23:58:40-07:00 ak@muc.de +1 -1 # x86-64: make APIC errors KERN_DEBUG # # arch/x86_64/kernel/apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +1 -1 # x86-64: make APIC errors KERN_DEBUG # # ChangeSet # 2004/09/17 11:59:15-07:00 ak@muc.de # [PATCH] x86-64: add atomic64_t # # Add an atomic64_t type to x86-64. # # Not used right now, but may be useful in the future, e.g. for rss together # with C.Lameter's page fault scalability patches. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/atomic.h # 2004/09/16 23:58:39-07:00 ak@muc.de +160 -0 # x86-64: add atomic64_t # # ChangeSet # 2004/09/17 11:59:04-07:00 david@gibson.dropbear.id.au # [PATCH] ppc64: remove LARGE_PAGE_SHIFT constant # # For historical reasons, ppc64 has ended up with two #defines for the size # of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT. This patch # removes LARGE_PAGE_SHIFT in favour of the more widely used HPAGE_SHIFT. # # Signed-off-by: David Gibson # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu.h # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +0 -2 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/mm/hugetlbpage.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +1 -1 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/mm/hash_utils.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +2 -2 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/kernel/pSeries_htab.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +1 -1 # ppc64: remove LARGE_PAGE_SHIFT constant # # ChangeSet # 2004/09/17 11:58:49-07:00 anton@samba.org # [PATCH] ppc64: fix CONFIG_CMDLINE # # When I cleaned up our cmdline parsing, I missed a RELOC of CONFIG_CMDLINE # itself. Without it we copy something random into cmd_line, but only when # CONFIG_CMDLINE is enabled. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/prom.c # 2004/09/16 23:58:39-07:00 anton@samba.org +1 -1 # ppc64: fix CONFIG_CMDLINE # # ChangeSet # 2004/09/17 11:58:37-07:00 anton@samba.org # [PATCH] ppc64: disable some drivers broken on 64bit # # The mace, bmac and dmasound drivers use virt_to_bus and so will not work on # ppc64. Reflect this in the relevant Kconfig files. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # sound/oss/dmasound/Kconfig # 2004/09/16 23:58:39-07:00 anton@samba.org +1 -1 # ppc64: disable some drivers broken on 64bit # # drivers/net/Kconfig # 2004/09/17 00:28:03-07:00 anton@samba.org +2 -2 # ppc64: disable some drivers broken on 64bit # # ChangeSet # 2004/09/17 11:58:23-07:00 anton@samba.org # [PATCH] ppc64: fix hotplug CPU when building a pseries+pmac kernel # # When a pseries+pmac kernel is built, the rtas stop-self token wasnt being # initialised. Since doing this will safely fail on pmac, remove the # !CONFIG_PPC_PMAC restriction # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/16 23:58:39-07:00 anton@samba.org +2 -2 # ppc64: fix hotplug CPU when building a pseries+pmac kernel # # ChangeSet # 2004/09/17 11:58:10-07:00 anton@samba.org # [PATCH] ppc64: don't use state == SYSTEM_BOOTING # # From: Nathan Lynch # # Fedora has a patch which introduces a new system state during boot. Change # system_state == SYSTEM_BOOTING to system_state < SYSTEM_RUNNING to match # it. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/smp.c # 2004/09/16 23:58:39-07:00 anton@samba.org +3 -3 # ppc64: don't use state == SYSTEM_BOOTING # # ChangeSet # 2004/09/17 11:57:55-07:00 anton@samba.org # [PATCH] ppc64: export probe_irq_mask # # yenta_socket wants probe_irq_mask, so export it. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/irq.c # 2004/09/16 23:58:39-07:00 anton@samba.org +2 -0 # ppc64: export probe_irq_mask # # ChangeSet # 2004/09/17 11:57:44-07:00 anton@samba.org # [PATCH] ppc64: Remove A() and AA() # # Remove the A() and AA() macros. Now we have compat_ptr we should be using # that. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/ppc32.h # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -24 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/sys_ppc32.c # 2004/09/16 23:58:38-07:00 anton@samba.org +8 -8 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/signal.c # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -1 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/ioctl32.c # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -2 # ppc64: Remove A() and AA() # # ChangeSet # 2004/09/17 11:57:28-07:00 benh@kernel.crashing.org # [PATCH] ppc64: Fix some bogus warnings & cleanup tlbie code path # # This patch fixes some warnings that popped up with the removal of # -Wno-uninitialized around the code doing tlbie's. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/pSeries_lpar.c # 2004/09/16 23:58:38-07:00 benh@kernel.crashing.org +3 -2 # ppc64: Fix some bogus warnings & cleanup tlbie code path # # arch/ppc64/kernel/pSeries_htab.c # 2004/09/17 00:28:13-07:00 benh@kernel.crashing.org +14 -9 # ppc64: Fix some bogus warnings & cleanup tlbie code path # # ChangeSet # 2004/09/17 11:57:17-07:00 anton@samba.org # [PATCH] ppc64: clean up asm/mmu.h # # Remove some old definitions that arent relevant to us. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu.h # 2004/09/17 00:28:13-07:00 anton@samba.org +0 -157 # ppc64: clean up asm/mmu.h # # ChangeSet # 2004/09/17 11:57:04-07:00 anton@samba.org # [PATCH] ppc64: iseries build fixes # # Fix one compile warning and one build warning on iseries. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/page.h # 2004/09/16 23:58:38-07:00 anton@samba.org +3 -3 # ppc64: iseries build fixes # # arch/ppc64/mm/init.c # 2004/09/16 23:58:38-07:00 anton@samba.org +2 -0 # ppc64: iseries build fixes # # ChangeSet # 2004/09/17 11:56:50-07:00 anton@samba.org # [PATCH] ppc64: replace mmu_context_queue with idr allocator # # Replace the mmu_context_queue structure with the idr allocator. The # mmu_context_queue allocation was quite large (~200kB) so on most machines # we will have a reduction in usage. # # We might put a single entry cache on the front of this so we are more # likely to reuse ppc64 MMU hashtable entries that are in the caches. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu_context.h # 2004/09/16 23:58:38-07:00 anton@samba.org +5 -99 # ppc64: replace mmu_context_queue with idr allocator # # arch/ppc64/mm/init.c # 2004/09/17 00:28:14-07:00 anton@samba.org +54 -13 # ppc64: replace mmu_context_queue with idr allocator # # ChangeSet # 2004/09/17 11:56:38-07:00 anton@samba.org # [PATCH] ppc64: powersave_nap sysctl # # Implement powersave_nap sysctl, like ppc32. This allows us to disable the # nap function which is useful when profiling with oprofile (to get an # accurate count of idle time). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/17 00:28:13-07:00 anton@samba.org +0 -2 # ppc64: powersave_nap sysctl # # arch/ppc64/kernel/idle.c # 2004/09/16 23:58:38-07:00 anton@samba.org +34 -0 # ppc64: powersave_nap sysctl # # ChangeSet # 2004/09/17 11:56:24-07:00 anton@samba.org # [PATCH] ppc64: force_sigsegv fixes # # Replace do_exit() in 64bit signal code with force_sig/force_sigsegv where # appropriate. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/signal.c # 2004/09/17 00:28:14-07:00 anton@samba.org +3 -2 # ppc64: force_sigsegv fixes # # ChangeSet # 2004/09/17 11:56:13-07:00 olh@suse.de # [PATCH] ppc32: open_pic2.c build fix # # arch/ppc/syslib/open_pic2.c: In function `init_openpic2_sysfs': # arch/ppc/syslib/open_pic2.c:694: error: `ENODEV' undeclared (first use in this function) # arch/ppc/syslib/open_pic2.c:694: error: (Each undeclared identifier is reported only once # arch/ppc/syslib/open_pic2.c:694: error: for each function it appears in.) # # possible fix below. # # Signed-off-by: Olaf Hering # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/syslib/open_pic2.c # 2004/09/16 23:58:37-07:00 olh@suse.de +1 -0 # ppc32: open_pic2.c build fix # # ChangeSet # 2004/09/17 11:55:59-07:00 trini@kernel.crashing.org # [PATCH] ppc32: Fix arch/ppc/boot/common/ns16550.c # # When started including this exposed one of the # fragilities of the code in arch/ppc/boot/, namely that it is tied to the # kernel headers for some information, yet not really the kernel. The # following starts us in the direction of being less tied to the kernel by # providing our own serial_state definition (all we care about is the ability # to grab information from SERIAL_PORT_DFNS). # # Signed-off-by: Tom Rini # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/boot/include/serial.h # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +46 -0 # ppc32: Fix arch/ppc/boot/common/ns16550.c # # arch/ppc/boot/common/ns16550.c # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +3 -3 # ppc32: Fix arch/ppc/boot/common/ns16550.c # # arch/ppc/boot/include/serial.h # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/ppc/boot/include/serial.h # # ChangeSet # 2004/09/17 11:55:43-07:00 roland@redhat.com # [PATCH] fix posix-timers leak # # Exec fails to clean up posix-timers. This manifests itself in two ways, one # worse than the other. In the single-threaded case, it just fails to clear out # the timers on exec. POSIX says that exec clears out the timers from # timer_create (though not the setitimer ones), so it's wrong that a lingering # timer could fire after exec and kill the process with a signal it's not # expecting. In the multi-threaded case, it not only leaves lingering timers, # but it leaks them entirely when it replaces signal_struct, so they will never # be freed by the process exiting after that exec. The new per-user # RLIMIT_SIGPENDING actually limits the damage here, because a UID will fill up # its quota with leaked timers and then never be able to use timer_create again # (that's what my test program does). But if you have many many untrusted UIDs, # this leak could be considered a DoS risk. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/exec.c # 2004/09/16 23:58:37-07:00 roland@redhat.com +3 -1 # fix posix-timers leak # # ChangeSet # 2004/09/17 11:55:31-07:00 mingo@elte.hu # [PATCH] x86 TSS: io bitmap lazy updating # # This uses Davide's do_general_protection() fault based io-bitmap lazy update # code and combines it with the ioport-owner cache. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-i386/processor.h # 2004/09/16 23:58:37-07:00 mingo@elte.hu +1 -0 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/traps.c # 2004/09/17 00:28:10-07:00 mingo@elte.hu +30 -0 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/process.c # 2004/09/17 00:28:01-07:00 mingo@elte.hu +8 -9 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/ioport.c # 2004/09/16 23:58:37-07:00 mingo@elte.hu +5 -5 # x86 TSS: io bitmap lazy updating # # ChangeSet # 2004/09/17 11:55:17-07:00 mingo@elte.hu # [PATCH] x86 TSS: io port caching # # There's one additional step we can do ontop of the ports-max code to get rid # of copying in X.org's case: cache the last task that set up the IO bitmap. # This means we can set the offset to invalid and keep the IO bitmap of that # task, and switch back to a valid offset (without any copying) when switching # back to that task. (or do a copy if there is another ioperm task we switch # to.) # # I've attached ioport-cache-2.6.8.1.patch that implements this. When # there's a single active ioperm() using task in the system then the # context-switch overhead is very low and constant: # # # ./ioperm-latency # default no ioperm: scheduling latency: 2478 cycles # turning on port 80 ioperm: scheduling latency: 2499 cycles # turning on port 65535 ioperm: scheduling latency: 2481 cycles # # This single-ioperm-user situation matches 99% of the actual ioperm() # usage scenarios and gets rid of any copying whatsoever - without relying # on any fault mechanism. I can see no advantage of the GPF approach over # this patch. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-i386/processor.h # 2004/09/17 00:28:16-07:00 mingo@elte.hu +10 -3 # x86 TSS: io port caching # # arch/i386/kernel/process.c # 2004/09/17 00:28:16-07:00 mingo@elte.hu +39 -15 # x86 TSS: io port caching # # arch/i386/kernel/ioport.c # 2004/09/17 00:28:16-07:00 mingo@elte.hu +4 -1 # x86 TSS: io port caching # # ChangeSet # 2004/09/17 11:55:05-07:00 rsa@us.ibm.com # [PATCH] hvc_console fix to protect hvc_write against ldisc write after hvc_close # # Due to the tty ldisc code not stopping write operations against a driver # even after a tty has been closed I added a mechanism to hvc_console in my # previous patch to prevent this by nulling out the tty->driver_data in # hvc_close() but I forgot to check tty->driver_data in hvc_write(). Anton # Blanchard got several oops'es from hvc_write() accessing NULL as if it were # a pointer to an hvc_struct usually stored in tty->driver_data. # # So this patch checks tty->driver_data in hvc_write() before it is used. # Hopefully once Alan Cox's patch is checked in ldisc writes won't continue # to happen after tty closes. # # Anton Blanchard has tested this patch and is unable to reproduce the oops # with it applied. # # Changelog: # # drivers/char/hvc_console.c # # - Added comment to hvc_close() to explain the reason for NULLing # tty->driver_data. # # - Added check to hvc_write() to verify that tty->driver_data is valid # (NOT NULL) which would be the case if the write operation was invoked # after a tty close was initiated on the tty. # # Signed-off-by: Ryan S. Arnold # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvc_console.c # 2004/09/16 23:58:37-07:00 rsa@us.ibm.com +9 -0 # hvc_console fix to protect hvc_write against ldisc write after hvc_close # # ChangeSet # 2004/09/17 11:54:51-07:00 Markus.Lidel@shadowconnect.com # [PATCH] reduce ioremap memory size for Adaptec I2O controllers # # The I2O subsystem currently map all memory from the I2O controller for the # controller's in queue, even if it is not necessary. This is a problem, # because on some systems the size returned from pci_resource_len() could be # 128MB and only 1-4MB is needed. # # Changes: # # - only ioremap as much memory as the controller is actually using. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/message/i2o/pci.c # 2004/09/16 23:58:37-07:00 Markus.Lidel@shadowconnect.com +15 -0 # reduce ioremap memory size for Adaptec I2O controllers # # ChangeSet # 2004/09/17 11:11:23-07:00 david@gibson.dropbear.id.au # [IPV4]: Initialize newly allocated hash tables in fib_semantics.c # # When fib_create_info() allocates new hash tables, it neglects to # initialize them. This leads to an oops during boot on at least # machine I use. This patch addresses the problem. # # Signed-off-by: David Gibson # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 11:11:04-07:00 david@gibson.dropbear.id.au +5 -1 # [IPV4]: Initialize newly allocated hash tables in fib_semantics.c # # When fib_create_info() allocates new hash tables, it neglects to # initialize them. This leads to an oops during boot on at least # machine I use. This patch addresses the problem. # # Signed-off-by: David Gibson # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 12:07:11-04:00 akpm@osdl.org # [PATCH] fix driver name in eth1394 as returned by ETHTOOL_GDRVINFO # # From: Thierry Vignaud # # The GDRVINFO command of the ETHTOOL ioctl returns a bogus driver name. # # Signed-off-by: Andrew Morton # # drivers/ieee1394/eth1394.c # 2004/09/14 14:13:05-04:00 akpm@osdl.org +1 -1 # fix driver name in eth1394 as returned by ETHTOOL_GDRVINFO # # ChangeSet # 2004/09/17 07:54:01-07:00 trini@kernel.crashing.org # ppc32: The ISA PIC address for int-ack wasn't being picked out right # # Signed-off-by: Leigh Brown # Signed-off-by: Tom Rini # # arch/ppc/platforms/residual.c # 2004/09/17 07:53:38-07:00 trini@kernel.crashing.org +2 -2 # The ISA PIC address for acknowledging interrupts is actually # defined in residual data as a 32-bit system address, rather # than a 32-bit memory address. This is rather embarrasing, as # I don't think this function has done the right thing, ever. # # ChangeSet # 2004/09/17 07:51:37-07:00 trini@kernel.crashing.org # ppc32: Fix a problem with the FCC enet driver for CPM2 systems # # The Local Protect Bit needs to be set when entering full # duplex mode. # # Signed-off-by: Rune Torgersen # Signed-off-by: Tom Rini # # arch/ppc/8260_io/fcc_enet.c # 2004/09/17 07:51:14-07:00 trini@kernel.crashing.org +2 -2 # The Local Protect Bit is not set when enterring Full Duplex mode. # This causes the FCC to turn off the transmitter when packets are # received, and also causes NonOctet frame errors and CRC errors # (late collission) # # ChangeSet # 2004/09/16 18:23:10-07:00 davem@nuts.davemloft.net # [SPARC]: Kill dump_dma_regs, unused. # # Signed-off-by: David S. Miller # # drivers/sbus/dvma.c # 2004/09/16 18:22:39-07:00 davem@nuts.davemloft.net +0 -11 # [SPARC]: Kill dump_dma_regs, unused. # # ChangeSet # 2004/09/16 18:21:41-07:00 davem@nuts.davemloft.net # [SPARC64]: Missing ioremap() in parport support. # # Signed-off-by: David S. Miller # # include/asm-sparc64/parport.h # 2004/09/16 18:21:10-07:00 davem@nuts.davemloft.net +5 -1 # [SPARC64]: Missing ioremap() in parport support. # # ChangeSet # 2004/09/16 18:08:07-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix I/O port args to string routines. # # Signed-off-by: David S. Miller # # arch/sparc64/lib/PeeCeeI.c # 2004/09/16 18:07:37-07:00 davem@nuts.davemloft.net +6 -6 # [SPARC64]: Fix I/O port args to string routines. # # ChangeSet # 2004/09/16 20:43:18-04:00 olh@suse.de # [PATCH] mark mace and bmac as ppc32 only # # mace and bmac are only used in "oldworld" PowerMacs. # Mark them as ppc32 only. # # drivers/net/Kconfig # 2004/09/06 09:27:26-04:00 olh@suse.de +2 -2 # mark mace and bmac as ppc32 only # # ChangeSet # 2004/09/16 17:25:12-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # Signed-off-by: David S. Miller # # drivers/scsi/qlogicpti.h # 2004/09/16 17:24:41-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # drivers/scsi/qlogicpti.c # 2004/09/16 17:24:41-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # ChangeSet # 2004/09/16 17:21:15-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in esp scsi driver. # # Signed-off-by: David S. Miller # # drivers/scsi/esp.h # 2004/09/16 17:20:43-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: Fix iomem warnings in esp scsi driver. # # drivers/scsi/esp.c # 2004/09/16 17:20:43-07:00 davem@nuts.davemloft.net +0 -0 # [SPARC64]: Fix iomem warnings in esp scsi driver. # # ChangeSet # 2004/09/16 17:11:17-07:00 davem@nuts.davemloft.net # [B44]: Fix remaining iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/b44.h # 2004/09/16 17:10:44-07:00 davem@nuts.davemloft.net +1 -1 # [B44]: Fix remaining iomem warnings. # # drivers/net/b44.c # 2004/09/16 17:10:44-07:00 davem@nuts.davemloft.net +2 -2 # [B44]: Fix remaining iomem warnings. # # ChangeSet # 2004/09/16 17:08:09-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in flash driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/flash.c # 2004/09/16 17:07:39-07:00 davem@nuts.davemloft.net +2 -1 # [SPARC64]: Fix iomem warnings in flash driver. # # ChangeSet # 2004/09/16 17:05:52-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in cpwatchdog driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/cpwatchdog.c # 2004/09/16 17:05:24-07:00 davem@nuts.davemloft.net +35 -49 # [SPARC64]: Fix iomem warnings in cpwatchdog driver. # # ChangeSet # 2004/09/16 16:50:24-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in display7seg driver. # # drivers/sbus/char/display7seg.c # 2004/09/16 16:50:03-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in display7seg driver. # # ChangeSet # 2004/09/16 16:43:54-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in envctrl driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/envctrl.c # 2004/09/16 16:43:26-07:00 davem@nuts.davemloft.net +23 -42 # [SPARC64]: Fix iomem warnings in envctrl driver. # # ChangeSet # 2004/09/16 16:02:39-07:00 davem@nuts.davemloft.net # [TYPHOON]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/typhoon.c # 2004/09/16 16:02:08-07:00 davem@nuts.davemloft.net +27 -26 # [TYPHOON]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:53:59-07:00 davem@nuts.davemloft.net # [MYRI_SBUS]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/myri_sbus.h # 2004/09/16 15:53:28-07:00 davem@nuts.davemloft.net +8 -9 # [MYRI_SBUS]: Fix iomem warnings. # # drivers/net/myri_sbus.c # 2004/09/16 15:53:28-07:00 davem@nuts.davemloft.net +33 -34 # [MYRI_SBUS]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:42:01-07:00 davem@nuts.davemloft.net # [SUNBMAC]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunbmac.h # 2004/09/16 15:41:29-07:00 davem@nuts.davemloft.net +4 -4 # [SUNBMAC]: Fix iomem warnings. # # drivers/net/sunbmac.c # 2004/09/16 15:41:29-07:00 davem@nuts.davemloft.net +20 -20 # [SUNBMAC]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:35:11-07:00 davem@nuts.davemloft.net # [SUNQE]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunqe.h # 2004/09/16 15:34:41-07:00 davem@nuts.davemloft.net +3 -3 # [SUNQE]: Fix iomem warnings. # # drivers/net/sunqe.c # 2004/09/16 15:34:41-07:00 davem@nuts.davemloft.net +7 -7 # [SUNQE]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:31:27-07:00 davem@nuts.davemloft.net # [SUNLANCE]: Fix iomem warnings. # # Also clear all the bogus volatile usage out of # this driver. # # Signed-off-by: David S. Miller # # include/asm-sparc64/dma.h # 2004/09/16 15:30:47-07:00 davem@nuts.davemloft.net +1 -1 # [SUNLANCE]: Fix iomem warnings. # # drivers/net/sunlance.c # 2004/09/16 15:30:47-07:00 davem@nuts.davemloft.net +32 -32 # [SUNLANCE]: Fix iomem warnings. # # ChangeSet # 2004/09/16 22:25:43+00:00 markgw@sgi.com # [IA64] SGI Altix hardware performance monitoring API # # # The SGI Altix PROM supports a SAL call for performance monitoring and for # exporting NUMA topology. We need this in community kernels for diagnostic # and performance tools to use, especially on very large machines. # # This patch registers a dynamic misc device "sn_hwperf" that supports an # ioctl interface for reading/writing memory mapped registers on Altix # nodes and routers via the new SAL call. It also creates a read-only # procfs file "/proc/sgi_sn/sn_topology" to export NUMA topology and Altix # hardware inventory. # # > What tools are using this? # # Performance Co-Pilot http://oss.sgi.com/projects/pcp in particular, # pmshub, shubstats and linkstat. Numerous other users include anything # that needs knowledge of numa topology/interconnect in order to perform # well, e.g. mpt. BTW I have not exported any API functions .. at this # point I don't think we need any modules to call the API. # # Signed-off-by: Mark Goodwin # Signed-off-by: Tony Luck # # include/asm-ia64/sn/sn_sal.h # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +18 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/sn_proc_fs.c # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +7 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/Makefile # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Add SGI h/w performance API # # include/asm-ia64/sn/sn2/sn_hwperf.h # 2004/09/16 22:18:29+00:00 aegl@agluck-lia64.sc.intel.com +218 -0 # Add SGI h/w performance API # # include/asm-ia64/sn/sn2/sn_hwperf.h # 2004/09/16 22:18:29+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # BitKeeper file /data/home/aegl/BK/work/sgi/include/asm-ia64/sn/sn2/sn_hwperf.h # # arch/ia64/sn/kernel/sn2/sn_hwperf.c # 2004/09/16 22:18:28+00:00 aegl@agluck-lia64.sc.intel.com +652 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/sn_hwperf.c # 2004/09/16 22:18:28+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # BitKeeper file /data/home/aegl/BK/work/sgi/arch/ia64/sn/kernel/sn2/sn_hwperf.c # # ChangeSet # 2004/09/16 15:14:20-07:00 davem@nuts.davemloft.net # [SUNHME]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunhme.h # 2004/09/16 15:13:50-07:00 davem@nuts.davemloft.net +7 -7 # [SUNHME]: Fix iomem warnings. # # drivers/net/sunhme.c # 2004/09/16 15:13:50-07:00 davem@nuts.davemloft.net +39 -38 # [SUNHME]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:05:36-07:00 davem@nuts.davemloft.net # [MPTFUSION]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/message/fusion/mptbase.h # 2004/09/16 15:05:06-07:00 davem@nuts.davemloft.net +2 -2 # [MPTFUSION]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:02:22-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in i8042-sparcio.h # # Signed-off-by: David S. Miller # # drivers/input/serio/i8042-sparcio.h # 2004/09/16 15:01:53-07:00 davem@nuts.davemloft.net +4 -4 # [SPARC64]: Fix iomem warnings in i8042-sparcio.h # # ChangeSet # 2004/09/16 15:00:23-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in cs4231 sound driver. # # Signed-off-by: David S. Miller # # sound/sparc/cs4231.c # 2004/09/16 14:59:57-07:00 davem@nuts.davemloft.net +8 -8 # [SPARC64]: Fix iomem warnings in cs4231 sound driver. # # ChangeSet # 2004/09/16 14:58:10-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in amd7930 sound driver. # # Signed-off-by: David S. Miller # # sound/sparc/amd7930.c # 2004/09/16 14:57:41-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in amd7930 sound driver. # # ChangeSet # 2004/09/16 14:56:48-07:00 davem@nuts.davemloft.net # [SPARC64]: Make IDE ops take __iomem pointers. # # Signed-off-by: David S. Miller # # include/asm-sparc64/ide.h # 2004/09/16 14:56:16-07:00 davem@nuts.davemloft.net +4 -8 # [SPARC64]: Make IDE ops take __iomem pointers. # # ChangeSet # 2004/09/16 14:53:28-07:00 davem@nuts.davemloft.net # [FC4]: Fix iomem warnings in SOCAL driver. # # drivers/fc4/socal.h # 2004/09/16 14:53:06-07:00 davem@nuts.davemloft.net +3 -3 # [FC4]: Fix iomem warnings in SOCAL driver. # # drivers/fc4/socal.c # 2004/09/16 14:53:06-07:00 davem@nuts.davemloft.net +2 -2 # [FC4]: Fix iomem warnings in SOCAL driver. # # ChangeSet # 2004/09/16 14:51:08-07:00 davem@nuts.davemloft.net # [FC4]: Fix iomem warnings in SOC driver. # # drivers/fc4/soc.h # 2004/09/16 14:50:46-07:00 davem@nuts.davemloft.net +10 -10 # [FC4]: Fix iomem warnings in SOC driver. # # drivers/fc4/soc.c # 2004/09/16 14:50:46-07:00 davem@nuts.davemloft.net +0 -0 # [FC4]: Fix iomem warnings in SOC driver. # # ChangeSet # 2004/09/16 14:44:58-07:00 davem@nuts.davemloft.net # [SPARC64]: Update defconfig. # # arch/sparc64/defconfig # 2004/09/16 14:44:38-07:00 davem@nuts.davemloft.net +5 -2 # [SPARC64]: Update defconfig. # # ChangeSet # 2004/09/16 14:43:33-07:00 davem@nuts.davemloft.net # [SPARC64]: Add io{read,write}{8,16,32}_rep(). # # Signed-off-by: David S. Miller # # include/asm-sparc64/io.h # 2004/09/16 14:43:04-07:00 davem@nuts.davemloft.net +12 -6 # [SPARC64]: Add io{read,write}{8,16,32}_rep(). # # ChangeSet # 2004/09/16 20:26:04+00:00 aegl@agluck-lia64.sc.intel.com # Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/Linus # into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.9 # # arch/ia64/Kconfig # 2004/09/16 20:25:58+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # ChangeSet # 2004/09/16 13:19:01-07:00 bdschuym@pandora.be # [NETFILTER]: port physdev to ip6tables # # Signed-off-by: Bart De Schuymer # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv6/netfilter/Makefile # 2004/09/16 13:18:28-07:00 bdschuym@pandora.be +1 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/Kconfig # 2004/09/16 13:18:27-07:00 bdschuym@pandora.be +9 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/ip6t_physdev.c # 2004/09/16 13:18:24-07:00 bdschuym@pandora.be +136 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/ip6t_physdev.c # 2004/09/16 13:18:24-07:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6/net/ipv6/netfilter/ip6t_physdev.c # # include/linux/netfilter_ipv6/ip6t_physdev.h # 2004/09/16 13:18:23-07:00 bdschuym@pandora.be +24 -0 # [NETFILTER]: port physdev to ip6tables # # include/linux/netfilter_ipv6/ip6t_physdev.h # 2004/09/16 13:18:23-07:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6/include/linux/netfilter_ipv6/ip6t_physdev.h # # ChangeSet # 2004/09/16 13:13:12-07:00 tgraf@suug.ch # [PKT_SCHED]: Fix slab corruption in cbq_destroy # # Fixes slab corruption in cbq_destroy. cbq_destroy_filters and # qdisc_put_rtab(q->link.R_tab) are already called in cbq_destroy_class. # The latter lead to a slab corruption due to repeated freeing of # q->link.R_tab because q->link is part of q->classes. Problem introduced # in 1.21. # # Signed-off-by: Thomas Graf # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/sched/sch_cbq.c # 2004/09/16 13:12:54-07:00 tgraf@suug.ch +0 -6 # [PKT_SCHED]: Fix slab corruption in cbq_destroy # # Fixes slab corruption in cbq_destroy. cbq_destroy_filters and # qdisc_put_rtab(q->link.R_tab) are already called in cbq_destroy_class. # The latter lead to a slab corruption due to repeated freeing of # q->link.R_tab because q->link is part of q->classes. Problem introduced # in 1.21. # # Signed-off-by: Thomas Graf # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 13:12:04-07:00 herbert@gondor.apana.org.au # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/key/af_key.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +4 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/xfrm6_input.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +2 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/xfrm4_input.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +2 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +6 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/xfrm.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +1 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/pfkeyv2.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +1 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 13:10:18-07:00 herbert@gondor.apana.org.au # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/sched/sch_red.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/xfrm6_input.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/tcp_ipv6.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/sit.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/ip_gre.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +1 -3 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 12:57:58-07:00 yoshfuji@linux-ipv6.org # [IPV6]: NDISC: ensure responding to NS without link-layer information # # When sending NA in response to NS, we may not know the # link-layer address for the destination of the NA # since unicast NS is not required to include its link-layer information. # In this case, we first need to resolve the link-layer address. # (RFC 2461 7.2.4) # # We now create neighbour entry for the destination # and link-layer information will be automatically solved # in the output path. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # net/ipv6/ndisc.c # 2004/09/16 12:57:40-07:00 yoshfuji@linux-ipv6.org +2 -1 # [IPV6]: NDISC: ensure responding to NS without link-layer information # # When sending NA in response to NS, we may not know the # link-layer address for the destination of the NA # since unicast NS is not required to include its link-layer information. # In this case, we first need to resolve the link-layer address. # (RFC 2461 7.2.4) # # We now create neighbour entry for the destination # and link-layer information will be automatically solved # in the output path. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 19:57:29+00:00 jbarnes@sgi.com # [IA64] Kconfig: Add help text for IA64_SGI_SN2 config option. # # Mark Goodwin suggested that we document our platform a bit. This patch adds # help text for the sn2 specific kernel option. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # ChangeSet # 2004/09/16 12:56:49-07:00 eric.lemoine@gmail.com # [SUNGEM]: Add netpoll support. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.c # 2004/09/16 12:56:28-07:00 eric.lemoine@gmail.com +16 -0 # [SUNGEM]: Add netpoll support. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # arch/ia64/Kconfig # 2004/09/16 19:55:32+00:00 aegl@agluck-lia64.sc.intel.com +6 -0 # Add help text for IA64_SGI_SN2 config option. # # ChangeSet # 2004/09/16 12:11:21-07:00 vandrove@vc.cvut.cz # [PATCH] matroxfb update + sparse annotations # # This change switches matroxfb on x86 and x86_64 from dereferencing # pointers to {read,write}[bwl], as __pa() are gone from them, and so gcc # does not need an additional register for preserving address between # consecutive {read,write}[bwl]. # # Then it switches only supported architecture left (ppc/ppc64/arm) from # dereferencing pointers to __raw_{read,write}[bwl]. # # Third part is fixing sparse complaints: add __iomem here and there, and # switch one 1bit bitfield from int to unsigned int. # # After this there should be no sparse complaints in matroxfb. # # Signed-off-by: Petr Vandrovec # Signed-off-by: Linus Torvalds # # drivers/video/matrox/matroxfb_misc.c # 2004/09/16 06:33:22-07:00 vandrove@vc.cvut.cz +6 -6 # matroxfb update + sparse annotations # # drivers/video/matrox/matroxfb_crtc2.h # 2004/09/16 06:31:05-07:00 vandrove@vc.cvut.cz +1 -1 # matroxfb update + sparse annotations # # drivers/video/matrox/matroxfb_base.h # 2004/09/16 08:12:04-07:00 vandrove@vc.cvut.cz +12 -19 # matroxfb update + sparse annotations # # ChangeSet # 2004/09/16 19:11:00+00:00 kaos@sgi.com # [IA64] ar.k[56] have virtual addresses already, don't convert # # r.k[56] used to contain physical addresses but now contain virtual # addresses. There are code remnants which still believe that they are # physical and "convert" ar.k[56] to virtual. This breaks when current # is not in region 7 (e.g. the idle task on cpu 0). # # Signed-off-by: Keith Owens # Signed-off-by: Tony Luck # # include/asm-ia64/mca_asm.h # 2004/09/16 19:09:04+00:00 aegl@agluck-lia64.sc.intel.com +0 -3 # ar.k[56] have virtual addresses already # # arch/ia64/kernel/minstate.h # 2004/09/16 19:09:04+00:00 aegl@agluck-lia64.sc.intel.com +1 -3 # ar.k[56] have virtual addresses already # # ChangeSet # 2004/09/16 11:50:39-07:00 alex.williamson@hp.com # [PATCH] fix compat_do_execve stack usage # # Looks like a couple struct to pointer conversions were missed. # # Signed-off-by: Linus Torvalds # # fs/compat.c # 2004/09/16 11:19:26-07:00 alex.williamson@hp.com +2 -2 # fix compat_do_execve stack usage # # ChangeSet # 2004/09/16 07:13:57-07:00 rusty@rustcorp.com.au # [PATCH] Fix ip_nat_ftp registration when no ports= arg # # FTP NAT module doesn't register anything with no args. Oops. # # Signed-off-by: Rusty Russell # Signed-off-by: Linus Torvalds # # net/ipv4/netfilter/ip_nat_ftp.c # 2004/09/15 15:05:38-07:00 rusty@rustcorp.com.au +1 -1 # Fix ip_nat_ftp registration when no ports= arg # # ChangeSet # 2004/09/16 07:12:54-07:00 roland@redhat.com # [PATCH] back out siginfo_t.si_rusage from waitid changes # # As I explained in the waitid patches, I added the si_rusage field to # siginfo_t with the idea of having the siginfo_t waitid fills in contain all # the information that wait4 or any such call could ever tell you. Nowhere # in POSIX nor anywhere else specifies this field in siginfo_t. # # When Ulrich and I hashed out the system call interface we wanted, we looked # at siginfo_t and decided there was plenty of space to throw in si_rusage. # Well, it turns out we didn't check the 64-bit platforms. There struct # rusage is ridiculously large (lots of longs for things that are never in a # million years going to hit 2^32), and my changes bumped up the size of # siginfo_t. Changing that size is more trouble than it's worth. # # This patch reverts the changes to the siginfo_t structure types, # and no longer provides the rusage details in SIGCHLD signal data. # Instead, I added a fifth argument to the waitid system call to fill in rusage. # # waitid is the name of the POSIX function with four arguments. It might # make sense to rename the system call `waitsys' to follow SGI's system call # with the same arguments, or `wait5' in the mindless tradition. But, feh. # I just added the argument to sys_waitid, rather than worrying about # changing the name in all the tables (and choosing a new stupid name). # # Signed-off-by: Roland McGrath # Signed-off-by: Linus Torvalds # # kernel/signal.c # 2004/09/15 01:26:18-07:00 roland@redhat.com +0 -4 # back out siginfo_t.si_rusage from waitid changes # # kernel/exit.c # 2004/09/15 01:25:50-07:00 roland@redhat.com +10 -7 # back out siginfo_t.si_rusage from waitid changes # # include/asm-x86_64/ia32.h # 2004/09/15 11:38:24-07:00 roland@redhat.com +0 -1 # back out siginfo_t.si_rusage from waitid changes # # include/asm-ia64/siginfo.h # 2004/09/15 11:38:30-07:00 roland@redhat.com +0 -1 # back out siginfo_t.si_rusage from waitid changes # # include/asm-generic/siginfo.h # 2004/09/15 01:26:58-07:00 roland@redhat.com +0 -2 # back out siginfo_t.si_rusage from waitid changes # # arch/x86_64/ia32/ia32_signal.c # 2004/09/15 01:46:29-07:00 roland@redhat.com +0 -2 # back out siginfo_t.si_rusage from waitid changes # # arch/sparc64/kernel/signal32.c # 2004/09/15 11:38:55-07:00 roland@redhat.com +0 -3 # back out siginfo_t.si_rusage from waitid changes # # ChangeSet # 2004/09/16 23:28:42+10:00 airlied@starflyer.(none) # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +2 -2 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_os_linux.h # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +2 -2 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +4 -4 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/16 21:15:38+10:00 airlied@starflyer.(none) # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +2 -2 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/drm_os_linux.h # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +2 -2 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +4 -4 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # ChangeSet # 2004/09/16 21:09:37+10:00 airlied@starflyer.(none) # drm: add pci_enable_device # # Add pci_enable_device for any PCI device we want to use. # # From: Bjorn Helgaas # Approved-by: David Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 21:09:30+10:00 airlied@starflyer.(none) +3 -0 # drm: add pci_enable_device # # Add pci_enable_device for any PCI device we want to use. # # From: Bjorn Helgaas # Approved-by: David Airlie # # ChangeSet # 2004/09/16 19:57:18+10:00 airlied@starflyer.(none) # drm: fix bug introduced in the macro removal # # This caused issues with a PCI radeon card. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_scatter.h # 2004/09/16 19:53:12+10:00 airlied@starflyer.(none) +1 -1 # drm: fix bug introduced in the macro removal # # This caused issues with a PCI radeon card. # # From: Jon Smirl # Approved-by: Dave Airlie # # ChangeSet # 2004/09/16 02:45:22-04:00 jgarzik@pobox.com # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # include/linux/libata.h # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +5 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_vsc.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_via.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sx4.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +2 -1 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_svw.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sis.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sil.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_promise.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_nv.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/libata-core.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +41 -21 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/ata_piix.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +2 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # ChangeSet # 2004/09/15 23:02:18+00:00 jbarnes@sgi.com # [IA64-SGI]: fix `qw' might be used uninitialized warning # # The compiler has no way of knowing whether nentries will be greater than 0, so # it was generating a warning that qw might be used uninitialized. Fix it by # explicitly setting it to 0. Cc'ing Brian in case he has an internal version # he'd like to keep in sync. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/sn/kernel/sn2/prominfo_proc.c # 2004/09/15 22:58:59+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # fix `qw' might be used uninitialized # # ChangeSet # 2004/09/15 21:34:47+00:00 tony.luck@intel.com # [IA64] make INIT dump work again # # current can be in region 5, use 'tpa' to convert to physical # # Signed-off-by: Tony Luck # # arch/ia64/kernel/minstate.h # 2004/09/15 21:32:29+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # current can be in region 5, use 'tpa' to convert to physical # # ChangeSet # 2004/09/15 13:55:32-07:00 davem@nuts.davemloft.net # [IPV4]: More fib_hash cleanups. # # Kill fn_key_eq and fn_key_leq # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/15 13:54:54-07:00 davem@nuts.davemloft.net +10 -21 # [IPV4]: More fib_hash cleanups. # # ChangeSet # 2004/09/15 16:58:53-03:00 acme@conectiva.com.br # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # include/linux/net.h # 2004/09/15 16:58:39-03:00 acme@conectiva.com.br +9 -1 # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # include/asm-mips/socket.h # 2004/09/15 16:58:39-03:00 acme@conectiva.com.br +27 -0 # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 10:20:55-07:00 davem@nuts.davemloft.net # [NETFILTER]: Fix tcp_find_option() bug properly. # # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_tables.c # 2004/09/15 10:20:14-07:00 davem@nuts.davemloft.net +5 -2 # [NETFILTER]: Fix tcp_find_option() bug properly. # # ChangeSet # 2004/09/15 09:18:46-07:00 davem@nuts.davemloft.net # [IPV4]: Use hlist_for_each_entry_safe in fib_hash_move. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/15 09:18:16-07:00 davem@nuts.davemloft.net +4 -4 # [IPV4]: Use hlist_for_each_entry_safe in fib_hash_move. # # ChangeSet # 2004/09/15 09:16:19-07:00 davem@nuts.davemloft.net # [IPV4]: Basic cleanups in fib_hash.c # # 1) Kill special key, prefix, and hash index types. # They make the code less readable and maintainable. # 2) __inline__ --> inline # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/15 09:15:50-07:00 davem@nuts.davemloft.net +29 -51 # [IPV4]: Basic cleanups in fib_hash.c # # 1) Kill special key, prefix, and hash index types. # They make the code less readable and maintainable. # 2) __inline__ --> inline # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 08:34:58-07:00 davem@nuts.davemloft.net # [NETFILTER]: Fix off-by-one test error in ip_tables.c # # Bug noticed by Ysauyuki Kozakai. # # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_tables.c # 2004/09/15 08:34:17-07:00 davem@nuts.davemloft.net +1 -1 # [NETFILTER]: Fix off-by-one test error in ip_tables.c # # ChangeSet # 2004/09/15 08:18:16-07:00 eric.lemoine@gmail.com # [SUNGEM]: LLTX support # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.c # 2004/09/15 08:17:58-07:00 eric.lemoine@gmail.com +10 -4 # [SUNGEM]: LLTX support # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 08:16:44-07:00 eric.lemoine@gmail.com # [SUNGEM]: Add tx_lock # # Using tx_lock in SunGEM makes the driver logic in conformance # with tg3 and e1000, easing maintainance. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.h # 2004/09/15 08:16:05-07:00 eric.lemoine@gmail.com +1 -0 # [SUNGEM]: Add tx_lock # # drivers/net/sungem.c # 2004/09/15 08:16:05-07:00 eric.lemoine@gmail.com +58 -17 # [SUNGEM]: Add tx_lock # # ChangeSet # 2004/09/15 07:39:07-07:00 trini@kernel.crashing.org # ppc32: Fix some warnings in rheap from newer compilers # # Signed-off-by: Pantelis Antoniou # Signed-off-by: Tom Rini # # arch/ppc/lib/rheap.c # 2004/09/15 07:38:56-07:00 trini@kernel.crashing.org +4 -4 # Warning fixes. # # ChangeSet # 2004/09/15 07:25:30-07:00 vda@port.imtp.ilyichevsk.odessa.ua # [PATCH] reduce [compat_]do_execve stack usage # # Allocating the 'struct linux_binprm' on the stack chews up too much # stackspace. # # Just kmalloc it instead. # # Signed-off-by: Linus Torvalds # # fs/exec.c # 2004/09/14 16:49:49-07:00 vda@port.imtp.ilyichevsk.odessa.ua +39 -37 # reduce [compat_]do_execve stack usage # # fs/compat.c # 2004/09/14 16:24:46-07:00 vda@port.imtp.ilyichevsk.odessa.ua +37 -37 # reduce [compat_]do_execve stack usage # # ChangeSet # 2004/09/15 05:17:25-07:00 rth@kanga.twiddle.home # [ALPHA] Implement _raw_write_trylock. # # include/asm-alpha/spinlock.h # 2004/09/15 05:17:05-07:00 rth@kanga.twiddle.home +23 -0 # Implement _raw_write_trylock. # # ChangeSet # 2004/09/15 05:16:14-07:00 rth@kanga.twiddle.home # [ALPHA] Minor updates for cpumask_t. # # arch/alpha/kernel/sys_titan.c # 2004/09/15 05:15:54-07:00 rth@kanga.twiddle.home +3 -3 # Update titan_cpu_set_irq_affinity for cpumask_t. # # ChangeSet # 2004/09/14 22:32:27-07:00 yoshfuji@linux-ipv6.org # [IPV6]: Missing xfrm_lookup() in icmpv6_{send,echo_reply}() # # net/ipv6/icmp.c was not converted in xfrm_lookup() extraction patch. # This patch converts it; adding the missing call to xfrm_lookup in # icmpv6_{send,echo_reply}(). # # Signed-off-by: Kazunori Miyazawa # Signed-off-by: Hideaki YOSHIFUJI # SIgned-off-by: David S. Miller # # net/ipv6/icmp.c # 2004/09/14 22:32:09-07:00 yoshfuji@linux-ipv6.org +5 -0 # [IPV6]: Missing xfrm_lookup() in icmpv6_{send,echo_reply}() # # net/ipv6/icmp.c was not converted in xfrm_lookup() extraction patch. # This patch converts it; adding the missing call to xfrm_lookup in # icmpv6_{send,echo_reply}(). # # Signed-off-by: Kazunori Miyazawa # Signed-off-by: Hideaki YOSHIFUJI # SIgned-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:21:40-07:00 davem@nuts.davemloft.net # [CRYPTO]: Zero out tfm before freeing in crypto_free_tfm(). # # Based upon discussions with Ulrich Kuehn # (ukuehn@acm.org) # # Signed-off-by: James Morris # Signed-off-by: David S. Miller # # crypto/api.c # 2004/09/14 22:21:12-07:00 davem@nuts.davemloft.net +5 -1 # [CRYPTO]: Zero out tfm before freeing in crypto_free_tfm(). # # Based upon discussions with Ulrich Kuehn # (ukuehn@acm.org) # # Signed-off-by: James Morris # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:15:26-07:00 davem@nuts.davemloft.net # [TG3]: Update driver version and reldate. # # drivers/net/tg3.c # 2004/09/14 22:15:06-07:00 davem@nuts.davemloft.net +2 -2 # [TG3]: Update driver version and reldate. # # ChangeSet # 2004/09/14 22:10:26-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:09:48-07:00 davem@nuts.davemloft.net +1 -1 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # drivers/net/tg3.c # 2004/09/14 22:09:48-07:00 davem@nuts.davemloft.net +14 -20 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # ChangeSet # 2004/09/14 22:06:01-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:05:42-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:03:10-07:00 davem@nuts.davemloft.net # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/14 22:02:13-07:00 davem@nuts.davemloft.net +241 -36 # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # include/net/ip_fib.h # 2004/09/14 22:02:13-07:00 davem@nuts.davemloft.net +12 -12 # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 21:23:34-07:00 herbert@gondor.apana.org.au # [NET]: Convert RTM+_* to enum. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/rtnetlink.h # 2004/09/14 21:23:04-07:00 herbert@gondor.apana.org.au +83 -47 # [NET]: Convert RTM+_* to enum. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:25:41-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:25:34-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:23:54-04:00 jgarzik@pobox.com # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/sata_nv.c # 2004/09/14 22:23:47-04:00 jgarzik@pobox.com +0 -2 # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/libata-core.c # 2004/09/14 22:23:47-04:00 jgarzik@pobox.com +13 -13 # [libata] minor comment updates, preparing for iomap merge # # ChangeSet # 2004/09/14 17:40:07-07:00 torvalds@ppc970.osdl.org # Fix up typo in ppc64 eeh ioport_map() code. # # Noticed by BenH, happily harmless (nothing that uses that # code has been committed yet, and PIO seems to be pretty much # unused on at least the Apple G5 machines: all the normal # hardware is set up purely for MMIO, to the point that I # couldn't even test this thing). # # arch/ppc64/kernel/eeh.c # 2004/09/14 17:40:01-07:00 torvalds@ppc970.osdl.org +1 -1 # Fix up typo in ppc64 eeh ioport_map() code. # # Noticed by BenH, happily harmless (nothing that uses that # code has been committed yet, and PIO seems to be pretty much # unused on at least the Apple G5 machines: all the normal # hardware is set up purely for MMIO, to the point that I # couldn't even test this thing). # # ChangeSet # 2004/09/14 16:28:53-07:00 torvalds@ppc970.osdl.org # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # Also export the iomap routines on ppc64. # # lib/iomap.c # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +85 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # include/asm-generic/iomap.h # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +19 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # arch/ppc64/kernel/eeh.c # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +54 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # ChangeSet # 2004/09/14 16:12:54-07:00 trini@kernel.crashing.org # ppc32: Don't make cmd_line be an emptry string # # As noted by Olaf Hering, CONFIG_CMDLINE didn't work on PMacs # as we made cmd_line be an empty string and then looked for the # cmdline in odd places. # # Signed-off-by: Tom Rini # # arch/ppc/kernel/setup.c # 2004/09/14 16:12:44-07:00 trini@kernel.crashing.org +0 -1 # Don't terminate the cmd_line again. It's alredy been zeroed # and may have already been set. # # ChangeSet # 2004/09/14 14:11:23-07:00 davem@nuts.davemloft.net # [IPV4]: Use list.h facilities for fib_info_list. # # Do not use a by-hand list implementation. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/14 14:10:47-07:00 davem@nuts.davemloft.net +4 -13 # [IPV4]: Use list.h facilities for fib_info_list. # # include/net/ip_fib.h # 2004/09/14 14:10:47-07:00 davem@nuts.davemloft.net +1 -2 # [IPV4]: Use list.h facilities for fib_info_list. # # ChangeSet # 2004/09/14 14:03:47-07:00 yoshfuji@linux-ipv6.org # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # net/ipv6/route.c # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +12 -6 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # net/ipv6/ip6_fib.c # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +1 -7 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # include/net/ip6_route.h # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +2 -0 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # ChangeSet # 2004/09/14 13:57:17-07:00 davem@nuts.davemloft.net # Merge bk://kernel.bkbits.net/acme/net-2.6 # into nuts.davemloft.net:/disk1/BK/net-2.6 # # net/ipv4/tcp_ipv4.c # 2004/09/14 13:57:07-07:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # include/net/tcp.h # 2004/09/14 13:57:07-07:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/09/14 10:38:50-07:00 torvalds@ppc970.osdl.org # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # arch/ppc64/kernel/eeh.c # 2004/09/14 10:38:43-07:00 torvalds@ppc970.osdl.org +68 -0 # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # arch/ppc64/Kconfig # 2004/09/14 10:38:43-07:00 torvalds@ppc970.osdl.org +0 -4 # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # ChangeSet # 2004/09/14 09:36:53-07:00 torvalds@ppc970.osdl.org # Update shipped version of zconfig.tab.c to match bison/yacc file. # # scripts/kconfig/zconf.tab.c_shipped # 2004/09/14 09:36:46-07:00 torvalds@ppc970.osdl.org +2 -0 # Update shipped version of zconfig.tab.c to match bison/yacc file. # # ChangeSet # 2004/09/14 09:33:17-07:00 zippel@linux-m68k.org # [PATCH] properly fix double current_menu # # The two current_menu variables are really two separate variables, so keep # them separate. # # Signed-off-by: Roman Zippel # Signed-off-by: Linus Torvalds # # scripts/kconfig/zconf.y # 2004/09/14 06:46:41-07:00 zippel@linux-m68k.org +2 -0 # properly fix double current_menu # # scripts/kconfig/menu.c # 2004/09/14 06:46:42-07:00 zippel@linux-m68k.org +0 -1 # properly fix double current_menu # # scripts/kconfig/mconf.c # 2004/09/14 06:51:44-07:00 zippel@linux-m68k.org +1 -1 # properly fix double current_menu # # scripts/kconfig/lkc.h # 2004/09/14 06:44:58-07:00 zippel@linux-m68k.org +0 -3 # properly fix double current_menu # # ChangeSet # 2004/09/14 09:32:22-07:00 levon@movementarian.org # [PATCH] fix OProfile locking # # This makes OProgile use get_task_mm() as discussed. It also fixes up # Anton's previous patch. Zwane's soaked this patch all night w/o # problems. # # kernel/fork.c # 2004/09/13 13:39:03-07:00 levon@movementarian.org +2 -0 # fix OProfile locking # # drivers/oprofile/cpu_buffer.h # 2004/09/13 13:45:26-07:00 levon@movementarian.org +2 -2 # fix OProfile locking # # drivers/oprofile/cpu_buffer.c # 2004/09/13 13:45:29-07:00 levon@movementarian.org +6 -6 # fix OProfile locking # # drivers/oprofile/buffer_sync.c # 2004/09/13 13:50:51-07:00 levon@movementarian.org +11 -26 # fix OProfile locking # # ChangeSet # 2004/09/14 09:17:49-07:00 torvalds@ppc970.osdl.org # Fix up stupid last-minute edit of fork cleanup. # # I'm a retard. # # kernel/fork.c # 2004/09/14 09:17:43-07:00 torvalds@ppc970.osdl.org +1 -1 # Fix up stupid last-minute edit of fork cleanup. # # I'm a retard. # # ChangeSet # 2004/09/14 09:15:35-07:00 torvalds@ppc970.osdl.org # fivafb; Increase DDC/CI timeouts # # Nicolas Boichat reports that his monitor needs the slower # i2c bus timings. These values also match atyfb and the # original ones. # # drivers/video/riva/rivafb-i2c.c # 2004/09/14 09:15:29-07:00 torvalds@ppc970.osdl.org +2 -2 # fivafb; Increase DDC/CI timeouts # # Nicolas Boichat reports that his monitor needs the slower # i2c bus timings. These values also match atyfb and the # original ones. # # ChangeSet # 2004/09/14 09:04:35-07:00 torvalds@ppc970.osdl.org # Fix fork failure case. # # It would clear the segment registers in the parent, which # wasn't really intentional. Noticed by Andries Brouwer. # # # kernel/fork.c # 2004/09/14 09:04:28-07:00 torvalds@ppc970.osdl.org +1 -3 # Fix fork failure case. # # It would clear the segment registers in the parent, which # wasn't really intentional. Noticed by Andries Brouwer. # # ChangeSet # 2004/09/14 08:54:40-07:00 mingo@elte.hu # [PATCH] i386: elf_read_implies_exec() fixup # # The final ia64 related cleanup to elf_read_implies_exec() seems to have # broken it. The effect is that the READ_IMPLIES_EXEC flag is never set # for !pt_gnu_stack binaries! # # That's a bit more secure than we need to be, and might break some legacy # app that doesn't expect it. # # include/asm-i386/elf.h # 2004/09/13 17:00:00-07:00 mingo@elte.hu +1 -1 # i386: elf_read_implies_exec() fixup # # ChangeSet # 2004/09/14 08:38:02-07:00 ak@suse.de # [PATCH] Fix ABI in set_mempolicy() # # Fix ABI in set_mempolicy() that got broken by an earlier change. # # Add a check for very big input values and prevent excessive looping in the # kernel. # # Cc: Paul "nyer, nyer, your mother wears combat boots!" Jackson # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/mempolicy.c # 2004/09/13 18:56:13-07:00 ak@suse.de +3 -0 # Fix ABI in set_mempolicy() # # ChangeSet # 2004/09/14 07:52:00-07:00 mpm@selenic.com # [PATCH] netpoll endian fixes # # Correct wrong ip header in netpoll_send_udp. # # Signed-off-by: Duncan Sands # Signed-off-by: Matt Mackall # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # net/core/netpoll.c # 2004/09/13 17:23:26-07:00 mpm@selenic.com +2 -2 # netpoll endian fixes # # ChangeSet # 2004/09/14 07:51:48-07:00 hch@lst.de # [PATCH] mark amiflop non-unloadable # # As it's using the obsolete MOD_{INC,DEC}_USE_COUNT it's implicitly locked # already, but let's remove them and make it explicit so these macros can go # away completely without breaking m68k compile. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/block/amiflop.c # 2004/09/13 17:23:25-07:00 hch@lst.de +2 -14 # mark amiflop non-unloadable # # ChangeSet # 2004/09/14 07:51:36-07:00 hch@lst.de # [PATCH] crept back in h8300 and sh64 # # went away in 2.5, but new ports keep adding instances again # and again. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-softirq.h~5870f0a8abafdf84 # 2004/09/14 07:51:30-07:00 hch@lst.de +0 -0 # Delete: include/asm-h8300/softirq.h # # BitKeeper/deleted/.del-softirq.h~2d71a252808115bb # 2004/09/14 07:51:30-07:00 hch@lst.de +0 -0 # Delete: include/asm-sh64/softirq.h # # ChangeSet # 2004/09/14 07:51:24-07:00 roland@frob.com # [PATCH] BSD disklabel: handle more than 8 partitions # # NetBSD allows 16 partitions, not just 8. This patch both ups the number, # and makes the recognition code tell you if the count in the disklabel # exceeds the number supported by the kernel. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/genhd.h # 2004/09/13 17:23:25-07:00 roland@frob.com +1 -1 # BSD disklabel: handle more than 8 partitions # # fs/partitions/msdos.c # 2004/09/13 17:23:25-07:00 roland@frob.com +3 -0 # BSD disklabel: handle more than 8 partitions # # ChangeSet # 2004/09/14 07:51:13-07:00 hch@lst.de # [PATCH] small tweaks # # - I misspelled CONFIG_PREEMPT CONFIG_PREEPT as various people noticed. # But in fact that ifdef should just go, else we'll get drivers that # compile with CONFIG_PREEMPT but not without sooner or later. # # - remove unused hardirq_trylock and hardirq_endlock # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/hardirq.h # 2004/09/13 17:23:24-07:00 hch@lst.de +0 -5 # small tweaks # # ChangeSet # 2004/09/14 07:51:00-07:00 jbarnes@engr.sgi.com # [PATCH] fix uninitialized warnings in mempolicy.c # # err may be used uninitialized in mempolicy.c in both compat_set_mempolicy # and compat_mbind. This patch fixes that by setting them both to 0. # # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/mempolicy.c # 2004/09/13 17:23:24-07:00 jbarnes@engr.sgi.com +2 -2 # fix uninitialized warnings in mempolicy.c # # ChangeSet # 2004/09/14 07:50:46-07:00 dsaxena@plexity.net # [PATCH] Add support for word-length UART registers # # UARTS on several Intel IXP2000 systems are connected in such a way that # they can only be addressed using full word accesses instead of bytes. # Following patch adds a UPIO_MEM32 io-type to identify these UARTs. # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/serial_core.h # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +1 -0 # Add support for word-length UART registers # # drivers/serial/serial_core.c # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +1 -0 # Add support for word-length UART registers # # drivers/serial/8250.c # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +7 -0 # Add support for word-length UART registers # # ChangeSet # 2004/09/14 07:50:33-07:00 axboe@suse.de # [PATCH] block highmem flushes # # Add a couple of missing cache flushes to the bouncing code. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/highmem.c # 2004/09/13 17:23:24-07:00 axboe@suse.de +2 -0 # block highmem flushes # # ChangeSet # 2004/09/14 07:50:21-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: remove CONFIG_UML_SMP # # Using CONFIG_UML_SMP and then making CONFIG_SMP = CONFIG_UML_SMP is useless # (there was a reason in 2.4, to have different help texts, but not now). # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Kconfig # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +2 -5 # uml: remove CONFIG_UML_SMP # # ChangeSet # 2004/09/14 07:50:09-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: smp build fix # # From: Sonny Rao # # Make the SMP code compile, at least, to make testing possible, and remove # its dependency on CONFIG_BROKEN. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-um/spinlock.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +6 -0 # uml: smp build fix # # include/asm-um/smp.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +2 -0 # uml: smp build fix # # arch/um/kernel/smp.c # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +7 -1 # uml: smp build fix # # include/asm-um/spinlock.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-um/spinlock.h # # ChangeSet # 2004/09/14 07:49:54-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: remove commented old code in Kconfig # # Drop a config option which has disappeared from all archs. Btw, this # shouldn't be in the UML-specific part, but since we cannot include generic # Kconfigs to avoid problem with hardware-related configs, it's duplicated # for now. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Kconfig_char # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +0 -5 # uml: remove commented old code in Kconfig # # ChangeSet # 2004/09/14 07:49:42-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: refer to CONFIG_USERMODE, not to CONFIG_UM # # Correct one Kconfig dependency, which should refer to CONFIG_USERMODE # rather than to CONFIG_UM. # # We should also figure out how to make the config process work better for # UML. We would like to make UML able to "source drivers/Kconfig" and have # the right drivers selectable (i.e. LVM, ramdisk, and so on) and the ones # for actual hardware excluded. I've been reading such a request even from # Jeff Dike at the last Kernel Summit, (in the lwn.net coverage) but without # any followup. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/Kconfig # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +1 -1 # uml: refer to CONFIG_USERMODE, not to CONFIG_UM # # ChangeSet # 2004/09/14 07:49:28-07:00 jdike@addtoit.com # [PATCH] uml: disable pending signals across a reboot # # On reboot, all signals and signal sources are disabled so that # late-arriving signals don't show up after the reboot exec, confusing the # new image, which is not expecting signals yet. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/file.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +10 -0 # uml: disable pending signals across a reboot # # arch/um/kernel/time.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +9 -0 # uml: disable pending signals across a reboot # # arch/um/kernel/irq_user.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +14 -0 # uml: disable pending signals across a reboot # # arch/um/include/time_user.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # arch/um/include/os.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # arch/um/include/irq_user.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # ChangeSet # 2004/09/14 07:49:16-07:00 jdike@addtoit.com # [PATCH] uml: fix binary layout assumption # # This patch calculates section boundaries differently so as to not get # tripped up by holes in the binary such as are introduced by exec-shield. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/um_arch.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +11 -1 # uml: fix binary layout assumption # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -1 # uml: fix binary layout assumption # # ChangeSet # 2004/09/14 07:49:04-07:00 jdike@addtoit.com # [PATCH] uml: fix scheduler race # # This fixes a use-after-free bug in the context switching. A process going # out of context after exiting wakes up the next process and then kills # itself. The problem is that when it gets around to killing itself is up to # the host and can happen a long time later, including after the incoming # process has freed its stack, and that memory is possibly being used for # something else. # # The fix is to have the incoming process kill the exiting process just to # make sure it can't be running at the point that its stack is freed. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +13 -1 # uml: fix scheduler race # # ChangeSet # 2004/09/14 07:48:53-07:00 jdike@addtoit.com # [PATCH] uml: eliminate useless thread field # # This patch eliminates use of task.thread.kernel_stack. It was unnecessary, # confusing, and was masking some kernel stack size assumptions. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-um/processor-generic.h # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +0 -2 # uml: eliminate useless thread field # # arch/um/kernel/um_arch.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +0 -3 # uml: eliminate useless thread field # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +4 -5 # uml: eliminate useless thread field # # arch/um/kernel/tt/exec_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -2 # uml: eliminate useless thread field # # arch/um/kernel/skas/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +2 -3 # uml: eliminate useless thread field # # arch/um/kernel/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -4 # uml: eliminate useless thread field # # arch/um/kernel/process.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -1 # uml: eliminate useless thread field # # ChangeSet # 2004/09/14 07:48:40-07:00 jdike@addtoit.com # [PATCH] uml: remove ghash.h # # Remove dependency on ghash.h. Remvoe ghash.h, too. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/physmem.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +48 -48 # uml: remove ghash.h # # BitKeeper/deleted/.del-ghash.h~17597075be73f07b # 2004/09/14 07:48:32-07:00 jdike@addtoit.com +0 -0 # Delete: include/linux/ghash.h # # ChangeSet # 2004/09/14 07:48:26-07:00 rsa@us.ibm.com # [PATCH] HVCS fix to replace yield with tty_wait_until_sent in hvcs_close # # Following the same advice you gave in a recent hvc_console patch I have # modified HVCS to remove a while() { yield(); } from hvcs_close() which may # cause problems where real time scheduling is concerned and replaced it with # tty_wait_until_sent() which uses a real wait queue and is the proper method # for blocking a tty operation while waiting for data to be sent. This patch # has been tested to verify that all the paths of code that were changed were # hit during the code run and performed as expected including hotplug remove # of hvcs adapters and hangup of ttys. # # - Replaced yield() in hvcs_close() with tty_wait_until_sent() to prevent # possible lockup with realtime scheduling. # # - Removed hvcs_final_close() and reordered cleanup operations to prevent # discarding of pending data during an hvcs_close() call. # # - Removed spinlock protection of hvcs_struct data members in # hvcs_write_room() and hvcs_chars_in_buffer() because they aren't needed. # # Signed-off-by: Ryan S. Arnold # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvcs.c # 2004/09/13 17:23:21-07:00 rsa@us.ibm.com +43 -64 # HVCS fix to replace yield with tty_wait_until_sent in hvcs_close # # ChangeSet # 2004/09/14 07:48:14-07:00 mingo@elte.hu # [PATCH] blk: max_sectors tunables # # Introduces two new /sys/block values: # # /sys/block/*/queue/max_hw_sectors_kb # /sys/block/*/queue/max_sectors_kb # # max_hw_sectors_kb is the maximum that the driver can handle and is # readonly. max_sectors_kb is the current max_sectors value and can be tuned # by root. PAGE_SIZE granularity is enforced. # # It's all locking-safe and all affected layered drivers have been updated as # well. The patch has been in testing for a couple of weeks already as part # of the voluntary-preempt patches and it works just fine - people use it to # reduce IDE IRQ handling latencies. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/blkdev.h # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -0 # blk: max_sectors tunables # # drivers/md/raid1.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +2 -2 # blk: max_sectors tunables # # drivers/md/raid0.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/md/multipath.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +2 -2 # blk: max_sectors tunables # # drivers/md/linear.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/md/dm-table.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/block/ll_rw_blk.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +66 -4 # blk: max_sectors tunables # # ChangeSet # 2004/09/14 07:48:01-07:00 ak@suse.de # [PATCH] Add prctl to modify current->comm # # This patch adds a prctl to modify current->comm as shown in /proc. This # feature was requested by KDE developers. In KDE most programs are started by # forking from a kdeinit program that already has the libraries loaded and some # other state. # # Problem is to give these forked programs the proper name. It already writes # the command line in the environment (as seen in ps), but top uses a different # field in /proc/pid/status that reports current->comm. And that was always # "kdeinit" instead of the real command name. So you ended up with lots of # kdeinits in your top listing, which was not very useful. # # This patch adds a new prctl PR_SET_NAME to allow a program to change its comm # field. # # I considered the potential security issues of a program obscuring itself with # this interface, but I don't think it matters much because a program can # already obscure itself when the admin uses ps instead of top. In case of a # KDE desktop calling everything kdeinit is much more obfuscation than the # alternative. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sys.c # 2004/09/13 17:23:21-07:00 ak@suse.de +11 -0 # Add prctl to modify current->comm # # include/linux/prctl.h # 2004/09/13 17:23:21-07:00 ak@suse.de +2 -0 # Add prctl to modify current->comm # # ChangeSet # 2004/09/14 07:47:51-07:00 hch@lst.de # [PATCH] remove exports from audit code # # Tons of exports in the new audit code, but not a single module that # actually uses one of them. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/auditsc.c # 2004/09/13 17:23:21-07:00 hch@lst.de +1 -8 # remove exports from audit code # # kernel/audit.c # 2004/09/13 17:23:21-07:00 hch@lst.de +0 -13 # remove exports from audit code # # ChangeSet # 2004/09/14 07:47:38-07:00 hch@lst.de # [PATCH] mark dq_list_lock static # # Only used in dq_list_lock these days. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/quota.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # mark dq_list_lock static # # fs/dquot.c # 2004/09/13 17:23:20-07:00 hch@lst.de +1 -2 # mark dq_list_lock static # # ChangeSet # 2004/09/14 07:47:27-07:00 hch@lst.de # [PATCH] mark md_interrupt_thread static # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/raid/md.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # mark md_interrupt_thread static # # drivers/md/md.c # 2004/09/13 17:23:20-07:00 hch@lst.de +1 -2 # mark md_interrupt_thread static # # ChangeSet # 2004/09/14 07:47:15-07:00 hch@lst.de # [PATCH] make kmem_find_general_cachep static in slab.c # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/slab.c # 2004/09/13 17:23:20-07:00 hch@lst.de +16 -18 # make kmem_find_general_cachep static in slab.c # # include/linux/slab.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # make kmem_find_general_cachep static in slab.c # # ChangeSet # 2004/09/14 07:47:02-07:00 juhl-lkml@dif.dk # [PATCH] __copy_to_user() check in cdrom_read_cdda_old() # # akpm: really, reads are supposed to return the number-of-bytes-read on faults, # or -EFAULT of no bytes were read. This patch returns either zero or -EFAULT, # ignoring any successfully transferred data. But the user interface (whcih is # an ioctl()) was never set up to do that. # # Signed-off-by: Jesper Juhl # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/cdrom/cdrom.c # 2004/09/13 17:23:20-07:00 juhl-lkml@dif.dk +10 -5 # __copy_to_user() check in cdrom_read_cdda_old() # # ChangeSet # 2004/09/14 07:46:50-07:00 anton@samba.org # [PATCH] Allocate correct amount of memory for pid hash # # We are now allocating twice as much memory as required. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/pid.c # 2004/09/13 17:23:19-07:00 anton@samba.org +1 -1 # Allocate correct amount of memory for pid hash # # ChangeSet # 2004/09/14 07:46:38-07:00 hugh@veritas.com # [PATCH] shmem: Copyright file_setup trivia # # I _think_ shmem_file_setup is protected against negative loff_t size by the # TASK_SIZE in each arch, but prefer the security of an explicit test. Wipe # those parentheses off its return(file), and update our Copyright. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:19-07:00 hugh@veritas.com +4 -4 # shmem: Copyright file_setup trivia # # ChangeSet # 2004/09/14 07:46:25-07:00 hugh@veritas.com # [PATCH] shmem: rework majmin and ZERO_PAGE # # Very minor adjustments to shmem_getpage return path: I now prefer it to return # NULL and let do_shmem_file_read use ZERO_PAGE(0) in that case; and we don't # need a local majmin variable, do_no_page initializes *type to VM_FAULT_MINOR # already. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +12 -14 # shmem: rework majmin and ZERO_PAGE # # ChangeSet # 2004/09/14 07:46:13-07:00 hugh@veritas.com # [PATCH] shmem: avoid the shmem_inodes list # # If we're thinking about shmem scalability... isn't it silly that each shmem # object is added to the shmem_inodes list on creation, and removed on deletion, # yet the only use for that list is in swapoff (shmem_unuse)? # # Call it shmem_swaplist; shmem_writepage add inode to swaplist when first swap # allocated (usually never); shmem_delete_inode remove inode from the list after # truncating (if called before, inode could be re-added to it). # # Inode can remain on the swaplist after all its pages are swapped back in, just # be lazy about it; but if shmem_unuse finds swapped count now 0, save itself # time by then removing that inode from the swaplist. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +24 -19 # shmem: avoid the shmem_inodes list # # include/linux/shmem_fs.h # 2004/09/13 17:23:18-07:00 hugh@veritas.com +1 -1 # shmem: avoid the shmem_inodes list # # ChangeSet # 2004/09/14 07:46:01-07:00 hugh@veritas.com # [PATCH] shmem: no sbinfo for tmpfs mount? # # Some might want a tmpfs mount with the improved scalability afforded by # omitting shmem superblock accounting; or some might just want to test it in an # externally-visible tmpfs mount instance. # # Adopt the convention that mount option -o nr_blocks=0,nr_inodes=0 means # without resource limits, and hence no shmem_sb_info. Not recommended for # general use, but no worse than ramfs. # # Disallow remounting from unlimited to limited (no accounting has been done so # far, so no idea whether it's permissible), and from limited to unlimited # (because we'd need then to free the sbinfo, and visit each inode to reset its # i_blocks to 0: why bother?). # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +41 -19 # shmem: no sbinfo for tmpfs mount? # # Documentation/filesystems/tmpfs.txt # 2004/09/13 17:23:18-07:00 hugh@veritas.com +6 -0 # shmem: no sbinfo for tmpfs mount? # # ChangeSet # 2004/09/14 07:45:49-07:00 hugh@veritas.com # [PATCH] shmem: no sbinfo for shm mount # # SGI investigations have shown a dramatic contrast in scalability between # anonymous memory and shmem objects. Processes building distinct shmem objects # in parallel hit heavy contention on shmem superblock stat_lock. Across 256 # cpus an intensive test runs 300 times slower than anonymous. # # Jack Steiner has observed that all the shmem superblock free_blocks and # free_inodes accounting is redundant in the case of the internal mount used for # SysV shared memory and for shared writable /dev/zero objects (the cases which # most concern them): it specifically declines to limit. # # Based upon Brent Casavant's SHMEM_NOSBINFO patch, this instead just removes # the shmem_sb_info structure from the internal kernel mount, testing where # necessary for null sbinfo pointer. shmem_set_size moved within CONFIG_TMPFS, # its arg named "sbinfo" as elsewhere. # # This brings shmem object scalability up to that of anonymous memory, in the # case where distinct processes are building (faulting to allocate) distinct # objects. It significantly improves parallel building of a shared shmem object # (that test runs 14 times faster across 256 cpus), but other issues remain in # that case: to be addressed in later patches. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +88 -76 # shmem: no sbinfo for shm mount # # ChangeSet # 2004/09/14 07:45:36-07:00 hugh@veritas.com # [PATCH] shmem: inodes and links need lowmem # # Keith Mannthey's Bugzilla #3268 drew attention to how tmpfs inodes and # dentries and long names and radix-tree nodes pin lowmem. Assuming about 1k of # lowmem per inode, we need to lower the default nr_inodes limit on machines # with significant highmem. # # Be conservative, but more generous than in the original patch to Keith: limit # to number of lowmem pages, which works out around 200,000 on i386. Easily # overridden by giving the nr_inodes= mount option: those who want to sail # closer to the rocks should be allowed to do so. # # Notice how tmpfs dentries cannot be reclaimed in the way that disk-based # dentries can: so even hard links need to be costed. They are cheaper than # inodes, but easier all round to charge the same. This way, the limit for hard # links is equally visible through "df -i": but expect occasional bugreports # that tmpfs links are being treated like this. # # Would have been simpler just to move the free_inodes accounting from # shmem_delete_inode to shmem_unlink; but that would lose the charge on unlinked # but open files. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +26 -2 # shmem: inodes and links need lowmem # # Documentation/filesystems/tmpfs.txt # 2004/09/13 17:23:17-07:00 hugh@veritas.com +4 -2 # shmem: inodes and links need lowmem # # ChangeSet # 2004/09/14 07:45:23-07:00 hugh@veritas.com # [PATCH] shmem: don't SLAB_HWCACHE_ALIGN # # Anton recently removed SLAB_HWCACHE_ALIGN from the fs inode caches, now do the # same for tmpfs inode cache: fits 9 per page where 7 before. # # Was saying SLAB_RECLAIM_ACCOUNT too, but that's wrong: tmpfs inodes are not # reclaimed under pressure; and hugetlbfs had copied that too. # # Rearrange shmem_inode_info fields so those most likely to be needed are most # likely to be in the same cacheline as the spinlock guarding them. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +1 -2 # shmem: don't SLAB_HWCACHE_ALIGN # # include/linux/shmem_fs.h # 2004/09/13 17:23:17-07:00 hugh@veritas.com +7 -7 # shmem: don't SLAB_HWCACHE_ALIGN # # fs/hugetlbfs/inode.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +1 -2 # shmem: don't SLAB_HWCACHE_ALIGN # # ChangeSet # 2004/09/14 07:45:11-07:00 castet.matthieu@free.fr # [PATCH] pnpbios parser bugfix # # this patch fix a pnpbios problem with independant # resource(http://bugzilla.kernel.org/show_bug.cgi?id=3295) : # the old code assume that they are given at the beggining (before any # SMALL_TAG_STARTDEP entry), but in some case there are found after # SMALL_TAG_ENDDEP entry. # # tag : 6 SMALL_TAG_STARTDEP # tag : 8 SMALL_TAG_PORT # tag : 6 SMALL_TAG_STARTDEP # tag : 8 SMALL_TAG_PORT # tag : 7 SMALL_TAG_ENDDEP # tag : 4 SMALL_TAG_IRQ <-- independant resource # tag : f SMALL_TAG_END # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/pnp/pnpbios/rsparser.c # 2004/09/13 17:23:17-07:00 castet.matthieu@free.fr +7 -2 # pnpbios parser bugfix # # ChangeSet # 2004/09/14 07:44:59-07:00 yuvalt@gmail.com # [PATCH] searching for parameters in 'make menuconfig' # # I added the ability to search for parameters in make menuconfig (find a # given parameter's location in the tree). # # You use '/' to invoke the feature. Regular expression searches are supported. # # Signed-off-by: Yuval Turgeman # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # scripts/lxdialog/menubox.c # 2004/09/13 17:23:16-07:00 yuvalt@gmail.com +9 -0 # searching for parameters in 'make menuconfig' # # scripts/kconfig/mconf.c # 2004/09/13 17:23:16-07:00 yuvalt@gmail.com +145 -16 # searching for parameters in 'make menuconfig' # # ChangeSet # 2004/09/14 07:44:46-07:00 benh@kernel.crashing.org # [PATCH] ppc32: pmac cpufreq for ibook 2 600 # # This patch adds support for the 750CX based ibook2 600Mhz to the cpufreq # powermac driver. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/pmac_cpufreq.c # 2004/09/13 17:23:16-07:00 benh@kernel.crashing.org +2 -5 # ppc32: pmac cpufreq for ibook 2 600 # # ChangeSet # 2004/09/14 07:44:34-07:00 anton@samba.org # [PATCH] ppc32: remove -Wno-uninitialized # # Remove -Wno-uninitialized on ppc32 too. Ive just found a number of real bugs # on ppc64 by doing the same. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/Makefile # 2004/09/13 17:23:16-07:00 anton@samba.org +1 -1 # ppc32: remove -Wno-uninitialized # # ChangeSet # 2004/09/14 07:44:21-07:00 david@gibson.dropbear.id.au # [PATCH] ppc64: improved VSID allocation algorithm # # This patch has been tested both on SLB and segment table machines. This # new approach is far from the final word in VSID/context allocation, but # it's a noticeable improvement on the old method. # # Replace the VSID allocation algorithm. The new algorithm first generates a # 36-bit "proto-VSID" (with 0xfffffffff reserved). For kernel addresses this # is equal to the ESID (address >> 28), for user addresses it is: # # (context << 15) | (esid & 0x7fff) # # These are distinguishable from kernel proto-VSIDs because the top bit is # clear. Proto-VSIDs with the top two bits equal to 0b10 are reserved for # now. # # The proto-VSIDs are then scrambled into real VSIDs with the multiplicative # hash: # # VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS # where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 # VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF # # This scramble is 1:1, because VSID_MULTIPLIER and VSID_MODULUS are co-prime # since VSID_MULTIPLIER is prime (the largest 28-bit prime, in fact). # # This scheme has a number of advantages over the old one: # # - We now have VSIDs for every kernel address (i.e. everything above # 0xC000000000000000), except the very top segment. That simplifies a # number of things. # # - We allow for 15 significant bits of ESID for user addresses with 20 # bits of context. i.e. 8T (43 bits) of address space for up to 1M # contexts, significantly more than the old method (although we will need # changes in the hash path and context allocation to take advantage of # this). # # - Because we use a real multiplicative hash function, we have better and # more robust hash scattering with this VSID algorithm (at least based on # some initial results). # # Because the MODULUS is 2^n-1 we can use a trick to compute it efficiently # without a divide or extra multiply. This makes the new algorithm barely # slower than the old one. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/pgtable.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +10 -4 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/page.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +0 -11 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/mmu_context.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +79 -38 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/mmu.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +39 -6 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/stab.c # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +1 -5 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/slb_low.S # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +21 -32 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/hash_utils.c # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +5 -5 # ppc64: improved VSID allocation algorithm # # arch/ppc64/kernel/head.S # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +8 -17 # ppc64: improved VSID allocation algorithm # # ChangeSet # 2004/09/14 07:44:08-07:00 anton@samba.org # [PATCH] hvc: uninitialised variable # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvc_console.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # hvc: uninitialised variable # # ChangeSet # 2004/09/14 07:43:55-07:00 anton@samba.org # [PATCH] ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # Here are fixes for some false positives. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/macintosh/via-pmu.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # drivers/char/hvsi.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/xmon/xmon.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/oprofile/op_model_rs64.c # 2004/09/13 17:23:15-07:00 anton@samba.org +2 -2 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/sysfs.c # 2004/09/13 17:23:15-07:00 anton@samba.org +7 -6 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/signal32.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/signal.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/rtasd.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/pSeries_pci.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/nvram.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/iommu.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/14 07:43:43-07:00 anton@samba.org # [PATCH] ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # The removal of -Wno-uninitialized on ppc64 revealed a number of real # bugs. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/pci/hotplug/rpaphp_core.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # drivers/net/ibmveth.c # 2004/09/13 17:23:15-07:00 anton@samba.org +5 -2 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # drivers/char/hvcs.c # 2004/09/13 17:23:15-07:00 anton@samba.org +3 -3 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/iSeries_pci_reset.c # 2004/09/13 17:23:15-07:00 anton@samba.org +2 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/14 07:43:30-07:00 anton@samba.org # [PATCH] ppc64: remove -Wno-uninitialized # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/Makefile # 2004/09/13 17:23:14-07:00 anton@samba.org +1 -2 # ppc64: remove -Wno-uninitialized # # ChangeSet # 2004/09/14 07:43:18-07:00 anton@samba.org # [PATCH] ppc64: clean up idle loop code # # Clean up our idle loop code: # # - Remove a bunch of useless includes and make most functions static # - There were places where we werent disabling interrupts before checking # need_resched then calling the hypervisor to sleep our thread. We might # race with an IPI and end up missing a reschedule. Disable interrupts # around these regions to make them safe. # - We forgot to turn off the polling flag when exiting the dedicated_idle # idle loop. This could have resulted in all manner problems as other # cpus would avoid sending IPIs to force reschedules. # - Add a missing check for cpu_is_offline in the shared cpu idle loop. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +60 -64 # ppc64: clean up idle loop code # # ChangeSet # 2004/09/14 07:43:06-07:00 anton@samba.org # [PATCH] ppc64: enable POWER5 low power mode in idle loop # # Now that we understand (and have fixed) the problem with using low power mode # in the idle loop, lets enable it. It should save a fair amount of power. # # (The problem was that our exceptions were inheriting the low power mode and so # were executing at a fraction of the normal cpu issue rate. We fixed it by # always bumping our priority to medium at the start of every exception). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +13 -9 # ppc64: enable POWER5 low power mode in idle loop # # ChangeSet # 2004/09/14 07:42:54-07:00 anton@samba.org # [PATCH] ppc64: restore smt-enabled=off kernel command line option # # Restore the smt-enabled=off kernel command line functionality: # # - Remove the SMT_DYNAMIC state now that smt_snooze_delay allows for the # same thing. # - Remove the early prom.c parsing for the option, put it into an # early_param instead. # - In setup_cpu_maps honour the smt-enabled setting # # Note to Nathan: In order to allow cpu hotplug add of secondary threads after # booting with smt-enabled=off, I had to initialise cpu_present_map to # cpu_online_map in smp_cpus_done. Im not sure how you want to handle this but # it seems our present map currently does not allow cpus to be added into the # partition that werent there at boot (but were in the possible map). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/smp.h # 2004/09/13 17:23:14-07:00 anton@samba.org +2 -0 # ppc64: restore smt-enabled=off kernel command line option # # include/asm-ppc64/naca.h # 2004/09/13 17:23:14-07:00 anton@samba.org +0 -3 # ppc64: restore smt-enabled=off kernel command line option # # include/asm-ppc64/memory.h # 2004/09/13 17:23:14-07:00 anton@samba.org +0 -10 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/smp.c # 2004/09/13 17:23:14-07:00 anton@samba.org +10 -0 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:14-07:00 anton@samba.org +55 -2 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/prom.c # 2004/09/13 17:23:14-07:00 anton@samba.org +3 -67 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +1 -6 # ppc64: restore smt-enabled=off kernel command line option # # ChangeSet # 2004/09/14 07:42:41-07:00 anton@samba.org # [PATCH] ppc64: use early_param # # Make use of Rusty's early_param code. Its good stuff. # # We appear to be the first user :) # # Move vpa_init and idle_setup later in boot, we dont have to do them # right up front in setup_system. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/mm/numa.c # 2004/09/13 17:23:14-07:00 anton@samba.org +18 -4 # ppc64: use early_param # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:14-07:00 anton@samba.org +43 -47 # ppc64: use early_param # # ChangeSet # 2004/09/14 07:42:28-07:00 anton@samba.org # [PATCH] ppc64: remove EEH command line device matching code # # We have had reports of people attempting to disable EEH on POWER5 boxes. This # is not supported, and the device will most likely not respond to config space # reads/writes. Remove the IBM location matching code that was being used to # disable devices as well as the global option. # # We already have the ability to ignore EEH erros via the panic_on_oops sysctl # option, advanced users should make use of that instead. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/eeh.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -160 # ppc64: remove EEH command line device matching code # # ChangeSet # 2004/09/14 07:42:16-07:00 anton@samba.org # [PATCH] ppc64: remove unused ppc64_calibrate_delay # # - Remove ppc64_calibrate_delay, no longer used # - Formatting fixups # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -18 # ppc64: remove unused ppc64_calibrate_delay # # ChangeSet # 2004/09/14 07:42:04-07:00 anton@samba.org # [PATCH] ppc64: clean up kernel command line code # # Clean up some of our command line code: # # - We were copying the command line out of the device tree twice, but the # first time we forgot to add CONFIG_CMDLINE. Fix this and remove the # second copy. # - The command line birec code ran after we had done some command line # parsing in prom.c. This had the opportunity to really confuse the # user, with some options being parsed out of the device tree and the # other out of birecs. Luckily we could find no user of the command # line birecs, so remove them. # - remove duplicate printing of kernel command line; # - clean up iseries inits and create an iSeries_parse_cmdline. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -65 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/prom.c # 2004/09/13 17:23:13-07:00 anton@samba.org +3 -0 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/iSeries_setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +9 -10 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/chrp_setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +0 -2 # ppc64: clean up kernel command line code # # ChangeSet # 2004/09/14 07:41:51-07:00 anton@samba.org # [PATCH] ppc64: use nm --synthetic where available # # On new toolchains we need to use nm --synthetic or we miss code symbols. Sam, # I'm not thrilled about this patch but Im not sure of an easier way. Any ideas? # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/Makefile # 2004/09/13 17:23:13-07:00 anton@samba.org +6 -0 # ppc64: use nm --synthetic where available # # ChangeSet # 2004/09/14 07:41:39-07:00 anton@samba.org # [PATCH] ppc64: give the kernel an OPD section # # From: Alan Modra # # Give the kernel an OPD section, required for recent ppc64 toolchains. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/vmlinux.lds.S # 2004/09/13 17:23:12-07:00 anton@samba.org +4 -1 # ppc64: give the kernel an OPD section # # ChangeSet # 2004/09/14 07:41:27-07:00 anton@samba.org # [PATCH] ppc64: Enable NUMA API # # Plumb the NUMA API syscalls into ppc64. Also add some missing cond_syscalls # so we still link with NUMA API disabled. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sys.c # 2004/09/13 17:23:12-07:00 anton@samba.org +2 -0 # ppc64: Enable NUMA API # # include/asm-ppc64/unistd.h # 2004/09/13 17:23:12-07:00 anton@samba.org +3 -3 # ppc64: Enable NUMA API # # arch/ppc64/kernel/misc.S # 2004/09/13 17:23:12-07:00 anton@samba.org +6 -6 # ppc64: Enable NUMA API # # ChangeSet # 2004/09/14 07:41:15-07:00 anton@samba.org # [PATCH] ppc64: RTAS error logs can appear twice in dmesg # # I've started seeing rtas errors printed twice. Remove the second call to # printk_log_rtas. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/rtasd.c # 2004/09/13 17:23:12-07:00 anton@samba.org +5 -7 # ppc64: RTAS error logs can appear twice in dmesg # # ChangeSet # 2004/09/14 07:41:03-07:00 anton@samba.org # [PATCH] ppc64: remove SPINLINE config option # # After the spinlock rework, CONFIG_SPINLINE doesnt work and causes a compile # error. Remove it for now. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/lib/locks.c # 2004/09/13 17:23:12-07:00 anton@samba.org +0 -4 # ppc64: remove SPINLINE config option # # arch/ppc64/Kconfig.debug # 2004/09/13 17:23:12-07:00 anton@samba.org +0 -10 # ppc64: remove SPINLINE config option # # ChangeSet # 2004/09/14 07:40:51-07:00 willschm@us.ibm.com # [PATCH] ppc64: lparcfg whitespace and wordwrap cleanup. # # This patch is the result of running Lindent against # arch/ppc64/kernel/lparcfg.c. # # This cleans up an assortment of whitespace and wordwrap inconsistencies. # # Signed-off-by: Will Schmidt # Signed-off-by: Paul Mackerras # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/lparcfg.c # 2004/09/13 17:23:12-07:00 willschm@us.ibm.com +99 -91 # ppc64: lparcfg whitespace and wordwrap cleanup. # # ChangeSet # 2004/09/14 07:40:39-07:00 willschm@us.ibm.com # [PATCH] ppc64: lparcfg fixes for processor counts # # This patch corrects how the lparcfg interface was presenting the number of # active and potential processors. (As reported in LTC bugzilla number 10889). # # - Correct output for partition_potential_processors and # system_active_processors. # - suppress pool related values in scenarios where they do not make # sense. (non-shared processor configurations) # - Display pool_capacity as a percentage, to match the behavior from # iSeries code. # # Signed-off-by: Will Schmidt # Signed-off-by: Paul Mackerras # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/lparcfg.c # 2004/09/13 17:23:11-07:00 willschm@us.ibm.com +29 -23 # ppc64: lparcfg fixes for processor counts # # ChangeSet # 2004/09/14 07:40:27-07:00 davej@redhat.com # [PATCH] Pointer dereference before NULL check in ACPI thermal driver # # Again, found with coverity's checker. # # Signed-off-by: Dave Jones # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/acpi/thermal.c # 2004/09/13 17:23:11-07:00 davej@redhat.com +3 -1 # Pointer dereference before NULL check in ACPI thermal driver # # ChangeSet # 2004/09/14 07:40:15-07:00 jason.davis@unisys.com # [PATCH] ES7000 subarch update # # The patch below implements an algorithm to determine an unique GSI override # for mapping GSIs to IO-APIC pins correctly. GSI overrides are required in # order for ES7000 machines to function properly since IRQ to pin mappings # are NOT all one-to-one. This patch applies only to the Unisys specific # ES7000 machines and has been tested thoroughly on several models of the # ES7000 line. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/i386/mach-es7000/es7000plat.c # 2004/09/13 17:23:11-07:00 jason.davis@unisys.com +64 -17 # ES7000 subarch update # # arch/i386/mach-es7000/es7000.h # 2004/09/13 17:23:11-07:00 jason.davis@unisys.com +7 -0 # ES7000 subarch update # # ChangeSet # 2004/09/14 07:40:03-07:00 nathanl@austin.ibm.com # [PATCH] fix schedstats null deref in sched_exec # # In sched_exec, schedstat_inc will dereference a null pointer if no domain # is found with the SD_BALANCE_EXEC flag set. This was exposed during # testing of the previous patches where cpus are temporarily attached to a # dummy domain without SD_BALANCE_EXEC set. # # Signed-off-by: Nathan Lynch # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sched.c # 2004/09/13 17:23:11-07:00 nathanl@austin.ibm.com +1 -1 # fix schedstats null deref in sched_exec # # ChangeSet # 2004/09/14 03:03:26-07:00 rth@kanga.twiddle.home # [ALPHA] Add waitid. # # include/asm-alpha/unistd.h # 2004/09/14 03:03:06-07:00 rth@kanga.twiddle.home +2 -1 # Add waitid. # # arch/alpha/kernel/systbls.S # 2004/09/14 03:03:06-07:00 rth@kanga.twiddle.home +1 -0 # Add waitid. # # ChangeSet # 2004/09/14 03:02:28-07:00 rth@kanga.twiddle.home # [ALPHA] Arrange to return EINTR for sigsuspend on signal path. # # arch/alpha/kernel/signal.c # 2004/09/14 03:02:09-07:00 rth@kanga.twiddle.home +14 -4 # Arrange to return EINTR for sigsuspend on signal path. # # ChangeSet # 2004/09/14 02:39:33-07:00 rth@kanga.twiddle.home # [ALPHA] Use "long" on some internal bitops routines. # # include/asm-alpha/compiler.h # 2004/09/14 02:39:13-07:00 rth@kanga.twiddle.home +3 -3 # Use long versions of ctz, clz, popcount. # # include/asm-alpha/bitops.h # 2004/09/14 02:39:13-07:00 rth@kanga.twiddle.home +2 -2 # Use longs for floor/ceil_log2. # # ChangeSet # 2004/09/14 02:36:46-07:00 rth@kanga.twiddle.home # [ALPHA] Check set_fd_set return. # # arch/alpha/kernel/osf_sys.c # 2004/09/14 02:36:25-07:00 rth@kanga.twiddle.home +4 -3 # Check set_fd_set return. # # ChangeSet # 2004/09/14 09:54:04+01:00 nico@org.rmk.(none) # [ARM PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # Patch from Nicolas Pitre # # Let's make sure OSCR doesn't end up to be restored with a value # past OSMR0 otherwise the system timer won't start ticking until # OSCR wraps around (aprox 17 min. # # Also set OSCR _after_ OIER is restored to avoid matching when # corresponding match interrupt is masked out. # # Signed-off-by: Nicolas Pitre # # arch/arm/mach-sa1100/pm.c # 2004/09/14 02:51:46+01:00 nico@org.rmk.(none) +4 -3 # [PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # arch/arm/mach-pxa/pm.c # 2004/09/14 02:56:28+01:00 nico@org.rmk.(none) +4 -3 # [PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # ChangeSet # 2004/09/13 22:13:59-07:00 davem@nuts.davemloft.net # [SPARC64]: __iomem annotations and iomap implementation. # # include/asm-sparc64/io.h # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +77 -67 # [SPARC64]: __iomem annotations and iomap implementation. # # include/asm-sparc64/ebus.h # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/Makefile # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/power.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +4 -4 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/pci_schizo.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/auxio.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +6 -5 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/iomap.c # 2004/09/13 22:13:27-07:00 davem@nuts.davemloft.net +48 -0 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/iomap.c # 2004/09/13 22:13:27-07:00 davem@nuts.davemloft.net +0 -0 # BitKeeper file /disk1/BK/sparc-2.6/arch/sparc64/lib/iomap.c # # ChangeSet # 2004/09/13 21:40:12-07:00 davem@nuts.davemloft.net # [TCP]: Fix logic error in packets_out accounting. # # Noticed by Herbert Xu. # # Signed-off-by: David S. Miller # # net/ipv4/tcp_output.c # 2004/09/13 21:39:17-07:00 davem@nuts.davemloft.net +1 -1 # [TCP]: Fix logic error in packets_out accounting. # # ChangeSet # 2004/09/13 23:31:50-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:43-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:43-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:43-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:43-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:43-04:00 jgarzik@pobox.com +104 -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:34:11-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:34:03-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:14:43-04:00 jgarzik@pobox.com # [libata sata_nv] sync with 2.4 # # Driver should be using LIBATA_MAX_PRD not ATA_MAX_PRD, # due to iommu layer splitting. # # drivers/scsi/sata_nv.c # 2004/09/13 22:14:35-04:00 jgarzik@pobox.com +1 -1 # [libata sata_nv] sync with 2.4 # # Driver should be using LIBATA_MAX_PRD not ATA_MAX_PRD, # due to iommu layer splitting. # # ChangeSet # 2004/09/13 19:01:14-07:00 davem@nuts.davemloft.net # [IOMAP]: Make ioport_map() take unsigned long port argument. # # Signed-off-by: David S. Miller # # lib/iomap.c # 2004/09/13 19:00:43-07:00 davem@nuts.davemloft.net +4 -4 # [IOMAP]: Make ioport_map() take unsigned long port argument. # # include/asm-generic/iomap.h # 2004/09/13 19:00:43-07:00 davem@nuts.davemloft.net +1 -1 # [IOMAP]: Make ioport_map() take unsigned long port argument. # # ChangeSet # 2004/09/13 16:17:24-07:00 shemminger@osdl.org # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # drivers/net/b44.h # 2004/09/13 16:17:06-07:00 shemminger@osdl.org +1 -4 # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # drivers/net/b44.c # 2004/09/13 16:17:06-07:00 shemminger@osdl.org +103 -92 # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 16:08:46-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:08:18-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:08:17-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/09/13 20:05:28-03:00 acme@conectiva.com.br # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/socket.c # 2004/09/13 20:05:10-03:00 acme@conectiva.com.br +30 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/protocol.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +18 -8 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/ipv6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +17 -7 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/udp.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/tcp_ipv6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/raw.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/af_inet6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +69 -86 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/udp.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_minisocks.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -1 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/raw.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/af_inet.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +53 -56 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/core/sock.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +21 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/tcp.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +0 -3 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/sock.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +12 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/sctp/sctp.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/ipv6.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +4 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 16:04:36-07:00 i@stingr.net # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # Signed-off-by: David S. Miller # # net/ipv4/ip_gre.c # 2004/09/13 16:04:06-07:00 i@stingr.net +12 -1 # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # include/linux/if_ether.h # 2004/09/13 16:04:06-07:00 i@stingr.net +2 -0 # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # ChangeSet # 2004/09/13 23:52:16+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2093/1: S3C2410 - remove un-necessary resource from NAND # # Patch from Ben Dooks # # Removed resource description left by copying error # # Thanks to Klaus Fetscher for pointing this out. # # Signed-off-by: Ben Dooks # # arch/arm/mach-s3c2410/devs.c # 2004/09/13 13:18:54+01:00 ben-linux@org.rmk.(none) +0 -6 # [PATCH] 2093/1: S3C2410 - remove un-necessary resource from NAND # # ChangeSet # 2004/09/13 23:47:50+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # Patch from Ben Dooks # # Fix inverted mask in s3c2410_gpio_setpin() function, # add s3c2410_modify_misccr() for shared register, and # add s3c2410_gpio_getpin() # # Signed-off-by: Ben Dooks # # include/asm-arm/arch-s3c2410/hardware.h # 2004/09/12 17:15:18+01:00 ben-linux@org.rmk.(none) +5 -0 # [PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # arch/arm/mach-s3c2410/gpio.c # 2004/09/12 16:59:08+01:00 ben-linux@org.rmk.(none) +28 -1 # [PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # ChangeSet # 2004/09/13 23:43:25+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2091/1: S3C2410 - change id of s3c2410-ohci # # Patch from Ben Dooks # # Fix missed ID change on s3c2410-usb # # Signed-off-by: Ben DOoks # # ChangeSet # 2004/09/13 15:43:14-07:00 davem@nuts.davemloft.net # [TCP]: Just silently ignore ICMP Source Quench messages. # # Recommended by draft-gont-tcpm-icmp-attacks-01.txt # # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/09/13 15:42:33-07:00 davem@nuts.davemloft.net +1 -5 # [TCP]: Just silently ignore ICMP Source Quench messages. # # arch/arm/mach-s3c2410/devs.c # 2004/09/12 12:39:29+01:00 ben-linux@org.rmk.(none) +1 -1 # [PATCH] 2091/1: S3C2410 - change id of s3c2410-ohci # # ChangeSet # 2004/09/13 23:39:13+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2090/2: S3C2410 - usb gadged (udc) include # # Patch from Ben Dooks # # Header file for USB gadget controller (udc) for the # Samsung S3C2410 SoC # # Signed-off-by: Herbert Poetzl # Signed-off-by: Ben Dooks # # include/asm-arm/arch-s3c2410/regs-udc.h # 2004/09/12 01:55:24+01:00 ben-linux@org.rmk.(none) +162 -0 # [PATCH] 2090/2: S3C2410 - usb gadged (udc) include # # include/asm-arm/arch-s3c2410/regs-udc.h # 2004/09/12 01:55:24+01:00 ben-linux@org.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-s3c2410/regs-udc.h # # ChangeSet # 2004/09/13 23:33:33+01:00 rmk@flint.arm.linux.org.uk # [ARM] Revive kapmd and provide apm_queue_event() # # Add kapmd thread to provide a process context to handle "APM" # events submitted via apm_queue_event(). # # Add apm_queue_event(), which can be called from hardware # interrupt handlers and the like, typically to fire off a # suspend. # # include/asm-arm/apm.h # 2004/09/13 23:30:04+01:00 rmk@flint.arm.linux.org.uk +5 -0 # Add apm_queue_event() prototype # # arch/arm/kernel/apm.c # 2004/09/13 23:29:42+01:00 rmk@flint.arm.linux.org.uk +79 -28 # Revive kapmd # # ChangeSet # 2004/09/13 23:28:34+01:00 rmk@flint.arm.linux.org.uk # [ARM] Update APM state definitions # # Move existing APM state definitions into struct apm_power_info, # and add further definitions describing other fields. # # include/asm-arm/apm.h # 2004/09/13 23:24:14+01:00 rmk@flint.arm.linux.org.uk +23 -19 # Move existing APM state definitions into struct apm_power_info, # and add further definitions describing other fields. # # ChangeSet # 2004/09/13 23:22:23+01:00 rmk@flint.arm.linux.org.uk # [ARM] Keep APM threads frozen # # Ensure threads waiting for suspend to occur in apm_ioctl are # not woken by the pm_suspend thread freezing - they're already # frozen. # # arch/arm/kernel/apm.c # 2004/09/13 23:19:11+01:00 rmk@flint.arm.linux.org.uk +22 -13 # Keep APM threads frozen # # ChangeSet # 2004/09/13 23:18:17+01:00 rmk@flint.arm.linux.org.uk # [ARM] No point having "nonblock" local variable - kill it. # # arch/arm/kernel/apm.c # 2004/09/13 23:14:58+01:00 rmk@flint.arm.linux.org.uk +2 -2 # No point having "nonblock" local variable - kill it. # # ChangeSet # 2004/09/13 23:13:03+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert suspend to a state machine. # # The original version had issues when two suspend events came # in at around the same time, causing APM to get confused: # threads became stuck in APM_IOC_SUSPEND and suspends_pending # incremented on each apm --suspend call. # # Now, we only add a suspend event to a users queue and increment # suspends_pending if the user isn't already in the middle of # handling a suspend event. # # ChangeSet # 2004/09/13 15:11:27-07:00 nico@cam.org # [PATCH] linux/dma-mapping.h needs linux/device.h # # It seems that most architectures already include linux/device.h in their # own asm/dma-mapping.h. Most but not all, and some drivers fail to # compile on those architectures that don't. Since everybody needs it # let's include device.h from one place only and fix compilation for # everybody. # # include/linux/dma-mapping.h # 2004/09/10 08:28:58-07:00 nico@cam.org +1 -0 # linux/dma-mapping.h needs linux/device.h # # include/asm-x86_64/dma-mapping.h # 2004/09/10 08:33:31-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sparc/dma-mapping.h # 2004/09/10 08:30:54-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sh64/dma-mapping.h # 2004/09/10 08:33:57-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sh/dma-mapping.h # 2004/09/10 08:34:27-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ppc64/dma-mapping.h # 2004/09/10 08:34:51-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ppc/dma-mapping.h # 2004/09/10 08:35:12-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-mips/dma-mapping.h # 2004/09/10 08:35:32-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ia64/dma-mapping.h # 2004/09/10 08:32:59-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-i386/dma-mapping.h # 2004/09/10 08:30:26-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # arch/arm/kernel/apm.c # 2004/09/13 23:09:29+01:00 rmk@flint.arm.linux.org.uk +44 -29 # Convert suspend to a state machine. # # ChangeSet # 2004/09/13 23:04:59+01:00 rmk@flint.arm.linux.org.uk # [ARM] Remove APM standby support - it's unused. # # arch/arm/kernel/apm.c # 2004/09/13 23:01:58+01:00 rmk@flint.arm.linux.org.uk +3 -29 # Remove APM standby support - it's unused. # # ChangeSet # 2004/09/13 22:59:57+01:00 rmk@flint.arm.linux.org.uk # [ARM] APM: "Battery life" needs to be a signed integer. # # include/asm-arm/apm.h # 2004/09/13 22:54:57+01:00 rmk@flint.arm.linux.org.uk +1 -1 # "Battery life" needs to be a signed integer. # # arch/arm/kernel/apm.c # 2004/09/13 22:54:52+01:00 rmk@flint.arm.linux.org.uk +1 -1 # "Battery life" needs to be a signed integer. # # ChangeSet # 2004/09/13 22:52:50+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert APM user list lock to r/w sem # # Convert user_list_lock spinlock to a read/write semaphore; # the spinlock was affording us very little protection. # # arch/arm/kernel/apm.c # 2004/09/13 22:49:32+01:00 rmk@flint.arm.linux.org.uk +9 -9 # Convert user_list_lock spinlock to a read/write semaphore; # the spinlock was affording us very little protection. # # ChangeSet # 2004/09/13 22:43:47+01:00 rmk@flint.arm.linux.org.uk # [ARM] Abstract APM circular queue object. # # arch/arm/kernel/apm.c # 2004/09/13 22:39:18+01:00 rmk@flint.arm.linux.org.uk +33 -21 # Abstract APM circular queue object. # # ChangeSet # 2004/09/13 22:38:26+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert list_for_each()/list_entry() to list_for_each_entry() # # arch/arm/kernel/apm.c # 2004/09/13 22:35:58+01:00 rmk@flint.arm.linux.org.uk +4 -8 # Convert list_for_each()/list_entry() to list_for_each_entry() # # ChangeSet # 2004/09/13 22:34:49+01:00 rmk@flint.arm.linux.org.uk # [ARM] Remove the hh.org H3600 "example" code. # # arch/arm/kernel/apm.c # 2004/09/13 22:29:29+01:00 rmk@flint.arm.linux.org.uk +0 -13 # Remove the hh.org H3600 "example" code. # # ChangeSet # 2004/09/13 22:28:23+01:00 rmk@flint.arm.linux.org.uk # [ARM] Fix ARM APM emulation sparse errors # # arch/arm/kernel/apm.c:57:16: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:58:17: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:59:17: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:60:23: warning: dubious one-bit signed bitfield # # arch/arm/kernel/apm.c # 2004/09/13 22:25:13+01:00 rmk@flint.arm.linux.org.uk +4 -4 # Fix a few extra sparse errors # # ChangeSet # 2004/09/13 14:05:42-07:00 akpm@osdl.org # [PATCH] isofs buffer management fix # # There's a double-free in the isofs filesystem. # # Invalidate this pointer so it doesn't get freed twice. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/isofs/rock.c # 2004/09/10 01:47:00-07:00 akpm@osdl.org +1 -1 # isofs buffer management fix # # ChangeSet # 2004/09/13 14:05:30-07:00 anton@samba.org # [PATCH] Backward compatibility for compat sched_getaffinity # # The follow patch special cases the NR_CPUS <= BITS_PER_COMPAT_LONG case. # Without this patch, a 32bit task would be required to have a 64bit # cpumask no matter what value of NR_CPUS are used. # # With this patch a compat long sized bitmask is allowed if NR_CPUS is # small enough to fit within it. # # Of course applications should be using the glibc wrappers that use an # opaque cpu_mask_t type, but there could be older applications using the # syscalls directly. # # Signed-off-by: Anton Blanchard # Signed-off-by: Linus Torvalds # # kernel/compat.c # 2004/09/09 05:59:05-07:00 anton@samba.org +7 -3 # Backward compatibility for compat sched_getaffinity # # ChangeSet # 2004/09/13 14:05:18-07:00 anton@samba.org # [PATCH] Clean up compat sched affinity syscalls # # Remove the set_fs hack in the compat affinity calls. Create # sched_getaffinity and sched_setaffinity helper functions that both the # native and compat affinity syscalls use. # # Also make the compat functions match what the native ones are doing now, # setaffinity calls succeed no matter what length the bitmask is, but # getaffinity calls must pass in bitmasks at least as long as the kernel # type. # # Signed-off-by: Anton Blanchard # Signed-off-by: Linus Torvalds # # kernel/sched.c # 2004/09/09 05:09:57-07:00 anton@samba.org +60 -42 # Clean up compat sched affinity syscalls # # kernel/compat.c # 2004/09/09 05:58:30-07:00 anton@samba.org +29 -67 # Clean up compat sched affinity syscalls # # include/linux/sched.h # 2004/09/09 05:09:57-07:00 anton@samba.org +3 -0 # Clean up compat sched affinity syscalls # # ChangeSet # 2004/09/13 13:47:41-07:00 torvalds@ppc970.osdl.org # Export new PCI iomem access interfaces to modules too. # # lib/iomap.c # 2004/09/13 13:47:35-07:00 torvalds@ppc970.osdl.org +11 -0 # Export new PCI iomem access interfaces to modules too. # # ChangeSet # 2004/09/13 13:03:56-07:00 herbert@gondor.apana.org.au # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/ip6_tunnel.c # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +2 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +7 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/ip6_tunnel.h # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +2 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 12:58:04-07:00 ak@muc.de # [NET]: Fix missing spin lock in lltx path. # # This fixes a silly missing spin lock in the relock path. For some # reason it seems to still work when you don't have spinlock debugging # enabled. # # Please apply. # # Thanks to Arjan's spinlock debug kernel for finding it. # # Signed-off-by: Andi Kleen # Signed-off-by: David S. Miller # # net/sched/sch_generic.c # 2004/09/13 12:57:46-07:00 ak@muc.de +3 -1 # [NET]: Fix missing spin lock in lltx path. # # This fixes a silly missing spin lock in the relock path. For some # reason it seems to still work when you don't have spinlock debugging # enabled. # # Please apply. # # Thanks to Arjan's spinlock debug kernel for finding it. # # Signed-off-by: Andi Kleen # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 18:55:39+00:00 aegl@agluck-lia64.sc.intel.com # Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/work/stephane # into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.9 # # arch/ia64/Makefile # 2004/09/13 18:55:33+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # ChangeSet # 2004/09/13 18:48:29+00:00 eranian@hpl.hp.com # [IA64] Makefile: fix for the PTRACE_SYSCALL corruption bug # # Thanks to David for his help in tracking it down. # # compile the kernel with sibling call optimization # turned off. There is a problem with all functions # using the optimization and the asmlinkage attribute. # The compiler should not perform the optimization on # these functions because it cannot preserve the syscall # parameters in the callee. This caused SIGSEGV on programs # traced with PTRACE_SYSCALL, for instance. # # signed-off-by: stephane eranian # Signed-off-by: Tony Luck # # arch/ia64/Makefile # 2004/09/13 18:44:37+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Turn off sibling call optimizations (avoid asmlinkage breakage). # # ChangeSet # 2004/09/13 11:32:00-07:00 torvalds@ppc970.osdl.org # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # lib/iomap.c # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +110 -0 # # include/asm-generic/iomap.h # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +44 -0 # # lib/iomap.c # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/lib/iomap.c # # lib/Makefile # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +1 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # include/asm-generic/iomap.h # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-generic/iomap.h # # include/asm-ppc64/io.h # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +2 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # include/asm-i386/io.h # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +2 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/x86_64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ppc64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ppc/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ia64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/i386/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/arm/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/alpha/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # ChangeSet # 2004/09/13 09:41:04-07:00 bzolnier@elka.pw.edu.pl # [PATCH] ide: small cleanup for sis5513 # # Sigh, Thomas Gleixner pointed out that his # sis5518 fix didn't need forward porting. # # Signed-off-by: Bartlomiej Zolnierkiewicz # Signed-off-by: Linus Torvalds # # drivers/ide/pci/sis5513.c # 2004/09/13 05:53:51-07:00 bzolnier@elka.pw.edu.pl +10 -16 # ide: small cleanup for sis5513 # # ChangeSet # 2004/09/13 12:28:57+02:00 vojtech@suse.cz # Merge suse.cz:/data2/bk/linus into suse.cz:/data2/bk/input # # include/linux/hiddev.h # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -7 # Auto merged # # fs/compat_ioctl.c # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -6 # Auto merged # # drivers/input/serio/Kconfig # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # MAINTAINERS # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/09/13 16:04:16+09:00 yoshfuji@linux-ipv6.org # [IPV6] purge routes via non-router neighbour but gateway. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 16:02:20+09:00 yoshfuji@linux-ipv6.org # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # ChangeSet # 2004/09/13 15:59:11+09:00 yoshfuji@linux-ipv6.org # [IPV6] don't use expired default routes. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:57:40+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:56:55+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:56:10+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: update entry appropriately when receiving NS. # # Update neighbour entry appropriately by passing correct flags # when receiving NS. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:54:32+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: use time_after() and its friends. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:54:11+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:52:13+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:51:20+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:50:56+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:50:00+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ip6_fib.c # 2004/09/13 16:04:07+09:00 yoshfuji@linux-ipv6.org +5 -0 # [IPV6] purge routes via non-router neighbour but gateway. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/route.c # 2004/09/13 16:02:09+09:00 yoshfuji@linux-ipv6.org +4 -4 # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # net/ipv6/ip6_fib.c # 2004/09/13 16:02:09+09:00 yoshfuji@linux-ipv6.org +7 -0 # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # net/ipv6/route.c # 2004/09/13 15:59:01+09:00 yoshfuji@linux-ipv6.org +4 -0 # [IPV6] don't use expired default routes. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/route.c # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +26 -18 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +2 -15 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/ip6_route.h # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:56:45+09:00 yoshfuji@linux-ipv6.org +74 -80 # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:56:45+09:00 yoshfuji@linux-ipv6.org +1 -1 # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:55:59+09:00 yoshfuji@linux-ipv6.org +5 -2 # [IPV6] NDISC: update entry appropriately when receiving NS. # # Update neighbour entry appropriately by passing correct flags # when receiving NS. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:54:22+09:00 yoshfuji@linux-ipv6.org +14 -15 # [NET] NEIGHBOUR: use time_after() and its friends. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +22 -17 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +13 -0 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +2 -0 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +3 -4 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +6 -5 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +1 -2 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +7 -2 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +5 -2 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +2 -1 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +20 -9 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +3 -3 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv4/arp.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +7 -3 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +15 -8 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/atm/clip.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +4 -2 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +6 -1 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/09 21:50:47+00:00 jbarnes@sgi.com # [IA64-SGI]: disable non-display ROM resources # # This patch is needed to correctly support the new sysfs rom file. On sn2, we # only allocate PIO space for display option ROMs since PIO space is a # relatively scarce resource (we've seen exhaustion when running with several # qla cards in the same domain). And without this patch we won't zero out # non-display ROM resources which can lead to panics if anyone tries to use the # bogus addresses left over there from the generic PCI probing code. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/sn/io/machvec/pci_bus_cvlink.c # 2004/09/09 21:47:56+00:00 aegl@agluck-lia64.sc.intel.com +14 -1 # sn2: disable non-display ROM resources # # ChangeSet # 2004/09/09 21:45:01+00:00 markgw@sgi.com # [IA64-SGI] sn_proc_fs.c: convert to use seq_file API # # Signed-off-by: Mark Goodwin # Signed-off-by: Tony Luck # # arch/ia64/sn/kernel/sn2/sn_proc_fs.c # 2004/09/09 21:42:19+00:00 aegl@agluck-lia64.sc.intel.com +86 -99 # convert to use seq_file API # # ChangeSet # 2004/09/08 11:51:10+02:00 marcel@holtmann.org # [Bluetooth] Check checksums for BNEP # # The checking of the checksums is needed, because with certain Bluetooth # hardware there are failures which aren't caught otherwise. # # Signed-off-by: David Woodhouse # Signed-off-by: Marcel Holtmann # # net/bluetooth/bnep/core.c # 2004/09/08 11:48:06+02:00 marcel@holtmann.org +1 -1 # Check checksums for BNEP # # ChangeSet # 2004/09/04 12:52:38+02:00 marcel@holtmann.org # [Bluetooth] Don't send L2CAP reject command for bad responses # # If a L2CAP response is bad or not understood there is no need to send # a reject command. The right way is to ignore the response and let the # L2CAP timers trigger the further actions. # # Signed-off-by: Marcel Holtmann # # net/bluetooth/l2cap.c # 2004/09/04 12:51:17+02:00 marcel@holtmann.org +10 -9 # Don't send L2CAP reject command for bad responses # # ChangeSet # 2004/09/04 12:42:34+02:00 marcel@holtmann.org # [Bluetooth] Don't use ISOC transfers for Broadcom dongle # # The Broadcom dongles with HID proxy support don't work with SCO over # HCI and so there is no need to start the ISOC transfers. # # Signed-off-by: Marcel Holtmann # # drivers/bluetooth/hci_usb.c # 2004/09/04 12:39:45+02:00 marcel@holtmann.org +1 -1 # Don't use ISOC transfers for Broadcom dongle # # ChangeSet # 2004/08/25 14:05:08+02:00 vojtech@suse.cz # Manual merge. # Signed-off-by: Vojtech Pavlik # # MAINTAINERS # 2004/08/25 14:05:03+02:00 vojtech@suse.cz +6 -6 # Manual merge. # Signed-off-by: Vojtech Pavlik # # include/linux/compat_ioctl.h # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/gscps2.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/emu10k1-gp.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/08/25 14:01:28+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/19 17:02:03+02:00 vojtech@suse.cz # input: Make sure the HID request queue survives report transfer failures gracefully. # # Signed-off-by: Vojtech Pavlik # Problem-spotted-by: Alan Stern # # drivers/usb/input/hid-core.c # 2004/08/19 17:01:56+02:00 vojtech@suse.cz +54 -41 # input: Make sure the HID request queue survives report transfer failures gracefully. # # ChangeSet # 2004/08/16 15:32:04+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/08/16 15:32:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/16 15:16:23+02:00 vojtech@suse.cz # input: Update MAINTAINERS entries for Vojtech Pavlik. # # MAINTAINERS # 2004/08/16 15:16:16+02:00 vojtech@suse.cz +8 -9 # input: Update MAINTAINERS entries for Vojtech Pavlik. # # ChangeSet # 2004/08/12 14:56:02+02:00 rmk@arm.linux.org.uk # input: Update pcips2 driver # # Use pci_request_regions()/pci_release_regions() instead of # request_region()/release_region() # # Signed-off-by: Russell King # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/pcips2.c # 2004/08/12 14:55:54+02:00 rmk@arm.linux.org.uk +6 -9 # Use pci_request_regions()/pci_release_regions() instead of # request_region()/release_region() # # Signed-off-by: Russell King # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/08/09 22:00:56+02:00 vojtech@suse.cz # Merge bkbits:input2 into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/08/09 22:00:49+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/04 11:31:02+02:00 vojtech@suse.cz # Merge bkbits:input2 into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/02 11:13:22+02:00 vojtech@suse.cz # input: Fix an i8042 access timing violation spotted by Alan Cox. # # drivers/input/serio/i8042.c # 2004/08/02 11:13:16+02:00 vojtech@suse.cz +1 -0 # input: Fix an i8042 access timing violation spotted by Alan Cox. # # ChangeSet # 2004/08/02 09:39:28+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/08/02 09:39:24+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/30 19:11:34+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/30 19:11:21+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/29 16:20:07-07:00 vojtech@kernel.bkbits.net # Merge 62.245.75.237:bk/input-linus # into kernel.bkbits.net:/home/vojtech/input # # fs/compat_ioctl.c # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # drivers/Makefile # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # ChangeSet # 2004/07/29 16:14:29+02:00 vojtech@suse.cz # Merge bk://dtor.bkbits.net/input into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/07/29 16:14:26+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/29 16:14:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/07/29 16:14:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/29 14:13:12+02:00 vojtech@suse.cz # input: Check the range for HIDIOC?USAGES num_values. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/07/29 14:13:05+02:00 vojtech@suse.cz +4 -7 # input: Check the range for HIDIOC?USAGES num_values. # # ChangeSet # 2004/07/29 13:42:55+02:00 vojtech@suse.cz # input: Fix a missing index in tmdc.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/tmdc.c # 2004/07/29 13:42:48+02:00 vojtech@suse.cz +1 -1 # input: Fix a missing index in tmdc.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/07/28 00:57:35-05:00 dtor_core@ameritech.net # Input: fix absolute device handling in mousedev that was broken # by recent change that tried to do better multiplexing. # Now every client will keep its own virtual cursor position # and both absolute and relative events will update it # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/07/28 00:57:20-05:00 dtor_core@ameritech.net +35 -8 # Fix absolute device handling - have every client keep its own # virtual position and have both absolute and relative events # update it # # ChangeSet # 2004/07/28 00:55:34-05:00 dtor_core@ameritech.net # Input: fix reader wakeup conditions in mousedev, joydev and tsdev # (we want readers to wake up when underlying device is gone # so they would get -ENODEV and close the device). # # Signed-off-by: Dmitry Torokhov # # drivers/input/tsdev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +5 -5 # Wake up readers when device is gone # # drivers/input/mousedev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +5 -1 # Wake up readers when device is gone # # drivers/input/joydev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +4 -2 # Wake up readers when device is gone # # ChangeSet # 2004/07/28 00:54:40-05:00 dtor_core@ameritech.net # Input: switch atkbd driver from busy-polling for command completion # to waiting for event # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/atkbd.c # 2004/07/28 00:54:23-05:00 dtor_core@ameritech.net +108 -31 # Switch from busy-polling for command completion to waiting for event # # ChangeSet # 2004/07/28 00:54:01-05:00 dtor_core@ameritech.net # Input: atkbd - harden ACK/NAK and command processing logic # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/atkbd.c # 2004/07/28 00:53:37-05:00 dtor_core@ameritech.net +38 -33 # Harden ACK/NAK and command processing logic # # ChangeSet # 2004/07/28 00:52:45-05:00 dtor_core@ameritech.net # Input: switch psmouse driver from busy-polling for command completion # to waiting for event # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/28 00:52:21-05:00 dtor_core@ameritech.net +3 -0 # Add wait queue to psmouse structure # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:52:21-05:00 dtor_core@ameritech.net +38 -33 # Switch from busy-polling for command completion to waiting for event # # ChangeSet # 2004/07/28 00:51:37-05:00 dtor_core@ameritech.net # Input: psmouse - harden command mode processing logic # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/28 00:51:21-05:00 dtor_core@ameritech.net +2 -2 # Change PSMOUSE_FLAG_ID to PSMOUSE_FLAG_WAITID # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:51:21-05:00 dtor_core@ameritech.net +52 -40 # Harden command mode processing logic # # ChangeSet # 2004/07/28 00:50:38-05:00 dtor_core@ameritech.net # Input: fix psmouse_sendbyte logic # - correctly return NAK when command times out on our side # - always reset ACK flag, even when serio_write fails # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:49:51-05:00 dtor_core@ameritech.net +8 -3 # Correctly handle timeout condition # # ChangeSet # 2004/07/27 14:46:36+02:00 olh@suse.de # input: Re-add PC Speaker support for PPC # # Signed-off-by: Olaf Hering # Signed-off-by: Vojtech Pavlik # # include/asm-ppc64/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +10 -0 # # include/asm-ppc/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +10 -0 # # include/asm-ppc64/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +0 -0 # BitKeeper file /data/bk/input/include/asm-ppc64/8253pit.h # # include/asm-ppc/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +0 -0 # BitKeeper file /data/bk/input/include/asm-ppc/8253pit.h # # drivers/input/misc/Kconfig # 2004/07/27 14:46:29+02:00 olh@suse.de +1 -1 # input: Re-add PC Speaker support for PPC # # ChangeSet # 2004/07/27 14:39:53+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # drivers/serial/sunsu.c # 2004/07/27 14:39:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/keyboard/sunkbd.c # 2004/07/27 14:39:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/07/27 14:39:49+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/20 15:54:55+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/19 23:26:20-05:00 dtor_core@ameritech.net # Input: serio - switch to use driver_find, adjust reference count # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/07/19 23:25:59-05:00 dtor_core@ameritech.net +2 -3 # Switch to use driver_find, adjust reference count # # ChangeSet # 2004/07/19 23:17:19-05:00 dtor_core@ameritech.net # Input: allow marking serio ports (in addition to serio drivers) # as manual bind only, export the flag through sysfs # # echo -n "manual" > /sys/bus/serio/devices/serio0/bind_mode # echo -n "auto" > /sys/bus/serio/drivers/serio_raw/bind_mode # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/07/19 23:17:04-05:00 dtor_core@ameritech.net +3 -1 # Add manual_bind to serio port structure # # drivers/input/serio/serio.c # 2004/07/19 23:17:04-05:00 dtor_core@ameritech.net +60 -8 # Allow serio ports be marked as manual bind, export through sysfs # # ChangeSet # 2004/07/19 23:16:28-05:00 dtor_core@ameritech.net # Input: Switch to use bus' default device and driver attributes to # manage serio sysfs attributes # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/07/19 23:16:14-05:00 dtor_core@ameritech.net +14 -6 # Switch to use bus' default device and driver attributes to # manage serio sysfs attributes # # ChangeSet # 2004/07/19 23:15:36-05:00 dtor_core@ameritech.net # Input: integrate ct82c710, maceps2, q40kbd and rpckbd with sysfs # as platform devices so their serio ports have proper parents # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/rpckbd.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +15 -5 # Integrate with sysfs as a platform device # # drivers/input/serio/q40kbd.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +14 -4 # Integrate with sysfs as a platform device # # drivers/input/serio/maceps2.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +14 -5 # Integrate with sysfs as a platform device # # drivers/input/serio/ct82c710.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +28 -22 # Integrate with sysfs as a platform device # # ChangeSet # 2004/07/19 23:14:44-05:00 dtor_core@ameritech.net # Input: make i8042 a platform device instead of system device so # its serio ports have proper parent # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/i8042.c # 2004/07/19 23:13:42-05:00 dtor_core@ameritech.net +34 -26 # Make i8042 a platform device instead of system device # # ChangeSet # 2004/07/19 22:48:22-05:00 dtor_core@ameritech.net # Input: drop __attribute__ ((packed)) from mousedev_emul # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/07/19 22:48:00-05:00 dtor_core@ameritech.net +1 -1 # Drop __attribute__ ((packed)) from mousedev_emul # # ChangeSet # 2004/07/19 22:44:37-05:00 dtor_core@ameritech.net # Input: rearrange activation/children probe sequence in psmouse so # reconnect on children ports works even after parent port is # fully activated: # - when connecting/reconnecting a port always activate it # - when connecting/reconnecting a pass-throgh port deactivate # parent first and activate it after connect is done # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/19 22:44:22-05:00 dtor_core@ameritech.net +1 -0 # PSMOUSE_CMD_DISABLE added # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:44:22-05:00 dtor_core@ameritech.net +37 -18 # Rearrange activation/children probe sequence so reconnect on children # ports works even after parent port is fully activated: # - when connecting/reconnecting a port always activate it # - when connecting/reconnecting a pass-throgh port deactivate parent # first and activate it after connect is done. # # ChangeSet # 2004/07/19 22:41:37-05:00 dtor_core@ameritech.net # Input: synaptics - do not try to process packets from slave device # as if they were coming form the touchpad itself if pass-through # port is disconnected, just pass them to serio core and it will # attempt to bind proper driver to the port # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/synaptics.c # 2004/07/19 22:41:21-05:00 dtor_core@ameritech.net +12 -14 # Do not try to process packets from slave device as if they were coming # from touchpad itself if pass-through port is disconnected, just pass # them to serio core so it will try to bind a driver to the port # # ChangeSet # 2004/07/19 22:39:18-05:00 dtor_core@ameritech.net # Input: do not call protocol handler in psmouse unless mouse is # filly initialized - helps when USB Legacy emulation gets # in our way and starts generating junk data stream while # psmouse is detecting hardware # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/19 22:38:59-05:00 dtor_core@ameritech.net +8 -6 # Introduce new state - PSMOUSE_INITIALIZING, convert to enum # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:38:59-05:00 dtor_core@ameritech.net +10 -3 # Introduce new state - PSMOUSE_INITIALIZING, do not call protocol # handler until mouse is fully initialized # # ChangeSet # 2004/07/19 22:38:32-05:00 dtor_core@ameritech.net # Input: when changing psmouse state (activated, ignore) use srio_pause_rx/ # serio_continue_rx so it will not fight with the interrupt handler # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:38:17-05:00 dtor_core@ameritech.net +21 -11 # Use serio_pause_rx/serio_continue_rx when changing psmouse state # (activated, ignore) to ensure that the interrupt handler will not # interfere # # ChangeSet # 2004/07/19 22:37:24-05:00 dtor_core@ameritech.net # Input: add serio_pause_rx and serio_continue_rx so drivers can protect # their critical sections from port's interrupt handler # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/07/19 22:37:06-05:00 dtor_core@ameritech.net +19 -2 # Add serio_pause_rx and serio_continue_rx # # drivers/input/serio/serio.c # 2004/07/19 22:37:06-05:00 dtor_core@ameritech.net +8 -10 # Use serio_pause_rx and serio_continue_rx to protect access to serio->drv # # ChangeSet # 2004/07/19 22:36:34-05:00 dtor_core@ameritech.net # Input: workaround for i8042 active multiplexing controllers losing # track of where data is coming from. Also sprinkled some # "likely"s in i8042 interrupt handler. # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/i8042.c # 2004/07/19 22:36:01-05:00 dtor_core@ameritech.net +42 -18 # Workaround for i8042 active multiplexing controllers losing track of # where data is coming from # # ChangeSet # 2004/07/19 22:35:13-05:00 dtor_core@ameritech.net # Input: rearrange code in sunzilog so it registers its serio ports # only after hardware was fully initialized and with interrupts # tuned back on, otherwise it deadlocks. # # Signed-off-by: Dmitry Torokhov # # drivers/serial/sunzilog.c # 2004/07/19 22:34:47-05:00 dtor_core@ameritech.net +13 -5 # Do not try to register serio ports with interrupts off # # ChangeSet # 2004/07/19 22:34:23-05:00 dtor_core@ameritech.net # Input: move input/serio closer to the top of drivers/Makefile so # serio_bus is available early # # Signed-off-by: Dmitry Torokhov # # drivers/Makefile # 2004/07/19 22:33:56-05:00 dtor_core@ameritech.net +3 -1 # Move input/serio higher so serio_bus is available early # # ChangeSet # 2004/07/19 22:25:07-05:00 dtor_core@ameritech.net # Merge bk://linux.bkbits.net/linux-2.5 # into ameritech.net:/usr/src/export/input # # fs/compat_ioctl.c # 2004/07/19 22:24:55-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/19 22:24:54-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # drivers/Makefile # 2004/07/19 22:24:54-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # ChangeSet # 2004/07/12 07:07:06+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/07/12 07:06:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/12 07:06:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/07 22:02:01+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/07 22:01:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/07 22:01:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/07 15:35:03+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # include/linux/compat_ioctl.h # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # fs/compat_ioctl.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/06 10:15:07+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/05 13:38:52+02:00 akropel1@rochester.rr.com # This patch fixes another disconnect oops in hiddev. # # hid-core calls hiddev_disconnect() when the underlying device goes away # (hot unplug or system shutdown). Normally, hiddev_disconnect() will # clean up nicely and return to hid-core who then frees the hid structure. # However, if the corresponding hiddev node is open at disconnect time, # hiddev delays the majority of disconnect work until the device is closed # via hiddev_release(). hiddev_release() calls hiddev_cleanup() which # proceeds to dereference the hid struct which hid-core freed back when # the hardware was disconnected. Oops. # # To solve this, we change hiddev_disconnect() to deregister the hiddev # minor and invalidate its table entry immediately and delay only the # freeing of the hiddev structure itself. We're protected against future # operations on the fd since the major fops check hiddev->exists. # # There may still be an ordering of events that causes a problem but I can # no longer reproduce any manually. There are enough different subsystems # and object lifetimes interacting here that I may have screwed something # else up; review is certainly welcome. # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/07/05 13:38:41+02:00 akropel1@rochester.rr.com +6 -12 # This patch fixes another disconnect oops in hiddev. # # hid-core calls hiddev_disconnect() when the underlying device goes away # (hot unplug or system shutdown). Normally, hiddev_disconnect() will # clean up nicely and return to hid-core who then frees the hid structure. # However, if the corresponding hiddev node is open at disconnect time, # hiddev delays the majority of disconnect work until the device is closed # via hiddev_release(). hiddev_release() calls hiddev_cleanup() which # proceeds to dereference the hid struct which hid-core freed back when # the hardware was disconnected. Oops. # # To solve this, we change hiddev_disconnect() to deregister the hiddev # minor and invalidate its table entry immediately and delay only the # freeing of the hiddev structure itself. We're protected against future # operations on the fd since the major fops check hiddev->exists. # # There may still be an ordering of events that causes a problem but I can # no longer reproduce any manually. There are enough different subsystems # and object lifetimes interacting here that I may have screwed something # else up; review is certainly welcome. # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 12:56:34+02:00 vojtech@suse.cz # Merge # # drivers/input/serio/i8042.c # 2004/06/29 12:56:28+02:00 vojtech@suse.cz +0 -1 # SCCS merged # # ChangeSet # 2004/06/29 11:59:04+02:00 vojtech@suse.cz # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/29 11:58:54+02:00 vojtech@suse.cz +2 -10 # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042-io.h # 2004/06/29 11:58:54+02:00 vojtech@suse.cz +31 -0 # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 10:00:24+02:00 vojtech@suse.cz # Merge # # arch/i386/kernel/dmi_scan.c # 2004/06/29 10:00:18+02:00 vojtech@suse.cz +0 -20 # SCCS merged # # ChangeSet # 2004/06/29 09:48:40+02:00 vojtech@suse.cz # input: Fix Kconfig so that the joydump module can be compiled. # # Reported-by: Matthieu Castet # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 01:36:29-05:00 dtor_core@ameritech.net # Input: link serio ports to their parent devices in ambakmi, # gscps2, pcips2 and sa1111ps2 drivers # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/pcips2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/gscps2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/ambakmi.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # ChangeSet # 2004/06/29 01:31:03-05:00 dtor_core@ameritech.net # Input: Add serio_raw driver that binds to serio ports and provides # unobstructed access to the underlying serio port via a char # device. The driver tries to register char device 10,1 # (/dev/psaux) first and if it fails goes for dynamically # allocated minor. To bind use sysfs interface: # # echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/Makefile # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +1 -0 # serio_raw driver added # # drivers/input/serio/Kconfig # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +16 -0 # serio_raw driver added # # drivers/input/serio/serio_raw.c # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +390 -0 # BitKeeper file /usr/src/dtor/drivers/input/serio/serio_raw.c # # drivers/input/serio/serio_raw.c # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +0 -0 # BitKeeper file /usr/src/export/input/drivers/input/serio/serio_raw.c # # ChangeSet # 2004/06/29 01:30:19-05:00 dtor_core@ameritech.net # Input: allow marking some drivers (that don't do HW autodetection) # as manual bind only. Such drivers will only be bound to a # serio port if user requests it by echoing driver name into # port's sysfs driver attribute. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:30:01-05:00 dtor_core@ameritech.net +2 -0 # Allow marking some drivers for manual bind only # # drivers/input/serio/serio.c # 2004/06/29 01:30:01-05:00 dtor_core@ameritech.net +7 -2 # If a driver is marked for manual binding only bind it to a port # if user requested it # # ChangeSet # 2004/06/29 01:29:39-05:00 dtor_core@ameritech.net # Input: allow users manually rebind serio ports, like this: # echo -n "psmouse" > /sys/bus/serio/devices/serio0/driver # echo -n "atkbd" > /sys/bus/serio/devices/serio1/driver # echo -n "none" > /sys/bus/serio/devices/serio1/driver # echo -n "reconnect" > /sys/bus/serio/devices/serio1/driver # echo -n "rescan" > /sys/bus/serio/devices/serio1/driver # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/06/29 01:29:17-05:00 dtor_core@ameritech.net +33 -1 # Manual driver rebinding/reconnecting # # ChangeSet # 2004/06/29 01:28:53-05:00 dtor_core@ameritech.net # Input: serio sysfs integration # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +8 -1 # Serio sysfs integration # # drivers/input/touchscreen/h3600_ts_input.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/touchscreen/gunze.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/serio/serio.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +75 -10 # Serio sysfs integration # # drivers/input/mouse/vsxxxaa.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/mouse/sermouse.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +12 -6 # Serio sysfs integration # # drivers/input/keyboard/xtkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/sunkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/newtonkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/lkkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/atkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +12 -6 # Serio sysfs integration # # drivers/input/joystick/warrior.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/twidjoy.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +7 -3 # Serio sysfs integration # # drivers/input/joystick/stinger.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/spaceorb.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/spaceball.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/magellan.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/iforce/iforce-serio.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +8 -4 # Serio sysfs integration # # drivers/Makefile # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +1 -1 # Move serio initialization ahead of input so serio bus will # be registered before drivers such as atkbd and psmouse will # try using it # # ChangeSet # 2004/06/29 01:28:21-05:00 dtor_core@ameritech.net # Input: allow serio drivers to create children ports and register these # ports for them in serio core to avoid having recursion in connect # methods. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +2 -2 # Allow drivers to create children serio ports and register these # ports for them to avoid doing recursion # # drivers/input/serio/serio.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +166 -49 # Allow drivers to create children serio ports and register these # ports for them to avoid doing recursion # # drivers/input/mouse/synaptics.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +11 -16 # ptport is no more, serio port now has pointers both to parent and child # # drivers/input/mouse/psmouse.h # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +4 -12 # Get rid of ptport as serio port now has pointers both to parent and child # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +48 -27 # Do not recursively register passthrough ports, leave it to serio core # # ChangeSet # 2004/06/29 01:27:46-05:00 dtor_core@ameritech.net # Input: switch to dynamic (heap) serio port allocation in preparation # to sysfs integration. By having all data structures dynamically # allocated serio driver modules can be unloaded without waiting # for the last reference to the port to be dropped. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +3 -2 # Have name and phys stored inside serio port structure instead of # being pointers # # drivers/serial/sunzilog.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +37 -23 # Switch to dynamic (heap) serio port allocation # Unregister serio ports when unloading the module # # drivers/serial/sunsu.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +46 -37 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/serport.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +23 -22 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/serio.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +1 -0 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +19 -13 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/rpckbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +29 -11 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/q40kbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +79 -28 # Switch to dynamic (heap) serio port allocation # Add some locking # # drivers/input/serio/pcips2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +18 -12 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/parkbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +30 -17 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/maceps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +38 -31 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/i8042.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +7 -0 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/i8042.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +115 -93 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/gscps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +34 -21 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/ct82c710.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +35 -27 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/ambakmi.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +20 -15 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/synaptics.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +20 -13 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/psmouse.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +2 -1 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +6 -6 # Switch to dynamic (heap) serio port allocation # # ChangeSet # 2004/06/29 01:27:11-05:00 dtor_core@ameritech.net # Input: more renames in serio in preparations to sysfs integration # - serio_dev -> serio_driver # - serio_[un]register_device -> serio_[un]register_driver # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +11 -11 # Rename serio_dev to serio_driver # # drivers/input/touchscreen/h3600_ts_input.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/touchscreen/gunze.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/serio/serport.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/serio/serio.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +36 -36 # Rename serio_dev to serio_driver # # drivers/input/mouse/vsxxxaa.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/mouse/synaptics.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/mouse/sermouse.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +7 -7 # Rename serio_dev to serio_driver # # drivers/input/keyboard/xtkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/sunkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/newtonkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/lkkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/atkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +7 -7 # Rename serio_dev to serio_driver # # drivers/input/joystick/warrior.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/twidjoy.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/stinger.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/spaceorb.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/spaceball.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/magellan.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce.h # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce-serio.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +3 -3 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce-main.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +2 -2 # Rename serio_dev to serio_driver # # ChangeSet # 2004/06/29 01:26:36-05:00 dtor_core@ameritech.net # Input: rename serio->driver to serio->port_data in preparation # to sysfs integration # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +1 -1 # Rename serio->driver to serio->port_data # # drivers/serial/sunzilog.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/serial/sunsu.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/serport.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +3 -3 # Rename serio->driver to serio->port_data # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/pcips2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/maceps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +18 -18 # Rename serio->driver to serio->port_data # # drivers/input/serio/i8042.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +7 -7 # Rename serio->driver to serio->port_data # # drivers/input/serio/gscps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/ambakmi.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +11 -11 # Rename serio->driver to serio->port_data # # drivers/input/mouse/synaptics.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +2 -2 # Rename serio->driver to serio->port_data # # ChangeSet # 2004/06/29 01:25:59-05:00 dtor_core@ameritech.net # Input: make connect and disconnect methods mandatory for serio # drivers since that's where serio_{open|close} are called # from to actually bind driver to a port. # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/06/29 01:25:35-05:00 dtor_core@ameritech.net +5 -6 # Connect and disconnect handlers are now mandatory # # drivers/input/joystick/Kconfig # 2004/06/27 10:25:16+02:00 vojtech@suse.cz +1 -1 # input: Fix Kconfig so that the joydump module can be compiled. # # Reported-by: Matthieu Castet # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/25 09:51:55+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/25 09:51:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/24 17:55:29+02:00 vojtech@suse.cz # input: Fix Peter Nelson's e-mail address in gamecon.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/gamecon.c # 2004/06/24 17:55:22+02:00 vojtech@suse.cz +1 -1 # input: Fix Peter Nelson's e-mail address in gamecon.c # # ChangeSet # 2004/06/24 15:44:37+02:00 cr7@os.inf.tu-dresden.de # input: Add CodeMercs IOWarrior to hid-core device blacklist. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-core.c # 2004/06/24 15:44:31+02:00 cr7@os.inf.tu-dresden.de +7 -2 # input: Add CodeMercs IOWarrior to hid-core device blacklist. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/24 15:39:08+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # include/linux/serio.h # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/tsdev.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mouse/Kconfig # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/misc/uinput.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/keyboard/atkbd.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/06/24 15:39:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/06/24 15:39:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/23 22:19:54+02:00 James@superbug.demon.co.uk # input: Add Audigy LS PCI ID to emu10k1-gp.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/emu10k1-gp.c # 2004/06/23 22:19:44+02:00 James@superbug.demon.co.uk +1 -0 # input: Add Audigy LS PCI ID to emu10k1-gp.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/23 19:58:19+02:00 vojtech@suse.cz # input: Add Dell SB Live! PCI ID to the emu10k1-gp driver. # # Reported-by: Francisco Moraes # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/emu10k1-gp.c # 2004/06/23 19:58:09+02:00 vojtech@suse.cz +2 -0 # input: Add Dell SB Live! PCI ID to the emu10k1-gp driver. # # Reported-by: Francisco Moraes # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/23 08:06:20+02:00 vojtech@suse.cz # input: Fix array overflows in keyboard.c when KEY_MAX > keycode > NR_KEYS > 128. # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/06/23 08:06:11+02:00 vojtech@suse.cz +5 -2 # input: Fix array overflows in keyboard.c when KEY_MAX > keycode > NR_KEYS > 128. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 20:31:56+02:00 vojtech@suse.cz # input: when probing for ImExPS/2 mice, the ImPS/2 sequence needs # to be sent first, but the result should be ignored. # # Signed-off-by: Vojtech Pavlik # # drivers/input/mouse/psmouse-base.c # 2004/06/21 20:31:45+02:00 vojtech@suse.cz +2 -0 # input: when probing for ImExPS/2 mice, the ImPS/2 sequence needs # to be sent first, but the result should be ignored. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 08:35:20+02:00 pnelson@andrew.cmu.edu # input: Enhancements/fixes for PSX pad support: # # * Adds support for more than one controller. Previously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/gamecon.c # 2004/06/21 08:35:10+02:00 pnelson@andrew.cmu.edu +101 -91 # input: Enhancements/fixes for PSX pad support: # * Adds support for more than one controller. Previ # ously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # Documentation/input/joystick-parport.txt # 2004/06/21 08:35:10+02:00 pnelson@andrew.cmu.edu +11 -2 # input: Enhancements/fixes for PSX pad support: # * Adds support for more than one controller. Previ # ously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 07:48:47+02:00 vojtech@suse.cz # input: Remove an extra dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/21 07:48:38+02:00 vojtech@suse.cz +2 -1 # input: Remove an extra dmi_noloop declaration in i8042.c # # ChangeSet # 2004/06/17 08:38:07+02:00 zinx@epicsol.org # input: Fix bad struct hidinput initialization in hid-tmff.c # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-tmff.c # 2004/06/17 08:37:56+02:00 zinx@epicsol.org +1 -1 # input: Fix bad struct hidinput initialization in hid-tmff.c # # ChangeSet # 2004/06/12 13:55:01+02:00 vojtech@suse.cz # Input: rearrangements and cleanups in serio.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/serio.c # 2004/06/12 13:54:52+02:00 vojtech@suse.cz +102 -89 # Input: rearrangements and cleanups in serio.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/11 23:04:12+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/11 12:10:29+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/data/bk/input # # drivers/input/serio/i8042.c # 2004/06/11 12:10:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/09 07:33:13+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/08 22:57:09+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/07 11:46:31+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/07 11:46:27+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/07 11:41:45+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/07 11:41:40+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 20:13:56+02:00 vojtech@suse.cz # input: Remove OSB4/Profusion hack in i8042, as it's handled by # DMI blacklist now. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/06 20:13:43+02:00 vojtech@suse.cz +1 -10 # input: Remove OSB4/Profusion hack in i8042, as it's handled by # DMI blacklist now. # # ChangeSet # 2004/06/06 19:15:17+02:00 vojtech@suse.cz # Merge bk://dtor.bkbits.net/input into suse.cz:/home/vojtech/bk/input # # drivers/input/serio/i8042.c # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 11:37:05-05:00 dtor_core@ameritech.net # Input: mousedev - implement tapping for touchpads working in absolute # mode, such as Synaptics # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +31 -7 # Implement tapping for touchpads working in absolute mode # # drivers/input/mouse/Kconfig # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +0 -2 # Do not recommend proto=imps option for Synaptics since mousedev # now supports tapping # # Documentation/kernel-parameters.txt # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +6 -0 # mousedev.tap_time option documented # # ChangeSet # 2004/06/06 11:34:24-05:00 dtor_core@ameritech.net # Input: mousedev - better handle button presses when under load # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/06/06 11:33:44-05:00 dtor_core@ameritech.net +104 -48 # Better handle button presses under load, cleanups # # ChangeSet # 2004/06/06 15:05:20+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/06/06 15:05:15+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 11:56:42+02:00 zap@homelink.ru # input: # # From: Andrew Zabolotny # # - Implement the 'raw' touchscreen protocol for backward compatibility # (/dev/input/ts[0-7] now speaks the protocol of the old /dev/h3600_ts, and # the /dev/input/tsraw[0-7] speaks the protocol of the old /dev/h3600_tsraw # device). # # - Support the ioctls for setting the calibration parameters. The default # calibration matrix is computed from the xres,yres parameters (duplicate the # old behaviour), however this is not enough for a good translation from # touchscreen space to screen space. # # - Fixed a old bug in tsdev: on a pen motion event X1,Y1 -> X2,Y2 the driver # would output three events with coordinates: X1,Y1, X2,Y1, X2,Y2. This # happened not only with coordinates, but with pressure too. # # - Update James's email address # # - Remove mention of Transvirtual Technologies: they no longer exist. # # Signed-off-by: Vojtech Pavlik # # drivers/input/tsdev.c # 2004/06/06 11:56:33+02:00 zap@homelink.ru +186 -105 # input: # # From: Andrew Zabolotny # # - Implement the 'raw' touchscreen protocol for backward compatibility # (/dev/input/ts[0-7] now speaks the protocol of the old /dev/h3600_ts, and # the /dev/input/tsraw[0-7] speaks the protocol of the old /dev/h3600_tsraw # device). # # - Support the ioctls for setting the calibration parameters. The default # calibration matrix is computed from the xres,yres parameters (duplicate the # old behaviour), however this is not enough for a good translation from # touchscreen space to screen space. # # - Fixed a old bug in tsdev: on a pen motion event X1,Y1 -> X2,Y2 the driver # would output three events with coordinates: X1,Y1, X2,Y1, X2,Y2. This # happened not only with coordinates, but with pressure too. # # - Update James's email address # # - Remove mention of Transvirtual Technologies: they no longer exist. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:37:43+02:00 herbert@gondor.apana.org.au # input: Fix boundary checks for GUSAGE/SUSAGE in hiddev. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/06/06 11:37:34+02:00 herbert@gondor.apana.org.au +13 -7 # input: Fix boundary checks for GUSAGE/SUSAGE in hiddev. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:09:31+02:00 vojtech@suse.cz # input: Add a missing extern i8042_dmi_loop. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/06 11:09:20+02:00 vojtech@suse.cz +1 -0 # input: Add a missing extern i8042_dmi_loop. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:08:20+02:00 vojtech@suse.cz # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # include/linux/input.h # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +1 -0 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +14 -2 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +2 -1 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/05 11:39:52+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # include/linux/compat_ioctl.h # 2004/06/05 11:39:47+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/04 07:18:00+02:00 wli@holomorphy.com # input: Move CONFIG_USB_HIDDEV a little lower in hiddev.h, to fix # compilation breakage when it is not defined. # # Signed-off-by: Vojtech Pavlik # # include/linux/hiddev.h # 2004/06/04 07:17:48+02:00 wli@holomorphy.com +1 -1 # input: Move CONFIG_USB_HIDDEV a little lower in hiddev.h, to fix # compilation breakage when it is not defined. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 13:00:58-05:00 dtor_core@ameritech.net # Input: logips2pp - do not call get_model_info 2 times # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/logips2pp.c # 2004/06/02 13:00:30-05:00 dtor_core@ameritech.net +1 -1 # Do not call get_model_info 2 times # # ChangeSet # 2004/06/02 12:56:24-05:00 dtor_core@ameritech.net # Cset exclude: dtor_core@ameritech.net|ChangeSet|20040510063935|25419 # # drivers/input/serio/i8042.c # 2004/06/02 12:56:02-05:00 dtor_core@ameritech.net +0 -0 # Exclude # # ChangeSet # 2004/06/02 16:30:53+02:00 vojtech@suse.cz # input: Add a missong dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/02 16:30:48+02:00 vojtech@suse.cz +1 -0 # input: Add a missong dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 16:09:25+02:00 vojtech@suse.cz # input: More locking improvements (and a fix) for serio. This # merges both my and Dmitry's changes. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/serio.c # 2004/06/02 16:09:19+02:00 vojtech@suse.cz +14 -12 # input: More locking improvements (and a fix) for serio. This # merges both my and Dmitry's changes. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 15:46:14+02:00 vojtech@suse.cz # input: Make atkbd.c's atkbd_command() function immune to keys being pressed # and scancodes coming from the keyboard while it's executing. # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/06/02 15:46:08+02:00 vojtech@suse.cz +8 -12 # input: Make atkbd.c's atkbd_command() function immune to keys being pressed # and scancodes coming from the keyboard while it's executing. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 13:48:07+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/compaq into suse.cz:/data/bk/input # # drivers/input/serio/i8042.c # 2004/06/02 13:48:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/02 13:44:20+02:00 vojtech@suse.cz # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/02 13:44:15+02:00 vojtech@suse.cz +13 -1 # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # arch/i386/kernel/dmi_scan.c # 2004/06/02 13:44:15+02:00 vojtech@suse.cz +31 -0 # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # ChangeSet # 2004/06/02 09:37:24+02:00 vojtech@suse.cz # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # Signed-off-by: Vojtech Pavlik # # include/linux/serio.h # 2004/06/02 09:37:13+02:00 vojtech@suse.cz +3 -0 # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # drivers/input/serio/serio.c # 2004/06/02 09:37:13+02:00 vojtech@suse.cz +29 -26 # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # ChangeSet # 2004/05/31 16:25:29+02:00 vojtech@suse.cz # input: Use raw events generated by atkbd in keyboard.c to implement true # rawmode for PS/2 keyboards. # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/05/31 16:25:23+02:00 vojtech@suse.cz +19 -6 # input: Use raw events generated by atkbd in keyboard.c to implement true # rawmode for PS/2 keyboards. # # ChangeSet # 2004/05/31 15:49:05+02:00 vojtech@suse.cz # input: Add reporting of raw scancodes to atkbd.c # # Signed-off-by: Vojtech Pavlik # # include/linux/input.h # 2004/05/31 15:49:00+02:00 vojtech@suse.cz +1 -0 # input: Add reporting of raw scancodes to atkbd.c # # drivers/input/keyboard/atkbd.c # 2004/05/31 15:49:00+02:00 vojtech@suse.cz +5 -3 # input: Add reporting of raw scancodes to atkbd.c # # ChangeSet # 2004/05/31 15:11:41+02:00 vojtech@suse.cz # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/mouse/psmouse.h # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +7 -2 # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/mouse/psmouse-base.c # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +79 -50 # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/keyboard/atkbd.c # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +1 -1 # input: Explicit variable access rules for psmouse.c, using bitops. # # ChangeSet # 2004/05/31 12:27:40+02:00 vojtech@suse.cz # input: Return 0 from uinput poll if device isn't yet created. # # Signed-off-by: Vojtech Pavlik # # drivers/input/misc/uinput.c # 2004/05/31 12:27:29+02:00 vojtech@suse.cz +1 -1 # input: Return 0 from uinput poll if device isn't yet created. # # ChangeSet # 2004/05/30 16:57:22+02:00 vojtech@suse.cz # input: Make atomicity and exclusive access to variables explicit # in atkbd.c, using bitops. # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/05/30 16:54:58+02:00 vojtech@suse.cz +89 -44 # input: Make atomicity and exclusive access to variables explicit # in atkbd.c, using bitops. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/05/30 16:12:14+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/05/29 14:27:40+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # include/linux/compat_ioctl.h # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # fs/compat_ioctl.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/mtouchusb.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -35 # Auto merged # # drivers/usb/input/hiddev.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -42 # Auto merged # # ChangeSet # 2004/05/28 22:57:43+02:00 vojtech@suse.cz # input: Fix an oops in poll() on uinput. Thanks to Dmitry Torokhov # for suggesting the fix. # # drivers/input/misc/uinput.c # 2004/05/28 22:57:31+02:00 vojtech@suse.cz +3 -0 # input: Fix an oops in poll() on uinput. # # ChangeSet # 2004/05/28 18:24:08+02:00 vojtech@suse.cz # input: An attempt at fixing locking in i8042.c and serio.c # # include/linux/serio.h # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +1 -1 # input: An attempt at fixing locking in i8042.c and serio.c # # drivers/input/serio/serio.c # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +54 -10 # input: An attempt at fixing locking in i8042.c and serio.c # # drivers/input/serio/i8042.c # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +4 -0 # input: An attempt at fixing locking in i8042.c and serio.c # # ChangeSet # 2004/05/28 16:19:29+02:00 vojtech@suse.cz # Cset exclude: dtor_core@ameritech.net|ChangeSet|20040510063935|25419 # # drivers/input/serio/i8042.c # 2004/05/28 16:19:20+02:00 vojtech@suse.cz +0 -0 # Exclude # # ChangeSet # 2004/05/19 00:13:58+02:00 akropel1@rochester.rr.com # input: Add 64-bit compatible ioctls for hiddev. # # include/linux/hiddev.h # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +7 -1 # input: Add 64-bit compatible ioctls for hiddev. # # include/linux/compat_ioctl.h # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +17 -0 # input: Add 64-bit compatible ioctls for hiddev. # # fs/compat_ioctl.c # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +2 -0 # input: Add 64-bit compatible ioctls for hiddev. # # drivers/usb/input/hiddev.c # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +1 -1 # input: Add 64-bit compatible ioctls for hiddev. # diff -Nru a/Documentation/RCU/RTFP.txt b/Documentation/RCU/RTFP.txt --- a/Documentation/RCU/RTFP.txt 2004-09-21 20:52:52 -07:00 +++ b/Documentation/RCU/RTFP.txt 2004-09-21 20:52:52 -07:00 @@ -202,10 +202,33 @@ ,institution="US Patent and Trademark Office" ,address="Washington, DC" ,year="1995" -,number="US Patent 5,442,758" +,number="US Patent 5,442,758 (contributed under GPL)" ,month="August" } +@techreport{Slingwine97 +,author="John D. Slingwine and Paul E. McKenney" +,title="Method for maintaining data coherency using thread +activity summaries in a multicomputer system" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="1997" +,number="US Patent 5,608,893 (contributed under GPL)" +,month="March" +} + +@techreport{Slingwine98 +,author="John D. Slingwine and Paul E. McKenney" +,title="Apparatus and method for achieving reduced overhead +mutual exclusion and maintaining coherency in a multiprocessor +system utilizing execution history and thread monitoring" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="1998" +,number="US Patent 5,727,209 (contributed under GPL)" +,month="March" +} + @Conference{McKenney98 ,Author="Paul E. McKenney and John D. Slingwine" ,Title="Read-Copy Update: Using Execution History to Solve Concurrency @@ -227,6 +250,18 @@ ,Year="1999" ,pages="87-100" ,Address="New Orleans, LA" +} + +@techreport{Slingwine01 +,author="John D. Slingwine and Paul E. McKenney" +,title="Apparatus and method for achieving reduced overhead +mutual exclusion and maintaining coherency in a multiprocessor +system utilizing execution history and thread monitoring" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="2001" +,number="US Patent 5,219,690 (contributed under GPL)" +,month="April" } @Conference{McKenney01a diff -Nru a/Documentation/RCU/UP.txt b/Documentation/RCU/UP.txt --- a/Documentation/RCU/UP.txt 2004-09-21 20:52:51 -07:00 +++ b/Documentation/RCU/UP.txt 2004-09-21 20:52:51 -07:00 @@ -50,8 +50,8 @@ Summary -Permitting call_rcu() to immediatly invoke its arguments or permitting -synchronize_kernel() to immediatly return breaks RCU, even on a UP system. +Permitting call_rcu() to immediately invoke its arguments or permitting +synchronize_kernel() to immediately return breaks RCU, even on a UP system. So do not do it! Even on a UP system, the RCU infrastructure -must- respect grace periods. diff -Nru a/Documentation/RCU/arrayRCU.txt b/Documentation/RCU/arrayRCU.txt --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/RCU/arrayRCU.txt 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,141 @@ +Using RCU to Protect Read-Mostly Arrays + + +Although RCU is more commonly used to protect linked lists, it can +also be used to protect arrays. Three situations are as follows: + +1. Hash Tables + +2. Static Arrays + +3. Resizeable Arrays + +Each of these situations are discussed below. + + +Situation 1: Hash Tables + +Hash tables are often implemented as an array, where each array entry +has a linked-list hash chain. Each hash chain can be protected by RCU +as described in the listRCU.txt document. This approach also applies +to other array-of-list situations, such as radix trees. + + +Situation 2: Static Arrays + +Static arrays, where the data (rather than a pointer to the data) is +located in each array element, and where the array is never resized, +have not been used with RCU. Rik van Riel recommends using seqlock in +this situation, which would also have minimal read-side overhead as long +as updates are rare. + +Quick Quiz: Why is it so important that updates be rare when + using seqlock? + + +Situation 3: Resizeable Arrays + +Use of RCU for resizeable arrays is demonstrated by the grow_ary() +function used by the System V IPC code. The array is used to map from +semaphore, message-queue, and shared-memory IDs to the data structure +that represents the corresponding IPC construct. The grow_ary() +function does not acquire any locks; instead its caller must hold the +ids->sem semaphore. + +The grow_ary() function, shown below, does some limit checks, allocates a +new ipc_id_ary, copies the old to the new portion of the new, initializes +the remainder of the new, updates the ids->entries pointer to point to +the new array, and invokes ipc_rcu_putref() to free up the old array. +Note that rcu_assign_pointer() is used to update the ids->entries pointer, +which includes any memory barriers required on whatever architecture +you are running on. + + static int grow_ary(struct ipc_ids* ids, int newsize) + { + struct ipc_id_ary* new; + struct ipc_id_ary* old; + int i; + int size = ids->entries->size; + + if(newsize > IPCMNI) + newsize = IPCMNI; + if(newsize <= size) + return newsize; + + new = ipc_rcu_alloc(sizeof(struct kern_ipc_perm *)*newsize + + sizeof(struct ipc_id_ary)); + if(new == NULL) + return size; + new->size = newsize; + memcpy(new->p, ids->entries->p, + sizeof(struct kern_ipc_perm *)*size + + sizeof(struct ipc_id_ary)); + for(i=size;ip[i] = NULL; + } + old = ids->entries; + + /* + * Use rcu_assign_pointer() to make sure the memcpyed + * contents of the new array are visible before the new + * array becomes visible. + */ + rcu_assign_pointer(ids->entries, new); + + ipc_rcu_putref(old); + return newsize; + } + +The ipc_rcu_putref() function decrements the array's reference count +and then, if the reference count has dropped to zero, uses call_rcu() +to free the array after a grace period has elapsed. + +The array is traversed by the ipc_lock() function. This function +indexes into the array under the protection of rcu_read_lock(), +using rcu_dereference() to pick up the pointer to the array so +that it may later safely be dereferenced -- memory barriers are +required on the Alpha CPU. Since the size of the array is stored +with the array itself, there can be no array-size mismatches, so +a simple check suffices. The pointer to the structure corresponding +to the desired IPC object is placed in "out", with NULL indicating +a non-existent entry. After acquiring "out->lock", the "out->deleted" +flag indicates whether the IPC object is in the process of being +deleted, and, if not, the pointer is returned. + + struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id) + { + struct kern_ipc_perm* out; + int lid = id % SEQ_MULTIPLIER; + struct ipc_id_ary* entries; + + rcu_read_lock(); + entries = rcu_dereference(ids->entries); + if(lid >= entries->size) { + rcu_read_unlock(); + return NULL; + } + out = entries->p[lid]; + if(out == NULL) { + rcu_read_unlock(); + return NULL; + } + spin_lock(&out->lock); + + /* ipc_rmid() may have already freed the ID while ipc_lock + * was spinning: here verify that the structure is still valid + */ + if (out->deleted) { + spin_unlock(&out->lock); + rcu_read_unlock(); + return NULL; + } + return out; + } + + +Answer to Quick Quiz: + + The reason that it is important that updates be rare when + using seqlock is that frequent updates can livelock readers. + One way to avoid this problem is to assign a seqlock for + each array entry rather than to the entire array. diff -Nru a/Documentation/RCU/listRCU.txt b/Documentation/RCU/listRCU.txt --- a/Documentation/RCU/listRCU.txt 2004-09-21 20:52:51 -07:00 +++ b/Documentation/RCU/listRCU.txt 2004-09-21 20:52:51 -07:00 @@ -18,8 +18,8 @@ Therefore, once the route has been computed, there is no need to hold the routing table static during transmission of the packet. After all, you can hold the routing table static all you want, but that won't keep -the external internet from changing, and it is the state of the external -internet that really matters. In addition, routing entries are typically +the external Internet from changing, and it is the state of the external +Internet that really matters. In addition, routing entries are typically added or deleted, rather than being modified in place. A straightforward example of this use of RCU may be found in the @@ -195,7 +195,7 @@ if (!audit_compare_rule(rule, &e->rule)) { ne = kmalloc(sizeof(*entry), GFP_ATOMIC); if (ne == NULL) - return _ENOMEM; + return -ENOMEM; audit_copy_rule(&ne->rule, &e->rule); ne->rule.action = newaction; ne->rule.file_count = newfield_count; @@ -255,6 +255,12 @@ rcu_read_unlock(); return AUDIT_BUILD_CONTEXT; } + +Note that this example assumes that entries are only added and deleted. +Additional mechanism is required to deal correctly with the +update-in-place performed by audit_upd_rule(). For one thing, +audit_upd_rule() would need additional memory barriers to ensure +that the list_add_rcu() was really executed before the list_del_rcu(). The audit_del_rule() function would need to set the "deleted" flag under the spinlock as follows: diff -Nru a/Documentation/RCU/rcu.txt b/Documentation/RCU/rcu.txt --- a/Documentation/RCU/rcu.txt 2004-09-21 20:52:51 -07:00 +++ b/Documentation/RCU/rcu.txt 2004-09-21 20:52:51 -07:00 @@ -1,20 +1,19 @@ RCU Concepts -The basic idea behind RCU is to split destructive operations into two -parts, one that makes anyone from seeing the data item being destroyed, -and one that actually carries out the destruction. A "grace period" -must elapse between the two parts, and this grace period must be long -enough that any readers accessing the item being deleted have since -dropped their references. For example, an RCU-protected deletion from a -linked list would first remove the item from the list, wait for a grace -period to elapse, then free the element. See the listRCU.txt file for -more information on using RCU with linked lists. +The basic idea behind RCU (read-copy update) is to split destructive +operations into two parts, one that prevents anyone from seeing the data +item being destroyed, and one that actually carries out the destruction. +A "grace period" must elapse between the two parts, and this grace period +must be long enough that any readers accessing the item being deleted have +since dropped their references. For example, an RCU-protected deletion +from a linked list would first remove the item from the list, wait for +a grace period to elapse, then free the element. See the listRCU.txt +file for more information on using RCU with linked lists. Frequently Asked Questions - o Why would anyone want to use RCU? The advantage of RCU's two-part approach is that RCU readers need @@ -25,7 +24,6 @@ in read-mostly situations. The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code. - o How can the updater tell when a grace period has completed if the RCU readers give no indication when they are done? @@ -50,6 +48,19 @@ o What guidelines should I follow when writing code that uses RCU? See the checklist.txt file in this directory. + +o Why the name "RCU"? + + "RCU" stands for "read-copy update". The file listRCU.txt has + more information on where this name came from, search for + "read-copy update" to find it. + +o I hear that RCU is patented? What is with that? + + Yes, it is. There are several known patents related to RCU, + search for the string "Patent" in RTFP.txt to find them. + Of these, one was allowed to lapse by the assignee, and the + others have been contributed to the Linux kernel under GPL. o Where can I find more information on RCU? diff -Nru a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking --- a/Documentation/filesystems/Locking 2004-09-21 20:52:52 -07:00 +++ b/Documentation/filesystems/Locking 2004-09-21 20:52:52 -07:00 @@ -90,7 +90,7 @@ void (*destroy_inode)(struct inode *); void (*read_inode) (struct inode *); void (*dirty_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); diff -Nru a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt --- a/Documentation/filesystems/tmpfs.txt 2004-09-21 20:52:51 -07:00 +++ b/Documentation/filesystems/tmpfs.txt 2004-09-21 20:52:51 -07:00 @@ -62,13 +62,21 @@ since the OOM handler will not be able to free that memory. nr_blocks: The same as size, but in blocks of PAGE_CACHE_SIZE. nr_inodes: The maximum number of inodes for this instance. The default - is half of the number of your physical RAM pages. + is half of the number of your physical RAM pages, or (on a + a machine with highmem) the number of lowmem RAM pages, + whichever is the lower. These parameters accept a suffix k, m or g for kilo, mega and giga and can be changed on remount. The size parameter also accepts a suffix % to limit this tmpfs instance to that percentage of your physical RAM: the default, when neither size nor nr_blocks is specified, is size=50% +If both nr_blocks (or size) and nr_inodes are set to 0, neither blocks +nor inodes will be limited in that instance. It is generally unwise to +mount with such options, since it allows any user with write access to +use up all the memory on the machine; but enhances the scalability of +that instance in a system with many cpus making intensive use of it. + To specify the initial root directory you can use the following mount options: @@ -89,4 +97,4 @@ Author: Christoph Rohland , 1.12.01 Updated: - Hugh Dickins , 01 April 2003 + Hugh Dickins , 01 September 2004 diff -Nru a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt --- a/Documentation/filesystems/vfs.txt 2004-09-21 20:52:52 -07:00 +++ b/Documentation/filesystems/vfs.txt 2004-09-21 20:52:52 -07:00 @@ -176,7 +176,7 @@ struct super_operations { void (*read_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); diff -Nru a/Documentation/input/joystick-parport.txt b/Documentation/input/joystick-parport.txt --- a/Documentation/input/joystick-parport.txt 2004-09-21 20:52:52 -07:00 +++ b/Documentation/input/joystick-parport.txt 2004-09-21 20:52:52 -07:00 @@ -335,6 +335,7 @@ * Analog PSX Pad (red mode) * Analog PSX Pad (green mode) * PSX Rumble Pad + * PSX DDR Pad 2.4 Sega ~~~~~~~~ @@ -452,13 +453,21 @@ 5 | Multisystem 2-button joystick 6 | N64 pad 7 | Sony PSX controller + 8 | Sony PSX DDR controller - The exact type of the PSX controller type is autoprobed, so you must have -your controller plugged in before initializing. + The exact type of the PSX controller type is autoprobed when used so +hot swapping should work (but is not recomended). Should you want to use more than one of parallel ports at once, you can use gamecon.map2 and gamecon.map3 as additional command line parameters for two more parallel ports. + + There are two options specific to PSX driver portion. gamecon.psx_delay sets +the command delay when talking to the controllers. The default of 25 should +work but you can try lowering it for better performace. If your pads don't +respond try raising it untill they work. Setting the type to 8 allows the +driver to be used with Dance Dance Revolution or similar games. Arrow keys are +registered as key presses instead of X and Y axes. 3.2 db9.c ~~~~~~~~~ diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt --- a/Documentation/kernel-parameters.txt 2004-09-21 20:52:52 -07:00 +++ b/Documentation/kernel-parameters.txt 2004-09-21 20:52:52 -07:00 @@ -453,6 +453,11 @@ hd?= [HW] (E)IDE subsystem hd?lun= See Documentation/ide.txt. + highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact + size of . This works even on boxes that have no + highmem otherwise. This also works to reduce highmem + size on bigger boxes. + hisax= [HW,ISDN] See Documentation/isdn/README.HiSax. @@ -669,6 +674,12 @@ mga= [HW,DRM] + mousedev.tap_time= + [MOUSE] Maximum time between finger touching and + leaving touchpad surface for touch to be considered + a tap and be reported as a left button click (for + touchpads working in absolute mode only). + Format: mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices reporting absolute coordinates, such as tablets mousedev.yres= [MOUSE] Vertical screen resolution, used for devices @@ -879,6 +890,13 @@ noacpi [IA-32] Do not use ACPI for IRQ routing or for PCI scanning. + firmware [ARM] Do not re-enumerate the bus but + instead just use the configuration + from the bootloader. This is currently + used on IXP2000 systems where the + bus has to be configured a certain way + for adjunct CPUs. + pcmv= [HW,PCMCIA] BadgePAD 4 pd. [PARIDE] @@ -1279,6 +1297,12 @@ Use vga=ask for menu. This is actually a boot loader parameter; the value is passed to the kernel using a special protocol. + + vmalloc=nn[KMG] [KNL,BOOT] forces the vmalloc area to have an exact + size of . This can be used to increase the + minimum size (128MB on x86). It can also be used to + decrease the size and leave more room for directly + mapped kernel RAM. vmhalt= [KNL,S390] diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS 2004-09-21 20:52:52 -07:00 +++ b/MAINTAINERS 2004-09-21 20:52:52 -07:00 @@ -1078,6 +1078,13 @@ L: linux-fbdev-devel@lists.sourceforge.net S: Maintained +INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS +P: Vojtech Pavlik +M: vojtech@suse.cz +L: linux-input@atrey.karlin.mff.cuni.cz +L: linux-joystick@atrey.karlin.mff.cuni.cz +S: Maintained + INTEL 810/815 FRAMEBUFFER DRIVER P: Antonino Daplas M: adaplas@pol.net @@ -1202,13 +1209,6 @@ W: http://oss.software.ibm.com/jfs/ S: Supported -JOYSTICK DRIVER -P: Vojtech Pavlik -M: vojtech@suse.cz -L: linux-joystick@atrey.karlin.mff.cuni.cz -W: http://www.suse.cz/development/joystick/ -S: Maintained - KCONFIG P: Roman Zippel M: zippel@linux-m68k.org @@ -2220,12 +2220,11 @@ L: linux-usb-devel@lists.sourceforge.net S: Maintained -USB HID/HIDBP/INPUT DRIVERS +USB HID/HIDBP DRIVERS P: Vojtech Pavlik M: vojtech@suse.cz L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net -W: http://www.suse.cz/development/input/ S: Maintained USB HUB DRIVER diff -Nru a/arch/alpha/Kconfig b/arch/alpha/Kconfig --- a/arch/alpha/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/alpha/Kconfig 2004-09-21 20:52:52 -07:00 @@ -32,6 +32,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" diff -Nru a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c --- a/arch/alpha/kernel/osf_sys.c 2004-09-21 20:52:51 -07:00 +++ b/arch/alpha/kernel/osf_sys.c 2004-09-21 20:52:51 -07:00 @@ -91,8 +91,8 @@ * braindamage (it can't really handle filesystems where the directory * offset differences aren't the same as "d_reclen"). */ -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) -#define ROUND_UP(x) (((x)+3) & ~3) +#define NAME_OFFSET offsetof (struct osf_dirent, d_name) +#define ROUND_UP(x) (((x)+3) & ~3) struct osf_dirent { unsigned int d_ino; @@ -114,7 +114,7 @@ { struct osf_dirent __user *dirent; struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; - unsigned int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); + unsigned int reclen = ROUND_UP(NAME_OFFSET + namlen + 1); buf->error = -EINVAL; /* only used if we fail */ if (reclen > buf->count) @@ -989,7 +989,7 @@ fd_set_bits fds; char *bits; size_t size; - unsigned long timeout; + long timeout; int ret; timeout = MAX_SCHEDULE_TIMEOUT; @@ -1053,9 +1053,10 @@ ret = 0; } - set_fd_set(n, inp->fds_bits, fds.res_in); - set_fd_set(n, outp->fds_bits, fds.res_out); - set_fd_set(n, exp->fds_bits, fds.res_ex); + if (set_fd_set(n, inp->fds_bits, fds.res_in) || + set_fd_set(n, outp->fds_bits, fds.res_out) || + set_fd_set(n, exp->fds_bits, fds.res_ex)) + ret = -EFAULT; out: kfree(bits); diff -Nru a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c --- a/arch/alpha/kernel/ptrace.c 2004-09-21 20:52:52 -07:00 +++ b/arch/alpha/kernel/ptrace.c 2004-09-21 20:52:52 -07:00 @@ -91,15 +91,15 @@ PT_REG( pc) }; -static long zero; +static unsigned long zero; /* * Get address of register REGNO in task TASK. */ -static long * +static unsigned long * get_reg_addr(struct task_struct * task, unsigned long regno) { - long *addr; + unsigned long *addr; if (regno == 30) { addr = &task->thread_info->pcb.usp; @@ -109,7 +109,7 @@ zero = 0; addr = &zero; } else { - addr = (long *)((long)task->thread_info + regoff[regno]); + addr = (void *)task->thread_info + regoff[regno]; } return addr; } @@ -117,7 +117,7 @@ /* * Get contents of register REGNO in task TASK. */ -static long +static unsigned long get_reg(struct task_struct * task, unsigned long regno) { /* Special hack for fpcr -- combine hardware and software bits. */ @@ -135,7 +135,7 @@ * Write contents of register REGNO in task TASK. */ static int -put_reg(struct task_struct *task, unsigned long regno, long data) +put_reg(struct task_struct *task, unsigned long regno, unsigned long data) { if (regno == 63) { task->thread_info->ieee_state @@ -168,11 +168,11 @@ ptrace_set_bpt(struct task_struct * child) { int displ, i, res, reg_b, nsaved = 0; - u32 insn, op_code; + unsigned int insn, op_code; unsigned long pc; pc = get_reg(child, REG_PC); - res = read_int(child, pc, &insn); + res = read_int(child, pc, (int *) &insn); if (res < 0) return res; @@ -203,7 +203,8 @@ /* install breakpoints: */ for (i = 0; i < nsaved; ++i) { - res = read_int(child, child->thread_info->bpt_addr[i], &insn); + res = read_int(child, child->thread_info->bpt_addr[i], + (int *) &insn); if (res < 0) return res; child->thread_info->bpt_insn[i] = insn; diff -Nru a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c --- a/arch/alpha/kernel/signal.c 2004-09-21 20:52:51 -07:00 +++ b/arch/alpha/kernel/signal.c 2004-09-21 20:52:51 -07:00 @@ -145,7 +145,7 @@ * Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int -do_sigsuspend(old_sigset_t mask, struct pt_regs *reg, struct switch_stack *sw) +do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) { sigset_t oldset; @@ -156,17 +156,22 @@ recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + /* Indicate EINTR on return from any possible signal handler, + which will not come back through here, but via sigreturn. */ + regs->r0 = EINTR; + regs->r19 = 1; + while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(&oldset, reg, sw, 0, 0)) + if (do_signal(&oldset, regs, sw, 0, 0)) return -EINTR; } } asmlinkage int do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, - struct pt_regs *reg, struct switch_stack *sw) + struct pt_regs *regs, struct switch_stack *sw) { sigset_t oldset, set; @@ -183,10 +188,15 @@ recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + /* Indicate EINTR on return from any possible signal handler, + which will not come back through here, but via sigreturn. */ + regs->r0 = EINTR; + regs->r19 = 1; + while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(&oldset, reg, sw, 0, 0)) + if (do_signal(&oldset, regs, sw, 0, 0)) return -EINTR; } } @@ -217,6 +227,12 @@ struct ucontext uc; unsigned int retcode[3]; }; + +/* If this changes, userland unwinders that Know Things about our signal + frame will break. Do not undertake lightly. It also implies an ABI + change wrt the size of siginfo_t, which may cause some pain. */ +extern char compile_time_assert + [offsetof(struct rt_sigframe, uc.uc_mcontext) == 176 ? 1 : -1]; #define INSN_MOV_R30_R16 0x47fe0410 #define INSN_LDI_R0 0x201f0000 diff -Nru a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c --- a/arch/alpha/kernel/srmcons.c 2004-09-21 20:52:52 -07:00 +++ b/arch/alpha/kernel/srmcons.c 2004-09-21 20:52:52 -07:00 @@ -91,15 +91,15 @@ /* called with callback_lock held */ static int -srmcons_do_write(struct tty_struct *tty, const unsigned char *buf, int count) +srmcons_do_write(struct tty_struct *tty, const char *buf, int count) { - unsigned char *str_cr = "\r"; + static char str_cr[1] = "\r"; long c, remaining = count; srmcons_result result; - unsigned char *cur; + char *cur; int need_cr; - for (cur = (unsigned char *)buf; remaining > 0; ) { + for (cur = (char *)buf; remaining > 0; ) { need_cr = 0; /* * Break it up into reasonable size chunks to allow a chance @@ -138,7 +138,7 @@ unsigned long flags; if (from_user) { - unsigned char tmp[512]; + char tmp[512]; int ret = 0; size_t c; @@ -167,7 +167,7 @@ } spin_lock_irqsave(&srmcons_callback_lock, flags); - srmcons_do_write(tty, buf, count); + srmcons_do_write(tty, (const char *) buf, count); spin_unlock_irqrestore(&srmcons_callback_lock, flags); return count; diff -Nru a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c --- a/arch/alpha/kernel/sys_titan.c 2004-09-21 20:52:52 -07:00 +++ b/arch/alpha/kernel/sys_titan.c 2004-09-21 20:52:52 -07:00 @@ -145,12 +145,12 @@ } static void -titan_cpu_set_irq_affinity(unsigned int irq, unsigned long affinity) +titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) { int cpu; for (cpu = 0; cpu < 4; cpu++) { - if (affinity & (1UL << cpu)) + if (cpu_isset(cpu, affinity)) titan_cpu_irq_affinity[cpu] |= 1UL << irq; else titan_cpu_irq_affinity[cpu] &= ~(1UL << irq); @@ -159,7 +159,7 @@ } static void -titan_set_irq_affinity(unsigned int irq, unsigned long affinity) +titan_set_irq_affinity(unsigned int irq, cpumask_t affinity) { spin_lock(&titan_irq_lock); titan_cpu_set_irq_affinity(irq - 16, affinity); diff -Nru a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S --- a/arch/alpha/kernel/systbls.S 2004-09-21 20:52:52 -07:00 +++ b/arch/alpha/kernel/systbls.S 2004-09-21 20:52:52 -07:00 @@ -457,6 +457,7 @@ .quad sys_mq_timedreceive /* 435 */ .quad sys_mq_notify .quad sys_mq_getsetattr + .quad sys_waitid .size sys_call_table, . - sys_call_table .type sys_call_table, @object diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig --- a/arch/arm/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/arm/Kconfig 2004-09-21 20:52:52 -07:00 @@ -63,6 +63,10 @@ config GENERIC_ISA_DMA bool +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "System Type" diff -Nru a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig --- a/arch/arm/configs/ebsa110_defconfig 2004-09-21 20:52:51 -07:00 +++ b/arch/arm/configs/ebsa110_defconfig 2004-09-21 20:52:51 -07:00 @@ -176,7 +176,6 @@ CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_NAT=y # CONFIG_IP_ROUTE_MULTIPATH is not set -# CONFIG_IP_ROUTE_TOS is not set CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig --- a/arch/arm/configs/ixp4xx_defconfig 2004-09-21 20:52:51 -07:00 +++ b/arch/arm/configs/ixp4xx_defconfig 2004-09-21 20:52:51 -07:00 @@ -308,7 +308,6 @@ CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y diff -Nru a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c --- a/arch/arm/kernel/apm.c 2004-09-21 20:52:52 -07:00 +++ b/arch/arm/kernel/apm.c 2004-09-21 20:52:52 -07:00 @@ -46,7 +46,13 @@ /* * Maximum number of events stored */ -#define APM_MAX_EVENTS 20 +#define APM_MAX_EVENTS 16 + +struct apm_queue { + unsigned int event_head; + unsigned int event_tail; + apm_event_t events[APM_MAX_EVENTS]; +}; /* * The per-file APM data @@ -54,27 +60,25 @@ struct apm_user { struct list_head list; - int suser: 1; - int writer: 1; - int reader: 1; - int suspend_wait: 1; - int suspend_result; + unsigned int suser: 1; + unsigned int writer: 1; + unsigned int reader: 1; - int suspends_pending; - int standbys_pending; - unsigned int suspends_read; - unsigned int standbys_read; + int suspend_result; + unsigned int suspend_state; +#define SUSPEND_NONE 0 /* no suspend pending */ +#define SUSPEND_PENDING 1 /* suspend pending read */ +#define SUSPEND_READ 2 /* suspend read, pending ack */ +#define SUSPEND_ACKED 3 /* suspend acked */ +#define SUSPEND_DONE 4 /* suspend completed */ - int event_head; - int event_tail; - apm_event_t events[APM_MAX_EVENTS]; + struct apm_queue queue; }; /* * Local variables */ static int suspends_pending; -static int standbys_pending; static int apm_disabled; static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); @@ -83,14 +87,19 @@ /* * This is a list of everyone who has opened /dev/apm_bios */ -static spinlock_t user_list_lock = SPIN_LOCK_UNLOCKED; +static DECLARE_RWSEM(user_list_lock); static LIST_HEAD(apm_user_list); /* - * The kapmd info. + * kapmd info. kapmd provides us a process context to handle + * "APM" events within - specifically necessary if we're going + * to be suspending the system. */ -static struct task_struct *kapmd; +static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait); static DECLARE_COMPLETION(kapmd_exit); +static spinlock_t kapmd_queue_lock = SPIN_LOCK_UNLOCKED; +static struct apm_queue kapmd_queue; + static const char driver_version[] = "1.13"; /* no spaces */ @@ -102,19 +111,6 @@ */ static void __apm_get_power_status(struct apm_power_info *info) { -#if 0 && defined(CONFIG_SA1100_H3600) && defined(CONFIG_TOUCHSCREEN_H3600) - extern int h3600_apm_get_power_status(u_char *, u_char *, u_char *, - u_char *, u_short *); - - if (machine_is_h3600()) { - int dx; - h3600_apm_get_power_status(&info->ac_line_status, - &info->battery_status, &info->battery_flag, - &info->battery_life, &dx); - info->time = dx & 0x7fff; - info->units = dx & 0x8000 ? 0 : 1; - } -#endif } /* @@ -123,65 +119,71 @@ void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status; EXPORT_SYMBOL(apm_get_power_status); -static int queue_empty(struct apm_user *as) + +/* + * APM event queue management. + */ +static inline int queue_empty(struct apm_queue *q) { - return as->event_head == as->event_tail; + return q->event_head == q->event_tail; } -static apm_event_t get_queued_event(struct apm_user *as) +static inline apm_event_t queue_get_event(struct apm_queue *q) { - as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; - return as->events[as->event_tail]; + q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS; + return q->events[q->event_tail]; } -static void queue_event_one_user(struct apm_user *as, apm_event_t event) +static void queue_add_event(struct apm_queue *q, apm_event_t event) { - as->event_head = (as->event_head + 1) % APM_MAX_EVENTS; - if (as->event_head == as->event_tail) { + q->event_head = (q->event_head + 1) % APM_MAX_EVENTS; + if (q->event_head == q->event_tail) { static int notified; if (notified++ == 0) printk(KERN_ERR "apm: an event queue overflowed\n"); - as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; + q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS; } - as->events[as->event_head] = event; - - if (!as->suser || !as->writer) - return; + q->events[q->event_head] = event; +} - switch (event) { - case APM_SYS_SUSPEND: - case APM_USER_SUSPEND: - as->suspends_pending++; - suspends_pending++; - break; +static void queue_event_one_user(struct apm_user *as, apm_event_t event) +{ + if (as->suser && as->writer) { + switch (event) { + case APM_SYS_SUSPEND: + case APM_USER_SUSPEND: + /* + * If this user already has a suspend pending, + * don't queue another one. + */ + if (as->suspend_state != SUSPEND_NONE) + return; - case APM_SYS_STANDBY: - case APM_USER_STANDBY: - as->standbys_pending++; - standbys_pending++; - break; + as->suspend_state = SUSPEND_PENDING; + suspends_pending++; + break; + } } + queue_add_event(&as->queue, event); } static void queue_event(apm_event_t event, struct apm_user *sender) { - struct list_head *l; - - spin_lock(&user_list_lock); - list_for_each(l, &apm_user_list) { - struct apm_user *as = list_entry(l, struct apm_user, list); + struct apm_user *as; + down_read(&user_list_lock); + list_for_each_entry(as, &apm_user_list, list) { if (as != sender && as->reader) queue_event_one_user(as, event); } - spin_unlock(&user_list_lock); + up_read(&user_list_lock); wake_up_interruptible(&apm_waitqueue); } -static int apm_suspend(void) +static void apm_suspend(void) { - struct list_head *l; + struct apm_user *as; int err = pm_suspend(PM_SUSPEND_MEM); /* @@ -193,52 +195,39 @@ /* * Finally, wake up anyone who is sleeping on the suspend. */ - spin_lock(&user_list_lock); - list_for_each(l, &apm_user_list) { - struct apm_user *as = list_entry(l, struct apm_user, list); - + down_read(&user_list_lock); + list_for_each_entry(as, &apm_user_list, list) { as->suspend_result = err; - as->suspend_wait = 0; + as->suspend_state = SUSPEND_DONE; } - spin_unlock(&user_list_lock); + up_read(&user_list_lock); - wake_up_interruptible(&apm_suspend_waitqueue); - return err; + wake_up(&apm_suspend_waitqueue); } static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos) { struct apm_user *as = fp->private_data; apm_event_t event; - int i = count, ret = 0, nonblock = fp->f_flags & O_NONBLOCK; + int i = count, ret = 0; if (count < sizeof(apm_event_t)) return -EINVAL; - if (queue_empty(as) && nonblock) + if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK) return -EAGAIN; - wait_event_interruptible(apm_waitqueue, !queue_empty(as)); + wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue)); - while ((i >= sizeof(event)) && !queue_empty(as)) { - event = get_queued_event(as); - printk(" apm_read: event=%d\n", event); + while ((i >= sizeof(event)) && !queue_empty(&as->queue)) { + event = queue_get_event(&as->queue); ret = -EFAULT; if (copy_to_user(buf, &event, sizeof(event))) break; - switch (event) { - case APM_SYS_SUSPEND: - case APM_USER_SUSPEND: - as->suspends_read++; - break; - - case APM_SYS_STANDBY: - case APM_USER_STANDBY: - as->standbys_read++; - break; - } + if (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND) + as->suspend_state = SUSPEND_READ; buf += sizeof(event); i -= sizeof(event); @@ -252,10 +241,10 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait) { - struct apm_user * as = fp->private_data; + struct apm_user *as = fp->private_data; poll_wait(fp, &apm_waitqueue, wait); - return queue_empty(as) ? 0 : POLLIN | POLLRDNORM; + return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM; } /* @@ -272,43 +261,65 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) { struct apm_user *as = filp->private_data; + unsigned long flags; int err = -EINVAL; if (!as->suser || !as->writer) return -EPERM; switch (cmd) { - case APM_IOC_STANDBY: - break; - case APM_IOC_SUSPEND: - /* - * If we read a suspend command from /dev/apm_bios, - * then the corresponding APM_IOC_SUSPEND ioctl is - * interpreted as an acknowledge. - */ - if (as->suspends_read > 0) { - as->suspends_read--; - as->suspends_pending--; + as->suspend_result = -EINTR; + + if (as->suspend_state == SUSPEND_READ) { + /* + * If we read a suspend command from /dev/apm_bios, + * then the corresponding APM_IOC_SUSPEND ioctl is + * interpreted as an acknowledge. + */ + as->suspend_state = SUSPEND_ACKED; suspends_pending--; } else { + /* + * Otherwise it is a request to suspend the system. + * Queue an event for all readers, and expect an + * acknowledge from all writers who haven't already + * acknowledged. + */ queue_event(APM_USER_SUSPEND, as); } /* - * If there are outstanding suspend requests for other - * people on /dev/apm_bios, we must sleep for them. - * Last one to bed turns the lights out. + * If there are no further acknowledges required, suspend + * the system. */ - if (suspends_pending > 0) { - as->suspend_wait = 1; - err = wait_event_interruptible(apm_suspend_waitqueue, - as->suspend_wait == 0); - if (err == 0) - err = as->suspend_result; - } else { - err = apm_suspend(); - } + if (suspends_pending == 0) + apm_suspend(); + + /* + * Wait for the suspend/resume to complete. If there are + * pending acknowledges, we wait here for them. + * + * Note that we need to ensure that the PM subsystem does + * not kick us out of the wait when it suspends the threads. + */ + flags = current->flags; + current->flags |= PF_NOFREEZE; + + /* + * Note: do not allow a thread which is acking the suspend + * to escape until the resume is complete. + */ + if (as->suspend_state == SUSPEND_ACKED) + wait_event(apm_suspend_waitqueue, + as->suspend_state == SUSPEND_DONE); + else + wait_event_interruptible(apm_suspend_waitqueue, + as->suspend_state == SUSPEND_DONE); + + current->flags = flags; + err = as->suspend_result; + as->suspend_state = SUSPEND_NONE; break; } @@ -320,24 +331,19 @@ struct apm_user *as = filp->private_data; filp->private_data = NULL; - spin_lock(&user_list_lock); + down_write(&user_list_lock); list_del(&as->list); - spin_unlock(&user_list_lock); + up_write(&user_list_lock); /* * We are now unhooked from the chain. As far as new * events are concerned, we no longer exist. However, we - * need to balance standbys_pending and suspends_pending, - * which means the possibility of sleeping. + * need to balance suspends_pending, which means the + * possibility of sleeping. */ - if (as->standbys_pending > 0) { - standbys_pending -= as->standbys_pending; -// if (standbys_pending <= 0) -// standby(); - } - if (as->suspends_pending > 0) { - suspends_pending -= as->suspends_pending; - if (suspends_pending <= 0) + if (as->suspend_state != SUSPEND_NONE) { + suspends_pending -= 1; + if (suspends_pending == 0) apm_suspend(); } @@ -364,9 +370,9 @@ as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE; as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ; - spin_lock(&user_list_lock); + down_write(&user_list_lock); list_add(&as->list, &apm_user_list); - spin_unlock(&user_list_lock); + up_write(&user_list_lock); filp->private_data = as; } @@ -438,7 +444,7 @@ info.ac_line_status = 0xff; info.battery_status = 0xff; info.battery_flag = 0xff; - info.battery_life = 255; + info.battery_life = -1; info.time = -1; info.units = -1; @@ -461,34 +467,53 @@ } #endif -#if 0 -static int kapmd(void *startup) +static int kapmd(void *arg) { - struct task_struct *tsk = current; + daemonize("kapmd"); + current->flags |= PF_NOFREEZE; - daemonize(); - strcpy(tsk->comm, "kapmd"); - kapmd = tsk; + do { + apm_event_t event; - spin_lock_irq(&tsk->sigmask_lock); - siginitsetinv(&tsk->blocked, sigmask(SIGQUIT)); - recalc_sigpending(tsk); - spin_unlock_irq(&tsk->sigmask_lock); + wait_event_interruptible(kapmd_wait, + !queue_empty(&kapmd_queue) || !pm_active); - complete((struct completion *)startup); + if (!pm_active) + break; - do { - set_task_state(tsk, TASK_INTERRUPTIBLE); - schedule(); - } while (!signal_pending(tsk)); + spin_lock_irq(&kapmd_queue_lock); + event = 0; + if (!queue_empty(&kapmd_queue)) + event = queue_get_event(&kapmd_queue); + spin_unlock_irq(&kapmd_queue_lock); + + switch (event) { + case 0: + break; + + case APM_LOW_BATTERY: + case APM_POWER_STATUS_CHANGE: + queue_event(event, NULL); + break; + + case APM_USER_SUSPEND: + case APM_SYS_SUSPEND: + queue_event(event, NULL); + if (suspends_pending == 0) + apm_suspend(); + break; + + case APM_CRITICAL_SUSPEND: + apm_suspend(); + break; + } + } while (1); complete_and_exit(&kapmd_exit, 0); } -#endif static int __init apm_init(void) { -// struct completion startup = COMPLETION_INITIALIZER(startup); int ret; if (apm_disabled) { @@ -501,22 +526,24 @@ return -EINVAL; } -// ret = kernel_thread(kapmd, &startup, CLONE_FS | CLONE_FILES); -// if (ret) -// return ret; -// wait_for_completion(&startup); - pm_active = 1; + ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); + if (ret < 0) { + pm_active = 0; + return ret; + } + #ifdef CONFIG_PROC_FS create_proc_info_entry("apm", 0, NULL, apm_get_info); #endif ret = misc_register(&apm_device); if (ret != 0) { - pm_active = 0; remove_proc_entry("apm", NULL); - send_sig(SIGQUIT, kapmd, 1); + + pm_active = 0; + wake_up(&kapmd_wait); wait_for_completion(&kapmd_exit); } @@ -527,9 +554,10 @@ { misc_deregister(&apm_device); remove_proc_entry("apm", NULL); + pm_active = 0; -// send_sig(SIGQUIT, kapmd, 1); -// wait_for_completion(&kapmd_exit); + wake_up(&kapmd_wait); + wait_for_completion(&kapmd_exit); } module_init(apm_init); @@ -556,3 +584,27 @@ __setup("apm=", apm_setup); #endif + +/** + * apm_queue_event - queue an APM event for kapmd + * @event: APM event + * + * Queue an APM event for kapmd to process and ultimately take the + * appropriate action. Only a subset of events are handled: + * %APM_LOW_BATTERY + * %APM_POWER_STATUS_CHANGE + * %APM_USER_SUSPEND + * %APM_SYS_SUSPEND + * %APM_CRITICAL_SUSPEND + */ +void apm_queue_event(apm_event_t event) +{ + unsigned long flags; + + spin_lock_irqsave(&kapmd_queue_lock, flags); + queue_add_event(&kapmd_queue, event); + spin_unlock_irqrestore(&kapmd_queue_lock, flags); + + wake_up_interruptible(&kapmd_wait); +} +EXPORT_SYMBOL(apm_queue_event); diff -Nru a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c --- a/arch/arm/mach-pxa/generic.c 2004-09-21 20:52:51 -07:00 +++ b/arch/arm/mach-pxa/generic.c 2004-09-21 20:52:51 -07:00 @@ -32,6 +32,7 @@ #include #include +#include #include "generic.h" @@ -127,6 +128,12 @@ .num_resources = ARRAY_SIZE(pxamci_resources), .resource = pxamci_resources, }; + +void __init pxa_set_mci_info(struct pxamci_platform_data *info) +{ + pxamci_device.dev.platform_data = info; +} +EXPORT_SYMBOL(pxa_set_mci_info); static struct pxa2xx_udc_mach_info pxa_udc_info; diff -Nru a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c --- a/arch/arm/mach-pxa/pm.c 2004-09-21 20:52:52 -07:00 +++ b/arch/arm/mach-pxa/pm.c 2004-09-21 20:52:52 -07:00 @@ -45,7 +45,7 @@ */ enum { SLEEP_SAVE_START = 0, - SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER, + SLEEP_SAVE_OIER, SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3, SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2, @@ -78,7 +78,6 @@ delta = xtime.tv_sec - RCNR; /* save vital registers */ - SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); @@ -149,8 +148,10 @@ RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); - RESTORE(OSCR); RESTORE(OIER); + + /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */ + OSCR = OSMR0 - LATCH; RESTORE(CKEN); diff -Nru a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c --- a/arch/arm/mach-s3c2410/devs.c 2004-09-21 20:52:51 -07:00 +++ b/arch/arm/mach-s3c2410/devs.c 2004-09-21 20:52:51 -07:00 @@ -53,7 +53,7 @@ struct platform_device s3c_device_usb = { .name = "s3c2410-ohci", - .id = 0, + .id = -1, .num_resources = ARRAY_SIZE(s3c_usb_resource), .resource = s3c_usb_resource, .dev = { @@ -102,13 +102,7 @@ .start = S3C2410_PA_NAND, .end = S3C2410_PA_NAND + S3C2410_SZ_NAND, .flags = IORESOURCE_MEM, - }, - [1] = { - .start = IRQ_S3CUART_RX0, - .end = IRQ_S3CUART_ERR0, - .flags = IORESOURCE_IRQ, } - }; struct platform_device s3c_device_nand = { diff -Nru a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c --- a/arch/arm/mach-s3c2410/gpio.c 2004-09-21 20:52:52 -07:00 +++ b/arch/arm/mach-s3c2410/gpio.c 2004-09-21 20:52:52 -07:00 @@ -19,6 +19,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * Changelog + * 13-Sep-2004 BJD Implemented change of MISCCR + * 14-Sep-2004 BJD Added getpin call + * 14-Sep-2004 BJD Fixed bug in setpin() call */ @@ -90,9 +94,32 @@ local_irq_save(flags); dat = __raw_readl(base + 0x04); - dat &= 1 << offs; + dat &= ~(1 << offs); dat |= to << offs; __raw_writel(dat, base + 0x04); local_irq_restore(flags); +} + +unsigned int s3c2410_gpio_getpin(unsigned int pin) +{ + unsigned long base = S3C2410_GPIO_BASE(pin); + unsigned long offs = S3C2410_GPIO_OFFSET(pin); + + return __raw_readl(base + 0x04) & (1<< offs); +} + +unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) +{ + unsigned long flags; + unsigned long misccr; + + local_irq_save(flags); + misccr = __raw_readl(S3C2410_MISCCR); + misccr &= ~clear; + misccr ^= change; + __raw_writel(misccr, S3C2410_MISCCR); + local_irq_restore(flags); + + return misccr; } diff -Nru a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c --- a/arch/arm/mach-sa1100/pm.c 2004-09-21 20:52:51 -07:00 +++ b/arch/arm/mach-sa1100/pm.c 2004-09-21 20:52:51 -07:00 @@ -44,7 +44,7 @@ */ enum { SLEEP_SAVE_SP = 0, - SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER, + SLEEP_SAVE_OIER, SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3, SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR, @@ -69,7 +69,6 @@ gpio = GPLR; /* save vital registers */ - SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); @@ -131,8 +130,10 @@ RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); - RESTORE(OSCR); RESTORE(OIER); + + /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */ + OSCR = OSMR0 - LATCH; /* restore current time */ xtime.tv_sec = RCNR + delta; diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig --- a/arch/i386/Kconfig 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/Kconfig 2004-09-21 20:52:51 -07:00 @@ -29,6 +29,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "Processor type and features" diff -Nru a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S --- a/arch/i386/boot/setup.S 2004-09-21 20:52:52 -07:00 +++ b/arch/i386/boot/setup.S 2004-09-21 20:52:52 -07:00 @@ -156,7 +156,7 @@ # can be located anywhere in # low memory 0x10000 or higher. -ramdisk_max: .long (MAXMEM-1) & 0x7fffffff +ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff # (Header version 0x0203 or later) # The highest safe address for # the contents of an initrd diff -Nru a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c --- a/arch/i386/kernel/apm.c 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/kernel/apm.c 2004-09-21 20:52:51 -07:00 @@ -2362,8 +2362,15 @@ { int error; - if (set_pm_idle) + if (set_pm_idle) { pm_idle = original_pm_idle; + /* + * We are about to unload the current idle thread pm callback + * (pm_idle), Wait for all processors to update cached/local + * copies of pm_idle before proceeding. + */ + synchronize_kernel(); + } if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0) && (apm_info.connection_version > 0x0100)) { error = apm_engage_power_management(APM_DEVICE_ALL, 0); diff -Nru a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c --- a/arch/i386/kernel/ioport.c 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/kernel/ioport.c 2004-09-21 20:52:51 -07:00 @@ -56,7 +56,7 @@ */ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) { - unsigned int i, max_long, bytes, bytes_updated; + unsigned long i, max_long, bytes, bytes_updated; struct thread_struct * t = ¤t->thread; struct tss_struct * tss; unsigned long *bitmap; @@ -105,8 +105,11 @@ t->io_bitmap_max = bytes; - /* Update the TSS: */ - memcpy(tss->io_bitmap, t->io_bitmap_ptr, bytes_updated); + /* + * Sets the lazy trigger so that the next I/O operation will + * reload the correct bitmap. + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; put_cpu(); diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c --- a/arch/i386/kernel/process.c 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/kernel/process.c 2004-09-21 20:52:51 -07:00 @@ -142,13 +142,21 @@ /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) { - void (*idle)(void) = pm_idle; + void (*idle)(void); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; if (!idle) idle = default_idle; irq_stat[smp_processor_id()].idle_timestamp = jiffies; idle(); + rcu_read_unlock(); } schedule(); } @@ -301,8 +309,11 @@ /* * Careful, clear this in the TSS too: */ - memset(tss->io_bitmap, 0xff, t->io_bitmap_max); + memset(tss->io_bitmap, 0xff, tss->io_bitmap_max); t->io_bitmap_max = 0; + tss->io_bitmap_owner = NULL; + tss->io_bitmap_max = 0; + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; put_cpu(); } } @@ -472,6 +483,37 @@ return 1; } +static inline void +handle_io_bitmap(struct thread_struct *next, struct tss_struct *tss) +{ + if (!next->io_bitmap_ptr) { + /* + * Disable the bitmap via an invalid offset. We still cache + * the previous bitmap owner and the IO bitmap contents: + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + return; + } + if (likely(next == tss->io_bitmap_owner)) { + /* + * Previous owner of the bitmap (hence the bitmap content) + * matches the next task, we dont have to do anything but + * to set a valid offset in the TSS: + */ + tss->io_bitmap_base = IO_BITMAP_OFFSET; + return; + } + /* + * Lazy TSS's I/O bitmap copy. We set an invalid offset here + * and we let the task to get a GPF in case an I/O instruction + * is performed. The handler of the GPF will verify that the + * faulting task has a valid I/O bitmap and, it true, does the + * real copy and restart the instruction. This will save us + * redundant copies when the currently switched task does not + * perform any I/O during its timeslice. + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; +} /* * This special macro can be used to load a debugging register */ @@ -556,20 +598,9 @@ loaddebug(next, 7); } - if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) { - if (next->io_bitmap_ptr) - /* - * Copy the relevant range of the IO bitmap. - * Normally this is 128 bytes or less: - */ - memcpy(tss->io_bitmap, next->io_bitmap_ptr, - max(prev->io_bitmap_max, next->io_bitmap_max)); - else - /* - * Clear any possible leftover bits: - */ - memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); - } + if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) + handle_io_bitmap(next, tss); + return prev_p; } diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/kernel/setup.c 2004-09-21 20:52:51 -07:00 @@ -815,6 +815,14 @@ if (c == ' ' && !memcmp(from, "highmem=", 8)) highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; + /* + * vmalloc=size forces the vmalloc area to be exactly 'size' + * bytes. This can be used to increase (or decrease) the + * vmalloc area - the default is 128m. + */ + if (c == ' ' && !memcmp(from, "vmalloc=", 8)) + __VMALLOC_RESERVE = memparse(from+8, &from); + c = *(from++); if (!c) break; diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c --- a/arch/i386/kernel/traps.c 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/kernel/traps.c 2004-09-21 20:52:51 -07:00 @@ -475,10 +475,40 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) DO_ERROR(12, SIGBUS, "stack segment", stack_segment) -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr2()) +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) asmlinkage void do_general_protection(struct pt_regs * regs, long error_code) { + int cpu = get_cpu(); + struct tss_struct *tss = &per_cpu(init_tss, cpu); + struct thread_struct *thread = ¤t->thread; + + /* + * Perform the lazy TSS's I/O bitmap copy. If the TSS has an + * invalid offset set (the LAZY one) and the faulting thread has + * a valid I/O bitmap pointer, we copy the I/O bitmap in the TSS + * and we set the offset field correctly. Then we let the CPU to + * restart the faulting instruction. + */ + if (tss->io_bitmap_base == INVALID_IO_BITMAP_OFFSET_LAZY && + thread->io_bitmap_ptr) { + memcpy(tss->io_bitmap, thread->io_bitmap_ptr, + thread->io_bitmap_max); + /* + * If the previously set map was extending to higher ports + * than the current one, pad extra space with 0xff (no access). + */ + if (thread->io_bitmap_max < tss->io_bitmap_max) + memset((char *) tss->io_bitmap + + thread->io_bitmap_max, 0xff, + tss->io_bitmap_max - thread->io_bitmap_max); + tss->io_bitmap_max = thread->io_bitmap_max; + tss->io_bitmap_base = IO_BITMAP_OFFSET; + put_cpu(); + return; + } + put_cpu(); + if (regs->eflags & VM_MASK) goto gp_in_vm86; diff -Nru a/arch/i386/mach-es7000/es7000.h b/arch/i386/mach-es7000/es7000.h --- a/arch/i386/mach-es7000/es7000.h 2004-09-21 20:52:51 -07:00 +++ b/arch/i386/mach-es7000/es7000.h 2004-09-21 20:52:51 -07:00 @@ -104,6 +104,13 @@ #define MIP_SW_APIC 0x1020b #define MIP_FUNC(VALUE) (VALUE & 0xff) +#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +#define IOAPIC_GSI_BOUND(ioapic) ((ioapic+1) * (nr_ioapic_registers[ioapic]-1)) +#define MAX_GSI_MAPSIZE 32 +#endif + +extern unsigned long io_apic_irqs; + extern int parse_unisys_oem (char *oemptr, int oem_entries); extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length); extern int es7000_start_cpu(int cpu, unsigned long eip); diff -Nru a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c --- a/arch/i386/mach-es7000/es7000plat.c 2004-09-21 20:52:52 -07:00 +++ b/arch/i386/mach-es7000/es7000plat.c 2004-09-21 20:52:52 -07:00 @@ -51,27 +51,74 @@ int mip_port; unsigned long mip_addr, host_addr; +#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +static unsigned long cycle_irqs = 0; +static unsigned long free_irqs = 0; +static int gsi_map[MAX_GSI_MAPSIZE] = { [0 ... MAX_GSI_MAPSIZE-1] = -1 }; + +/* + * GSI override for ES7000 platforms. + */ + +static int __init +es7000_gsi_override(int ioapic, int gsi) +{ + static int newgsi = 0; + + if (gsi_map[gsi] != -1) + gsi = gsi_map[gsi]; + else if (cycle_irqs ^ free_irqs) { + newgsi = find_next_bit(&cycle_irqs, IOAPIC_GSI_BOUND(0), newgsi); + __set_bit(newgsi, &free_irqs); + gsi_map[gsi] = newgsi; + gsi = newgsi; + newgsi++; + Dprintk("es7000_gsi_override: free_irqs = 0x%lx\n", free_irqs); + } + + return gsi; +} + static int __init es7000_rename_gsi(int ioapic, int gsi) { + static int initialized = 0; + int i; + + /* + * These should NEVER be true at this point but we'd rather be + * safe than sorry. + */ + if (acpi_disabled || acpi_pci_disabled || acpi_noirq) + return gsi; + if (ioapic) - return gsi; - else { - if (gsi == 0) - return 13; - if (gsi == 1) - return 16; - if (gsi == 4) - return 17; - if (gsi == 6) - return 18; - if (gsi == 7) - return 19; - if (gsi == 8) - return 20; - return gsi; - } + return gsi; + + if (!initialized) { + unsigned long tmp_irqs = 0; + + for (i = 0; i < nr_ioapic_registers[0]; i++) + __set_bit(mp_irqs[i].mpc_srcbusirq, &tmp_irqs); + + cycle_irqs = (~tmp_irqs & io_apic_irqs & ((1 << IOAPIC_GSI_BOUND(0)) - 1)); + + initialized = 1; + Dprintk("es7000_rename_gsi: cycle_irqs = 0x%lx\n", cycle_irqs); + } + + for (i = 0; i < nr_ioapic_registers[0]; i++) { + if (mp_irqs[i].mpc_srcbusirq == gsi) { + if (mp_irqs[i].mpc_dstirq == gsi) + return gsi; + else + return es7000_gsi_override(0, gsi); + } + } + + return gsi; } +#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT) /* * Parse the OEM Table @@ -193,7 +240,7 @@ } } } - printk("ES7000: did not find Unisys ACPI OEM table!\n"); + Dprintk("ES7000: did not find Unisys ACPI OEM table!\n"); return -1; } diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c --- a/arch/i386/mm/init.c 2004-09-21 20:52:52 -07:00 +++ b/arch/i386/mm/init.c 2004-09-21 20:52:52 -07:00 @@ -40,6 +40,8 @@ #include #include +unsigned int __VMALLOC_RESERVE = 128 << 20; + DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); unsigned long highstart_pfn, highend_pfn; diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig --- a/arch/ia64/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/Kconfig 2004-09-21 20:52:52 -07:00 @@ -38,6 +38,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + choice prompt "System type" default IA64_GENERIC @@ -72,6 +76,12 @@ config IA64_SGI_SN2 bool "SGI-SN2" + help + Selecting this option will optimize the kernel for use on sn2 based + systems, but the resulting kernel binary will not run on other + types of ia64 systems. If you have an SGI Altix system, it's safe + to select this option. If in doubt, select ia64 generic support + instead. config IA64_HP_SIM bool "Ski-simulator" diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile --- a/arch/ia64/Makefile 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/Makefile 2004-09-21 20:52:51 -07:00 @@ -20,7 +20,7 @@ EXTRA := cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ - -falign-functions=32 -frename-registers + -falign-functions=32 -frename-registers -fno-optimize-sibling-calls CFLAGS_KERNEL := -mconstant-gp GCC_VERSION := $(call cc-version) diff -Nru a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig --- a/arch/ia64/configs/sn2_defconfig 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/configs/sn2_defconfig 2004-09-21 20:52:51 -07:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.9-rc1 -# Fri Aug 27 22:00:00 2004 +# Linux kernel version: 2.6.9-rc2 +# Fri Sep 17 13:58:32 2004 # # @@ -13,6 +13,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -33,6 +34,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -54,6 +57,7 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_TIME_INTERPOLATION=y CONFIG_EFI=y +CONFIG_GENERIC_IOMAP=y # CONFIG_IA64_GENERIC is not set # CONFIG_IA64_DIG is not set # CONFIG_IA64_HP_ZX1 is not set @@ -210,7 +214,6 @@ # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set @@ -277,7 +280,8 @@ # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set # CONFIG_SCSI_ATA_PIIX is not set @@ -334,8 +338,7 @@ # Fusion MPT device support # CONFIG_FUSION=y -CONFIG_FUSION_MAX_SGE=40 -CONFIG_FUSION_ISENSE=m +CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_CTL=m # @@ -550,7 +553,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -575,6 +577,7 @@ CONFIG_RAW_DRIVER=m # CONFIG_HPET is not set CONFIG_MAX_RAW_DEVS=256 +CONFIG_MMTIMER=y # # I2C support diff -Nru a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c --- a/arch/ia64/ia32/binfmt_elf32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/ia32/binfmt_elf32.c 2004-09-21 20:52:52 -07:00 @@ -48,6 +48,7 @@ extern struct page *ia32_shared_page[]; extern unsigned long *ia32_gdt; +extern struct page *ia32_gate_page; struct page * ia32_install_shared_page (struct vm_area_struct *vma, unsigned long address, int *type) @@ -59,10 +60,25 @@ return pg; } +struct page * +ia32_install_gate_page (struct vm_area_struct *vma, unsigned long address, int *type) +{ + struct page *pg = ia32_gate_page; + get_page(pg); + if (type) + *type = VM_FAULT_MINOR; + return pg; +} + + static struct vm_operations_struct ia32_shared_page_vm_ops = { .nopage = ia32_install_shared_page }; +static struct vm_operations_struct ia32_gate_page_vm_ops = { + .nopage = ia32_install_gate_page +}; + void ia64_elf32_init (struct pt_regs *regs) { @@ -82,6 +98,29 @@ vma->vm_page_prot = PAGE_SHARED; vma->vm_flags = VM_READ|VM_MAYREAD|VM_RESERVED; vma->vm_ops = &ia32_shared_page_vm_ops; + down_write(¤t->mm->mmap_sem); + { + insert_vm_struct(current->mm, vma); + } + up_write(¤t->mm->mmap_sem); + } + + /* + * When user stack is not executable, push sigreturn code to stack makes + * segmentation fault raised when returning to kernel. So now sigreturn + * code is locked in specific gate page, which is pointed by pretcode + * when setup_frame_ia32 + */ + vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); + if (vma) { + memset(vma, 0, sizeof(*vma)); + vma->vm_mm = current->mm; + vma->vm_start = IA32_GATE_OFFSET; + vma->vm_end = vma->vm_start + PAGE_SIZE; + vma->vm_page_prot = PAGE_COPY_EXEC; + vma->vm_flags = VM_READ | VM_MAYREAD | VM_EXEC + | VM_MAYEXEC | VM_RESERVED; + vma->vm_ops = &ia32_gate_page_vm_ops; down_write(¤t->mm->mmap_sem); { insert_vm_struct(current->mm, vma); diff -Nru a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S --- a/arch/ia64/ia32/ia32_entry.S 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/ia32/ia32_entry.S 2004-09-21 20:52:52 -07:00 @@ -311,7 +311,7 @@ data8 sys_ni_syscall /* old profil syscall holder */ data8 compat_sys_statfs data8 compat_sys_fstatfs /* 100 */ - data8 sys32_ioperm + data8 sys_ni_syscall /* ioperm */ data8 compat_sys_socketcall data8 sys_syslog data8 compat_sys_setitimer @@ -320,7 +320,7 @@ data8 compat_sys_newlstat data8 compat_sys_newfstat data8 sys_ni_syscall - data8 sys32_iopl /* 110 */ + data8 sys_ni_syscall /* iopl */ /* 110 */ data8 sys_vhangup data8 sys_ni_syscall /* used to be sys_idle */ data8 sys_ni_syscall diff -Nru a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c --- a/arch/ia64/ia32/ia32_signal.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/ia32/ia32_signal.c 2004-09-21 20:52:51 -07:00 @@ -853,14 +853,19 @@ unsigned int restorer = IA32_SA_RESTORER(ka); err |= __put_user(restorer, &frame->pretcode); } else { - err |= __put_user((long)frame->retcode, &frame->pretcode); - /* This is popl %eax ; movl $,%eax ; int $0x80 */ - err |= __put_user(0xb858, (short *)(frame->retcode+0)); - err |= __put_user(__IA32_NR_sigreturn & 0xffff, (short *)(frame->retcode+2)); - err |= __put_user(__IA32_NR_sigreturn >> 16, (short *)(frame->retcode+4)); - err |= __put_user(0x80cd, (short *)(frame->retcode+6)); + /* Pointing to restorer in ia32 gate page */ + err |= __put_user(IA32_GATE_OFFSET, &frame->pretcode); } + /* This is popl %eax ; movl $,%eax ; int $0x80 + * and there for historical reasons only. + * See arch/i386/kernel/signal.c + */ + + err |= __put_user(0xb858, (short *)(frame->retcode+0)); + err |= __put_user(__IA32_NR_sigreturn, (int *)(frame->retcode+2)); + err |= __put_user(0x80cd, (short *)(frame->retcode+6)); + if (err) goto give_sigsegv; @@ -922,12 +927,18 @@ unsigned int restorer = IA32_SA_RESTORER(ka); err |= __put_user(restorer, &frame->pretcode); } else { - err |= __put_user((long)frame->retcode, &frame->pretcode); - /* This is movl $,%eax ; int $0x80 */ - err |= __put_user(0xb8, (char *)(frame->retcode+0)); - err |= __put_user(__IA32_NR_rt_sigreturn, (int *)(frame->retcode+1)); - err |= __put_user(0x80cd, (short *)(frame->retcode+5)); + /* Pointing to rt_restorer in ia32 gate page */ + err |= __put_user(IA32_GATE_OFFSET + 8, &frame->pretcode); } + + /* This is movl $,%eax ; int $0x80 + * and there for historical reasons only. + * See arch/i386/kernel/signal.c + */ + + err |= __put_user(0xb8, (char *)(frame->retcode+0)); + err |= __put_user(__IA32_NR_rt_sigreturn, (int *)(frame->retcode+1)); + err |= __put_user(0x80cd, (short *)(frame->retcode+5)); if (err) goto give_sigsegv; diff -Nru a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c --- a/arch/ia64/ia32/ia32_support.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/ia32/ia32_support.c 2004-09-21 20:52:51 -07:00 @@ -33,6 +33,7 @@ struct page *ia32_shared_page[NR_CPUS]; unsigned long *ia32_boot_gdt; unsigned long *cpu_gdt_table[NR_CPUS]; +struct page *ia32_gate_page; static unsigned long load_desc (u16 selector) @@ -158,7 +159,7 @@ /* * Setup IA32 GDT and TSS */ -void +static void ia32_boot_gdt_init (void) { unsigned long ldt_size; @@ -172,12 +173,12 @@ /* CS descriptor in IA-32 (scrambled) format */ ia32_boot_gdt[__USER_CS >> 3] - = IA32_SEG_DESCRIPTOR(0, (IA32_PAGE_OFFSET-1) >> IA32_PAGE_SHIFT, + = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT, 0xb, 1, 3, 1, 1, 1, 1); /* DS descriptor in IA-32 (scrambled) format */ ia32_boot_gdt[__USER_DS >> 3] - = IA32_SEG_DESCRIPTOR(0, (IA32_PAGE_OFFSET-1) >> IA32_PAGE_SHIFT, + = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT, 0x3, 1, 3, 1, 1, 1, 1); ldt_size = PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE); @@ -185,6 +186,27 @@ 0xb, 0, 3, 1, 1, 1, 0); ia32_boot_gdt[LDT_ENTRY] = IA32_SEG_DESCRIPTOR(IA32_LDT_OFFSET, ldt_size - 1, 0x2, 0, 3, 1, 1, 1, 0); +} + +static void +ia32_gate_page_init(void) +{ + unsigned long *sr; + + ia32_gate_page = alloc_page(GFP_KERNEL); + sr = page_address(ia32_gate_page); + /* This is popl %eax ; movl $,%eax ; int $0x80 */ + *sr++ = 0xb858 | (__IA32_NR_sigreturn << 16) | (0x80cdUL << 48); + + /* This is movl $,%eax ; int $0x80 */ + *sr = 0xb8 | (__IA32_NR_rt_sigreturn << 8) | (0x80cdUL << 40); +} + +void +ia32_mem_init(void) +{ + ia32_boot_gdt_init(); + ia32_gate_page_init(); } /* diff -Nru a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h --- a/arch/ia64/ia32/ia32priv.h 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/ia32/ia32priv.h 2004-09-21 20:52:52 -07:00 @@ -168,6 +168,9 @@ #define IA32_SA_HANDLER(ka) ((unsigned long) (ka)->sa.sa_handler & 0xffffffff) #define IA32_SA_RESTORER(ka) ((unsigned long) (ka)->sa.sa_handler >> 32) +#define __IA32_NR_sigreturn 119 +#define __IA32_NR_rt_sigreturn 173 + struct sigaction32 { unsigned int sa_handler; /* Really a pointer, but need to deal with 32 bits */ unsigned int sa_flags; @@ -324,14 +327,16 @@ #define IA32_PAGE_OFFSET 0xc0000000 #define IA32_STACK_TOP IA32_PAGE_OFFSET +#define IA32_GATE_OFFSET IA32_PAGE_OFFSET +#define IA32_GATE_END IA32_PAGE_OFFSET + PAGE_SIZE /* * The system segments (GDT, TSS, LDT) have to be mapped below 4GB so the IA-32 engine can * access them. */ -#define IA32_GDT_OFFSET (IA32_PAGE_OFFSET) -#define IA32_TSS_OFFSET (IA32_PAGE_OFFSET + PAGE_SIZE) -#define IA32_LDT_OFFSET (IA32_PAGE_OFFSET + 2*PAGE_SIZE) +#define IA32_GDT_OFFSET (IA32_PAGE_OFFSET + PAGE_SIZE) +#define IA32_TSS_OFFSET (IA32_PAGE_OFFSET + 2*PAGE_SIZE) +#define IA32_LDT_OFFSET (IA32_PAGE_OFFSET + 3*PAGE_SIZE) #define ELF_EXEC_PAGESIZE IA32_PAGE_SIZE diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c --- a/arch/ia64/ia32/sys_ia32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/ia32/sys_ia32.c 2004-09-21 20:52:52 -07:00 @@ -1913,73 +1913,6 @@ return ret; } -/* - * The IA64 maps 4 I/O ports for each 4K page - */ -#define IOLEN ((65536 / 4) * 4096) - -asmlinkage long -sys32_iopl (int level) -{ - extern unsigned long ia64_iobase; - int fd; - struct file * file; - unsigned int old; - unsigned long addr; - mm_segment_t old_fs = get_fs (); - - if (level != 3) - return(-EINVAL); - /* Trying to gain more privileges? */ - old = ia64_getreg(_IA64_REG_AR_EFLAG); - if ((unsigned int) level > ((old >> 12) & 3)) { - if (!capable(CAP_SYS_RAWIO)) - return -EPERM; - } - set_fs(KERNEL_DS); - fd = sys_open("/dev/mem", O_SYNC | O_RDWR, 0); - set_fs(old_fs); - if (fd < 0) - return fd; - file = fget(fd); - if (file == NULL) { - sys_close(fd); - return(-EFAULT); - } - - down_write(¤t->mm->mmap_sem); - addr = do_mmap_pgoff(file, IA32_IOBASE, - IOLEN, PROT_READ|PROT_WRITE, MAP_SHARED, - (ia64_iobase & ~PAGE_OFFSET) >> PAGE_SHIFT); - up_write(¤t->mm->mmap_sem); - - if (addr >= 0) { - old = (old & ~0x3000) | (level << 12); - ia64_setreg(_IA64_REG_AR_EFLAG, old); - } - - fput(file); - sys_close(fd); - return 0; -} - -asmlinkage long -sys32_ioperm (unsigned int from, unsigned int num, int on) -{ - - /* - * Since IA64 doesn't have permission bits we'd have to go to - * a lot of trouble to simulate them in software. There's - * no point, only trusted programs can make this call so we'll - * just turn it into an iopl call and let the process have - * access to all I/O ports. - * - * XXX proper ioperm() support should be emulated by - * manipulating the page protections... - */ - return sys32_iopl(3); -} - typedef struct { unsigned int ss_sp; unsigned int ss_flags; diff -Nru a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h --- a/arch/ia64/kernel/minstate.h 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/kernel/minstate.h 2004-09-21 20:52:52 -07:00 @@ -54,8 +54,7 @@ (pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \ #define MINSTATE_END_SAVE_MIN_PHYS \ - or r12=r12,r14; /* make sp a kernel virtual address */ \ - or r13=r13,r14; /* make `current' a kernel virtual address */ \ + dep r12=-1,r12,61,3; /* make sp a kernel virtual address */ \ ;; #ifdef MINSTATE_VIRT @@ -65,7 +64,7 @@ #endif #ifdef MINSTATE_PHYS -# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT);; dep reg=0,reg,61,3 +# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT);; tpa reg=reg # define MINSTATE_START_SAVE_MIN MINSTATE_START_SAVE_MIN_PHYS # define MINSTATE_END_SAVE_MIN MINSTATE_END_SAVE_MIN_PHYS #endif @@ -172,7 +171,6 @@ ;; \ .mem.offset 0,0; st8.spill [r16]=r15,16; \ .mem.offset 8,0; st8.spill [r17]=r14,16; \ - dep r14=-1,r0,61,3; \ ;; \ .mem.offset 0,0; st8.spill [r16]=r2,16; \ .mem.offset 8,0; st8.spill [r17]=r3,16; \ diff -Nru a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c --- a/arch/ia64/kernel/process.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/kernel/process.c 2004-09-21 20:52:51 -07:00 @@ -228,18 +228,26 @@ /* endless idle loop with no priority at all */ while (1) { - void (*idle)(void) = pm_idle; - if (!idle) - idle = default_idle; - #ifdef CONFIG_SMP if (!need_resched()) min_xtp(); #endif while (!need_resched()) { + void (*idle)(void); + if (mark_idle) (*mark_idle)(1); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; + if (!idle) + idle = default_idle; (*idle)(); + rcu_read_unlock(); } if (mark_idle) diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/mm/init.c 2004-09-21 20:52:51 -07:00 @@ -587,6 +587,6 @@ setup_gate(); #ifdef CONFIG_IA32_SUPPORT - ia32_boot_gdt_init(); + ia32_mem_init(); #endif } diff -Nru a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c --- a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-09-21 20:52:52 -07:00 @@ -357,7 +357,20 @@ if (dev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_MEM) cmd |= PCI_COMMAND_MEMORY; } - } + } else { + /* + * Remove other ROM resources since they don't have valid + * CPU addresses. + */ + size = dev->resource[PCI_ROM_RESOURCE].end - + dev->resource[PCI_ROM_RESOURCE].start; + + if (size) { + dev->resource[PCI_ROM_RESOURCE].start = 0; + dev->resource[PCI_ROM_RESOURCE].end = 0; + dev->resource[PCI_ROM_RESOURCE].flags = 0; + } + } /* * Update the Command Word on the Card. diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c --- a/arch/ia64/sn/kernel/setup.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/sn/kernel/setup.c 2004-09-21 20:52:51 -07:00 @@ -64,6 +64,8 @@ unsigned long sn_rtc_cycles_per_second; +EXPORT_SYMBOL(sn_rtc_cycles_per_second); + partid_t sn_partid = -1; char sn_system_serial_number_string[128]; u64 sn_partition_serial_number; diff -Nru a/arch/ia64/sn/kernel/sn2/Makefile b/arch/ia64/sn/kernel/sn2/Makefile --- a/arch/ia64/sn/kernel/sn2/Makefile 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/sn/kernel/sn2/Makefile 2004-09-21 20:52:52 -07:00 @@ -10,4 +10,4 @@ # obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \ - prominfo_proc.o timer.o timer_interrupt.o + prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o diff -Nru a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c --- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c 2004-09-21 20:52:51 -07:00 @@ -222,7 +222,7 @@ { int nentries; int fentry; - unsigned long qw; + unsigned long qw = 0; int len; nasid_t nasid = NASID_GET(fit); diff -Nru a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,652 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. + * + * SGI Altix topology and hardware performance monitoring API. + * Mark Goodwin . + * + * Creates /proc/sgi_sn/sn_topology (read-only) to export + * info about Altix nodes, routers, CPUs and NumaLink + * interconnection/topology. + * + * Also creates a dynamic misc device named "sn_hwperf" + * that supports an ioctl interface to call down into SAL + * to discover hw objects, topology and to read/write + * memory mapped registers, e.g. for performance monitoring. + * The "sn_hwperf" device is registered only after the procfs + * file is first opened, i.e. only if/when it's needed. + * + * This API is used by SGI Performance Co-Pilot and other + * tools, see http://oss.sgi.com/projects/pcp + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void *sn_hwperf_salheap = NULL; +static int sn_hwperf_obj_cnt = 0; +static nasid_t sn_hwperf_master_nasid = INVALID_NASID; +static int sn_hwperf_init(void); +static DECLARE_MUTEX(sn_hwperf_init_mutex); + +static int sn_hwperf_enum_objects(int *nobj, struct sn_hwperf_object_info **ret) +{ + int e; + u64 sz; + struct sn_hwperf_object_info *objbuf = NULL; + + if ((e = sn_hwperf_init()) < 0) { + printk("sn_hwperf_init failed: err %d\n", e); + goto out; + } + + sz = sn_hwperf_obj_cnt * sizeof(struct sn_hwperf_object_info); + if ((objbuf = (struct sn_hwperf_object_info *) vmalloc(sz)) == NULL) { + printk("sn_hwperf_enum_objects: vmalloc(%d) failed\n", (int)sz); + e = -ENOMEM; + goto out; + } + + e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, SN_HWPERF_ENUM_OBJECTS, + 0, sz, (u64) objbuf, 0, 0, NULL); + if (e != SN_HWPERF_OP_OK) { + e = -EINVAL; + vfree(objbuf); + } + +out: + *nobj = sn_hwperf_obj_cnt; + *ret = objbuf; + return e; +} + +static int sn_hwperf_geoid_to_cnode(char *location) +{ + int cnode; + int mod, slot, slab; + int cmod, cslot, cslab; + + if (sscanf(location, "%03dc%02d#%d", &mod, &slot, &slab) != 3) + return -1; + for (cnode = 0; cnode < numnodes; cnode++) { + /* XXX: need a better way than this ... */ + if (sscanf(NODEPDA(cnode)->hwg_node_name, + "hw/module/%03dc%02d/slab/%d", &cmod, &cslot, &cslab) == 3) { + if (mod == cmod && slot == cslot && slab == cslab) + break; + } + } + + return cnode < numnodes ? cnode : -1; +} + +static int sn_hwperf_obj_to_cnode(struct sn_hwperf_object_info * obj) +{ + if (!obj->sn_hwp_this_part) + return -1; + return sn_hwperf_geoid_to_cnode(obj->location); +} + +static int sn_hwperf_generic_ordinal(struct sn_hwperf_object_info *obj, + struct sn_hwperf_object_info *objs) +{ + int ordinal; + struct sn_hwperf_object_info *p; + + for (ordinal=0, p=objs; p != obj; p++) { + if (SN_HWPERF_FOREIGN(p)) + continue; + if (p->location[3] == obj->location[3]) + ordinal++; + } + + return ordinal; +} + +#ifndef MODULE_IOBRICK +/* this will be available when ioif TIO support is added */ +#define MODULE_IOBRICK (MODULE_OPUSBRICK+1) +#endif + +static const char *sn_hwperf_get_brickname(struct sn_hwperf_object_info *obj, + struct sn_hwperf_object_info *objs, int *ordinal) +{ + int i; + const char *objtype = NULL; + + for (i=0; i < MAX_BRICK_TYPES; i++) { + if (brick_types[i] != obj->location[3]) + continue; + switch (i) { + case MODULE_CBRICK: + objtype = "node"; + *ordinal = sn_hwperf_obj_to_cnode(obj); /* cnodeid */ + break; + + case MODULE_RBRICK: + objtype = "router"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + break; + + case MODULE_IOBRICK: + objtype = "ionode"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + break; + } + break; + } + + if (i == MAX_BRICK_TYPES) { + objtype = "other"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + } + + return objtype; +} + +static int sn_topology_show(struct seq_file *s, void *d) +{ + int sz; + int pt; + int e; + int i; + int j; + const char *brickname; + int ordinal; + cpumask_t cpumask; + char slice; + struct cpuinfo_ia64 *c; + struct sn_hwperf_port_info *ptdata; + struct sn_hwperf_object_info *p; + struct sn_hwperf_object_info *obj = d; /* this object */ + struct sn_hwperf_object_info *objs = s->private; /* all objects */ + + if (obj == objs) { + seq_printf(s, "# sn_topology version 1\n"); + seq_printf(s, "# objtype ordinal location partition" + " [attribute value [, ...]]\n"); + } + + if (SN_HWPERF_FOREIGN(obj)) { + /* private in another partition: not interesting */ + return 0; + } + + for (i = 0; obj->name[i]; i++) { + if (obj->name[i] == ' ') + obj->name[i] = '_'; + } + + brickname = sn_hwperf_get_brickname(obj, objs, &ordinal); + seq_printf(s, "%s %d %s %s asic %s", brickname, ordinal, obj->location, + obj->sn_hwp_this_part ? "local" : "shared", obj->name); + + if (obj->location[3] != 'c') + seq_putc(s, '\n'); + else { + seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal)); + for (i=0; i < numnodes; i++) { + seq_printf(s, i ? ":%d" : ", dist %d", + node_distance(ordinal, i)); + } + seq_putc(s, '\n'); + + /* + * CPUs on this node + */ + cpumask = node_to_cpumask(ordinal); + for_each_online_cpu(i) { + if (cpu_isset(i, cpumask)) { + slice = 'a' + cpuid_to_slice(i); + c = cpu_data(i); + seq_printf(s, "cpu %d %s%c local" + " freq %luMHz, arch ia64", + i, obj->location, slice, + c->proc_freq / 1000000); + for_each_online_cpu(j) { + seq_printf(s, j ? ":%d" : ", dist %d", + node_distance( + cpuid_to_cnodeid(i), + cpuid_to_cnodeid(j))); + } + seq_putc(s, '\n'); + } + } + } + + if (obj->ports) { + /* + * numalink ports + */ + sz = obj->ports * sizeof(struct sn_hwperf_port_info); + if ((ptdata = vmalloc(sz)) == NULL) + return -ENOMEM; + e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_ENUM_PORTS, obj->id, sz, + (u64) ptdata, 0, 0, NULL); + if (e != SN_HWPERF_OP_OK) + return -EINVAL; + for (ordinal=0, p=objs; p != obj; p++) { + if (!SN_HWPERF_FOREIGN(p)) + ordinal += p->ports; + } + for (pt = 0; pt < obj->ports; pt++) { + for (p = objs, i = 0; i < sn_hwperf_obj_cnt; i++, p++) { + if (ptdata[pt].conn_id == p->id) { + break; + } + } + if (i >= sn_hwperf_obj_cnt) + continue; + seq_printf(s, "numalink %d %s-%d", + ordinal+pt, obj->location, ptdata[pt].port); + + if (obj->sn_hwp_this_part && p->sn_hwp_this_part) + /* both ends local to this partition */ + seq_puts(s, " local"); + else if (!obj->sn_hwp_this_part && !p->sn_hwp_this_part) + /* both ends of the link in foreign partiton */ + seq_puts(s, " foreign"); + else + /* link straddles a partition */ + seq_puts(s, " shared"); + + /* + * Unlikely, but strictly should query the LLP config + * registers because an NL4R can be configured to run + * NL3 protocol, even when not talking to an NL3 router. + * Ditto for node-node. + */ + seq_printf(s, " endpoint %s-%d, protocol %s\n", + p->location, ptdata[pt].conn_port, + strcmp(obj->name, "NL3Router") == 0 || + strcmp(p->name, "NL3Router") == 0 ? + "LLP3" : "LLP4"); + } + vfree(ptdata); + } + + return 0; +} + +static void *sn_topology_start(struct seq_file *s, loff_t * pos) +{ + struct sn_hwperf_object_info *objs = s->private; + + if (*pos < sn_hwperf_obj_cnt) + return (void *)(objs + *pos); + + return NULL; +} + +static void *sn_topology_next(struct seq_file *s, void *v, loff_t * pos) +{ + ++*pos; + return sn_topology_start(s, pos); +} + +static void sn_topology_stop(struct seq_file *m, void *v) +{ + return; +} + +/* + * /proc/sgi_sn/sn_topology, read-only using seq_file + */ +static struct seq_operations sn_topology_seq_ops = { + .start = sn_topology_start, + .next = sn_topology_next, + .stop = sn_topology_stop, + .show = sn_topology_show +}; + +struct sn_hwperf_op_info { + u64 op; + struct sn_hwperf_ioctl_args *a; + void *p; + int *v0; + int ret; +}; + +static void sn_hwperf_call_sal(void *info) +{ + struct sn_hwperf_op_info *op_info = info; + int r; + + r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op_info->op, + op_info->a->arg, op_info->a->sz, + (u64) op_info->p, 0, 0, op_info->v0); + op_info->ret = r; +} + +static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info) +{ + u32 cpu; + u32 use_ipi; + int r = 0; + cpumask_t save_allowed; + + cpu = (op_info->a->arg & SN_HWPERF_ARG_CPU_MASK) >> 32; + use_ipi = op_info->a->arg & SN_HWPERF_ARG_USE_IPI_MASK; + op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK; + + if (cpu != SN_HWPERF_ARG_ANY_CPU) { + if (cpu >= num_online_cpus() || !cpu_online(cpu)) { + r = -EINVAL; + goto out; + } + } + + if (cpu == SN_HWPERF_ARG_ANY_CPU || cpu == get_cpu()) { + /* don't care, or already on correct cpu */ + sn_hwperf_call_sal(op_info); + } + else { + if (use_ipi) { + /* use an interprocessor interrupt to call SAL */ + smp_call_function_single(cpu, sn_hwperf_call_sal, + op_info, 1, 1); + } + else { + /* migrate the task before calling SAL */ + save_allowed = current->cpus_allowed; + set_cpus_allowed(current, cpumask_of_cpu(cpu)); + sn_hwperf_call_sal(op_info); + set_cpus_allowed(current, save_allowed); + } + } + r = op_info->ret; + +out: + return r; +} + +/* + * ioctl for "sn_hwperf" misc device + */ +static int +sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg) +{ + struct sn_hwperf_ioctl_args a; + struct cpuinfo_ia64 *cdata; + struct sn_hwperf_object_info *objs; + struct sn_hwperf_object_info *cpuobj; + struct sn_hwperf_op_info op_info; + void *p = NULL; + int nobj; + char slice; + int node; + int r; + int v0; + int i; + int j; + + unlock_kernel(); + + /* only user requests are allowed here */ + if ((op & SN_HWPERF_OP_MASK) < 10) { + r = -EINVAL; + goto error; + } + r = copy_from_user(&a, (const void *)arg, + sizeof(struct sn_hwperf_ioctl_args)); + if (r != 0) { + r = -EFAULT; + goto error; + } + + /* + * Allocate memory to hold a kernel copy of the user buffer. The + * buffer contents are either copied in or out (or both) of user + * space depending on the flags encoded in the requested operation. + */ + if (a.ptr) { + p = vmalloc(a.sz); + if (!p) { + r = -ENOMEM; + goto error; + } + } + + if (op & SN_HWPERF_OP_MEM_COPYIN) { + r = copy_from_user(p, (const void *)a.ptr, a.sz); + if (r != 0) { + r = -EFAULT; + goto error; + } + } + + switch (op) { + case SN_HWPERF_GET_CPU_INFO: + if (a.sz == sizeof(u64)) { + /* special case to get size needed */ + *(u64 *) p = (u64) num_online_cpus() * + sizeof(struct sn_hwperf_object_info); + } else + if (a.sz < num_online_cpus() * sizeof(struct sn_hwperf_object_info)) { + r = -ENOMEM; + goto error; + } else + if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { + memset(p, 0, a.sz); + for (i = 0; i < nobj; i++) { + node = sn_hwperf_obj_to_cnode(objs + i); + for_each_online_cpu(j) { + if (node != cpu_to_node(j)) + continue; + cpuobj = (struct sn_hwperf_object_info *) p + j; + slice = 'a' + cpuid_to_slice(j); + cdata = cpu_data(j); + cpuobj->id = j; + snprintf(cpuobj->name, + sizeof(cpuobj->name), + "CPU %luMHz %s", + cdata->proc_freq / 1000000, + cdata->vendor); + snprintf(cpuobj->location, + sizeof(cpuobj->location), + "%s%c", objs[i].location, + slice); + } + } + + vfree(objs); + } + break; + + case SN_HWPERF_GET_NODE_NASID: + if (a.sz != sizeof(u64) || + (node = a.arg) < 0 || node >= numnodes) { + r = -EINVAL; + goto error; + } + *(u64 *)p = (u64)cnodeid_to_nasid(node); + break; + + case SN_HWPERF_GET_OBJ_NODE: + if (a.sz != sizeof(u64) || a.arg < 0) { + r = -EINVAL; + goto error; + } + if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { + if (a.arg >= nobj) { + r = -EINVAL; + vfree(objs); + goto error; + } + if (objs[(i = a.arg)].id != a.arg) { + for (i = 0; i < nobj; i++) { + if (objs[i].id == a.arg) + break; + } + } + if (i == nobj) { + r = -EINVAL; + vfree(objs); + goto error; + } + *(u64 *)p = (u64)sn_hwperf_obj_to_cnode(objs + i); + vfree(objs); + } + break; + + case SN_HWPERF_GET_MMRS: + case SN_HWPERF_SET_MMRS: + case SN_HWPERF_OBJECT_DISTANCE: + op_info.p = p; + op_info.a = &a; + op_info.v0 = &v0; + op_info.op = op; + r = sn_hwperf_op_cpu(&op_info); + break; + + default: + /* all other ops are a direct SAL call */ + r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op, + a.arg, a.sz, (u64) p, 0, 0, &v0); + a.v0 = v0; + break; + } + + if (op & SN_HWPERF_OP_MEM_COPYOUT) { + r = copy_to_user((void *)a.ptr, p, a.sz); + if (r != 0) { + r = -EFAULT; + goto error; + } + } + +error: + if (p) + vfree(p); + + lock_kernel(); + return r; +} + +static struct file_operations sn_hwperf_fops = { + .ioctl = sn_hwperf_ioctl, +}; + +static struct miscdevice sn_hwperf_dev = { + MISC_DYNAMIC_MINOR, + "sn_hwperf", + &sn_hwperf_fops +}; + +static int sn_hwperf_init(void) +{ + u64 v; + int salr; + int e = 0; + + /* single threaded, once-only initialization */ + down(&sn_hwperf_init_mutex); + if (sn_hwperf_salheap) { + up(&sn_hwperf_init_mutex); + return e; + } + + /* + * The PROM code needs a fixed reference node. For convenience the + * same node as the console I/O is used. + */ + sn_hwperf_master_nasid = (nasid_t) ia64_sn_get_console_nasid(); + + /* + * Request the needed size and install the PROM scratch area. + * The PROM keeps various tracking bits in this memory area. + */ + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + (u64) SN_HWPERF_GET_HEAPSIZE, 0, + (u64) sizeof(u64), (u64) &v, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + + if ((sn_hwperf_salheap = vmalloc(v)) == NULL) { + e = -ENOMEM; + goto out; + } + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_INSTALL_HEAP, 0, v, + (u64) sn_hwperf_salheap, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_OBJECT_COUNT, 0, + sizeof(u64), (u64) &v, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + sn_hwperf_obj_cnt = (int)v; + +out: + if (e < 0 && sn_hwperf_salheap) { + vfree(sn_hwperf_salheap); + sn_hwperf_salheap = NULL; + sn_hwperf_obj_cnt = 0; + } + + if (!e) { + /* + * Register a dynamic misc device for ioctl. Platforms + * supporting hotplug will create /dev/sn_hwperf, else + * user can to look up the minor number in /proc/misc. + */ + if ((e = misc_register(&sn_hwperf_dev)) != 0) { + printk(KERN_ERR "sn_hwperf_init: misc register " + "for \"sn_hwperf\" failed, err %d\n", e); + } + } + + up(&sn_hwperf_init_mutex); + return e; +} + +int sn_topology_open(struct inode *inode, struct file *file) +{ + int e; + struct seq_file *seq; + struct sn_hwperf_object_info *objbuf; + int nobj; + + if ((e = sn_hwperf_enum_objects(&nobj, &objbuf)) == 0) { + e = seq_open(file, &sn_topology_seq_ops); + seq = file->private_data; + seq->private = objbuf; + } + + return e; +} + +int sn_topology_release(struct inode *inode, struct file *file) +{ + struct seq_file *seq = file->private_data; + + if (seq->private) + vfree(seq->private); + return seq_release(inode, file); +} diff -Nru a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c --- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c 2004-09-21 20:52:52 -07:00 @@ -10,67 +10,41 @@ #ifdef CONFIG_PROC_FS #include +#include #include #include - -static int partition_id_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - - return sprintf(page, "%d\n", sn_local_partid()); +static int partition_id_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%d\n", sn_local_partid()); + return 0; } -static struct proc_dir_entry * sgi_proc_dir; - -void -register_sn_partition_id(void) { - struct proc_dir_entry *entry; - - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("partition_id", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = partition_id_read_proc; - entry->write_proc = NULL; - } +static int partition_id_open(struct inode *inode, struct file *file) +{ + return single_open(file, partition_id_show, NULL); } -static int -system_serial_number_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "%s\n", sn_system_serial_number()); +static int system_serial_number_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%s\n", sn_system_serial_number()); + return 0; } -static int -licenseID_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "0x%lx\n",sn_partition_serial_number_val()); +static int system_serial_number_open(struct inode *inode, struct file *file) +{ + return single_open(file, system_serial_number_show, NULL); } -void -register_sn_serial_numbers(void) { - struct proc_dir_entry *entry; +static int licenseID_show(struct seq_file *s, void *p) +{ + seq_printf(s, "0x%lx\n", sn_partition_serial_number_val()); + return 0; +} - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("system_serial_number", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = system_serial_number_read_proc; - entry->write_proc = NULL; - } - entry = create_proc_entry("licenseID", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = licenseID_read_proc; - entry->write_proc = NULL; - } +static int licenseID_open(struct inode *inode, struct file *file) +{ + return single_open(file, licenseID_show, NULL); } /* @@ -81,70 +55,90 @@ */ int sn_force_interrupt_flag = 1; -static int -sn_force_interrupt_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - if (sn_force_interrupt_flag) { - return sprintf(page, "Force interrupt is enabled\n"); - } - return sprintf(page, "Force interrupt is disabled\n"); +static int sn_force_interrupt_show(struct seq_file *s, void *p) +{ + seq_printf(s, "Force interrupt is %s\n", + sn_force_interrupt_flag ? "enabled" : "disabled"); + return 0; } -static int -sn_force_interrupt_write_proc(struct file *file, const char *buffer, - unsigned long count, void *data) +static ssize_t sn_force_interrupt_write_proc(struct file *file, + const __user char *buffer, size_t count, loff_t *data) { - if (*buffer == '0') { - sn_force_interrupt_flag = 0; - } else { - sn_force_interrupt_flag = 1; - } - return 1; + sn_force_interrupt_flag = (*buffer == '0') ? 0 : 1; + return count; } -void -register_sn_force_interrupt(void) { - struct proc_dir_entry *entry; +static int sn_force_interrupt_open(struct inode *inode, struct file *file) +{ + return single_open(file, sn_force_interrupt_show, NULL); +} - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("sn_force_interrupt",0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = sn_force_interrupt_read_proc; - entry->write_proc = sn_force_interrupt_write_proc; - } +static int coherence_id_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%d\n", cpuid_to_coherence_id(smp_processor_id())); + return 0; } -static int coherence_id_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "%d\n", cpuid_to_coherence_id(smp_processor_id())); +static int coherence_id_open(struct inode *inode, struct file *file) +{ + return single_open(file, coherence_id_show, NULL); } -void -register_sn_coherence_id(void) { - struct proc_dir_entry *entry; +static struct proc_dir_entry *sn_procfs_create_entry( + const char *name, struct proc_dir_entry *parent, + int (*openfunc)(struct inode *, struct file *), + int (*releasefunc)(struct inode *, struct file *)) +{ + struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("coherence_id", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = coherence_id_read_proc; - entry->write_proc = NULL; + if (e) { + e->proc_fops = (struct file_operations *)kmalloc( + sizeof(struct file_operations), GFP_KERNEL); + if (e->proc_fops) { + memset(e->proc_fops, 0, sizeof(struct file_operations)); + e->proc_fops->open = openfunc; + e->proc_fops->read = seq_read; + e->proc_fops->llseek = seq_lseek; + e->proc_fops->release = releasefunc; + } } + + return e; } -void -register_sn_procfs(void) { - register_sn_partition_id(); - register_sn_serial_numbers(); - register_sn_force_interrupt(); - register_sn_coherence_id(); +/* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ +extern int sn_topology_open(struct inode *, struct file *); +extern int sn_topology_release(struct inode *, struct file *); + +void register_sn_procfs(void) +{ + static struct proc_dir_entry *sgi_proc_dir = NULL; + struct proc_dir_entry *e; + + BUG_ON(sgi_proc_dir != NULL); + if (!(sgi_proc_dir = proc_mkdir("sgi_sn", 0))) + return; + + sn_procfs_create_entry("partition_id", sgi_proc_dir, + partition_id_open, single_release); + + sn_procfs_create_entry("system_serial_number", sgi_proc_dir, + system_serial_number_open, single_release); + + sn_procfs_create_entry("licenseID", sgi_proc_dir, + licenseID_open, single_release); + + e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, + sn_force_interrupt_open, single_release); + if (e) + e->proc_fops->write = sn_force_interrupt_write_proc; + + sn_procfs_create_entry("coherence_id", sgi_proc_dir, + coherence_id_open, single_release); + + sn_procfs_create_entry("sn_topology", sgi_proc_dir, + sn_topology_open, sn_topology_release); } #endif /* CONFIG_PROC_FS */ diff -Nru a/arch/m32r/Kconfig b/arch/m32r/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/Kconfig 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,443 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +mainmenu "Linux Kernel Configuration" + +config M32R + bool + default y + +config SBUS + bool + +config UID16 + bool + default y + +config GENERIC_ISA_DMA + bool + default y + +source "init/Kconfig" + + +menu "Processor type and features" + +choice + prompt "Platform Type" + default PLAT_MAPPI + +config PLAT_MAPPI + bool "Mappi-I" + help + The Mappi-I is an FPGA board for SOC (System-On-a-Chip) prototyping. + You can operate a Linux system on this board by using an M32R + softmacro core, which is a fully-synthesizable functional model + described in Verilog-HDL. + + The Mappi-I board was the first platform, which had been used + to port and develop a Linux system for the M32R processor. + Currently, the Mappi-II, an heir to the Mappi-I, is available. + +config PLAT_USRV + bool "uServer" + +config PLAT_M32700UT + bool "M32700UT" + help + The M3T-M32700UT is an evaluation board based on uT-Engine + specification. This board has an M32700 (Chaos) evaluation chip. + You can say Y for SMP, because the M32700 is a single chip + multiprocessor. + +config PLAT_OPSPUT + bool "OPSPUT" + help + The OPSPUT is an evaluation board based on uT-Engine + specification. This board has a OPSP-REP chip. + +config PLAT_OAKS32R + bool "OAKS32R" + help + The OAKS32R is a tiny, inexpensive evaluation board. + Please note that if you say Y here and choose chip "M32102", + say N for MMU and select a no-MMU version kernel, otherwise + a kernel with MMU support will not work, because the M32102 + is a microcontroller for embedded systems and it has no MMU. + +config PLAT_MAPPI2 + bool "Mappi-II(M3A-ZA36/M3A-ZA52)" + +endchoice + +choice + prompt "Processor family" + default CHIP_M32700 + +config CHIP_M32700 + bool "M32700 (Chaos)" + +config CHIP_M32102 + bool "M32102" + +config CHIP_VDEC2 + bool "VDEC2" + +config CHIP_OPSP + bool "OPSP" + +endchoice + +config MMU + bool "Support for memory management hardware" + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default y + +config TLB_ENTRIES + int "TLB Entries" + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default 32 if CHIP_M32700 || CHIP_OPSP + default 16 if CHIP_VDEC2 + + +config ISA_M32R + bool + depends on CHIP_M32102 + default y + +config ISA_M32R2 + bool + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default y + +config ISA_DSP_LEVEL2 + bool + depends on CHIP_M32700 || CHIP_OPSP + default y + +config ISA_DUAL_ISSUE + bool + depends on CHIP_M32700 || CHIP_OPSP + default y + +config BUS_CLOCK + int "Bus Clock [Hz] (integer)" + default "70000000" if PLAT_MAPPI + default "25000000" if PLAT_USRV + default "50000000" if PLAT_M32700UT + default "50000000" if PLAT_OPSPUT + default "33333333" if PLAT_OAKS32R + default "20000000" if PLAT_MAPPI2 + +config TIMER_DIVIDE + int "Timer divider (integer)" + default "128" + +config CPU_LITTLE_ENDIAN + bool "Generate little endian code" + default n + +config MEMORY_START + hex "Physical memory start address (hex)" + default "08000000" if PLAT_MAPPI || PLAT_MAPPI2 + default "08000000" if PLAT_USRV + default "08000000" if PLAT_M32700UT + default "08000000" if PLAT_OPSPUT + default "01000000" if PLAT_OAKS32R + +config MEMORY_SIZE + hex "Physical memory size (hex)" + default "04000000" if PLAT_MAPPI || PLAT_MAPPI2 + default "02000000" if PLAT_USRV + default "01000000" if PLAT_M32700UT + default "01000000" if PLAT_OPSPUT + default "00800000" if PLAT_OAKS32R + +config NOHIGHMEM + bool + default y + +config DISCONTIGMEM + bool "Internal RAM Support" + depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP + default y + +config IRAM_START + hex "Internal memory start address (hex)" + default "00f00000" + depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM + +config IRAM_SIZE + hex "Internal memory size (hex)" + depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM + default "00080000" if CHIP_M32700 + default "00010000" if CHIP_M32102 || CHIP_OPSP + default "00008000" if CHIP_VDEC2 + +# +# Define implied options from the CPU selection here +# + +config RWSEM_GENERIC_SPINLOCK + bool + depends on M32R + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + default n + +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config HAVE_DEC_LOCK + bool + depends on (SMP || PREEMPT) + default n + +config SMP + bool "Symmetric multi-processing support" + ---help--- + This enables support for systems with more than one CPU. If you have + a system with only one CPU, like most personal computers, say N. If + you have a system with more than one CPU, say Y. + + If you say N here, the kernel will run on single and multiprocessor + machines, but will use only one CPU of a multiprocessor machine. If + you say Y here, the kernel will run on many, but not all, + singleprocessor machines. On a singleprocessor machine, the kernel + will run faster if you say N here. + + People using multiprocessor machines who say Y here should also say + Y to "Enhanced Real Time Clock Support", below. The "Advanced Power + Management" code will be disabled if you say Y here. + + See also the , + and the SMP-HOWTO available at + . + + If you don't know what to do here, say N. + +config CHIP_M32700_TS1 + bool "Workaround code for the M32700 TS1 chip's bug" + depends on (CHIP_M32700 && SMP) + default n + +config NR_CPUS + int "Maximum number of CPUs (2-32)" + range 2 32 + depends on SMP + default "2" + help + This allows you to specify the maximum number of CPUs which this + kernel will support. The maximum supported value is 32 and the + minimum value which makes sense is 2. + + This is purely to save memory - each supported CPU adds + approximately eight kilobytes to the kernel image. + +# Common NUMA Features +config NUMA + bool "Numa Memory Allocation Support" + depends on SMP + default n + +source "arch/m32r/drivers/Kconfig" + +# turning this on wastes a bunch of space. +# Summit needs it only when NUMA is on +config BOOT_IOREMAP + bool + depends on NUMA + default n + +endmenu + + +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + default n + help + Find out whether you have a PCI motherboard. PCI is the name of a + bus system, i.e. the way the CPU talks to the other stuff inside + your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or + VESA. If you have PCI, say Y, otherwise N. + + The PCI-HOWTO, available from + , contains valuable + information about which PCI hardware does work under Linux and which + doesn't. + +choice + prompt "PCI access mode" + depends on PCI + default PCI_GOANY + +config PCI_GOBIOS + bool "BIOS" + ---help--- + On PCI systems, the BIOS can be used to detect the PCI devices and + determine their configuration. However, some old PCI motherboards + have BIOS bugs and may crash if this is done. Also, some embedded + PCI-based systems don't have any BIOS at all. Linux can also try to + detect the PCI hardware directly without using the BIOS. + + With this option, you can specify how Linux should detect the PCI + devices. If you choose "BIOS", the BIOS will be used, if you choose + "Direct", the BIOS won't be used, and if you choose "Any", the + kernel will try the direct access method and falls back to the BIOS + if that doesn't work. If unsure, go with the default, which is + "Any". + +config PCI_GODIRECT + bool "Direct" + +config PCI_GOANY + bool "Any" + +endchoice + +config PCI_BIOS + bool + depends on PCI && (PCI_GOBIOS || PCI_GOANY) + default y + +config PCI_DIRECT + bool + depends on PCI && (PCI_GODIRECT || PCI_GOANY) + default y + +source "drivers/pci/Kconfig" + +config ISA + bool "ISA support" + help + Find out whether you have ISA slots on your motherboard. ISA is the + name of a bus system, i.e. the way the CPU talks to the other stuff + inside your box. If you have ISA, say Y, otherwise N. + +source "drivers/pcmcia/Kconfig" + +source "drivers/pci/hotplug/Kconfig" + +endmenu + + +menu "Executable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/m32r/oprofile/Kconfig" + +menu "Kernel hacking" + +config DEBUG_KERNEL + bool "Kernel debugging" + help + Say Y here if you are developing drivers or trying to debug and + identify kernel problems. + +config DEBUG_STACKOVERFLOW + bool "Check for stack overflows" + depends on DEBUG_KERNEL + +config DEBUG_SLAB + bool "Debug memory allocations" + depends on DEBUG_KERNEL + help + Say Y here to have the kernel do limited verification on memory + allocation as well as poisoning memory on free to catch use of freed + memory. + +config DEBUG_IOVIRT + bool "Memory mapped I/O debugging" + depends on DEBUG_KERNEL + help + Say Y here to get warned whenever an attempt is made to do I/O on + obviously invalid addresses such as those generated when ioremap() + calls are forgotten. Memory mapped I/O will go through an extra + check to catch access to unmapped ISA addresses, an access method + that can still be used by old drivers that are being ported from + 2.0/2.2. + +config MAGIC_SYSRQ + bool "Magic SysRq key" + depends on DEBUG_KERNEL + help + If you say Y here, you will have some control over the system even + if the system crashes for example during kernel debugging (e.g., you + will be able to flush the buffer cache to disk, reboot the system + immediately or dump some status information). This is accomplished + by pressing various keys while holding SysRq (Alt+PrintScreen). It + also works on a serial console (on PC hardware at least), if you + send a BREAK and then within 5 seconds a command keypress. The + keys are documented in . Don't say Y + unless you really know what this hack does. + +config DEBUG_SPINLOCK + bool "Spinlock debugging" + depends on DEBUG_KERNEL + help + Say Y here and build SMP to catch missing spinlock initialization + and certain other kinds of spinlock errors commonly made. This is + best used in conjunction with the NMI watchdog so that spinlock + deadlocks are also debuggable. + +config DEBUG_PAGEALLOC + bool "Page alloc debugging" + depends on DEBUG_KERNEL + help + Unmap pages from the kernel linear mapping after free_pages(). + This results in a large slowdown, but helps to find certain types + of memory corruptions. + +config DEBUG_INFO + bool "Compile the kernel with debug info" + depends on DEBUG_KERNEL + help + If you say Y here the resulting kernel image will include + debugging info resulting in a larger kernel image. + Say Y here only if you plan to use gdb to debug the kernel. + If you don't debug the kernel, you can say N. + +config DEBUG_SPINLOCK_SLEEP + bool "Sleep-inside-spinlock checking" + help + If you say Y here, various routines which may sleep will become very + noisy if they are called with a spinlock held. + +config FRAME_POINTER + bool "Compile the kernel with frame pointers" + help + If you say Y here the resulting kernel image will be slightly larger + and slower, but it will give very useful debugging information. + If you don't debug the kernel, you can say N, but we may not be able + to solve problems without frame pointers. + +endmenu + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig" + diff -Nru a/arch/m32r/Makefile b/arch/m32r/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,56 @@ +# +# m32r/Makefile +# + +LDFLAGS := +OBJCOPYFLAGS := -O binary -R .note -R .comment -S +LDFLAGS_vmlinux := -e startup_32 +LDFLAGS_BLOB := --format binary --oformat elf32-m32r + +CFLAGS += -pipe -fno-schedule-insns +CFLAGS_KERNEL += -mmodel=medium +CFLAGS_MODULE += -mmodel=large + +ifdef CONFIG_CHIP_VDEC2 +cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst +aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst +else +cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 +aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 +endif + +cflags-$(CONFIG_ISA_M32R) += -DNO_FPU +aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst + +CFLAGS += $(cflags-y) +AFLAGS += $(aflags-y) + +CHECK := $(CHECK) -D__m32r__=1 + +head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o + +LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) + +libs-y += arch/m32r/lib/ $(LIBGCC) +core-y += arch/m32r/kernel/ \ + arch/m32r/mm/ \ + arch/m32r/boot/ + +drivers-y += arch/m32r/drivers/ +drivers-$(CONFIG_OPROFILE) += arch/m32r/oprofile/ + +boot := arch/m32r/boot + +.PHONY: zImage + +zImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + +compressed: zImage + +archclean: + $(Q)$(MAKE) $(clean)=$(boot) + +define archhelp + @echo ' zImage - Compressed kernel image (arch/m32r/boot/zImage)' +endef diff -Nru a/arch/m32r/boot/Makefile b/arch/m32r/boot/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,19 @@ +# +# arch/m32r/boot/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. + +targets := zImage +subdir- := compressed + +obj-y := setup.o + +$(obj)/zImage: $(obj)/compressed/vmlinux FORCE + $(call if_changed,objcopy) + @echo 'Kernel: $@ is ready' + +$(obj)/compressed/vmlinux: FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + diff -Nru a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/Makefile 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,38 @@ +# +# linux/arch/sh/boot/compressed/Makefile +# +# create a compressed vmlinux image from the original vmlinux +# + +targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ + m32r-sio.o piggy.o vmlinux.lds +EXTRA_AFLAGS := -traditional + +OBJECTS = $(obj)/head.o $(obj)/misc.o $(obj)/m32r_sio.o + +# +# IMAGE_OFFSET is the load offset of the compression loader +# +#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x2000]) +#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x00400000]) + +LDFLAGS_vmlinux := -T + +$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(obj)/piggy.o FORCE + $(call if_changed,ld) + @: + +$(obj)/vmlinux.bin: vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE + $(call if_changed,gzip) + +$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.S FORCE + $(CPP) $(EXTRA_AFLAGS) -C -P -I include $< >$@ + +LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r-linux -T +OBJCOPYFLAGS += -R .empty_zero_page + +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE + $(call if_changed,ld) diff -Nru a/arch/m32r/boot/compressed/boot.h b/arch/m32r/boot/compressed/boot.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/boot.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,59 @@ +/* + * 1. load vmlinuz + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * 2. decompressed + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | vmlinux | + * +-----------------------+ + * + * 3. relocate copy & jump code + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | boot(copy&jump) | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | vmlinux | + * +-----------------------+ + * + * 4. relocate decompressed kernel + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinux | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | boot(copy&jump) | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | | + * +-----------------------+ + * + */ +#ifdef __ASSEMBLY__ +#define __val(x) x +#else +#define __val(x) (x) +#endif + +#define DECOMPRESS_OFFSET_BASE __val(0x00900000) +#define BOOT_RELOC_SIZE __val(0x00001000) + +#define KERNEL_EXEC_ADDR __val(CONFIG_MEMORY_START) +#define KERNEL_DECOMPRESS_ADDR __val(CONFIG_MEMORY_START + \ + DECOMPRESS_OFFSET_BASE + BOOT_RELOC_SIZE) +#define KERNEL_ENTRY __val(CONFIG_MEMORY_START + 0x1000) + +#define BOOT_EXEC_ADDR __val(CONFIG_MEMORY_START) +#define BOOT_RELOC_ADDR __val(CONFIG_MEMORY_START + DECOMPRESS_OFFSET_BASE) diff -Nru a/arch/m32r/boot/compressed/head.S b/arch/m32r/boot/compressed/head.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/head.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,115 @@ +/* + * linux/arch/m32r/boot/compressed/head.S + * + * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * Copyright (c) 2004 Hirokazu Takata + */ + + .text +#include +#include +#include +#include +#include + + .global startup + __ALIGN +startup: + ldi r0, #0x0000 /* SPI, disable EI */ + mvtc r0, psw + +/* + * Clear BSS first so that there are no surprises... + */ +#ifdef CONFIG_ISA_DUAL_ISSUE + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + ; R4 = BSS size in longwords (rounded down) + mv r4, r3 || ldi r1, #0 + srli r4, #4 || addi r2, #-4 + beqz r4, .Lendloop1 +.Lloop1: +#ifndef CONFIG_CHIP_M32310 + ; Touch memory for the no-write-allocating cache. + ld r0, @(4,r2) +#endif + st r1, @+r2 || addi r4, #-1 + st r1, @+r2 + st r1, @+r2 + st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? + bnc .Lloop1 +.Lendloop1: + and3 r4, r3, #15 + addi r2, #4 + beqz r4, .Lendloop2 +.Lloop2: + stb r1, @r2 || addi r4, #-1 + addi r2, #1 + bnez r4, .Lloop2 +.Lendloop2: + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + mv r4, r3 + srli r4, #2 ; R4 = BSS size in longwords (rounded down) + ldi r1, #0 ; clear R1 for longwords store + addi r2, #-4 ; account for pre-inc store + beqz r4, .Lendloop1 ; any more to go? +.Lloop1: + st r1, @+r2 ; yep, zero out another longword + addi r4, #-1 ; decrement count + bnez r4, .Lloop1 ; go do some more +.Lendloop1: + and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear + addi r2, #4 ; account for pre-inc store + beqz r4, .Lendloop2 ; any more to go? +.Lloop2: + stb r1, @r2 ; yep, zero out another byte + addi r2, #1 ; bump address + addi r4, #-1 ; decrement count + bnez r4, .Lloop2 ; go do some more +.Lendloop2: + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + seth r0, #shigh(stack_start) + ld sp, @(r0, low(stack_start)) /* set stack point */ + +/* + * decompress the kernel + */ + bl decompress_kernel + +#if defined(CONFIG_CHIP_M32700) + /* Cache flush */ + ldi r0, -1 + ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache + stb r1, @r0 +#else +#error "put your cache flush function, please" +#endif + seth r0, #high(CONFIG_MEMORY_START) + or3 r0, r0, #0x2000 + jmp r0 + + .balign 512 +fake_headers_as_bzImage: + .short 0 + .ascii "HdrS" + .short 0x0202 + .short 0 + .short 0 + .byte 0x00, 0x10 + .short 0 + .byte 0 + .byte 1 + .byte 0x00, 0x80 + .long 0 + .long 0 + diff -Nru a/arch/m32r/boot/compressed/install.sh b/arch/m32r/boot/compressed/install.sh --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/install.sh 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,57 @@ +#!/bin/sh +# +# arch/sh/boot/install.sh +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# Adapted from code in arch/i386/boot/install.sh by Russell King +# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy +# Adapted from code in arch/sh/boot/install.sh by Takeo Takahashi +# +# "make install" script for sh architecture +# +# Arguments: +# $1 - kernel version +# $2 - kernel image file +# $3 - kernel map file +# $4 - default install path (blank if root directory) +# + +# User may have a custom install script + +if [ -x /sbin/installkernel ]; then + exec /sbin/installkernel "$@" +fi + +if [ "$2" = "zImage" ]; then +# Compressed install + echo "Installing compressed kernel" + if [ -f $4/vmlinuz-$1 ]; then + mv $4/vmlinuz-$1 $4/vmlinuz.old + fi + + if [ -f $4/System.map-$1 ]; then + mv $4/System.map-$1 $4/System.old + fi + + cat $2 > $4/vmlinuz-$1 + cp $3 $4/System.map-$1 +else +# Normal install + echo "Installing normal kernel" + if [ -f $4/vmlinux-$1 ]; then + mv $4/vmlinux-$1 $4/vmlinux.old + fi + + if [ -f $4/System.map ]; then + mv $4/System.map $4/System.old + fi + + cat $2 > $4/vmlinux-$1 + cp $3 $4/System.map +fi diff -Nru a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/m32r_sio.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,53 @@ +/* + * arch/m32r/boot/compressed/m32r_sio.c + * + * 2003-02-12: Takeo Takahashi + * + */ + +#include +#include +#include + +void putc(char c); + +int puts(const char *s) +{ + char c; + while ((c = *s++)) putc(c); + return 0; +} + +#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) +#define USE_FPGA_MAP 0 + +#if USE_FPGA_MAP +/* + * fpga configuration program uses MMU, and define map as same as + * M32104 uT-Engine board. + */ +#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006) +#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c) +#else +#undef PLD_BASE +#define PLD_BASE 0xa4c00000 +#define BOOT_SIO0STS PLD_ESIO0STS +#define BOOT_SIO0TXB PLD_ESIO0TXB +#endif + +void putc(char c) +{ + + while ((*BOOT_SIO0STS & 0x3) != 0x3) ; + if (c == '\n') { + *BOOT_SIO0TXB = '\r'; + while ((*BOOT_SIO0STS & 0x3) != 0x3) ; + } + *BOOT_SIO0TXB = c; +} +#else +void putc(char c) +{ + /* do nothing */ +} +#endif diff -Nru a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/misc.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,223 @@ +/* + * arch/m32r/boot/compressed/misc.c + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * + * Adapted for SH by Stuart Menefy, Aug 1999 + * + * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000 + * + * 2003-02-12: Support M32R by Takeo Takahashi + * This is based on arch/sh/boot/compressed/misc.c. + */ + +#include +#include + +/* + * gzip declarations + */ + +#define OF(args) args +#define STATIC static + +#undef memset +#undef memcpy +#define memzero(s, n) memset ((s), 0, (n)) + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + +#define WSIZE 0x8000 /* Window size must be at least 32k, */ + /* and a power of two */ + +static uch *inbuf; /* input buffer */ +static uch window[WSIZE]; /* Sliding window buffer */ + +static unsigned insize; /* valid bytes in inbuf */ +static unsigned inptr; /* index of next byte to be processed in inbuf */ +static unsigned outcnt; /* bytes in output buffer */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + +/* Diagnostic functions */ +#ifdef DEBUG +# define Assert(cond,msg) {if(!(cond)) error(msg);} +# define Trace(x) fprintf x +# define Tracev(x) {if (verbose) fprintf x ;} +# define Tracevv(x) {if (verbose>1) fprintf x ;} +# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} +# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +static int fill_inbuf(void); +static void flush_window(void); +static void error(char *m); +static void gzip_mark(void **); +static void gzip_release(void **); + +extern char input_data[]; +extern int input_len; + +static long bytes_out; +static uch *output_data; +static unsigned long output_ptr; + + +static void *malloc(int size); +static void free(void *where); +static void error(char *m); +static void gzip_mark(void **); +static void gzip_release(void **); + +extern int puts(const char *); + +extern int _text; /* Defined in vmlinux.lds.S */ +extern int _end; +static unsigned long free_mem_ptr; +static unsigned long free_mem_end_ptr; + +#define HEAP_SIZE 0x10000 + +#include "../../../../lib/inflate.c" + +static void *malloc(int size) +{ + void *p; + + if (size <0) error("Malloc error\n"); + if (free_mem_ptr == 0) error("Memory error\n"); + + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + + p = (void *)free_mem_ptr; + free_mem_ptr += size; + + if (free_mem_ptr >= free_mem_end_ptr) + error("\nOut of memory\n"); + + return p; +} + +static void free(void *where) +{ /* Don't care */ +} + +static void gzip_mark(void **ptr) +{ + *ptr = (void *) free_mem_ptr; +} + +static void gzip_release(void **ptr) +{ + free_mem_ptr = (long) *ptr; +} + +void* memset(void* s, int c, size_t n) +{ + int i; + char *ss = (char*)s; + + for (i=0;i> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} + +static void error(char *x) +{ + puts("\n\n"); + puts(x); + puts("\n\n -- System halted"); + + while(1); /* Halt */ +} + +#define STACK_SIZE (4096) +long user_stack [STACK_SIZE]; +long* stack_start = &user_stack[STACK_SIZE]; + +/* return decompressed size */ +long decompress_kernel(void) +{ + insize = 0; + inptr = 0; + bytes_out = 0; + outcnt = 0; + output_data = 0; + output_ptr = CONFIG_MEMORY_START + 0x2000; + free_mem_ptr = (unsigned long)&_end; + free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; + + makecrc(); + puts("Uncompressing Linux... "); + gunzip(); + puts("Ok, booting the kernel.\n"); + return bytes_out; +} diff -Nru a/arch/m32r/boot/compressed/vmlinux.lds.S b/arch/m32r/boot/compressed/vmlinux.lds.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/vmlinux.lds.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,23 @@ +#include + +OUTPUT_ARCH(m32r) +ENTRY(startup) +SECTIONS +{ + . = CONFIG_MEMORY_START + 0x00400000; + + _text = .; + .text : { *(.text) } = 0 + .rodata : { *(.rodata) } + _etext = .; + + . = ALIGN(32) + (. & (32 - 1)); + .data : { *(.data) } + _edata = .; + + . = ALIGN(32 / 8); + __bss_start = .; + .bss : { *(.bss) } + . = ALIGN(32 / 8); + _end = . ; +} diff -Nru a/arch/m32r/boot/compressed/vmlinux.scr b/arch/m32r/boot/compressed/vmlinux.scr --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/vmlinux.scr 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,9 @@ +SECTIONS +{ + .data : { + input_len = .; + LONG(input_data_end - input_data) input_data = .; + *(.data) + input_data_end = .; + } +} diff -Nru a/arch/m32r/boot/setup.S b/arch/m32r/boot/setup.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/setup.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,162 @@ +/* + * linux/arch/m32r/boot/setup.S -- A setup code. + * + * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * and Hitoshi Yamamoto + * + */ +/* $Id$ */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * References to members of the boot_cpu_data structure. + */ + +#define CPU_PARAMS boot_cpu_data +#define M32R_MCICAR 0xfffffff0 +#define M32R_MCDCAR 0xfffffff4 +#define M32R_MCCR 0xfffffffc +#define M32R_BSCR0 0xffffffd2 + +;BSEL +#define BSEL0CR0 0x00ef5000 +#define BSEL0CR1 0x00ef5004 +#define BSEL1CR0 0x00ef5100 +#define BSEL1CR1 0x00ef5104 +#define BSEL0CR0_VAL 0x00000000 +#define BSEL0CR1_VAL 0x01200100 +#define BSEL1CR0_VAL 0x01018000 +#define BSEL1CR1_VAL 0x00200001 + +;SDRAMC +#define SDRAMC_SDRF0 0x00ef6000 +#define SDRAMC_SDRF1 0x00ef6004 +#define SDRAMC_SDIR0 0x00ef6008 +#define SDRAMC_SDIR1 0x00ef600c +#define SDRAMC_SD0ADR 0x00ef6020 +#define SDRAMC_SD0ER 0x00ef6024 +#define SDRAMC_SD0TR 0x00ef6028 +#define SDRAMC_SD0MOD 0x00ef602c +#define SDRAMC_SD1ADR 0x00ef6040 +#define SDRAMC_SD1ER 0x00ef6044 +#define SDRAMC_SD1TR 0x00ef6048 +#define SDRAMC_SD1MOD 0x00ef604c +#define SDRAM0 0x18000000 +#define SDRAM1 0x1c000000 + +/*------------------------------------------------------------------------ + * start up + */ + +/*------------------------------------------------------------------------ + * Kernel entry + */ + .section .boot, "ax" +ENTRY(boot) + +/* Set cache mode */ +#if defined(CONFIG_CHIP_XNUX2) + ldi r0, #-2 ;LDIMM (r0, M32R_MCCR) + ldi r1, #0x0101 ; cache on (with invalidation) +; ldi r1, #0x00 ; cache off + sth r1, @r0 +#elif defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) \ + || defined(CONFIG_CHIP_OPSP) + ldi r0, #-4 ;LDIMM (r0, M32R_MCCR) + ldi r1, #0x73 ; cache on (with invalidation) +; ldi r1, #0x00 ; cache off + st r1, @r0 +#else +#error unknown chip configuration +#endif + +#ifdef CONFIG_SMP + ;; if not BSP (CPU#0) goto AP_loop + seth r5, #shigh(M32R_CPUID_PORTL) + ld r5, @(low(M32R_CPUID_PORTL), r5) + bnez r5, AP_loop +#if !defined(CONFIG_PLAT_USRV) + ;; boot AP + ld24 r5, #0xeff2f8 ; IPICR7 + ldi r6, #0x2 ; IPI to CPU1 + st r6, @r5 +#endif +#endif + +/* + * Now, Jump to stext + * if with MMU, TLB on. + * if with no MMU, only jump. + */ + .global eit_vector +mmu_on: + LDIMM (r13, stext) +#ifdef CONFIG_MMU + bl init_tlb + LDIMM (r2, eit_vector) ; set EVB(cr5) + mvtc r2, cr5 + seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher + or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower + ldi r1, #0x01 + st r1, @(MATM_offset,r0) ; Set MATM (T bit ON) + ld r0, @(MATM_offset,r0) ; Check +#else + seth r0,#high(M32R_MCDCAR) + or3 r0,r0,#low(M32R_MCDCAR) + ld24 r1,#0x8080 + st r1,@r0 +#endif /* CONFIG_MMU */ + jmp r13 + nop + nop + +#ifdef CONFIG_SMP +/* + * AP wait loop + */ +ENTRY(AP_loop) + ;; disable interrupt + clrpsw #0x40 + ;; reset EVB + LDIMM (r4, _AP_RE) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + mvtc r4, cr5 + ;; disable maskable interrupt + seth r4, #high(M32R_ICU_IMASK_PORTL) + or3 r4, r4, #low(M32R_ICU_IMASK_PORTL) + ldi r5, #0 + st r5, @r4 + ld r5, @r4 + ;; enable only IPI + setpsw #0x40 + ;; LOOOOOOOOOOOOOOP!!! + .fillinsn +2: + nop + nop + bra 2b + nop + nop + +#ifdef CONFIG_CHIP_M32700_TS1 + .global dcache_dummy + .balign 16, 0 +dcache_dummy: + .byte 16 +#endif /* CONFIG_CHIP_M32700_TS1 */ +#endif /* CONFIG_SMP */ + + .end + diff -Nru a/arch/m32r/defconfig b/arch/m32r/defconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/defconfig 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,635 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set + +# +# SCSI low-level drivers +# +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_SATA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_DEBUG is not set + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/drivers/Kconfig b/arch/m32r/drivers/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/Kconfig 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,34 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +menu "M32R drivers" + +config M32RPCC + bool "M32R PCMCIA I/F" + depends on CHIP_M32700 + +config M32R_CFC + bool "CF I/F Controller" + depends on PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT + +config M32700UT_CFC + bool + depends on M32R_CFC + default y + +config CFC_NUM + int "CF I/F number" + depends on PLAT_USRV || PLAT_M32700UT + default "1" if PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT + +config MTD_M32R + bool "Flash device mapped on M32R" + depends on PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 + +config M32700UT_DS1302 + bool "DS1302 Real Time Clock support" + depends on PLAT_M32700UT || PLAT_OPSPUT + +endmenu diff -Nru a/arch/m32r/drivers/Makefile b/arch/m32r/drivers/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,7 @@ +# +# Makefile for the Linux/M32R driver +# + +obj-$(CONFIG_M32RPCC) += m32r_pcc.o +obj-$(CONFIG_M32R_CFC) += m32r_cfc.o +obj-$(CONFIG_M32700UT_DS1302) += ds1302.o diff -Nru a/arch/m32r/drivers/cs_internal.h b/arch/m32r/drivers/cs_internal.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/cs_internal.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,2 @@ +#include "../../../drivers/pcmcia/cs_internal.h" + diff -Nru a/arch/m32r/drivers/ds1302.c b/arch/m32r/drivers/ds1302.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/ds1302.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,432 @@ +/*!*************************************************************************** +*! +*! FILE NAME : ds1302.c +*! +*! DESCRIPTION: Implements an interface for the DS1302 RTC through Etrax I/O +*! +*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status +*! +*! $Log: ds1302.c,v $ +*! Revision 1.2 2003/10/29 08:42:58 fujiwara +*! Set PLD_RTCBAUR from bus clock +*! +*! Revision 1.12 2002/04/10 15:35:25 johana +*! Moved probe function closer to init function and marked it __init. +*! +*! Revision 1.11 2001/06/14 12:35:52 jonashg +*! The ATA hack is back. It is unfortunately the only way to set g27 to output. +*! +*! Revision 1.9 2001/06/14 10:00:14 jonashg +*! No need for tempudelay to be inline anymore (had to adjust the usec to +*! loops conversion because of this to make it slow enough to be a udelay). +*! +*! Revision 1.8 2001/06/14 08:06:32 jonashg +*! Made tempudelay delay usecs (well, just a tad more). +*! +*! Revision 1.7 2001/06/13 14:18:11 jonashg +*! Only allow processes with SYS_TIME capability to set time and charge. +*! +*! Revision 1.6 2001/06/12 15:22:07 jonashg +*! * Made init function __init. +*! * Parameter to out_byte() is unsigned char. +*! * The magic number 42 has got a name. +*! * Removed comment about /proc (nothing is exported there). +*! +*! Revision 1.5 2001/06/12 14:35:13 jonashg +*! Gave the module a name and added it to printk's. +*! +*! Revision 1.4 2001/05/31 14:53:40 jonashg +*! Made tempudelay() inline so that the watchdog doesn't reset (see +*! function comment). +*! +*! Revision 1.3 2001/03/26 16:03:06 bjornw +*! Needs linux/config.h +*! +*! Revision 1.2 2001/03/20 19:42:00 bjornw +*! Use the ETRAX prefix on the DS1302 options +*! +*! Revision 1.1 2001/03/20 09:13:50 magnusmn +*! Linux 2.4 port +*! +*! Revision 1.10 2000/07/05 15:38:23 bjornw +*! Dont update kernel time when a RTC_SET_TIME is done +*! +*! Revision 1.9 2000/03/02 15:42:59 macce +*! * Hack to make RTC work on all 2100/2400 +*! +*! Revision 1.8 2000/02/23 16:59:18 torbjore +*! added setup of R_GEN_CONFIG when RTC is connected to the generic port. +*! +*! Revision 1.7 2000/01/17 15:51:43 johana +*! Added RTC_SET_CHARGE ioctl to enable trickle charger. +*! +*! Revision 1.6 1999/10/27 13:19:47 bjornw +*! Added update_xtime_from_cmos which reads back the updated RTC into the kernel. +*! /dev/rtc calls it now. +*! +*! Revision 1.5 1999/10/27 12:39:37 bjornw +*! Disabled superuser check. Anyone can now set the time. +*! +*! Revision 1.4 1999/09/02 13:27:46 pkj +*! Added shadow for R_PORT_PB_CONFIG. +*! Renamed port_g_shadow to port_g_data_shadow. +*! +*! Revision 1.3 1999/09/02 08:28:06 pkj +*! Made it possible to select either port PB or the generic port for the RST +*! signal line to the DS1302 RTC. +*! Also make sure the RST bit is configured as output on Port PB (if used). +*! +*! Revision 1.2 1999/09/01 14:47:20 bjornw +*! Added support for /dev/rtc operations with ioctl RD_TIME and SET_TIME to read +*! and set the date. Register as major 121. +*! +*! Revision 1.1 1999/09/01 09:45:29 bjornw +*! Implemented a DS1302 RTC driver. +*! +*! +*! --------------------------------------------------------------------------- +*! +*! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN +*! +*! $Id: ds1302.c,v 1.2 2003/10/29 08:42:58 fujiwara Exp $ +*! +*!***************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define RTC_MAJOR_NR 121 /* local major, change later */ + +static const char ds1302_name[] = "ds1302"; + +/* Send 8 bits. */ +static void +out_byte_rtc(unsigned int reg_addr, unsigned char x) +{ + //RST H + outw(0x0001,(unsigned long)PLD_RTCRSTODT); + //write data + outw(((x<<8)|(reg_addr&0xff)),(unsigned long)PLD_RTCWRDATA); + //WE + outw(0x0002,(unsigned long)PLD_RTCCR); + //wait + while(inw((unsigned long)PLD_RTCCR)); + + //RST L + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + +} + +static unsigned char +in_byte_rtc(unsigned int reg_addr) +{ + unsigned char retval; + + //RST H + outw(0x0001,(unsigned long)PLD_RTCRSTODT); + //write data + outw((reg_addr&0xff),(unsigned long)PLD_RTCRDDATA); + //RE + outw(0x0001,(unsigned long)PLD_RTCCR); + //wait + while(inw((unsigned long)PLD_RTCCR)); + + //read data + retval=(inw((unsigned long)PLD_RTCRDDATA) & 0xff00)>>8; + + //RST L + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + + return retval; +} + +/* Enable writing. */ + +static void +ds1302_wenable(void) +{ + out_byte_rtc(0x8e,0x00); +} + +/* Disable writing. */ + +static void +ds1302_wdisable(void) +{ + out_byte_rtc(0x8e,0x80); +} + + + +/* Read a byte from the selected register in the DS1302. */ + +unsigned char +ds1302_readreg(int reg) +{ + unsigned char x; + + x=in_byte_rtc((0x81 | (reg << 1))); /* read register */ + + return x; +} + +/* Write a byte to the selected register. */ + +void +ds1302_writereg(int reg, unsigned char val) +{ + ds1302_wenable(); + out_byte_rtc((0x80 | (reg << 1)),val); + ds1302_wdisable(); +} + +void +get_rtc_time(struct rtc_time *rtc_tm) +{ + unsigned long flags; + + local_irq_save(flags); + local_irq_disable(); + + rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); + rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); + rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); + rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); + rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); + rtc_tm->tm_year = CMOS_READ(RTC_YEAR); + + local_irq_restore(flags); + + BCD_TO_BIN(rtc_tm->tm_sec); + BCD_TO_BIN(rtc_tm->tm_min); + BCD_TO_BIN(rtc_tm->tm_hour); + BCD_TO_BIN(rtc_tm->tm_mday); + BCD_TO_BIN(rtc_tm->tm_mon); + BCD_TO_BIN(rtc_tm->tm_year); + + /* + * Account for differences between how the RTC uses the values + * and how they are defined in a struct rtc_time; + */ + + if (rtc_tm->tm_year <= 69) + rtc_tm->tm_year += 100; + + rtc_tm->tm_mon--; +} + +static unsigned char days_in_mo[] = + {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +/* ioctl that supports RTC_RD_TIME and RTC_SET_TIME (read and set time/date). */ + +static int +rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + unsigned long flags; + + switch(cmd) { + case RTC_RD_TIME: /* read the time/date from RTC */ + { + struct rtc_time rtc_tm; + + memset(&rtc_tm, 0, sizeof (struct rtc_time)); + get_rtc_time(&rtc_tm); + if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) + return -EFAULT; + return 0; + } + + case RTC_SET_TIME: /* set the RTC */ + { + struct rtc_time rtc_tm; + unsigned char mon, day, hrs, min, sec, leap_yr; + unsigned int yrs; + + if (!capable(CAP_SYS_TIME)) + return -EPERM; + + if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) + return -EFAULT; + + yrs = rtc_tm.tm_year + 1900; + mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */ + day = rtc_tm.tm_mday; + hrs = rtc_tm.tm_hour; + min = rtc_tm.tm_min; + sec = rtc_tm.tm_sec; + + + if ((yrs < 1970) || (yrs > 2069)) + return -EINVAL; + + leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400)); + + if ((mon > 12) || (day == 0)) + return -EINVAL; + + if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr))) + return -EINVAL; + + if ((hrs >= 24) || (min >= 60) || (sec >= 60)) + return -EINVAL; + + if (yrs >= 2000) + yrs -= 2000; /* RTC (0, 1, ... 69) */ + else + yrs -= 1900; /* RTC (70, 71, ... 99) */ + + BIN_TO_BCD(sec); + BIN_TO_BCD(min); + BIN_TO_BCD(hrs); + BIN_TO_BCD(day); + BIN_TO_BCD(mon); + BIN_TO_BCD(yrs); + + local_irq_save(flags); + local_irq_disable(); + CMOS_WRITE(yrs, RTC_YEAR); + CMOS_WRITE(mon, RTC_MONTH); + CMOS_WRITE(day, RTC_DAY_OF_MONTH); + CMOS_WRITE(hrs, RTC_HOURS); + CMOS_WRITE(min, RTC_MINUTES); + CMOS_WRITE(sec, RTC_SECONDS); + local_irq_restore(flags); + + /* Notice that at this point, the RTC is updated but + * the kernel is still running with the old time. + * You need to set that separately with settimeofday + * or adjtimex. + */ + return 0; + } + + case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */ + { + int tcs_val; + + if (!capable(CAP_SYS_TIME)) + return -EPERM; + + if(copy_from_user(&tcs_val, (int*)arg, sizeof(int))) + return -EFAULT; + + tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F); + ds1302_writereg(RTC_TRICKLECHARGER, tcs_val); + return 0; + } + default: + return -EINVAL; + } +} + +int +get_rtc_status(char *buf) +{ + char *p; + struct rtc_time tm; + + p = buf; + + get_rtc_time(&tm); + + /* + * There is no way to tell if the luser has the RTC set for local + * time or for Universal Standard Time (GMT). Probably local though. + */ + + p += sprintf(p, + "rtc_time\t: %02d:%02d:%02d\n" + "rtc_date\t: %04d-%02d-%02d\n", + tm.tm_hour, tm.tm_min, tm.tm_sec, + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); + + return p - buf; +} + + +/* The various file operations we support. */ + +static struct file_operations rtc_fops = { + .owner = THIS_MODULE, + .ioctl = rtc_ioctl, +}; + +/* Probe for the chip by writing something to its RAM and try reading it back. */ + +#define MAGIC_PATTERN 0x42 + +static int __init +ds1302_probe(void) +{ + int retval, res, baur; + + baur=(boot_cpu_data.bus_clock/(2*1000*1000)); + + printk("%s: Set PLD_RTCBAUR = %d\n", ds1302_name,baur); + + outw(0x0000,(unsigned long)PLD_RTCCR); + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + outw(baur,(unsigned long)PLD_RTCBAUR); + + /* Try to talk to timekeeper. */ + + ds1302_wenable(); + /* write RAM byte 0 */ + /* write something magic */ + out_byte_rtc(0xc0,MAGIC_PATTERN); + + /* read RAM byte 0 */ + if((res = in_byte_rtc(0xc1)) == MAGIC_PATTERN) { + char buf[100]; + ds1302_wdisable(); + printk("%s: RTC found.\n", ds1302_name); + get_rtc_status(buf); + printk(buf); + retval = 1; + } else { + printk("%s: RTC not found.\n", ds1302_name); + retval = 0; + } + + return retval; +} + + +/* Just probe for the RTC and register the device to handle the ioctl needed. */ + +int __init +ds1302_init(void) +{ + if (!ds1302_probe()) { + return -1; + } + return 0; +} + +static int __init ds1302_register(void) +{ + ds1302_init(); + if (register_chrdev(RTC_MAJOR_NR, ds1302_name, &rtc_fops)) { + printk(KERN_INFO "%s: unable to get major %d for rtc\n", + ds1302_name, RTC_MAJOR_NR); + return -1; + } + return 0; +} + +module_init(ds1302_register); diff -Nru a/arch/m32r/drivers/m32r-pldsio.c b/arch/m32r/drivers/m32r-pldsio.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r-pldsio.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,3067 @@ +/* $Id$ + * + * M32R onboard PLD serial module support. + * + * Much of the design and some of the code came from serial.c: + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, + * 1998, 1999 Theodore Ts'o + * + * M32R work: + * Copyright 1996, 2001, Mitsubishi Electric Corporation + * Copyright (C) 2000,2001 by Hiro Kondo, Hiro Takata, and Hitoshi Yamamoto. + * + * 2002-12-25: Support M32700UT Platform by Takeo Takahashi + * Derived from dbg_console.c. + */ + +static char *serial_version = "kondo"; +static char *serial_revdate = "2002-09-11"; +static char *serial_name = "M32R Serial driver"; + +#define LOCAL_VERSTRING "" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* serial_state */ +#include /* kmalloc */ + +#include +#include +#include +#include +#include + +extern struct console console_for_debug; + +static int psio_write(struct tty_struct *tty, int from_user, + const unsigned char *buf, int count); +static int psio_write_room(struct tty_struct *tty); +static int psio_chars_in_buffer(struct tty_struct *tty); + +static void dbg_console_write(struct console *, const char *, unsigned); +static kdev_t dbg_console_device(struct console *c); +//static void psio_interrupt_single(int, void *, struct pt_regs *); +void psio_interrupt_single(int, void *, struct pt_regs *); +static void psio_receive_chars(struct async_struct *, int *); + +static void psio_wait_until_sent(struct tty_struct *, int); +static void change_speed(struct async_struct *,struct termios *); +static void autoconfig(struct serial_state *); +static unsigned detect_uart_irq (struct serial_state *); + +static struct tty_driver psio_driver; +static int psio_refcount; + +#define RS_STROBE_TIME (10*HZ) +#define RS_ISR_PASS_LIMIT 256 + +/* number of characters left in xmit buffer before we ask for more */ +#define WAKEUP_CHARS 256 + +static struct async_struct *IRQ_ports[NR_IRQS]; +static int IRQ_timeout[NR_IRQS]; +#ifdef CONFIG_SERIAL_CONSOLE +static struct console cons; +static int lsr_break_flag; +#endif + +#define BAUDRATE 115200 /* Set Baudrate */ + +/* + * Here we define the default xmit fifo size used for each type of + * UART + */ +static struct serial_uart_config uart_config[] = { + { "unknown", 1, 0 }, + { "8250", 1, 0 }, + { "16450", 1, 0 }, + { "16550", 1, 0 }, + { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, + { "cirrus", 1, 0 }, /* usurped by cyclades.c */ + { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH }, + { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO}, + { "Startech", 1, 0}, /* usurped by cyclades.c */ + { "16C950/954", 128, UART_CLEAR_FIFO | UART_USE_FIFO}, + { "ST16654", 64, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "XR16850", 128, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "RSA", 2048, UART_CLEAR_FIFO | UART_USE_FIFO }, + { "m32102", 1, 0 }, + { 0, 0} +}; + +static struct serial_state rs_table[RS_TABLE_SIZE] = { +/* UART CLK PORT IRQ FLAGS */ + { 0, BAUDRATE, ((int)PLD_ESIO0CR + NONCACHE_OFFSET), PLD_IRQ_SIO0_RCV, STD_COM_FLAGS }, +}; +#define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state)) + + +#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) + +static DECLARE_TASK_QUEUE(tq_psio_serial); +static struct tty_struct *psio_table[NR_PORTS]; +static struct termios *psio_termios[NR_PORTS]; +static struct termios *psio_termios_locked[NR_PORTS]; + +#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) +#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ + kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s +) +#else +#define DBG_CNT(s) +#endif + + +static struct timer_list serial_timer; + +static unsigned char *tmp_buf; +#ifdef DECLARE_MUTEX +static DECLARE_MUTEX(tmp_buf_sem); +#else +static struct semaphore tmp_buf_sem = MUTEX; +#endif + +static int dbg_console_setup(struct console *console, char *options); + +#undef SIO0CR +#undef SIO0MOD0 +#undef SIO0MOD1 +#undef SIO0STS +#undef SIO0IMASK +#undef SIO0BAUR +#undef SIO0TXB +#undef SIO0RXB +#define SIO0CR PLD_ESIO0CR +#define SIO0MOD0 PLD_ESIO0MOD0 +#define SIO0MOD1 PLD_ESIO0MOD1 +#define SIO0STS PLD_ESIO0STS +#define SIO0IMASK PLD_ESIO0INTCR +#define SIO0BAUR PLD_ESIO0BAUR +#define SIO0TXB PLD_ESIO0TXB +#define SIO0RXB PLD_ESIO0RXB + +#define SIO_IMASK_TEMPIE (1UL<<1) /* b14: enable */ +#define SIO_IMASK_RXCEN (1UL<<2) /* b13: enable */ +#define SIO_IMASK_REIE (0UL) +#define SIO_SIO0STS_TEMP (1UL<<0) /* Transmitter Register Empty */ +#define SIO_SIO0STS_TXCP (1UL<<1) +#define SIO_SIO0STS_RXCP (1UL<<2) +#define SIO_SIO0STS_OERR (0UL) +#define SIO_SIO0STS_PERR (0UL) +#define SIO_SIO0STS_FERR (0UL) +#define SIO_SIO0MOD0_CTSS (1UL<<6) +#define SIO_SIO0MOD0_RTSS (1UL<<7) +#define SIO_NONE (0UL) + +#define UART_TX ((unsigned char *)SIO0TXB - (unsigned char *)SIO0CR) +#define UART_RX ((unsigned char *)SIO0RXB - (unsigned char *)SIO0CR) +#define UART_IER ((unsigned char *)SIO0IMASK - (unsigned char *)SIO0CR) +#define UART_IER_THRI SIO_IMASK_TEMPIE +#define UART_IER_MSI SIO_NONE +#define UART_IER_RLSI SIO_IMASK_RXCEN +#define UART_IER_RDI SIO_IMASK_REIE +#define UART_LSR ((unsigned char *)SIO0STS - (unsigned char *)SIO0CR) +#define UART_LSR_DR SIO_SIO0STS_RXCP +#define UART_LSR_THRE SIO_SIO0STS_TEMP +#define UART_LSR_TEMT SIO_SIO0STS_TXCP +#define UART_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) +#define UART_LSR_BI SIO_NONE +#define UART_LSR_PE SIO_SIO0STS_PERR +#define UART_LSR_FE SIO_SIO0STS_FERR +#define UART_LSR_OE SIO_SIO0STS_OERR +#define UART_IIR ((unsigned char *)SIO0STS - (unsigned char *)SIO0CR) +#define UART_LCR ((unsigned char *)SIO0CR - (unsigned char *)SIO0CR) +#define UART_LCR_SBC SIO_NONE +#define UART_LCR_PARITY SIO_NONE +#define UART_LCR_EPAR SIO_NONE +#define UART_LCR_SPAR SIO_NONE +#define UART_MCR ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MCR_RTS SIO_SIO0MOD0_RTSS +#define UART_MCR_DTR SIO_NONE /* SIO_SIO0MOD0_CTSS */ +#define UART_MCR_LOOP SIO_NONE +#define UART_MCR_OUT1 SIO_NONE +#define UART_MCR_OUT2 SIO_NONE +#define UART_MSR ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MSR_DCD SIO_NONE +#define UART_MSR_RI SIO_NONE +#define UART_MSR_DSR SIO_NONE +#define UART_MSR_CTS SIO_NONE + +#define UART_BAUR ((unsigned char *)SIO0BAUR - (unsigned char *)SIO0CR) +#define UART_MOD0 ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MOD1 ((unsigned char *)SIO0MOD1 - (unsigned char *)SIO0CR) + +static inline unsigned int psio_in(struct async_struct *info,int offset) +{ + return *(volatile unsigned short *)(info->port + offset); +} +static inline void psio_out(struct async_struct *info,int offset,int value) +{ + *(volatile unsigned short *)(info->port + offset) = value; +} + +#define serial_in(info, offset) psio_in(info,(int)offset) +#define serial_out(info, offset, value) psio_out(info,(int)offset, value) +#define serial_inp(info, offset) psio_in(info,(int)offset) +#define serial_outp(info, offset, value) psio_out(info,(int)offset, value) + + +static inline int serial_paranoia_check(struct async_struct *info, + kdev_t device, const char *routine) +{ +#ifdef SERIAL_PARANOIA_CHECK + static const char *badmagic = + "Warning: bad magic number for serial struct (%s) in %s\n"; + static const char *badinfo = + "Warning: null async_struct for (%s) in %s\n"; + + if (!info) { + printk(badinfo, kdevname(device), routine); + return 1; + } + if (info->magic != SERIAL_MAGIC) { + printk(badmagic, kdevname(device), routine); + return 1; + } +#endif + return 0; +} + +/* + * ------------------------------------------------------------ + * psio_stop() and psio_start() + * + * This routines are called before setting or resetting tty->stopped. + * They enable or disable transmitter interrupts, as necessary. + * ------------------------------------------------------------ + */ +static void psio_stop(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_stop")) + return; + + save_flags(flags); cli(); + if (info->IER & UART_IER_THRI) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + } + restore_flags(flags); + +} + +static void psio_start(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_start")) + return; + + save_flags(flags); cli(); + if (info->xmit.head != info->xmit.tail + && info->xmit.buf + && !(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); +} + + +/* + * This routine is used by the interrupt handler to schedule + * processing in the software interrupt portion of the driver. + */ +static inline void psio_sched_event(struct async_struct *info,int event) +{ + info->event |= 1 << event; + queue_task(&info->tqueue, &tq_psio_serial); + mark_bh(SERIAL_BH); +} + +static inline void psio_receive_chars(struct async_struct *info,int *status) +{ + struct tty_struct *tty = info->tty; + unsigned char ch; + struct async_icount *icount; + int max_count = 256; + + icount = &info->state->icount; + do { + if (tty->flip.count >= TTY_FLIPBUF_SIZE) { + tty->flip.tqueue.routine((void *) tty); + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + return; // if TTY_DONT_FLIP is set + } + ch = serial_inp(info, UART_RX); + *tty->flip.char_buf_ptr = ch; + icount->rx++; + +#ifdef SERIAL_DEBUG_INTR + printk("DR%02x:%02x...", ch, *status); +#endif + *tty->flip.flag_buf_ptr = 0; + if (*status & (UART_LSR_BI | UART_LSR_PE | + UART_LSR_FE | UART_LSR_OE)) { + /* + * For statistics only + */ + if (*status & UART_LSR_BI) { + *status &= ~(UART_LSR_FE | UART_LSR_PE); + icount->brk++; + /* + * We do the SysRQ and SAK checking + * here because otherwise the break + * may get masked by ignore_status_mask + * or read_status_mask. + */ +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (info->line == cons.index) { + if (!break_pressed) { + break_pressed = jiffies; + goto ignore_char; + } + break_pressed = 0; + } +#endif + if (info->flags & ASYNC_SAK) + do_SAK(tty); + } else if (*status & UART_LSR_PE) + icount->parity++; + else if (*status & UART_LSR_FE) + icount->frame++; + if (*status & UART_LSR_OE) + icount->overrun++; + + /* + * Mask off conditions which should be ignored. + */ + *status &= info->read_status_mask; + +#ifdef CONFIG_SERIAL_CONSOLE + if (info->line == cons.index) { + /* Recover the break flag from console xmit */ + *status |= lsr_break_flag; + lsr_break_flag = 0; + } +#endif + if (*status & (UART_LSR_BI)) { +#ifdef SERIAL_DEBUG_INTR + printk("handling break...."); +#endif + *tty->flip.flag_buf_ptr = TTY_BREAK; + } else if (*status & UART_LSR_PE) + *tty->flip.flag_buf_ptr = TTY_PARITY; + else if (*status & UART_LSR_FE) + *tty->flip.flag_buf_ptr = TTY_FRAME; + } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (break_pressed && info->line == cons.index) { + if (ch != 0 && + time_before(jiffies, break_pressed + HZ*5)) { + handle_sysrq(ch, regs, NULL, NULL); + break_pressed = 0; + goto ignore_char; + } + break_pressed = 0; + } +#endif + if ((*status & info->ignore_status_mask) == 0) { + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + tty->flip.count++; + } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + ignore_char: +#endif + *status = serial_inp(info, UART_LSR); + } while ((*status & UART_LSR_DR) && (max_count-- > 0)); +#if (LINUX_VERSION_CODE > 131394) /* 2.1.66 */ + tty_flip_buffer_push(tty); +#else + queue_task_irq_off(&tty->flip.tqueue, &tq_timer); +#endif +} + +static void transmit_chars(struct async_struct *info, int *intr_done) +{ + int count; + + if (info->x_char) { + // for M32102 serial + // serial_outp(info, UART_TX, info->x_char); + info->state->icount.tx++; + info->x_char = 0; + if (intr_done) + *intr_done = 0; + while((serial_in(info,UART_LSR) & UART_LSR_TEMT) == 0); + return; + } + if (info->xmit.head == info->xmit.tail + || info->tty->stopped + || info->tty->hw_stopped) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + return; + } + count = info->xmit_fifo_size; + count = SERIAL_XMIT_SIZE-1; + do { + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + + if (info->xmit.head == info->xmit.tail) + break; + + while((serial_in(info,UART_LSR) & UART_LSR_THRE) == 0); + } while (--count > 0); + while((serial_in(info,UART_LSR) & UART_LSR_TEMT) == 0); + + if (CIRC_CNT(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE) < WAKEUP_CHARS) + psio_sched_event(info, RS_EVENT_WRITE_WAKEUP); + +#ifdef SERIAL_DEBUG_INTR + printk("THRE..."); +#endif + if (intr_done) + *intr_done = 0; + + if (info->xmit.head == info->xmit.tail) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + } +} + + +/* + +#ifdef CONFIG_SERIAL_SHARE_IRQ +static void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) +#endif +*/ + +static void sio_reset(struct async_struct *info) +{ + unsigned int dummy; + /* reset sio */ + /* read receive buffer */ + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_LSR); + serial_outp(info, UART_LCR, 0x0300); /* RSCLR:1, TSCLR:1 */ + serial_outp(info, UART_LCR, 0x0003); /* RSEN:1, TXEN:1 */ +} + +static void sio_error(struct async_struct *info,int status) +{ + unsigned int dummy; + /* reset sio */ + printk("sio[%d] error[%04x]\n", info->line,status); + /* read receive buffer */ + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_LSR); + serial_outp(info, UART_LCR, 0x0300); /* RSCLR:1, TSCLR:1 */ + serial_outp(info, UART_LCR, 0x0003); /* RSEN:1, TXEN:1 */ +} + +//static void psio_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) +void psio_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) +{ + int status; + // int pass_counter = 0; + struct async_struct * info; + +#ifdef CONFIG_SERIAL_MULTIPORT + int first_multi = 0; + struct rs_multiport_struct *multi; +#endif + +#ifdef SERIAL_DEBUG_INTR + printk("psio_interrupt_single(%d)...", irq); +#endif + + info = IRQ_ports[irq&(~1)]; + if (!info || !info->tty) + return; + +#ifdef CONFIG_SERIAL_MULTIPORT + multi = &rs_multiport[irq]; + if (multi->port_monitor) + first_multi = inb(multi->port_monitor); +#endif + + { + status = serial_inp(info, UART_LSR); +#ifdef SERIAL_DEBUG_INTR + printk("status = %x...", status); +#endif + if (status & UART_LSR_DR){ + psio_receive_chars(info, &status); + } + if ((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY) + sio_error(info, status); + if (status & UART_LSR_THRE) + transmit_chars(info, 0); +#ifdef SERIAL_DEBUG_INTR + printk("IIR = %x...", serial_in(info, UART_IIR)); +#endif + } + + info->last_active = jiffies; +#ifdef CONFIG_SERIAL_MULTIPORT + if (multi->port_monitor) + printk("rs port monitor (single) irq %d: 0x%x, 0x%x\n", + info->state->irq, first_multi, + inb(multi->port_monitor)); +#endif +#ifdef SERIAL_DEBUG_INTR + printk("end.\n"); +#endif +} +#ifdef CONFIG_SERIAL_MULTIPORT +static void rs_interrupt_multi(int irq, void *dev_id, struct pt_regs * regs) +{} +#endif + +static void do_psio_serial_bh(void) +{ + run_task_queue(&tq_psio_serial); +} + +static void do_softint(void *private_) +{ + struct async_struct *info = (struct async_struct *) private_; + struct tty_struct *tty; + + tty = info->tty; + if (!tty) + return; + + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); + wake_up_interruptible(&tty->write_wait); +#ifdef SERIAL_HAVE_POLL_WAIT + wake_up_interruptible(&tty->poll_wait); +#endif + } +} + +static void psio_timer(void) +{ + static unsigned long last_strobe = 0; + struct async_struct *info; + unsigned int i; + unsigned long flags; + + if ((jiffies - last_strobe) >= RS_STROBE_TIME) { + for (i=0; i < NR_IRQS; i++) { + info = IRQ_ports[i]; + if (!info) + continue; + save_flags(flags); cli(); + psio_interrupt_single(i, NULL, NULL); + restore_flags(flags); + } + } + last_strobe = jiffies; + +#if 1 + mod_timer(&serial_timer, jiffies + 10); +#else + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME); +#endif + + if (IRQ_ports[0]) { + save_flags(flags); cli(); +#ifdef CONFIG_SERIAL_SHARE_IRQ + psio_interrupt(0, NULL, NULL); +#else + psio_interrupt_single(0, NULL, NULL); +#endif + restore_flags(flags); + + mod_timer(&serial_timer, jiffies + IRQ_timeout[0]); + } +} + +/* + * --------------------------------------------------------------- + * Low level utility subroutines for the serial driver: routines to + * figure out the appropriate timeout for an interrupt chain, routines + * to initialize and startup a serial port, and routines to shutdown a + * serial port. Useful stuff like that. + * --------------------------------------------------------------- + */ + +/* + * This routine figures out the correct timeout for a particular IRQ. + * It uses the smallest timeout of all of the serial ports in a + * particular interrupt chain. Now only used for IRQ 0.... + */ +static void figure_IRQ_timeout(int irq) +{ + struct async_struct *info; + int timeout = 60*HZ; /* 60 seconds === a long time :-) */ + + info = IRQ_ports[irq]; + if (!info) { + IRQ_timeout[irq] = 60*HZ; + return; + } + while (info) { + if (info->timeout < timeout) + timeout = info->timeout; + info = info->next_port; + } + if (!irq) + timeout = timeout / 2; + IRQ_timeout[irq] = timeout ? timeout : 1; +} + +#ifdef CONFIG_SERIAL_RSA +/* Attempts to turn on the RSA FIFO. Returns zero on failure */ +static int enable_rsa(struct async_struct *info) {} + +/* Attempts to turn off the RSA FIFO. Returns zero on failure */ +static int disable_rsa(struct async_struct *info) { } +#endif /* CONFIG_SERIAL_RSA */ + +static int startup(struct async_struct * info) +{ + unsigned long flags; + int retval=0; + void (*handler)(int, void *, struct pt_regs *); + struct serial_state *state= info->state; + unsigned long page; +#ifdef CONFIG_SERIAL_MANY_PORTS + unsigned short ICP; +#endif + + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + save_flags(flags); cli(); + + if (info->flags & ASYNC_INITIALIZED) { + free_page(page); + goto errout; + } + if (info->xmit.buf) + free_page(page); + else + info->xmit.buf = (unsigned char *) page; + +#ifdef SERIAL_DEBUG_OPEN + printk("starting up ttyD%d (irq %d)...", info->line, state->irq); +#endif + + /* + * Clear the FIFO buffers and disable them + * (they will be reenabled in change_speed()) + */ + + /* + * Clear the interrupt registers. + */ + sio_reset(info); + + /* + * Allocate the IRQ if necessary + */ + if (state->irq && (!IRQ_ports[state->irq] || + !IRQ_ports[state->irq]->next_port)) { + if (IRQ_ports[state->irq]) { +#ifdef CONFIG_SERIAL_SHARE_IRQ + free_irq(state->irq, &IRQ_ports[state->irq]); + free_irq(state->irq+1, &IRQ_ports[state->irq]); +#ifdef CONFIG_SERIAL_MULTIPORT + if (rs_multiport[state->irq].port1) + handler = rs_interrupt_multi; + else +#endif + handler = psio_interrupt; +#else + retval = -EBUSY; + goto errout; +#endif /* CONFIG_SERIAL_SHARE_IRQ */ + } else + handler = psio_interrupt_single; + + /* 020116 */ + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial_rx", &IRQ_ports[state->irq]); + retval = request_irq(state->irq+1, handler, SA_SHIRQ, + "serial_tx", &IRQ_ports[state->irq]); + if (retval) { + if (capable(CAP_SYS_ADMIN)) { + if (info->tty) + set_bit(TTY_IO_ERROR, + &info->tty->flags); + retval = 0; + } + goto errout; + } + } + + /* + * Insert serial port into IRQ chain. + */ + info->prev_port = 0; + info->next_port = IRQ_ports[state->irq]; + if (info->next_port) + info->next_port->prev_port = info; + IRQ_ports[state->irq] = info; + figure_IRQ_timeout(state->irq); + + /* + * Now, initialize the UART + */ + /* for m32r @020113 */ + sio_reset(info); + + info->MCR = 0; + if (info->tty->termios->c_cflag & CBAUD) + info->MCR = UART_MCR_DTR | UART_MCR_RTS; +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + if (state->irq == 0) + info->MCR |= UART_MCR_OUT1; + } else +#endif + { + if (state->irq != 0) + info->MCR |= UART_MCR_OUT2; + } + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ + serial_outp(info, UART_MCR, info->MCR); + + /* + * Finally, enable interrupts + */ + info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; + serial_outp(info, UART_IER, info->IER); /* enable interrupts */ + +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + /* Enable interrupts on the AST Fourport board */ + ICP = (info->port & 0xFE0) | 0x01F; + outb_p(0x80, ICP); + (void) inb_p(ICP); + } +#endif + + /* + * And clear the interrupt registers again for luck. + */ + (void)serial_inp(info, UART_LSR); + (void)serial_inp(info, UART_RX); + (void)serial_inp(info, UART_IIR); + (void)serial_inp(info, UART_MSR); + + if (info->tty) + clear_bit(TTY_IO_ERROR, &info->tty->flags); + info->xmit.head = info->xmit.tail = 0; + + /* + * Set up serial timers... + */ + mod_timer(&serial_timer, jiffies + 2*HZ/100); + + /* + * Set up the tty->alt_speed kludge + */ +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + if (info->tty) { + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; + } +#endif + + /* + * and set the speed of the serial port + */ + change_speed(info, 0); + + info->flags |= ASYNC_INITIALIZED; + restore_flags(flags); + return 0; + +errout: + restore_flags(flags); + return retval; +} + +/* + * This routine will shutdown a serial port; interrupts are disabled, and + * DTR is dropped if the hangup on close termio flag is on. + */ +static void shutdown(struct async_struct * info) +{ + unsigned long flags; + struct serial_state *state; + int retval; + + if (!(info->flags & ASYNC_INITIALIZED)) + return; + + state = info->state; + +#ifdef SERIAL_DEBUG_OPEN + printk("Shutting down serial port %d (irq %d)....", info->line, + state->irq); +#endif + + save_flags(flags); cli(); /* Disable interrupts */ + + /* + * clear delta_msr_wait queue to avoid mem leaks: we may free the irq + * here so the queue might never be waken up + */ + wake_up_interruptible(&info->delta_msr_wait); + + /* + * First unlink the serial port from the IRQ chain... + */ + if (info->next_port) + info->next_port->prev_port = info->prev_port; + if (info->prev_port) + info->prev_port->next_port = info->next_port; + else + IRQ_ports[state->irq] = info->next_port; + figure_IRQ_timeout(state->irq); + + /* + * Free the IRQ, if necessary + */ + if (state->irq && (!IRQ_ports[state->irq] || + !IRQ_ports[state->irq]->next_port)) { + if (IRQ_ports[state->irq]) { + /* 020116 */ + free_irq(state->irq+1, &IRQ_ports[state->irq]); + retval = request_irq(state->irq+1, psio_interrupt_single, + SA_SHIRQ, "serial_xx", + &IRQ_ports[state->irq]); + free_irq(state->irq, &IRQ_ports[state->irq]); + retval = request_irq(state->irq, psio_interrupt_single, + SA_SHIRQ, "serial", + &IRQ_ports[state->irq]); + + if (retval) + printk("serial shutdown: request_irq: error %d" + " Couldn't reacquire IRQ.\n", retval); + } else{ + free_irq(state->irq, &IRQ_ports[state->irq]); + /* 020116 */ + free_irq(state->irq+1, &IRQ_ports[state->irq]); + } + } + if (info->xmit.buf) { + unsigned long pg = (unsigned long) info->xmit.buf; + info->xmit.buf = 0; + free_page(pg); + } + + info->IER = 0; + serial_outp(info, UART_IER, 0x00); /* disable all intrs */ +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + /* reset interrupts on the AST Fourport board */ + (void) inb((info->port & 0xFE0) | 0x01F); + info->MCR |= UART_MCR_OUT1; + } else +#endif + if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); + serial_outp(info, UART_MCR, info->MCR); + +#ifdef CONFIG_SERIAL_RSA + /* + * Reset the RSA board back to 115kbps compat mode. + */ + if ((state->type == PORT_RSA) && + (state->baud_base == SERIAL_RSA_BAUD_BASE && + disable_rsa(info))) + state->baud_base = SERIAL_RSA_BAUD_BASE_LO; +#endif + + + (void)serial_in(info, UART_RX); /* read data port to reset things */ + + if (info->tty) + set_bit(TTY_IO_ERROR, &info->tty->flags); + + sio_reset(info); + + info->flags &= ~ASYNC_INITIALIZED; + restore_flags(flags); +} + +static void change_speed(struct async_struct *info,struct termios *old_termios) +{ + int quot = 0, baud_base, baud; + unsigned cflag, cval = 0; + int bits; + unsigned long flags; + unsigned mod0, mod1; + + if (!info->tty || !info->tty->termios) + return; + cflag = info->tty->termios->c_cflag; + if (!CONFIGURED_SERIAL_PORT(info)) + return; + + /* byte size and parity */ + switch (cflag & CSIZE) { + case CS5: mod1 = 0x05; bits = 7; break; + case CS6: mod1 = 0x06; bits = 8; break; + case CS7: mod1 = 0x07; bits = 9; break; + case CS8: mod1 = 0x08; bits = 10; break; + /* Never happens, but GCC is too dumb to figure it out */ + default: mod1 = 0x05; bits = 7; break; + } + mod1 <<= 8; + mod0 = 0; + if (cflag & CSTOPB) { + mod0 |= 0x03; + bits++; + } + if (cflag & PARENB) { + mod0 |= 0x10; + bits++; + } + if (!(cflag & PARODD)) { + mod0 |= 0x4; + } + mod0 = 0x80; /* Use RTS# output only */ + + serial_outp(info, UART_MOD0, mod0); /* */ + //serial_outp(info, UART_MOD1, mod1); + //mod1 = 0; + info->LCR = mod1; /* Save LCR */ + + /* Determine divisor based on baud rate */ + baud = tty_get_baud_rate(info->tty); + if (!baud) + baud = 9600; /* B0 transition handled in rs_set_termios */ +#ifdef CONFIG_SERIAL_RSA + if ((info->state->type == PORT_RSA) && + (info->state->baud_base != SERIAL_RSA_BAUD_BASE) && + enable_rsa(info)) + info->state->baud_base = SERIAL_RSA_BAUD_BASE; +#endif + baud_base = info->state->baud_base; + + if (baud == 38400 && + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) + quot = info->state->custom_divisor; + else { + if (baud == 134) + /* Special case since 134 is really 134.5 */ + quot = (2*baud_base / 269); + else if (baud) + quot = baud_base / baud; + } + /* If the quotient is zero refuse the change */ + if (!quot && old_termios) { + info->tty->termios->c_cflag &= ~CBAUD; + info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); + baud = tty_get_baud_rate(info->tty); + if (!baud) + baud = 9600; + if (baud == 38400 && + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) + quot = info->state->custom_divisor; + else { + if (baud == 134) + /* Special case since 134 is really 134.5 */ + quot = (2*baud_base / 269); + else if (baud) + quot = baud_base / baud ; + } + } + quot = baud_base / (baud*4) ; + /* As a last resort, if the quotient is zero, default to 9600 bps */ + if (!quot) + quot = baud_base / 9600; + /* + * Work around a bug in the Oxford Semiconductor 952 rev B + * chip which causes it to seriously miscalculate baud rates + * when DLL is 0. + */ + if (((quot & 0xFF) == 0) && (info->state->type == PORT_16C950) && + (info->state->revision == 0x5201)) + quot++; + + info->quot = quot; + info->timeout = ((info->xmit_fifo_size*HZ*bits*quot) / baud_base); + info->timeout += HZ/50; /* Add .02 seconds of slop */ + + /* CTS flow control flag and modem status interrupts */ + info->IER &= ~UART_IER_MSI; + if (info->flags & ASYNC_HARDPPS_CD) + info->IER |= UART_IER_MSI; + if (cflag & CRTSCTS) { + info->flags |= ASYNC_CTS_FLOW; + info->IER |= UART_IER_MSI; + } else + info->flags &= ~ASYNC_CTS_FLOW; + if (cflag & CLOCAL) + info->flags &= ~ASYNC_CHECK_CD; + else { + info->flags |= ASYNC_CHECK_CD; + info->IER |= UART_IER_MSI; + } + serial_out(info, UART_IER, info->IER); + + /* + * Set up parity check flag + */ +#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) + + info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; + if (I_INPCK(info->tty)) + info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; + if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) + info->read_status_mask |= UART_LSR_BI; + + /* + * Characters to ignore + */ + info->ignore_status_mask = 0; + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; + if (I_IGNBRK(info->tty)) { + info->ignore_status_mask |= UART_LSR_BI; + /* + * If we're ignore parity and break indicators, ignore + * overruns too. (For real raw support). + */ + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= UART_LSR_OE; + } + /* + * !!! ignore all characters if CREAD is not set + */ + if ((cflag & CREAD) == 0) + info->ignore_status_mask |= UART_LSR_DR; + cval = (baud_base / (baud * 4)) - 1; + + save_flags(flags); cli(); + serial_outp(info, UART_BAUR, cval ); /* set baurate reg */ + serial_outp(info, UART_LCR, 0x03); + restore_flags(flags); +} + +static void psio_put_char(struct tty_struct *tty, unsigned char ch) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_put_char")) + return; + + if (!tty || !info->xmit.buf) + return; + + save_flags(flags); cli(); + if (CIRC_SPACE(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE) == 0) { + restore_flags(flags); + return; + } + + info->xmit.buf[info->xmit.head] = ch; + info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1); + restore_flags(flags); +} + +static void psio_flush_chars(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_flush_chars")) + return; + + if (info->xmit.head == info->xmit.tail + || tty->stopped + || tty->hw_stopped + || !info->xmit.buf) + return; + + save_flags(flags); cli(); + if (!(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); + while((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY); +} + +static int psio_write(struct tty_struct *tty, int from_user, + const unsigned char *buf, int count) +{ + int c, ret = 0; + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_write")) + return 0; + + if (!tty || !info->xmit.buf || !tmp_buf) + return 0; + + save_flags(flags); + if (from_user) { + down(&tmp_buf_sem); + while (1) { + int c1; + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) + break; + + c -= copy_from_user(tmp_buf, buf, c); + if (!c) { + if (!ret) + ret = -EFAULT; + break; + } + cli(); + c1 = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (c1 < c) + c = c1; + memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); + info->xmit.head = ((info->xmit.head + c) & + (SERIAL_XMIT_SIZE-1)); + restore_flags(flags); + buf += c; + count -= c; + ret += c; + } + up(&tmp_buf_sem); + } else { + cli(); + while (1) { + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) { + break; + } + memcpy(info->xmit.buf + info->xmit.head, buf, c); + info->xmit.head = ((info->xmit.head + c) & + (SERIAL_XMIT_SIZE-1)); + buf += c; + count -= c; + ret += c; + } + restore_flags(flags); + } + save_flags(flags); cli(); + if (info->xmit.head != info->xmit.tail + && !tty->stopped + && !tty->hw_stopped + && !(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); + while((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY); + return ret; +} + +static int psio_write_room(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_write_room")) + return 0; + return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); +} + +static int psio_chars_in_buffer(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_chars_in_buffer")) + return 0; + return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); +} + +static void psio_flush_buffer(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_flush_buffer")) + return; + save_flags(flags); cli(); + info->xmit.head = info->xmit.tail = 0; + restore_flags(flags); + wake_up_interruptible(&tty->write_wait); +#ifdef SERIAL_HAVE_POLL_WAIT + wake_up_interruptible(&tty->poll_wait); +#endif + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); +} + +/* + * This function is used to send a high-priority XON/XOFF character to + * the device + */ +static void psio_send_xchar(struct tty_struct *tty, char ch) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_send_char")) + return; + + info->x_char = ch; + if (ch) { + unsigned long flags; + save_flags(flags); cli(); + if (!(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->x_char); + } + restore_flags(flags); + } +} + +/* + * ------------------------------------------------------------ + * rs_throttle() + * + * This routine is called by the upper-layer tty layer to signal that + * incoming characters should be throttled. + * ------------------------------------------------------------ + */ +static void psio_throttle(struct tty_struct * tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; +#ifdef SERIAL_DEBUG_THROTTLE + char buf[64]; + + printk("throttle %s: %d....\n", tty_name(tty, buf), + tty->ldisc.chars_in_buffer(tty)); +#endif + + if (serial_paranoia_check(info, tty->device, "psio_throttle")) + return; + + if (I_IXOFF(tty)) + psio_send_xchar(tty, STOP_CHAR(tty)); + + if (tty->termios->c_cflag & CRTSCTS) + info->MCR &= ~UART_MCR_RTS; + + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); +} + +static void psio_unthrottle(struct tty_struct * tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; +#ifdef SERIAL_DEBUG_THROTTLE + char buf[64]; + + printk("unthrottle %s: %d....\n", tty_name(tty, buf), + tty->ldisc.chars_in_buffer(tty)); +#endif + + if (serial_paranoia_check(info, tty->device, "psio_unthrottle")) + return; + + if (I_IXOFF(tty)) { + if (info->x_char) info->x_char = 0; + } + if (tty->termios->c_cflag & CRTSCTS) + info->MCR |= UART_MCR_RTS; + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); +} + +/* + * ------------------------------------------------------------ + * rs_ioctl() and friends + * ------------------------------------------------------------ + */ + +static int get_serial_info(struct async_struct * info, + struct serial_struct * retinfo) +{ + struct serial_struct tmp; + struct serial_state *state = info->state; + + if (!retinfo) + return -EFAULT; + memset(&tmp, 0, sizeof(tmp)); + tmp.type = state->type; + tmp.line = state->line; + tmp.port = state->port; + if (HIGH_BITS_OFFSET) + tmp.port_high = state->port >> HIGH_BITS_OFFSET; + else + tmp.port_high = 0; + tmp.irq = state->irq; + tmp.flags = state->flags; + tmp.xmit_fifo_size = state->xmit_fifo_size; + tmp.baud_base = state->baud_base; + tmp.close_delay = state->close_delay; + tmp.closing_wait = state->closing_wait; + tmp.custom_divisor = state->custom_divisor; + tmp.hub6 = state->hub6; + tmp.io_type = state->io_type; + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) + return -EFAULT; + return 0; +} + +static int set_serial_info(struct async_struct * info, + struct serial_struct * new_info) +{ + struct serial_struct new_serial; + struct serial_state old_state, *state; + unsigned int i,change_irq,change_port; + int retval = 0; + unsigned long new_port; + + if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) + return -EFAULT; + state = info->state; + old_state = *state; + + new_port = new_serial.port; + if (HIGH_BITS_OFFSET) + new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET; + + change_irq = new_serial.irq != state->irq; + change_port = (new_port != ((int) state->port)) || + (new_serial.hub6 != state->hub6); + + if (!capable(CAP_SYS_ADMIN)) { + if (change_irq || change_port || + (new_serial.baud_base != state->baud_base) || + (new_serial.type != state->type) || + (new_serial.close_delay != state->close_delay) || + (new_serial.xmit_fifo_size != state->xmit_fifo_size) || + ((new_serial.flags & ~ASYNC_USR_MASK) != + (state->flags & ~ASYNC_USR_MASK))) + return -EPERM; + state->flags = ((state->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + info->flags = ((info->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + state->custom_divisor = new_serial.custom_divisor; + goto check_and_exit; + } + + new_serial.irq = irq_cannonicalize(new_serial.irq); + + if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || + (new_serial.baud_base < 9600)|| (new_serial.type < PORT_UNKNOWN) || + (new_serial.type > PORT_MAX) || (new_serial.type == PORT_CIRRUS) || + (new_serial.type == PORT_STARTECH)) { + return -EINVAL; + } + + if ((new_serial.type != state->type) || + (new_serial.xmit_fifo_size <= 0)) + new_serial.xmit_fifo_size = + uart_config[new_serial.type].dfl_xmit_fifo_size; + + /* Make sure address is not already in use */ + if (new_serial.type) { + for (i = 0 ; i < NR_PORTS; i++) + if ((state != &rs_table[i]) && + (rs_table[i].port == new_port) && + rs_table[i].type) + return -EADDRINUSE; + } + + if ((change_port || change_irq) && (state->count > 1)) + return -EBUSY; + + /* + * OK, past this point, all the error checking has been done. + * At this point, we start making changes..... + */ + + state->baud_base = new_serial.baud_base; + state->flags = ((state->flags & ~ASYNC_FLAGS) | + (new_serial.flags & ASYNC_FLAGS)); + info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | + (info->flags & ASYNC_INTERNAL_FLAGS)); + state->custom_divisor = new_serial.custom_divisor; + state->close_delay = new_serial.close_delay * HZ/100; + state->closing_wait = new_serial.closing_wait * HZ/100; +#if (LINUX_VERSION_CODE > 0x20100) + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; +#endif + info->xmit_fifo_size = state->xmit_fifo_size = + new_serial.xmit_fifo_size; + + if ((state->type != PORT_UNKNOWN) && state->port) { +#ifdef CONFIG_SERIAL_RSA + if (old_state.type == PORT_RSA) + release_region(state->port + UART_RSA_BASE, 16); + else +#endif + release_region(state->port,8); + } + state->type = new_serial.type; + if (change_port || change_irq) { + /* + * We need to shutdown the serial port at the old + * port/irq combination. + */ + shutdown(info); + state->irq = new_serial.irq; + info->port = state->port = new_port; + info->hub6 = state->hub6 = new_serial.hub6; + if (info->hub6) + info->io_type = state->io_type = SERIAL_IO_HUB6; + else if (info->io_type == SERIAL_IO_HUB6) + info->io_type = state->io_type = SERIAL_IO_PORT; + } + if ((state->type != PORT_UNKNOWN) && state->port) { +#ifdef CONFIG_SERIAL_RSA + if (state->type == PORT_RSA) + request_region(state->port + UART_RSA_BASE, + 16, "serial_rsa(set)"); + else +#endif + request_region(state->port,8,"serial(set)"); + } + + +check_and_exit: + if (!state->port || !state->type) + return 0; + if (info->flags & ASYNC_INITIALIZED) { + if (((old_state.flags & ASYNC_SPD_MASK) != + (state->flags & ASYNC_SPD_MASK)) || + (old_state.custom_divisor != state->custom_divisor)) { +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; +#endif + change_speed(info, 0); + } + } else + retval = startup(info); + return retval; +} + +/* + * get_lsr_info - get line status register info + * + * Purpose: Let user call ioctl() to get info when the UART physically + * is emptied. On bus types like RS485, the transmitter must + * release the bus after transmitting. This must be done when + * the transmit shift register is empty, not be done when the + * transmit holding register is empty. This functionality + * allows an RS485 driver to be written in user space. + */ +static int get_lsr_info(struct async_struct * info, unsigned int *value) +{ + unsigned char status; + unsigned int result; + unsigned long flags; + + save_flags(flags); cli(); + status = serial_in(info, UART_LSR); + restore_flags(flags); + result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); + + /* + * If we're about to load something into the transmit + * register, we'll pretend the transmitter isn't empty to + * avoid a race condition (depending on when the transmit + * interrupt happens). + */ + if (info->x_char || + ((CIRC_CNT(info->xmit.head, info->xmit.tail, + SERIAL_XMIT_SIZE) > 0) && + !info->tty->stopped && !info->tty->hw_stopped)) + result &= ~TIOCSER_TEMT; + + if (copy_to_user(value, &result, sizeof(int))) + return -EFAULT; + return 0; +} + + +static int get_modem_info(struct async_struct * info, unsigned int *value) +{ + unsigned char control, status; + unsigned int result; + unsigned long flags; + + control = info->MCR; + save_flags(flags); cli(); + status = serial_in(info, UART_MSR); + restore_flags(flags); + result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) + | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) +#ifdef TIOCM_OUT1 + | ((control & UART_MCR_OUT1) ? TIOCM_OUT1 : 0) + | ((control & UART_MCR_OUT2) ? TIOCM_OUT2 : 0) +#endif + | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) + | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) + | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) + | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); + + if (copy_to_user(value, &result, sizeof(int))) + return -EFAULT; + return 0; +} +static int set_modem_info(struct async_struct * info, unsigned int cmd, + unsigned int *value) +{ + unsigned int arg; + unsigned long flags; + + if (copy_from_user(&arg, value, sizeof(int))) + return -EFAULT; + + switch (cmd) { + case TIOCMBIS: + if (arg & TIOCM_RTS) + info->MCR |= UART_MCR_RTS; + if (arg & TIOCM_DTR) + info->MCR |= UART_MCR_DTR; +#ifdef TIOCM_OUT1 + if (arg & TIOCM_OUT1) + info->MCR |= UART_MCR_OUT1; + if (arg & TIOCM_OUT2) + info->MCR |= UART_MCR_OUT2; +#endif + if (arg & TIOCM_LOOP) + info->MCR |= UART_MCR_LOOP; + break; + case TIOCMBIC: + if (arg & TIOCM_RTS) + info->MCR &= ~UART_MCR_RTS; + if (arg & TIOCM_DTR) + info->MCR &= ~UART_MCR_DTR; +#ifdef TIOCM_OUT1 + if (arg & TIOCM_OUT1) + info->MCR &= ~UART_MCR_OUT1; + if (arg & TIOCM_OUT2) + info->MCR &= ~UART_MCR_OUT2; +#endif + if (arg & TIOCM_LOOP) + info->MCR &= ~UART_MCR_LOOP; + break; + case TIOCMSET: + info->MCR = ((info->MCR & ~(UART_MCR_RTS | +#ifdef TIOCM_OUT1 + UART_MCR_OUT1 | + UART_MCR_OUT2 | +#endif + UART_MCR_LOOP | + UART_MCR_DTR)) + | ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0) +#ifdef TIOCM_OUT1 + | ((arg & TIOCM_OUT1) ? UART_MCR_OUT1 : 0) + | ((arg & TIOCM_OUT2) ? UART_MCR_OUT2 : 0) +#endif + | ((arg & TIOCM_LOOP) ? UART_MCR_LOOP : 0) + | ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0)); + break; + default: + return -EINVAL; + } + save_flags(flags); cli(); + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + return 0; +} + +static int do_autoconfig(struct async_struct * info) +{ + int irq, retval; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (info->state->count > 1) + return -EBUSY; + + shutdown(info); + + autoconfig(info->state); + if ((info->state->flags & ASYNC_AUTO_IRQ) && + (info->state->port != 0 || info->state->iomem_base != 0) && + (info->state->type != PORT_UNKNOWN)) { + irq = detect_uart_irq(info->state); + if (irq > 0) + info->state->irq = irq; + } + + retval = startup(info); + if (retval) + return retval; + return 0; +} + +/* + * rs_break() --- routine which turns the break handling on or off + */ +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ +static void send_break( struct async_struct * info, int duration) +{ + if (!CONFIGURED_SERIAL_PORT(info)) + return; + current->state = TASK_INTERRUPTIBLE; + current->timeout = jiffies + duration; + cli(); + info->LCR |= UART_LCR_SBC; + serial_out(info, UART_LCR, 0x3); + schedule(); + info->LCR &= ~UART_LCR_SBC; + serial_out(info, UART_LCR, 0x3); + sti(); +} +#else +static void psio_break(struct tty_struct *tty, int break_state) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "rs_break")) + return; + + if (!CONFIGURED_SERIAL_PORT(info)) + return; + save_flags(flags); cli(); + if (break_state == -1) + info->LCR |= UART_LCR_SBC; + else + info->LCR &= ~UART_LCR_SBC; + restore_flags(flags); +} +#endif + +#ifdef CONFIG_SERIAL_MULTIPORT +static int get_multiport_struct(struct async_struct * info, + struct serial_multiport_struct *retinfo) +{ + struct serial_multiport_struct ret; + struct rs_multiport_struct *multi; + + multi = &rs_multiport[info->state->irq]; + + ret.port_monitor = multi->port_monitor; + + ret.port1 = multi->port1; + ret.mask1 = multi->mask1; + ret.match1 = multi->match1; + + ret.port2 = multi->port2; + ret.mask2 = multi->mask2; + ret.match2 = multi->match2; + + ret.port3 = multi->port3; + ret.mask3 = multi->mask3; + ret.match3 = multi->match3; + + ret.port4 = multi->port4; + ret.mask4 = multi->mask4; + ret.match4 = multi->match4; + + ret.irq = info->state->irq; + + if (copy_to_user(retinfo,&ret,sizeof(*retinfo))) + return -EFAULT; + return 0; +} + +static int set_multiport_struct(struct async_struct * info, + struct serial_multiport_struct *in_multi) +{ + struct serial_multiport_struct new_multi; + struct rs_multiport_struct *multi; + struct serial_state *state; + int was_multi, now_multi; + int retval; + void (*handler)(int, void *, struct pt_regs *); + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + state = info->state; + + if (copy_from_user(&new_multi, in_multi, + sizeof(struct serial_multiport_struct))) + return -EFAULT; + + if (new_multi.irq != state->irq || state->irq == 0 || + !IRQ_ports[state->irq]) + return -EINVAL; + + multi = &rs_multiport[state->irq]; + was_multi = (multi->port1 != 0); + + multi->port_monitor = new_multi.port_monitor; + + if (multi->port1) + release_region(multi->port1,1); + multi->port1 = new_multi.port1; + multi->mask1 = new_multi.mask1; + multi->match1 = new_multi.match1; + if (multi->port1) + request_region(multi->port1,1,"serial(multiport1)"); + + if (multi->port2) + release_region(multi->port2,1); + multi->port2 = new_multi.port2; + multi->mask2 = new_multi.mask2; + multi->match2 = new_multi.match2; + if (multi->port2) + request_region(multi->port2,1,"serial(multiport2)"); + + if (multi->port3) + release_region(multi->port3,1); + multi->port3 = new_multi.port3; + multi->mask3 = new_multi.mask3; + multi->match3 = new_multi.match3; + if (multi->port3) + request_region(multi->port3,1,"serial(multiport3)"); + + if (multi->port4) + release_region(multi->port4,1); + multi->port4 = new_multi.port4; + multi->mask4 = new_multi.mask4; + multi->match4 = new_multi.match4; + if (multi->port4) + request_region(multi->port4,1,"serial(multiport4)"); + + now_multi = (multi->port1 != 0); + + if (IRQ_ports[state->irq]->next_port && + (was_multi != now_multi)) { + free_irq(state->irq, &IRQ_ports[state->irq]); + if (now_multi) + handler = rs_interrupt_multi; + else + handler = rs_interrupt; + + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial", &IRQ_ports[state->irq]); + if (retval) { + printk("Couldn't reallocate serial interrupt " + "driver!!\n"); + } + } + return 0; +} +#endif + +static int psio_ioctl(struct tty_struct *tty, struct file * file, + unsigned int cmd, unsigned long arg) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct async_icount cprev, cnow; /* kernel counter temps */ + struct serial_icounter_struct icount; + unsigned long flags; +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ + int retval, tmp; +#endif + + if (serial_paranoia_check(info, tty->device, "rs_ioctl")) + return -ENODEV; + + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && + (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { + if (tty->flags & (1 << TTY_IO_ERROR)) + return -EIO; + } + + switch (cmd) { +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ + case TCSBRK: /* SVID version: non-zero arg --> no break */ + retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + if (!arg) { + send_break(info, HZ/4); /* 1/4 second */ + if (signal_pending(current)) + return -EINTR; + } + return 0; + case TCSBRKP: /* support for POSIX tcsendbreak() */ + retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + send_break(info, arg ? arg*(HZ/10) : HZ/4); + if (signal_pending(current)) + return -EINTR; + return 0; + case TIOCGSOFTCAR: + tmp = C_CLOCAL(tty) ? 1 : 0; + if (copy_to_user((void *)arg, &tmp, sizeof(int))) + return -EFAULT; + return 0; + case TIOCSSOFTCAR: + if (copy_from_user(&tmp, (void *)arg, sizeof(int))) + return -EFAULT; + + tty->termios->c_cflag = + ((tty->termios->c_cflag & ~CLOCAL) | + (tmp ? CLOCAL : 0)); + return 0; +#endif + case TIOCMGET: + return get_modem_info(info, (unsigned int *) arg); + case TIOCMBIS: + case TIOCMBIC: + case TIOCMSET: + return set_modem_info(info, cmd, (unsigned int *) arg); + case TIOCGSERIAL: + return get_serial_info(info, + (struct serial_struct *) arg); + case TIOCSSERIAL: + return set_serial_info(info, + (struct serial_struct *) arg); + case TIOCSERCONFIG: + return do_autoconfig(info); + + case TIOCSERGETLSR: /* Get line status register */ + return get_lsr_info(info, (unsigned int *) arg); + + case TIOCSERGSTRUCT: + if (copy_to_user((struct async_struct *) arg, + info, sizeof(struct async_struct))) + return -EFAULT; + return 0; + +#ifdef CONFIG_SERIAL_MULTIPORT + case TIOCSERGETMULTI: + return get_multiport_struct(info, + (struct serial_multiport_struct *) arg); + case TIOCSERSETMULTI: + return set_multiport_struct(info, + (struct serial_multiport_struct *) arg); +#endif + + /* + * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change + * - mask passed in arg for lines of interest + * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) + * Caller should use TIOCGICOUNT to see which one it was + */ + case TIOCMIWAIT: + save_flags(flags); cli(); + /* note the counters on entry */ + cprev = info->state->icount; + restore_flags(flags); + /* Force modem status interrupts on */ + info->IER |= UART_IER_MSI; + serial_out(info, UART_IER, info->IER); + while (1) { + interruptible_sleep_on(&info->delta_msr_wait); + /* see if a signal did it */ + if (signal_pending(current)) + return -ERESTARTSYS; + save_flags(flags); cli(); + cnow = info->state->icount; /* atomic copy */ + restore_flags(flags); + if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && + cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) + return -EIO; /* no change => error */ + if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || + ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || + ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || + ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) { + return 0; + } + cprev = cnow; + } + /* NOTREACHED */ + + /* + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) + * Return: write counters to the user passed counter struct + * NB: both 1->0 and 0->1 transitions are counted except for + * RI where only 0->1 is counted. + */ + case TIOCGICOUNT: + save_flags(flags); cli(); + cnow = info->state->icount; + restore_flags(flags); + icount.cts = cnow.cts; + icount.dsr = cnow.dsr; + icount.rng = cnow.rng; + icount.dcd = cnow.dcd; + icount.rx = cnow.rx; + icount.tx = cnow.tx; + icount.frame = cnow.frame; + icount.overrun = cnow.overrun; + icount.parity = cnow.parity; + icount.brk = cnow.brk; + icount.buf_overrun = cnow.buf_overrun; + + if (copy_to_user((void *)arg, &icount, sizeof(icount))) + return -EFAULT; + return 0; + case TIOCSERGWILD: + case TIOCSERSWILD: + /* "setserial -W" is called in Debian boot */ + printk ("TIOCSER?WILD ioctl obsolete, ignored.\n"); + return 0; + + default: + return -ENOIOCTLCMD; + } + return 0; +} + +static void psio_set_termios(struct tty_struct *tty, struct termios *old_termios) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + unsigned int cflag = tty->termios->c_cflag; + + if ( (cflag == old_termios->c_cflag) + && ( RELEVANT_IFLAG(tty->termios->c_iflag) + == RELEVANT_IFLAG(old_termios->c_iflag))) + return; + + change_speed(info, old_termios); + + /* Handle transition to B0 status */ + if ((old_termios->c_cflag & CBAUD) && + !(cflag & CBAUD)) { + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + } + + /* Handle transition away from B0 status */ + if (!(old_termios->c_cflag & CBAUD) && + (cflag & CBAUD)) { + info->MCR |= UART_MCR_DTR; + if (!(tty->termios->c_cflag & CRTSCTS) || + !test_bit(TTY_THROTTLED, &tty->flags)) { + info->MCR |= UART_MCR_RTS; + } + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + } + + /* Handle turning off CRTSCTS */ + if ((old_termios->c_cflag & CRTSCTS) && + !(tty->termios->c_cflag & CRTSCTS)) { + tty->hw_stopped = 0; + psio_start(tty); + } +} + +/* + * ----------------------------------------------------------- + * psio_close() + * + * This routine is called when the debug console port gets closed. + * First, we wait for the last remaining data to be sent. Then, we unlink + * its async structure from the interrupt chain if necessary, and we free + * that IRQ if nothing is left in the chain. + * ----------------------------------------------------------- + */ +static void psio_close(struct tty_struct *tty, struct file *filp) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct serial_state *state; + unsigned long flags; + + if (!info || serial_paranoia_check(info, tty->device, "rs_close")) + return; + + state = info->state; + + save_flags(flags); cli(); + + if (tty_hung_up_p(filp)) { + DBG_CNT("before DEC-hung"); + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + +#ifdef SERIAL_DEBUG_OPEN + printk("psio_close ttyD%d, count = %d\n", info->line, state->count); +#endif + if ((tty->count == 1) && (state->count != 1)) { + /* + * Uh, oh. tty->count is 1, which means that the tty + * structure will be freed. state->count should always + * be one in these conditions. If it's greater than + * one, we've got real problems, since it means the + * serial port won't be shutdown. + */ + printk("rs_close: bad serial port count; tty->count is 1, " + "state->count is %d\n", state->count); + state->count = 1; + } + if (--state->count < 0) { + printk("psio_close: bad serial port count for ttyD%d: %d\n", + info->line, state->count); + state->count = 0; + } + if (state->count) { + DBG_CNT("before DEC-2"); + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + info->flags |= ASYNC_CLOSING; + restore_flags(flags); + /* + * Save the termios structure, since this port may have + * separate termios for callout and dialin. + */ + if (info->flags & ASYNC_NORMAL_ACTIVE) + info->state->normal_termios = *tty->termios; + if (info->flags & ASYNC_CALLOUT_ACTIVE) + info->state->callout_termios = *tty->termios; + /* + * Now we wait for the transmit buffer to clear; and we notify + * the line discipline to only process XON/XOFF characters. + */ + tty->closing = 1; + if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) + tty_wait_until_sent(tty, info->closing_wait); + /* + * At this point we stop accepting input. To do this, we + * disable the receive line status interrupts, and tell the + * interrupt driver to stop checking the data ready bit in the + * line status register. + */ + info->IER &= ~UART_IER_RLSI; + info->read_status_mask &= ~UART_LSR_DR; + if (info->flags & ASYNC_INITIALIZED) { + serial_out(info, UART_IER, info->IER); + /* + * Before we drop DTR, make sure the UART transmitter + * has completely drained; this is especially + * important if there is a transmit FIFO! + */ + psio_wait_until_sent(tty, info->timeout); + } + shutdown(info); + if (tty->driver.flush_buffer) + tty->driver.flush_buffer(tty); + if (tty->ldisc.flush_buffer) + tty->ldisc.flush_buffer(tty); + tty->closing = 0; + info->event = 0; + info->tty = 0; + if (info->blocked_open) { + if (info->close_delay) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(info->close_delay); + } + wake_up_interruptible(&info->open_wait); + } + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| + ASYNC_CLOSING); + wake_up_interruptible(&info->close_wait); + MOD_DEC_USE_COUNT; +} + +/* + * rs_wait_until_sent() --- wait until the transmitter is empty + */ +static void psio_wait_until_sent(struct tty_struct *tty, int timeout) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + unsigned long orig_jiffies, char_time; + int lsr; + + if (serial_paranoia_check(info, tty->device, "psio_wait_until_sent")) + return; + + if (info->state->type == PORT_UNKNOWN) + return; + + if (info->xmit_fifo_size == 0) + return; /* Just in case.... */ + + orig_jiffies = jiffies; + /* + * Set the check interval to be 1/5 of the estimated time to + * send a single character, and make it at least 1. The check + * interval should also be less than the timeout. + * + * Note: we have to use pretty tight timings here to satisfy + * the NIST-PCTS. + */ + char_time = (info->timeout - HZ/50) / info->xmit_fifo_size; + char_time = char_time / 5; + if (char_time == 0) + char_time = 1; + if (timeout && timeout < char_time) + char_time = timeout; + /* + * If the transmitter hasn't cleared in twice the approximate + * amount of time to send the entire FIFO, it probably won't + * ever clear. This assumes the UART isn't doing flow + * control, which is currently the case. Hence, if it ever + * takes longer than info->timeout, this is probably due to a + * UART bug of some kind. So, we clamp the timeout parameter at + * 2*info->timeout. + */ + if (!timeout || timeout > 2*info->timeout) + timeout = 2*info->timeout; +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time); + printk("jiff=%lu...", jiffies); +#endif + while (!((lsr = serial_inp(info, UART_LSR)) & UART_LSR_TEMT)) { +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("lsr = %d (jiff=%lu)...", lsr, jiffies); +#endif + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(char_time); + if (signal_pending(current)) + break; + if (timeout && time_after(jiffies, orig_jiffies + timeout)) + break; + } +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); +#endif +} + +/* + * psio_hangup() --- called by tty_hangup() when a hangup is signaled. + */ +static void psio_hangup(struct tty_struct *tty) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct serial_state *state = info->state; + + if (serial_paranoia_check(info, tty->device, "psio_hangup")) + return; + + state = info->state; + + psio_flush_buffer(tty); + if (info->flags & ASYNC_CLOSING) + return; + shutdown(info); + info->event = 0; + state->count = 0; + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); + info->tty = 0; + wake_up_interruptible(&info->open_wait); +} + + + +/* +static void rs_wait_until_sent(struct tty_struct *tty, int timeout) +static void rs_hangup(struct tty_struct *tty) +*/ + +/* + * ------------------------------------------------------------ + * psio_open() and friends + * ------------------------------------------------------------ + */ +#define SERIAL_DEBUG_OPEN +static int block_til_ready(struct tty_struct *tty, struct file * filp, + struct async_struct *info) +{ + DECLARE_WAITQUEUE(wait, current); + struct serial_state *state = info->state; + int retval; + int do_clocal = 0, extra_count = 0; + unsigned long flags; + + /* + * If the device is in the middle of being closed, then block + * until it's done, and then try again. + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); +#ifdef SERIAL_DO_RESTART + return ((info->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS); +#else + return -EAGAIN; +#endif + } + + /* + * If this is a callout device, then just make sure the normal + * device isn't being used. + */ + if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { + if (info->flags & ASYNC_NORMAL_ACTIVE) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_SESSION_LOCKOUT) && + (info->session != current->session)) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_PGRP_LOCKOUT) && + (info->pgrp != current->pgrp)) + return -EBUSY; + info->flags |= ASYNC_CALLOUT_ACTIVE; + return 0; + } + +#if 1 /* ? 020906 */ +filp->f_flags |= O_NONBLOCK; +#endif /* ? 020906 */ + /* + * If non-blocking mode is set, or the port is not enabled, + * then make the check up front and then exit. + */ + if ((filp->f_flags & O_NONBLOCK) || + (tty->flags & (1 << TTY_IO_ERROR))) { + if (info->flags & ASYNC_CALLOUT_ACTIVE) + return -EBUSY; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; + } + + if (info->flags & ASYNC_CALLOUT_ACTIVE) { + if (state->normal_termios.c_cflag & CLOCAL) + do_clocal = 1; + } else { + if (tty->termios->c_cflag & CLOCAL) + do_clocal = 1; + } + + /* + * Block waiting for the carrier detect and the line to become + * free (i.e., not in use by the callout). While we are in + * this loop, state->count is dropped by one, so that + * rs_close() knows when to free things. We restore it upon + * exit, either normal or abnormal. + */ + retval = 0; + add_wait_queue(&info->open_wait, &wait); +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready before block: ttyD%d, count = %d\n", + state->line, state->count); +#endif + save_flags(flags); cli(); + if (!tty_hung_up_p(filp)) { + extra_count = 1; + state->count--; + } + restore_flags(flags); + info->blocked_open++; + while (1) { + save_flags(flags); cli(); + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + (tty->termios->c_cflag & CBAUD)) + serial_out(info, UART_MCR, + serial_inp(info, UART_MCR) | + (UART_MCR_DTR | UART_MCR_RTS)); + restore_flags(flags); + set_current_state(TASK_INTERRUPTIBLE); + if (tty_hung_up_p(filp) || + !(info->flags & ASYNC_INITIALIZED)) { +#ifdef SERIAL_DO_RESTART + if (info->flags & ASYNC_HUP_NOTIFY) + retval = -EAGAIN; + else + retval = -ERESTARTSYS; +#else + retval = -EAGAIN; +#endif + break; + } + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + !(info->flags & ASYNC_CLOSING) && + (do_clocal || (serial_in(info, UART_MSR) & + UART_MSR_DCD))) + break; + if (signal_pending(current)) { + retval = -ERESTARTSYS; + break; + } +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready blocking: ttyD%d, count = %d\n", + info->line, state->count); +#endif + schedule(); + } + set_current_state(TASK_RUNNING); + remove_wait_queue(&info->open_wait, &wait); + if (extra_count) + state->count++; + info->blocked_open--; +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready after blocking: ttyD%d, count = %d\n", + info->line, state->count); +#endif + if (retval) + return retval; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; +} +#undef SERIAL_DEBUG_OPEN + + +static int get_async_struct(int line, struct async_struct **ret_info) +{ + struct async_struct *info; + struct serial_state *sstate; + + sstate = rs_table + line; + sstate->count++; + if (sstate->info) { + *ret_info = sstate->info; + return 0; + } + info = kmalloc(sizeof(struct async_struct), GFP_KERNEL); + if (!info) { + sstate->count--; + return -ENOMEM; + } + memset(info, 0, sizeof(struct async_struct)); + init_waitqueue_head(&info->open_wait); + init_waitqueue_head(&info->close_wait); + init_waitqueue_head(&info->delta_msr_wait); + info->magic = SERIAL_MAGIC; + info->port = sstate->port; + info->flags = sstate->flags; + info->io_type = sstate->io_type; + info->iomem_base = sstate->iomem_base; + info->iomem_reg_shift = sstate->iomem_reg_shift; + info->xmit_fifo_size = sstate->xmit_fifo_size=0; + info->line = line; + info->tqueue.routine = do_softint; + info->tqueue.data = info; + info->state = sstate; + + if (sstate->info) { + kfree(info); + + *ret_info = sstate->info; + return 0; + } + *ret_info = sstate->info = info; + return 0; +} + +/* + * ----------------------------------------------------------- + * psio_open() + * + * This routine is called whenever a debug console port is opened. It + * enables interrupts for a serial port, linking in its async structure into + * the IRQ chain. It also performs the serial-specific + * initialization for the tty structure. + * ----------------------------------------------------------- + */ +static int psio_open(struct tty_struct *tty, struct file *filp) +{ + struct async_struct *info; + int retval,line=0; + unsigned long page; + + MOD_INC_USE_COUNT; + line = MINOR(tty->device) - tty->driver.minor_start; + if ((line < 0) || (line >= NR_PORTS)) { + MOD_DEC_USE_COUNT; + return -ENODEV; + } + + retval = get_async_struct(line, &info); + if (retval) { + printk("psio_open ttyD%d fail...",line); + MOD_DEC_USE_COUNT; + return retval; + } + tty->driver_data = info; + info->tty = tty; + if (serial_paranoia_check(info, tty->device, "psio_open")) + return -ENODEV; + +#ifdef SERIAL_DEBUG_OPEN + printk("psio_open %s%d, count = %d\n", tty->driver.name, info->line, + info->state->count); +#endif + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + + /* + * This relies on lock_kernel() stuff so wants tidying for 2.5 + */ + if (!tmp_buf) { + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + if (tmp_buf) + free_page(page); + else + tmp_buf = (unsigned char *) page; + } + /* + * If the port is the middle of closing, bail out now + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); +#ifdef SERIAL_DO_RESTART + return ((info->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS); +#else + return -EAGAIN; +#endif + } + + /* + * Start up serial port + */ + retval=startup(info); + if (retval) + return retval; + + retval = block_til_ready(tty, filp, info); + if (retval) { +#ifdef SERIAL_DEBUG_OPEN + printk("psio_open returning after block_til_ready with %d\n", + retval); +#endif + return retval; + } + + if ((info->state->count == 1) && + (info->flags & ASYNC_SPLIT_TERMIOS)) { + if (tty->driver.subtype == SERIAL_TYPE_NORMAL) + *tty->termios = info->state->normal_termios; + else + *tty->termios = info->state->callout_termios; + change_speed(info, 0); + } +#ifdef CONFIG_SERIAL_CONSOLE + if (cons.cflag && cons.index == line) { + tty->termios->c_cflag = cons.cflag; + cons.cflag = 0; + change_speed(info, 0); + } +#endif + info->session = current->session; + info->pgrp = current->pgrp; + + return 0; +} + +/* + * /proc fs routines.... + */ +static inline int line_info(char *buf, struct serial_state *state) +{ + struct async_struct *info = state->info, scr_info; + char stat_buf[30], control, status; + int ret; + unsigned long flags; + + ret = sprintf(buf, "%d: uart:%s port:%lX irq:%d", + state->line, uart_config[state->type].name, + state->port, state->irq); + + if (!state->port || (state->type == PORT_UNKNOWN)) { + ret += sprintf(buf+ret, "\n"); + return ret; + } + + /* + * Figure out the current RS-232 lines + */ + if (!info) { + info = &scr_info; /* This is just for serial_{in,out} */ + + info->magic = SERIAL_MAGIC; + info->port = state->port; + info->flags = state->flags; + info->hub6 = state->hub6; + info->io_type = state->io_type; + info->iomem_base = state->iomem_base; + info->iomem_reg_shift = state->iomem_reg_shift; + info->quot = 0; + info->tty = 0; + } + save_flags(flags); cli(); + status = serial_in(info, UART_MSR); + control = info != &scr_info ? info->MCR : serial_in(info, UART_MCR); + restore_flags(flags); + + stat_buf[0] = 0; + stat_buf[1] = 0; + if (control & UART_MCR_RTS) + strcat(stat_buf, "|RTS"); + if (status & UART_MSR_CTS) + strcat(stat_buf, "|CTS"); + if (control & UART_MCR_DTR) + strcat(stat_buf, "|DTR"); + if (status & UART_MSR_DSR) + strcat(stat_buf, "|DSR"); + if (status & UART_MSR_DCD) + strcat(stat_buf, "|CD"); + if (status & UART_MSR_RI) + strcat(stat_buf, "|RI"); + + if (info->quot) { + ret += sprintf(buf+ret, " baud:%d", + state->baud_base / (16*info->quot)); + } + + ret += sprintf(buf+ret, " tx:%d rx:%d", + state->icount.tx, state->icount.rx); + + if (state->icount.frame) + ret += sprintf(buf+ret, " fe:%d", state->icount.frame); + + if (state->icount.parity) + ret += sprintf(buf+ret, " pe:%d", state->icount.parity); + + if (state->icount.brk) + ret += sprintf(buf+ret, " brk:%d", state->icount.brk); + + if (state->icount.overrun) + ret += sprintf(buf+ret, " oe:%d", state->icount.overrun); + + /* + * Last thing is the RS-232 status lines + */ + ret += sprintf(buf+ret, " %s\n", stat_buf+1); + return ret; +} + + + +int psio_read_proc(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + int i, len = 0, l; + off_t begin = 0; + + len += sprintf(page, "sioinfo:1.0 driver:%s%s revision:%s\n", + serial_version, LOCAL_VERSTRING, serial_revdate); + for (i = 0; i < NR_PORTS && len < 4000; i++) { + l = line_info(page + len, &rs_table[i]); + len += l; + if (len+begin > off+count) + goto done; + if (len+begin < off) { + begin += len; + len = 0; + } + } + *eof = 1; +done: + if (off >= len+begin) + return 0; + *start = page + (off-begin); + return ((count < begin+len-off) ? count : begin+len-off); +} + +static char serial_options[] __initdata = + " no serial options enabled\n"; + + +static inline void show_serial_version(void) +{ + printk(KERN_INFO "%s version %s%s (%s) with%s", serial_name, + serial_version, LOCAL_VERSTRING, serial_revdate, + serial_options); +} +static unsigned detect_uart_irq (struct serial_state * state) +{ + if(! state->irq) + printk(KERN_INFO "detect_uart_irq: Ohh irq = 0\n"); + + return state->irq; +} + +static void autoconfig(struct serial_state * state) +{ + struct async_struct *info, scr_info; + //unsigned long flags; + + state->type = PORT_UNKNOWN; + +#ifdef SERIAL_DEBUG_AUTOCONF + printk("Testing ttyD%d (0x%04lx, 0x%04x)...\n", state->line, + state->port, (unsigned) state->iomem_base); +#endif + + if (!CONFIGURED_SERIAL_PORT(state)) + return; + + info = &scr_info; /* This is just for serial_{in,out} */ + + info->magic = SERIAL_MAGIC; + info->state = state; + info->port = state->port; + info->flags = state->flags; + sio_reset(info); +} + +/* + * The debug console driver boot-time initialization code! + */ +/* 20020830 */ +int __init psio_init(void) +{ + int i; + struct serial_state * state; + + init_bh(SERIAL_BH, do_psio_serial_bh); + init_timer(&serial_timer); + serial_timer.function = (void *)psio_timer; +#if 1 + mod_timer(&serial_timer, jiffies + 10); +#else /* 1 */ + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME); +#endif /* 1 */ + + for (i = 0; i < NR_IRQS; i++) { + IRQ_ports[i] = 0; + IRQ_timeout[i] = 0; + } + + /* + * Initialize the tty_driver structure + */ + memset(&psio_driver, 0, sizeof(struct tty_driver)); + psio_driver.magic = TTY_DRIVER_MAGIC; +#if (LINUX_VERSION_CODE > 0x20100) + psio_driver.driver_name = "serial_m32102"; +#endif +#if 1 + psio_driver.name = "ttyD"; +#else +#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) + psio_driver.name = "ttyd/%d"; +#else + psio_driver.name = "ttyD"; +#endif +#endif /* 1 */ + + psio_driver.major = TTY_MAJOR; + psio_driver.minor_start = 80; + psio_driver.name_base = 0; + psio_driver.num = NR_PORTS; + psio_driver.type = TTY_DRIVER_TYPE_SERIAL; + + psio_driver.subtype = SERIAL_TYPE_NORMAL; + psio_driver.init_termios = tty_std_termios; + psio_driver.init_termios.c_cflag = + B9600 | CS8 | CREAD | HUPCL | CLOCAL; + psio_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + psio_driver.refcount = &psio_refcount; + psio_driver.table = psio_table; + psio_driver.termios = psio_termios; + psio_driver.termios_locked = psio_termios_locked; + + psio_driver.open = psio_open; + psio_driver.close = psio_close; + psio_driver.write = psio_write; + psio_driver.put_char = psio_put_char; + psio_driver.flush_chars = psio_flush_chars; + psio_driver.write_room = psio_write_room; + psio_driver.chars_in_buffer = psio_chars_in_buffer; + psio_driver.flush_buffer = psio_flush_buffer; + psio_driver.ioctl = psio_ioctl; + psio_driver.throttle = psio_throttle; + psio_driver.unthrottle = psio_unthrottle; + psio_driver.set_termios = psio_set_termios; + psio_driver.stop = psio_stop; + psio_driver.start = psio_start; + psio_driver.hangup = psio_hangup; + +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + psio_driver.break_ctl = psio_break; +#endif +#if (LINUX_VERSION_CODE >= 131343) + psio_driver.send_xchar = psio_send_xchar; + psio_driver.wait_until_sent = psio_wait_until_sent; + psio_driver.read_proc = psio_read_proc; +#endif + + if (tty_register_driver(&psio_driver)) + panic("Couldn't register debug console driver\n"); + + for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) { + state->magic = SSTATE_MAGIC; + state->line = i; + state->type = 14; + state->custom_divisor = 0; + state->close_delay = 5*HZ/10; + state->closing_wait = 30*HZ; + state->callout_termios = psio_driver.init_termios; + state->normal_termios = psio_driver.init_termios; + state->icount.cts = state->icount.dsr = + state->icount.rng = state->icount.dcd = 0; + state->icount.rx = state->icount.tx = 0; + state->icount.frame = state->icount.parity = 0; + state->icount.overrun = state->icount.brk = 0; + state->irq = irq_cannonicalize(state->irq); + +#if 0 + if (check_region(state->port,8)) + continue; + if (state->flags & ASYNC_BOOT_AUTOCONF) + autoconfig(psio_table); +#endif + state->baud_base = boot_cpu_data.bus_clock; + printk(KERN_INFO "ttyD%d initialized.\n",i); + tty_register_devfs(&psio_driver, 0, + psio_driver.minor_start + state->line); + } + + return 0; +} + +/* 20020830 */ +static void __exit psio_fini(void) +{ + unsigned long flags; + // int e1, e2; + int e1; + // int i; + // struct async_struct *info; + + /* printk("Unloading %s: version %s\n", serial_name, serial_version); */ + del_timer_sync(&serial_timer); + save_flags(flags); cli(); + remove_bh(SERIAL_BH); + if ((e1 = tty_unregister_driver(&psio_driver))) + printk("psio_serial: failed to unregister serial driver (%d)\n",e1); + restore_flags(flags); + + if (tmp_buf) { + unsigned long pg = (unsigned long) tmp_buf; + tmp_buf = NULL; + free_page(pg); + } +} + +module_init(psio_init); +module_exit(psio_fini); +MODULE_DESCRIPTION("M32R/M32102 (dumb) serial driver"); +MODULE_AUTHOR("Hiroyuki Kondo , Takeo Takahashi "); +MODULE_LICENSE("GPL"); + + +/* + * ----------------------------------------------------------- + * Debug console driver + * ----------------------------------------------------------- + */ + +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) + +static struct async_struct async_dbgcons; + +/* + * Wait for transmitter & holding register to empty + */ +static inline void wait_for_xmitr(struct async_struct *info) +{ + unsigned int status, tmout = 1000000; + + do { + status = serial_in(info, UART_LSR); + + if (status & UART_LSR_BI) + lsr_break_flag = UART_LSR_BI; + + if (--tmout == 0) + break; + } while((status & BOTH_EMPTY) != BOTH_EMPTY); + + /* Wait for flow control if necessary */ + if (info->flags & ASYNC_CONS_FLOW) { + tmout = 1000000; + while (--tmout && + ((serial_in(info, UART_MSR) & UART_MSR_CTS) == 0)); + } +} +static void dbg_console_write(struct console *co, const char *s, + unsigned count) +{ + static struct async_struct *info = &async_dbgcons; + int ier; + unsigned i; + + /* + * First save the IER then disable the interrupts + */ + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); + + /* + * Now, do each character + */ + for (i = 0; i < count; i++, s++) { + wait_for_xmitr(info); + + /* + * Send the character out. + * If a LF, also do CR... + */ + serial_out(info, UART_TX, *s); + if (*s == 10) { + wait_for_xmitr(info); + serial_out(info, UART_TX, 13); + } + } + + /* + * Finally, Wait for transmitter & holding register to empty + * and restore the IER + */ + wait_for_xmitr(info); + serial_out(info, UART_IER, ier); +} + +#if (LINUX_VERSION_CODE <= 132114) /* Linux 2.4.18 */ +/* + * Receive character from the serial port + */ +static int dbg_console_wait_key(struct console *console) +{ + static struct async_struct *info; + int ier, c; + + info = &async_dbgcons; + + /* + * First save the IER then disable the interrupts so + * that the real driver for the port does not get the + * character. + */ + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); + + while ((serial_in(info, UART_LSR) & UART_LSR_DR) == 0); + c = serial_in(info, UART_RX); + + /* + * Restore the interrupts + */ + serial_out(info, UART_IER, ier); + + return c; +} +#endif + +static kdev_t dbg_console_device(struct console *c) +{ + return MKDEV(TTY_MAJOR, 80 + c->index); +} + + +static int __init dbg_console_setup(struct console *co, char *options) +{ + static struct async_struct *info; + struct serial_state *state; + int baud = BAUDRATE; + int baud_base= boot_cpu_data.bus_clock; + int bits = 8; + int parity = 'n'; + int doflow = 0; + unsigned int cflag = CREAD | HUPCL | CLOCAL | CRTSCTS; + int cval; + char *s; + + if (options) { + baud = simple_strtoul(options, NULL, 10); + s = options; + while(*s >= '0' && *s <= '9') + s++; + if (*s) parity = *s++; + if (*s) bits = *s++ - '0'; + if (*s) doflow = (*s++ == 'r'); + } + + co->flags |= CON_ENABLED; + + /* + * Now construct a cflag setting. + */ + switch(baud) { + case 1200: + cflag |= B1200; + break; + case 2400: + cflag |= B2400; + break; + case 4800: + cflag |= B4800; + break; + case 19200: + cflag |= B19200; + break; + case 38400: + cflag |= B38400; + break; + case 57600: + cflag |= B57600; + break; + case 115200: + cflag |= B115200; + break; + case 9600: + default: + cflag |= B9600; + baud = 9600; + break; + } + switch(bits) { + case 7: + cflag |= CS7; + break; + default: + case 8: + cflag |= CS8; + break; + } + switch(parity) { + case 'o': case 'O': + cflag |= PARODD; + break; + case 'e': case 'E': + cflag |= PARENB; + break; + } + co->cflag = cflag; + + state = rs_table + co->index; + if (doflow) + state->flags |= ASYNC_CONS_FLOW; + info = &async_dbgcons; + info->magic = SERIAL_MAGIC; + info->state = state; + info->port = state->port; + info->flags = state->flags; + info->io_type = state->io_type; + info->iomem_base = state->iomem_base; + info->iomem_reg_shift = state->iomem_reg_shift; + + cval = (baud_base / (baud * 4)) - 1; + + serial_outp(info, UART_LCR, 0x0300); /* init status */ + //serial_outp(info, UART_MOD1, 0x0800); /* 8bit */ + serial_outp(info, UART_MOD0, 0x80); /* cts/rts 1stop nonpari */ + //serial_outp(info, UART_MOD0, 0x180); /* rts 1stop nonpari */ + //serial_outp(info, UART_MOD0, 0xc0); /* cts/rts 1stop nonpari */ + + serial_outp(info, UART_BAUR, cval); /* set baurate reg */ + //serial_outp(info, UART_RBAUR, adj); /* set adj baurate reg */ + serial_outp(info, UART_IER, 0x00); /* intr mask */ + serial_outp(info, UART_LCR, 0x03); + + return 0; +} + +static struct console cons = { + name: "ttyD", + write: dbg_console_write, + device: dbg_console_device, +#if (LINUX_VERSION_CODE <= 132114) /* Linux 2.4.18 */ + wait_key: dbg_console_wait_key, +#endif + setup: dbg_console_setup, + flags: CON_PRINTBUFFER, + index: -1, +}; + + +/* + * Register console. + */ +void __init psio_console_init(void) +{ + register_console(&cons); +} + + diff -Nru a/arch/m32r/drivers/m32r_cfc.c b/arch/m32r/drivers/m32r_cfc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_cfc.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,910 @@ +/* + * linux/arch/m32r/drivers/m32r_cfc.c + * + * Device driver for the CFC functionality of M32R. + * + * Copyright (c) 2001, 2002, 2003, 2004 + * Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#undef MAX_IO_WIN /* FIXME */ +#define MAX_IO_WIN 1 +#undef MAX_WIN /* FIXME */ +#define MAX_WIN 1 + +#include "m32r_cfc.h" + +#if !defined(COFIG_PLAT_USRV) +#define PCMCIA_DEBUG 3 +#endif /* COFIG_PLAT_USRV */ + +#ifdef PCMCIA_DEBUG +int m32r_cfc_debug = PCMCIA_DEBUG; +module_param(m32r_cfc_debug, int, 0444); +#define DEBUG(n, args...) if (m32r_cfc_debug>(n)) printk(args) +#else +#define DEBUG(n, args...) do { } while (0) +#endif + +/* Poll status interval -- 0 means default to interrupt */ +static int poll_interval = 0; + +typedef enum pcc_space { as_none = 0, as_comm, as_attr, as_io } pcc_as_t; + +typedef struct pcc_socket { + u_short type, flags; + struct pcmcia_socket socket; + unsigned int number; + ioaddr_t ioaddr; + u_long mapaddr; + u_long base; /* PCC register base */ + u_char cs_irq1, cs_irq2, intr; + pccard_io_map io_map[MAX_IO_WIN]; + pccard_mem_map mem_map[MAX_WIN]; + u_char io_win; + u_char mem_win; + pcc_as_t current_space; + u_char last_iodbex; +#ifdef CHAOS_PCC_DEBUG + u_char last_iosize; +#endif +#ifdef CONFIG_PROC_FS + struct proc_dir_entry *proc; +#endif +} pcc_socket_t; + +static int pcc_sockets = 0; +static pcc_socket_t socket[M32R_MAX_PCC] = { + { 0, }, /* ... */ +}; + +#define ISA_LOCK(n, f) do { } while (0) +#define ISA_UNLOCK(n, f) do { } while (0) + +/*====================================================================*/ + +static unsigned int pcc_get(u_short, unsigned int); +static void pcc_set(u_short, unsigned int , unsigned int ); + +static spinlock_t pcc_lock = SPIN_LOCK_UNLOCKED; + +#if !defined(CONFIG_PLAT_USRV) +static __inline__ u_long pcc_port2addr(unsigned long port, int size) { + u_long addr = 0; + u_long odd; + + if (size == 1) { /* byte access */ + odd = (port&1) << 11; + port -= port & 1; + addr = CFC_IO_MAPBASE_BYTE - CFC_IOPORT_BASE + odd + port; + } else if (size == 2) + addr = CFC_IO_MAPBASE_WORD - CFC_IOPORT_BASE + port; + + return addr; +} +#else /* CONFIG_PLAT_USRV */ +static __inline__ u_long pcc_port2addr(unsigned long port, int size) { + u_long odd; + u_long addr = ((port - CFC_IOPORT_BASE) & 0xf000) << 8; + + if (size == 1) { /* byte access */ + odd = port & 1; + port -= odd; + odd <<= 11; + addr = (addr | CFC_IO_MAPBASE_BYTE) + odd + (port & 0xfff); + } else if (size == 2) /* word access */ + addr = (addr | CFC_IO_MAPBASE_WORD) + (port & 0xfff); + + return addr; +} +#endif /* CONFIG_PLAT_USRV */ + +void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned char *bp = (unsigned char *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " + "size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + addr = pcc_port2addr(port, 1); + if (!addr) { + printk("m32r_cfc:ioread_byte null port :%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + /* read Byte */ + while (nmemb--) + *bp++ = readb(addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned short *bp = (unsigned short *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + if (size != 2) + printk("m32r_cfc: ioread_word :illigal size %u : %#lx\n", size, + port); + if (size == 9) + printk("m32r_cfc: ioread_word :insw \n"); + + addr = pcc_port2addr(port, 2); + if (!addr) { + printk("m32r_cfc:ioread_word null port :%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + /* read Word */ + while (nmemb--) + *bp++ = readw(addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned char *bp = (unsigned char *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + /* write Byte */ + addr = pcc_port2addr(port, 1); + if (!addr) { + printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + while (nmemb--) + writeb(*bp++, addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned short *bp = (unsigned short *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + if(size != 2) + printk("m32r_cfc: iowrite_word :illigal size %u : %#lx\n", + size, port); + if(size == 9) + printk("m32r_cfc: iowrite_word :outsw \n"); + + addr = pcc_port2addr(port, 2); + if (!addr) { + printk("m32r_cfc:iowrite_word null addr :%#lx\n",port); + return; + } +#if 1 + if (addr & 1) { + printk("m32r_cfc:iowrite_word port addr (%#lx):%#lx\n", port, + addr); + return; + } +#endif + DEBUG(3, "m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + while (nmemb--) + writew(*bp++, addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +/*====================================================================*/ + +#define IS_ALIVE 0x8000 + +typedef struct pcc_t { + char *name; + u_short flags; +} pcc_t; + +static pcc_t pcc[] = { +#if !defined(CONFIG_PLAT_USRV) + { "m32r_cfc", 0 }, { "", 0 }, +#else /* CONFIG_PLAT_USRV */ + { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, + { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "", 0 }, +#endif /* CONFIG_PLAT_USRV */ +}; + +static irqreturn_t pcc_interrupt(int, void *, struct pt_regs *regs); + +/*====================================================================*/ + +static struct timer_list poll_timer; + +static unsigned int pcc_get(u_short sock, unsigned int reg) +{ + unsigned int val = inw(reg); + DEBUG(3, "m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); + return val; +} + + +static void pcc_set(u_short sock, unsigned int reg, unsigned int data) +{ + outw(data, reg); + DEBUG(3, "m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); +} + +/*====================================================================== + + See if a card is present, powered up, in IO mode, and already + bound to a (non PC Card) Linux driver. We leave these alone. + + We make an exception for cards that seem to be serial devices. + +======================================================================*/ + +static int __init is_alive(u_short sock) +{ + unsigned int stat; + + DEBUG(3, "m32r_cfc: is_alive:\n"); + + printk("CF: "); + stat = pcc_get(sock, (unsigned int)PLD_CFSTS); + if (!stat) + printk("No "); + printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); + DEBUG(3, "m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); + + return 0; +} + +static void add_pcc_socket(ulong base, int irq, ulong mapaddr, ioaddr_t ioaddr) +{ + pcc_socket_t *t = &socket[pcc_sockets]; + + DEBUG(3, "m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " + "mapaddr=%#lx, ioaddr=%08x\n", + base, irq, mapaddr, ioaddr); + + /* add sockets */ + t->ioaddr = ioaddr; + t->mapaddr = mapaddr; +#if !defined(CONFIG_PLAT_USRV) + t->base = 0; + t->flags = 0; + t->cs_irq1 = irq; // insert irq + t->cs_irq2 = irq + 1; // eject irq +#else /* CONFIG_PLAT_USRV */ + t->base = base; + t->flags = 0; + t->cs_irq1 = 0; // insert irq + t->cs_irq2 = 0; // eject irq +#endif /* CONFIG_PLAT_USRV */ + + if (is_alive(pcc_sockets)) + t->flags |= IS_ALIVE; + + /* add pcc */ +#if !defined(CONFIG_PLAT_USRV) + request_region((unsigned int)PLD_CFRSTCR, 0x20, "m32r_cfc"); +#else /* CONFIG_PLAT_USRV */ + { + unsigned int reg_base; + + reg_base = (unsigned int)PLD_CFRSTCR; + reg_base |= pcc_sockets << 8; + request_region(reg_base, 0x20, "m32r_cfc"); + } +#endif /* CONFIG_PLAT_USRV */ + printk(KERN_INFO " %s ", pcc[pcc_sockets].name); + printk("pcc at 0x%08lx\n", t->base); + + /* Update socket interrupt information, capabilities */ + t->socket.features |= (SS_CAP_PCCARD | SS_CAP_STATIC_MAP); + t->socket.map_size = M32R_PCC_MAPSIZE; + t->socket.io_offset = ioaddr; /* use for io access offset */ + t->socket.irq_mask = 0; +#if !defined(CONFIG_PLAT_USRV) + t->socket.pci_irq = PLD_IRQ_CFIREQ ; /* card interrupt */ +#else /* CONFIG_PLAT_USRV */ + t->socket.pci_irq = PLD_IRQ_CF0 + pcc_sockets; +#endif /* CONFIG_PLAT_USRV */ + +#ifndef CONFIG_PLAT_USRV + /* insert interrupt */ + request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); + /* eject interrupt */ + request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); + + DEBUG(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); + pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); +#endif /* CONFIG_PLAT_USRV */ +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + pcc_set(pcc_sockets, (unsigned int)PLD_CFCR1, 0x0200); +#endif + pcc_sockets++; + + return; +} + + +/*====================================================================*/ + +static irqreturn_t pcc_interrupt(int irq, void *dev, struct pt_regs *regs) +{ + int i; + u_int events = 0; + int handled = 0; + + DEBUG(3, "m32r_cfc: pcc_interrupt: irq=%d, dev=%p, regs=%p\n", + irq, dev, regs); + for (i = 0; i < pcc_sockets; i++) { + if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) + continue; + + handled = 1; + DEBUG(3, "m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", + i, irq); + events |= SS_DETECT; /* insert or eject */ + if (events) + pcmcia_parse_events(&socket[i].socket, events); + } + DEBUG(3, "m32r_cfc: pcc_interrupt: done\n"); + + return IRQ_RETVAL(handled); +} /* pcc_interrupt */ + +static void pcc_interrupt_wrapper(u_long data) +{ + DEBUG(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); + pcc_interrupt(0, NULL, NULL); + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); +} + +/*====================================================================*/ + +static int _pcc_get_status(u_short sock, u_int *value) +{ + u_int status; + + DEBUG(3, "m32r_cfc: _pcc_get_status:\n"); + status = pcc_get(sock, (unsigned int)PLD_CFSTS); + *value = (status) ? SS_DETECT : 0; + DEBUG(3, "m32r_cfc: _pcc_get_status: status=0x%08x\n", status); + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + if ( status ) { + /* enable CF power */ + status = inw((unsigned int)PLD_CPCR); + if (!(status & PLD_CPCR_CF)) { + DEBUG(3, "m32r_cfc: _pcc_get_status: " + "power on (CPCR=0x%08x)\n", status); + status |= PLD_CPCR_CF; + outw(status, (unsigned int)PLD_CPCR); + udelay(100); + } + *value |= SS_POWERON; + + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0);/* enable buffer */ + udelay(100); + + *value |= SS_READY; /* always ready */ + *value |= SS_3VCARD; + } else { + /* disable CF power */ + status = inw((unsigned int)PLD_CPCR); + status &= ~PLD_CPCR_CF; + outw(status, (unsigned int)PLD_CPCR); + udelay(100); + DEBUG(3, "m32r_cfc: _pcc_get_status: " + "power off (CPCR=0x%08x)\n", status); + } +#elif defined(CONFIG_PLAT_MAPPI2) + if ( status ) { + status = pcc_get(sock, (unsigned int)PLD_CPCR); + if (status == 0) { /* power off */ + pcc_set(sock, (unsigned int)PLD_CPCR, 1); + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); /* force buffer off for ZA-36 */ + udelay(50); + } + status = pcc_get(sock, (unsigned int)PLD_CFBUFCR); + if (status != 0) { /* buffer off */ + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); + udelay(50); + pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0101); + udelay(25); /* for IDE reset */ + pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0100); + mdelay(2); /* for IDE reset */ + } else { + *value |= SS_POWERON; + *value |= SS_READY; + } + } +#else +#error no platform configuration +#endif + DEBUG(3, "m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", + sock, *value); + return 0; +} /* _get_status */ + +/*====================================================================*/ + +static int _pcc_get_socket(u_short sock, socket_state_t *state) +{ +// pcc_socket_t *t = &socket[sock]; + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + state->flags = 0; + state->csc_mask = SS_DETECT; /* ??? */ + state->csc_mask |= SS_READY; /* ??? */ + state->io_irq = 0; + state->Vcc = 33; /* 3.3V fixed */ + state->Vpp = 33; +#endif + DEBUG(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + return 0; +} /* _get_socket */ + +/*====================================================================*/ + +static int _pcc_set_socket(u_short sock, socket_state_t *state) +{ +#if defined(CONFIG_PLAT_MAPPI2) + u_long reg = 0; +#endif + DEBUG(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + if (state->Vcc) { + if ((state->Vcc != 50) && (state->Vcc != 33)) + return -EINVAL; + /* accept 5V and 3.3V */ + } +#elif defined(CONFIG_PLAT_MAPPI2) + if (state->Vcc) { + /* + * 5V only + */ + if (state->Vcc == 50) { + reg |= PCCSIGCR_VEN; + } else { + return -EINVAL; + } + } +#endif + + if (state->flags & SS_RESET) { + DEBUG(3, ":RESET\n"); + pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); + }else{ + pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); + } + if (state->flags & SS_OUTPUT_ENA){ + DEBUG(3, ":OUTPUT_ENA\n"); + /* bit clear */ + pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); + } else { + pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); + } + +#ifdef PCMCIA_DEBUG + if(state->flags & SS_IOCARD){ + DEBUG(3, ":IOCARD"); + } + if (state->flags & SS_PWR_AUTO) { + DEBUG(3, ":PWR_AUTO"); + } + if (state->csc_mask & SS_DETECT) + DEBUG(3, ":csc-SS_DETECT"); + if (state->flags & SS_IOCARD) { + if (state->csc_mask & SS_STSCHG) + DEBUG(3, ":STSCHG"); + } else { + if (state->csc_mask & SS_BATDEAD) + DEBUG(3, ":BATDEAD"); + if (state->csc_mask & SS_BATWARN) + DEBUG(3, ":BATWARN"); + if (state->csc_mask & SS_READY) + DEBUG(3, ":READY"); + } + DEBUG(3, "\n"); +#endif + return 0; +} /* _set_socket */ + +/*====================================================================*/ + +static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) +{ + u_char map; + + DEBUG(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " + "%#4.4x-%#4.4x)\n", sock, io->map, io->flags, + io->speed, io->start, io->stop); + map = io->map; + + return 0; +} /* _set_io_map */ + +/*====================================================================*/ + +static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) +{ + + u_char map = mem->map; + u_long mode; + u_long addr; + pcc_socket_t *t = &socket[sock]; + + DEBUG(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " + "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags, + mem->speed, mem->res->start, mem->res->end, mem->card_start); + + /* + * sanity check + */ + if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) || + (mem->res->start > mem->res->end)) { + return -EINVAL; + } + + /* + * de-activate + */ + if ((mem->flags & MAP_ACTIVE) == 0) { + t->current_space = as_none; + return 0; + } + + /* + * Disable first + */ +// pcc_set(sock, PCCR, 0); + + /* + * Set mode + */ + if (mem->flags & MAP_ATTRIB) { + mode = PCMOD_AS_ATTRIB | PCMOD_CBSZ; + t->current_space = as_attr; + } else { + mode = 0; /* common memory */ + t->current_space = as_comm; + } +// pcc_set(sock, PCMOD, mode); + + /* + * Set address + */ + addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK); +// pcc_set(sock, PCADR, addr); + + mem->res->start = addr + mem->card_start; + mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1); + + /* + * Set timing + */ +// pcc_set(sock, PCATCR, pcc_access_timing); + + /* + * Enable again + */ +// pcc_set(sock, PCCR, 1); + + return 0; + +} /* _set_mem_map */ + +#if 0 /* driver model ordering issue */ +/*====================================================================== + + Routines for accessing socket information and register dumps via + /proc/bus/pccard/... + +======================================================================*/ + +static ssize_t show_info(struct class_device *class_dev, char *buf) +{ + pcc_socket_t *s = container_of(class_dev, struct pcc_socket, + socket.dev); + + return sprintf(buf, "type: %s\nbase addr: 0x%08lx\n", + pcc[s->type].name, s->base); +} + +static ssize_t show_exca(struct class_device *class_dev, char *buf) +{ + /* FIXME */ + + return 0; +} + +static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL); +static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL); +#endif + +/*====================================================================*/ + +/* this is horribly ugly... proper locking needs to be done here at + * some time... */ +#define LOCKED(x) do { \ + int retval; \ + unsigned long flags; \ + spin_lock_irqsave(&pcc_lock, flags); \ + retval = x; \ + spin_unlock_irqrestore(&pcc_lock, flags); \ + return retval; \ +} while (0) + + +static int pcc_get_status(struct pcmcia_socket *s, u_int *value) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_get_status: sock(%d) -EINVAL\n", sock); + *value = 0; + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_get_status: sock(%d)\n", sock); + LOCKED(_pcc_get_status(sock, value)); +} + +static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_get_socket: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_get_socket: sock(%d)\n", sock); + LOCKED(_pcc_get_socket(sock, state)); +} + +static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_socket: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_socket: sock(%d)\n", sock); + LOCKED(_pcc_set_socket(sock, state)); +} + +static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_io_map: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_io_map: sock(%d)\n", sock); + LOCKED(_pcc_set_io_map(sock, io)); +} + +static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_mem_map: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_mem_map: sock(%d)\n", sock); + LOCKED(_pcc_set_mem_map(sock, mem)); +} + +static int pcc_init(struct pcmcia_socket *s) +{ + DEBUG(3, "m32r_cfc: pcc_init()\n"); + return 0; +} + +static int pcc_suspend(struct pcmcia_socket *sock) +{ + DEBUG(3, "m32r_cfc: pcc_suspend()\n"); + return pcc_set_socket(sock, &dead_socket); +} + +static struct pccard_operations pcc_operations = { + .init = pcc_init, + .suspend = pcc_suspend, + .get_status = pcc_get_status, + .get_socket = pcc_get_socket, + .set_socket = pcc_set_socket, + .set_io_map = pcc_set_io_map, + .set_mem_map = pcc_set_mem_map, +}; + +/*====================================================================*/ + +static int m32rpcc_suspend(struct device *dev, u32 state, u32 level) +{ + int ret = 0; + if (level == SUSPEND_SAVE_STATE) + ret = pcmcia_socket_dev_suspend(dev, state); + return ret; +} + +static int m32rpcc_resume(struct device *dev, u32 level) +{ + int ret = 0; + if (level == RESUME_RESTORE_STATE) + ret = pcmcia_socket_dev_resume(dev); + return ret; +} + + +static struct device_driver pcc_driver = { + .name = "cfc", + .bus = &platform_bus_type, + .suspend = m32rpcc_suspend, + .resume = m32rpcc_resume, +}; + +static struct platform_device pcc_device = { + .name = "cfc", + .id = 0, +}; + +/*====================================================================*/ + +#define UT_CFC +static int __init init_m32r_pcc(void) +{ + int i, ret; + + ret = driver_register(&pcc_driver); + if (ret) + return ret; + + ret = platform_device_register(&pcc_device); + if (ret){ + driver_unregister(&pcc_driver); + return ret; + } + +#if defined(CONFIG_PLAT_MAPPI2) + pcc_set(0, (unsigned int)PLD_CFCR0, 0x0f0f); + pcc_set(0, (unsigned int)PLD_CFCR1, 0x0200); +#endif + + pcc_sockets = 0; + +#if !defined(CONFIG_PLAT_USRV) + add_pcc_socket(M32R_PCC0_BASE, PLD_IRQ_CFC_INSERT, CFC_ATTR_MAPBASE, + CFC_IOPORT_BASE); +#else /* CONFIG_PLAT_USRV */ + { + ulong base, mapaddr; + ioaddr_t ioaddr; + + for (i = 0 ; i < M32R_MAX_PCC ; i++) { + base = (ulong)PLD_CFRSTCR; + base = base | (i << 8); + ioaddr = (i + 1) << 12; + mapaddr = CFC_ATTR_MAPBASE | (i << 20); + add_pcc_socket(base, 0, mapaddr, ioaddr); + } + } +#endif /* CONFIG_PLAT_USRV */ + + if (pcc_sockets == 0) { + printk("socket is not found.\n"); + platform_device_unregister(&pcc_device); + driver_unregister(&pcc_driver); + return -ENODEV; + } + + /* Set up interrupt handler(s) */ + + for (i = 0 ; i < pcc_sockets ; i++) { + socket[i].socket.dev.dev = &pcc_device.dev; + socket[i].socket.ops = &pcc_operations; + socket[i].socket.owner = THIS_MODULE; + socket[i].number = i; + ret = pcmcia_register_socket(&socket[i].socket); + if (ret && i--) { + for (; i>= 0; i--) + pcmcia_unregister_socket(&socket[i].socket); + break; + } +#if 0 /* driver model ordering issue */ + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_info); + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_exca); +#endif + } + + /* Finally, schedule a polling interrupt */ + if (poll_interval != 0) { + poll_timer.function = pcc_interrupt_wrapper; + poll_timer.data = 0; + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); + } + + return 0; +} /* init_m32r_pcc */ + +static void __exit exit_m32r_pcc(void) +{ + int i; + + for (i = 0; i < pcc_sockets; i++) + pcmcia_unregister_socket(&socket[i].socket); + + platform_device_unregister(&pcc_device); + if (poll_interval != 0) + del_timer_sync(&poll_timer); + + driver_unregister(&pcc_driver); +} /* exit_m32r_pcc */ + +module_init(init_m32r_pcc); +module_exit(exit_m32r_pcc); +MODULE_LICENSE("Dual MPL/GPL"); +/*====================================================================*/ diff -Nru a/arch/m32r/drivers/m32r_cfc.h b/arch/m32r/drivers/m32r_cfc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_cfc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,85 @@ +/* + * $Id$ + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + +#if !defined(CONFIG_PLAT_USRV) +#define M32R_MAX_PCC 2 +#else /* CONFIG_PLAT_USRV */ +#define M32R_MAX_PCC CONFIG_CFC_NUM +#endif /* CONFIG_PLAT_USRV */ + +/* + * M32R PC Card Controler + */ +#define M32R_PCC0_BASE 0x00ef7000 +#define M32R_PCC1_BASE 0x00ef7020 + +/* + * Register offsets + */ +#define PCCR 0x00 +#define PCADR 0x04 +#define PCMOD 0x08 +#define PCIRC 0x0c +#define PCCSIGCR 0x10 +#define PCATCR 0x14 + +/* + * PCCR + */ +#define PCCR_PCEN (1UL<<(31-31)) + +/* + * PCIRC + */ +#define PCIRC_BWERR (1UL<<(31-7)) +#define PCIRC_CDIN1 (1UL<<(31-14)) +#define PCIRC_CDIN2 (1UL<<(31-15)) +#define PCIRC_BEIEN (1UL<<(31-23)) +#define PCIRC_CIIEN (1UL<<(31-30)) +#define PCIRC_COIEN (1UL<<(31-31)) + +/* + * PCCSIGCR + */ +#define PCCSIGCR_SEN (1UL<<(31-3)) +#define PCCSIGCR_VEN (1UL<<(31-7)) +#define PCCSIGCR_CRST (1UL<<(31-15)) +#define PCCSIGCR_COCR (1UL<<(31-31)) + +/* + * + */ +#define PCMOD_AS_ATTRIB (1UL<<(31-19)) +#define PCMOD_AS_IO (1UL<<(31-18)) + +#define PCMOD_CBSZ (1UL<<(31-23)) /* set for 8bit */ + +#define PCMOD_DBEX (1UL<<(31-31)) /* set for excahnge */ + +/* + * M32R PCC Map addr + */ + +#define M32R_PCC0_MAPBASE 0x14000000 +#define M32R_PCC1_MAPBASE 0x16000000 + +#define M32R_PCC_MAPMAX 0x02000000 + +#define M32R_PCC_MAPSIZE 0x00001000 /* XXX */ +#define M32R_PCC_MAPMASK (~(M32R_PCC_MAPMAX-1)) + +#define CFC_IOPORT_BASE 0x1000 + +#if !defined(CONFIG_PLAT_USRV) +#define CFC_ATTR_MAPBASE 0x0c014000 +#define CFC_IO_MAPBASE_BYTE 0xac012000 +#define CFC_IO_MAPBASE_WORD 0xac002000 +#else /* CONFIG_PLAT_USRV */ +#define CFC_ATTR_MAPBASE 0x04014000 +#define CFC_IO_MAPBASE_BYTE 0xa4012000 +#define CFC_IO_MAPBASE_WORD 0xa4002000 +#endif /* CONFIG_PLAT_USRV */ + diff -Nru a/arch/m32r/drivers/m32r_pcc.c b/arch/m32r/drivers/m32r_pcc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_pcc.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,821 @@ +/* + * linux/arch/m32r/drivers/m32r_pcc.c + * + * Device driver for the PCMCIA functionality of M32R. + * + * Copyright (c) 2001, 2002, 2003, 2004 + * Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* XXX: should be moved into asm/irq.h */ +#define PCC0_IRQ 24 +#define PCC1_IRQ 25 + +#define CHAOS_PCC_DEBUG +#ifdef CHAOS_PCC_DEBUG + static volatile u_short dummy_readbuf; +#endif + +#define PCC_DEBUG_DBEX + +#define PCMCIA_DEBUG 0 + +#include "m32r_pcc.h" + +#ifdef PCMCIA_DEBUG +int pc_debug = PCMCIA_DEBUG; +module_param(pc_debug, int, 0444); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(args) +#else +#define DEBUG(n, args...) do { } while (0) +#endif + +/* Poll status interval -- 0 means default to interrupt */ +static int poll_interval = 0; + +typedef enum pcc_space { as_none = 0, as_comm, as_attr, as_io } pcc_as_t; + +typedef struct pcc_socket { + u_short type, flags; + struct pcmcia_socket socket; + unsigned int number; + ioaddr_t ioaddr; + u_long mapaddr; + u_long base; /* PCC register base */ + u_char cs_irq, intr; + pccard_io_map io_map[MAX_IO_WIN]; + pccard_mem_map mem_map[MAX_WIN]; + u_char io_win; + u_char mem_win; + pcc_as_t current_space; + u_char last_iodbex; +#ifdef CHAOS_PCC_DEBUG + u_char last_iosize; +#endif +#ifdef CONFIG_PROC_FS + struct proc_dir_entry *proc; +#endif +} pcc_socket_t; + +static int pcc_sockets = 0; +static pcc_socket_t socket[M32R_MAX_PCC] = { + { 0, }, /* ... */ +}; + +#define ISA_LOCK(n, f) do { } while (0) +#define ISA_UNLOCK(n, f) do { } while (0) + +/*====================================================================*/ + +static unsigned int pcc_get(u_short, unsigned int); +static void pcc_set(u_short, unsigned int , unsigned int ); + +static spinlock_t pcc_lock = SPIN_LOCK_UNLOCKED; + +void pcc_iorw(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int wr, int flag) +{ + u_long addr; + u_long flags; + int need_ex; +#ifdef PCC_DEBUG_DBEX + int _dbex; +#endif + pcc_socket_t *t = &socket[sock]; +#ifdef CHAOS_PCC_DEBUG + int map_changed = 0; +#endif + + /* Need lock ? */ + spin_lock_irqsave(&pcc_lock, flags); + + /* + * Check if need dbex + */ + need_ex = (size > 1 && flag == 0) ? PCMOD_DBEX : 0; +#ifdef PCC_DEBUG_DBEX + _dbex = need_ex; + need_ex = 0; +#endif + + /* + * calculate access address + */ + addr = t->mapaddr + port - t->ioaddr + KSEG1; /* XXX */ + + /* + * Check current mapping + */ + if (t->current_space != as_io || t->last_iodbex != need_ex) { + + u_long cbsz; + + /* + * Disable first + */ + pcc_set(sock, PCCR, 0); + + /* + * Set mode and io address + */ + cbsz = (t->flags & MAP_16BIT) ? 0 : PCMOD_CBSZ; + pcc_set(sock, PCMOD, PCMOD_AS_IO | cbsz | need_ex); + pcc_set(sock, PCADR, addr & 0x1ff00000); + + /* + * Enable and read it + */ + pcc_set(sock, PCCR, 1); + +#ifdef CHAOS_PCC_DEBUG +#if 0 + map_changed = (t->current_space == as_attr && size == 2); /* XXX */ +#else + map_changed = 1; +#endif +#endif + t->current_space = as_io; + } + + /* + * access to IO space + */ + if (size == 1) { + /* Byte */ + unsigned char *bp = (unsigned char *)buf; + +#ifdef CHAOS_DEBUG + if (map_changed) { + dummy_readbuf = readb(addr); + } +#endif + if (wr) { + /* write Byte */ + while (nmemb--) { + writeb(*bp++, addr); + } + } else { + /* read Byte */ + while (nmemb--) { + *bp++ = readb(addr); + } + } + } else { + /* Word */ + unsigned short *bp = (unsigned short *)buf; + +#ifdef CHAOS_PCC_DEBUG + if (map_changed) { + dummy_readbuf = readw(addr); + } +#endif + if (wr) { + /* write Word */ + while (nmemb--) { +#ifdef PCC_DEBUG_DBEX + if (_dbex) { + unsigned char *cp = (unsigned char *)bp; + unsigned short tmp; + tmp = cp[1] << 8 | cp[0]; + writew(tmp, addr); + bp++; + } else +#endif + writew(*bp++, addr); + } + } else { + /* read Word */ + while (nmemb--) { +#ifdef PCC_DEBUG_DBEX + if (_dbex) { + unsigned char *cp = (unsigned char *)bp; + unsigned short tmp; + tmp = readw(addr); + cp[0] = tmp & 0xff; + cp[1] = (tmp >> 8) & 0xff; + bp++; + } else +#endif + *bp++ = readw(addr); + } + } + } + +#if 1 + /* addr is no longer used */ + if ((addr = pcc_get(sock, PCIRC)) & PCIRC_BWERR) { + printk("m32r_pcc: BWERR detected : port 0x%04lx : iosize %dbit\n", + port, size * 8); + pcc_set(sock, PCIRC, addr); + } +#endif + /* + * save state + */ + t->last_iosize = size; + t->last_iodbex = need_ex; + + /* Need lock ? */ + + spin_unlock_irqrestore(&pcc_lock,flags); + + return; +} + +void pcc_ioread(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int flag) { + pcc_iorw(sock, port, buf, size, nmemb, 0, flag); +} + +void pcc_iowrite(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int flag) { + pcc_iorw(sock, port, buf, size, nmemb, 1, flag); +} + +/*====================================================================*/ + +#define IS_ALIVE 0x8000 + +typedef struct pcc_t { + char *name; + u_short flags; +} pcc_t; + +static pcc_t pcc[] = { + { "xnux2", 0 }, { "xnux2", 0 }, +}; + +static irqreturn_t pcc_interrupt(int, void *, struct pt_regs *); + +/*====================================================================*/ + +static struct timer_list poll_timer; + +static unsigned int pcc_get(u_short sock, unsigned int reg) +{ + return inl(socket[sock].base + reg); +} + + +static void pcc_set(u_short sock, unsigned int reg, unsigned int data) +{ + outl(data, socket[sock].base + reg); +} + +/*====================================================================== + + See if a card is present, powered up, in IO mode, and already + bound to a (non PC Card) Linux driver. We leave these alone. + + We make an exception for cards that seem to be serial devices. + +======================================================================*/ + +static int __init is_alive(u_short sock) +{ + unsigned int stat; + unsigned int f; + + stat = pcc_get(sock, PCIRC); + f = (stat & (PCIRC_CDIN1 | PCIRC_CDIN2)) >> 16; + if(!f){ + printk("m32r_pcc: No Card is detected at socket %d : stat = 0x%08x\n",stat,sock); + return 0; + } + if(f!=3) + printk("m32r_pcc: Insertion fail (%.8x) at socket %d\n",stat,sock); + else + printk("m32r_pcc: Card is Inserted at socket %d(%.8x)\n",sock,stat); + return 0; +} + +static void add_pcc_socket(ulong base, int irq, ulong mapaddr, ioaddr_t ioaddr) +{ + pcc_socket_t *t = &socket[pcc_sockets]; + + /* add sockets */ + t->ioaddr = ioaddr; + t->mapaddr = mapaddr; + t->base = base; +#ifdef CHAOS_PCC_DEBUG + t->flags = MAP_16BIT; +#else + t->flags = 0; +#endif + if (is_alive(pcc_sockets)) + t->flags |= IS_ALIVE; + + /* add pcc */ + if (t->base > 0) { + request_region(t->base, 0x20, "m32r-pcc"); + } + + printk(KERN_INFO " %s ", pcc[pcc_sockets].name); + printk("pcc at 0x%08lx\n", t->base); + + /* Update socket interrupt information, capabilities */ + t->socket.features |= (SS_CAP_PCCARD | SS_CAP_STATIC_MAP); + t->socket.map_size = M32R_PCC_MAPSIZE; + t->socket.io_offset = ioaddr; /* use for io access offset */ + t->socket.irq_mask = 0; + t->socket.pci_irq = 2 + pcc_sockets; /* XXX */ + + request_irq(irq, pcc_interrupt, 0, "m32r-pcc", pcc_interrupt); + + pcc_sockets++; + + return; +} + + +/*====================================================================*/ + +static irqreturn_t pcc_interrupt(int irq, void *dev, struct pt_regs *regs) +{ + int i, j, irc; + u_int events, active; + int handled = 0; + + DEBUG(4, "m32r: pcc_interrupt(%d)\n", irq); + + for (j = 0; j < 20; j++) { + active = 0; + for (i = 0; i < pcc_sockets; i++) { + if ((socket[i].cs_irq != irq) && + (socket[i].socket.pci_irq != irq)) + continue; + handled = 1; + irc = pcc_get(i, PCIRC); + irc >>=16; + DEBUG(2, "m32r-pcc:interrput: socket %d pcirc 0x%02x ", i, irc); + if (!irc) + continue; + + events = (irc) ? SS_DETECT : 0; + events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; + DEBUG(2, " event 0x%02x\n", events); + + if (events) + pcmcia_parse_events(&socket[i].socket, events); + + active |= events; + active = 0; + } + if (!active) break; + } + if (j == 20) + printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); + + DEBUG(4, "m32r-pcc: interrupt done\n"); + + return IRQ_RETVAL(handled); +} /* pcc_interrupt */ + +static void pcc_interrupt_wrapper(u_long data) +{ + pcc_interrupt(0, NULL, NULL); + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); +} + +/*====================================================================*/ + +static int _pcc_get_status(u_short sock, u_int *value) +{ + u_int status; + + status = pcc_get(sock,PCIRC); + *value = ((status & PCIRC_CDIN1) && (status & PCIRC_CDIN2)) + ? SS_DETECT : 0; + + status = pcc_get(sock,PCCR); + +#if 0 + *value |= (status & PCCR_PCEN) ? SS_READY : 0; +#else + *value |= SS_READY; /* XXX: always */ +#endif + + status = pcc_get(sock,PCCSIGCR); + *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; + + DEBUG(3, "m32r-pcc: GetStatus(%d) = %#4.4x\n", sock, *value); + return 0; +} /* _get_status */ + +/*====================================================================*/ + +static int _pcc_get_socket(u_short sock, socket_state_t *state) +{ + DEBUG(3, "m32r-pcc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + return 0; +} /* _get_socket */ + +/*====================================================================*/ + +static int _pcc_set_socket(u_short sock, socket_state_t *state) +{ + u_long reg = 0; + + DEBUG(3, "m32r-pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x)", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + + if (state->Vcc) { + /* + * 5V only + */ + if (state->Vcc == 50) { + reg |= PCCSIGCR_VEN; + } else { + return -EINVAL; + } + } + + if (state->flags & SS_RESET) { + DEBUG(3, ":RESET\n"); + reg |= PCCSIGCR_CRST; + } + if (state->flags & SS_OUTPUT_ENA){ + DEBUG(3, ":OUTPUT_ENA\n"); + /* bit clear */ + } else { + reg |= PCCSIGCR_SEN; + } + + pcc_set(sock,PCCSIGCR,reg); + +#ifdef PCMCIA_DEBUG + if(state->flags & SS_IOCARD){ + DEBUG(3, ":IOCARD"); + } + if (state->flags & SS_PWR_AUTO) { + DEBUG(3, ":PWR_AUTO"); + } + if (state->csc_mask & SS_DETECT) + DEBUG(3, ":csc-SS_DETECT"); + if (state->flags & SS_IOCARD) { + if (state->csc_mask & SS_STSCHG) + DEBUG(3, ":STSCHG"); + } else { + if (state->csc_mask & SS_BATDEAD) + DEBUG(3, ":BATDEAD"); + if (state->csc_mask & SS_BATWARN) + DEBUG(3, ":BATWARN"); + if (state->csc_mask & SS_READY) + DEBUG(3, ":READY"); + } + DEBUG(3, "\n"); +#endif + return 0; +} /* _set_socket */ + +/*====================================================================*/ + +static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) +{ + u_char map; + + DEBUG(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " + "%#4.4x-%#4.4x)\n", sock, io->map, io->flags, + io->speed, io->start, io->stop); + map = io->map; + + return 0; +} /* _set_io_map */ + +/*====================================================================*/ + +static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) +{ + + u_char map = mem->map; + u_long mode; + u_long addr; + pcc_socket_t *t = &socket[sock]; +#ifdef CHAOS_PCC_DEBUG +#if 0 + pcc_as_t last = t->current_space; +#endif +#endif + + DEBUG(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " + "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags, + mem->speed, mem->res->start, mem->res->end, mem->card_start); + + /* + * sanity check + */ + if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) || + (mem->res->start > mem->res->end)) { + return -EINVAL; + } + + /* + * de-activate + */ + if ((mem->flags & MAP_ACTIVE) == 0) { + t->current_space = as_none; + return 0; + } + + /* + * Disable first + */ + pcc_set(sock, PCCR, 0); + + /* + * Set mode + */ + if (mem->flags & MAP_ATTRIB) { + mode = PCMOD_AS_ATTRIB | PCMOD_CBSZ; + t->current_space = as_attr; + } else { + mode = 0; /* common memory */ + t->current_space = as_comm; + } + pcc_set(sock, PCMOD, mode); + + /* + * Set address + */ + addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK); + pcc_set(sock, PCADR, addr); + + mem->res->start = addr + mem->card_start; + mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1); + + /* + * Enable again + */ + pcc_set(sock, PCCR, 1); + +#ifdef CHAOS_PCC_DEBUG +#if 0 + if (last != as_attr) { +#else + if (1) { +#endif + + dummy_readbuf = *(u_char *)(addr + KSEG1); + } +#endif + + return 0; + +} /* _set_mem_map */ + +#if 0 /* driver model ordering issue */ +/*====================================================================== + + Routines for accessing socket information and register dumps via + /proc/bus/pccard/... + +======================================================================*/ + +static ssize_t show_info(struct class_device *class_dev, char *buf) +{ + pcc_socket_t *s = container_of(class_dev, struct pcc_socket, + socket.dev); + + return sprintf(buf, "type: %s\nbase addr: 0x%08lx\n", + pcc[s->type].name, s->base); +} + +static ssize_t show_exca(struct class_device *class_dev, char *buf) +{ + /* FIXME */ + + return 0; +} + +static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL); +static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL); +#endif + +/*====================================================================*/ + +/* this is horribly ugly... proper locking needs to be done here at + * some time... */ +#define LOCKED(x) do { \ + int retval; \ + unsigned long flags; \ + spin_lock_irqsave(&pcc_lock, flags); \ + retval = x; \ + spin_unlock_irqrestore(&pcc_lock, flags); \ + return retval; \ +} while (0) + + +static int pcc_get_status(struct pcmcia_socket *s, u_int *value) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + *value = 0; + return -EINVAL; + } + LOCKED(_pcc_get_status(sock, value)); +} + +static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_get_socket(sock, state)); +} + +static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + + LOCKED(_pcc_set_socket(sock, state)); +} + +static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_set_io_map(sock, io)); +} + +static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_set_mem_map(sock, mem)); +} + +static int pcc_init(struct pcmcia_socket *s) +{ + DEBUG(4, "m32r-pcc: init call\n"); + return 0; +} + +static int pcc_suspend(struct pcmcia_socket *sock) +{ + return pcc_set_socket(sock, &dead_socket); +} + +static struct pccard_operations pcc_operations = { + .init = pcc_init, + .suspend = pcc_suspend, + .get_status = pcc_get_status, + .get_socket = pcc_get_socket, + .set_socket = pcc_set_socket, + .set_io_map = pcc_set_io_map, + .set_mem_map = pcc_set_mem_map, +}; + +/*====================================================================*/ + +static int m32r_pcc_suspend(struct device *dev, u32 state, u32 level) +{ + int ret = 0; + if (level == SUSPEND_SAVE_STATE) + ret = pcmcia_socket_dev_suspend(dev, state); + return ret; +} + +static int m32r_pcc_resume(struct device *dev, u32 level) +{ + int ret = 0; + if (level == RESUME_RESTORE_STATE) + ret = pcmcia_socket_dev_resume(dev); + return ret; +} + + +static struct device_driver pcc_driver = { + .name = "pcc", + .bus = &platform_bus_type, + .suspend = m32r_pcc_suspend, + .resume = m32r_pcc_resume, +}; + +static struct platform_device pcc_device = { + .name = "pcc", + .id = 0, +}; + +/*====================================================================*/ + +static int __init init_m32r_pcc(void) +{ + int i, ret; + + ret = driver_register(&pcc_driver); + if (ret) + return ret; + + ret = platform_device_register(&pcc_device); + if (ret){ + driver_unregister(&pcc_driver); + return ret; + } + + printk(KERN_INFO "m32r PCC probe:\n"); + + pcc_sockets = 0; + + add_pcc_socket(M32R_PCC0_BASE, PCC0_IRQ, M32R_PCC0_MAPBASE, 0x1000); + +#ifdef CONFIG_M32RPCC_SLOT2 + add_pcc_socket(M32R_PCC1_BASE, PCC1_IRQ, M32R_PCC1_MAPBASE, 0x2000); +#endif + + if (pcc_sockets == 0) { + printk("socket is not found.\n"); + platform_device_unregister(&pcc_device); + driver_unregister(&pcc_driver); + return -ENODEV; + } + + /* Set up interrupt handler(s) */ + + for (i = 0 ; i < pcc_sockets ; i++) { + socket[i].socket.dev.dev = &pcc_device.dev; + socket[i].socket.ops = &pcc_operations; + socket[i].socket.owner = THIS_MODULE; + socket[i].number = i; + ret = pcmcia_register_socket(&socket[i].socket); + if (ret && i--) { + for (; i>= 0; i--) + pcmcia_unregister_socket(&socket[i].socket); + break; + } +#if 0 /* driver model ordering issue */ + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_info); + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_exca); +#endif + } + + /* Finally, schedule a polling interrupt */ + if (poll_interval != 0) { + poll_timer.function = pcc_interrupt_wrapper; + poll_timer.data = 0; + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); + } + + return 0; +} /* init_m32r_pcc */ + +static void __exit exit_m32r_pcc(void) +{ + int i; + + for (i = 0; i < pcc_sockets; i++) + pcmcia_unregister_socket(&socket[i].socket); + + platform_device_unregister(&pcc_device); + if (poll_interval != 0) + del_timer_sync(&poll_timer); + + driver_unregister(&pcc_driver); +} /* exit_m32r_pcc */ + +module_init(init_m32r_pcc); +module_exit(exit_m32r_pcc); +MODULE_LICENSE("Dual MPL/GPL"); +/*====================================================================*/ diff -Nru a/arch/m32r/drivers/m32r_pcc.h b/arch/m32r/drivers/m32r_pcc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_pcc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + + + +#define M32R_MAX_PCC 2 + +/* + * M32R PC Card Controler + */ +#define M32R_PCC0_BASE 0x00ef7000 +#define M32R_PCC1_BASE 0x00ef7020 + +/* + * Register offsets + */ +#define PCCR 0x00 +#define PCADR 0x04 +#define PCMOD 0x08 +#define PCIRC 0x0c +#define PCCSIGCR 0x10 +#define PCATCR 0x14 + +/* + * PCCR + */ +#define PCCR_PCEN (1UL<<(31-31)) + +/* + * PCIRC + */ +#define PCIRC_BWERR (1UL<<(31-7)) +#define PCIRC_CDIN1 (1UL<<(31-14)) +#define PCIRC_CDIN2 (1UL<<(31-15)) +#define PCIRC_BEIEN (1UL<<(31-23)) +#define PCIRC_CIIEN (1UL<<(31-30)) +#define PCIRC_COIEN (1UL<<(31-31)) + +/* + * PCCSIGCR + */ +#define PCCSIGCR_SEN (1UL<<(31-3)) +#define PCCSIGCR_VEN (1UL<<(31-7)) +#define PCCSIGCR_CRST (1UL<<(31-15)) +#define PCCSIGCR_COCR (1UL<<(31-31)) + +/* + * + */ +#define PCMOD_AS_ATTRIB (1UL<<(31-19)) +#define PCMOD_AS_IO (1UL<<(31-18)) + +#define PCMOD_CBSZ (1UL<<(31-23)) /* set for 8bit */ + +#define PCMOD_DBEX (1UL<<(31-31)) /* set for excahnge */ + +/* + * M32R PCC Map addr + */ +#define M32R_PCC0_MAPBASE 0x14000000 +#define M32R_PCC1_MAPBASE 0x16000000 + +#define M32R_PCC_MAPMAX 0x02000000 + +#define M32R_PCC_MAPSIZE 0x00001000 /* XXX */ +#define M32R_PCC_MAPMASK (~(M32R_PCC_MAPMAX-1)) + diff -Nru a/arch/m32r/drivers/m5.c b/arch/m32r/drivers/m5.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5.c 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,913 @@ +/* + * Flash Memory Driver for M32700UT-CPU + * + * [support chips] + * - M5M29GT320VP + * + * Copyright (C) 2003 Takeo Takahashi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * 2003-02-01: Takeo Takahashi, support M5M29GT320VP page program. + * + */ + +#ifndef __KERNEL__ +# define __KERNEL__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "m5.h" + +static const char version[] = "M5 Flash Driver"; +static const char date[] = __DATE__; +static const char time[] = __TIME__; + +/* + * Special function + */ +#define M5_SUPPORT_PROBE 1 +#define M5_MAX_ERROR 5 + +/* + * flash memory start address: + */ +//#define M5_BASE_ADDR (0x00000000 + NONCACHE_OFFSET) +#define M5_BASE_ADDR (0x00000000 + PAGE_OFFSET) +#define M5_IDENT_ADDR (M5_BASE_ADDR + 0) + +/* + * This driver does not have a real partition block, but + * it can support simulation of partition in single chip. + */ +#define M5_PARTITIONS (3) +static int m5_len[M5_PARTITIONS] = { + 192 * 1024, /* 192kB: 0x00000000 - 0x0002ffff */ + 1088 * 1024, /* 1088kB: 0x00030000 - 0x0013ffff */ + 2816 * 1024 /* 2816kB: 0x00140000 - 0x003fffff */ +}; + +static int major = 240; +static int debug = 2; +static int led=0; +static int m5_addr[M5_PARTITIONS]; +static int m5_blk_size[M5_PARTITIONS]; +static int m5_blksize_size[M5_PARTITIONS]; +static int m5_hardsect_size[M5_PARTITIONS]; +static int m5_read_ahead = 1; +MODULE_PARM(major, "i"); +//MODULE_PARM_DESC(major, "major number"); +MODULE_PARM(debug, "i"); +//MODULE_PARM_DESC(debug, "debug flag"); +MODULE_PARM(led, "i"); +//MODULE_PARM_DESC(led, "LED2 support"); + +static devfs_handle_t devfs_handle = NULL; +#ifdef CONFIG_PROC_FS +static struct proc_dir_entry *proc_m5; +#endif + +#define MAJOR_NR major +#define DEVICE_NAME "m5" +#define DEVICE_NR(device) MINOR(device) +#define DEVICE_NO_RANDOM +#define DEVICE_OFF(device) +#define DEVICE_ON(device) +#define DEVICE_REQUEST m5_request +#include + +#define WAIT_TIME 10 /* 10 usec */ +#define WAIT_COUNT (50000/WAIT_TIME) /* 50ms = 10us*5000times */ + +#define SUCCESS 0 +#define FAILED (-1) + +/* + * definitions for cache + */ +static struct cache { + int blk; /* block number, -1:invalid */ + int status; /* cache status */ +#define B_CLEAN 0 +#define B_DIRTY 1 + m5_t *addr; /* block base address */ + m5_t cache[M5_BLOCK_SIZE64]; +} m5_cache; +#define M5_BLK_NOCACHED() (m5_cache.blk == -1) +#define M5_BLK_CACHED(blk) (m5_cache.blk == (blk)) +#define M5_STATE_DIRTY() (m5_cache.status == B_DIRTY) +#define M5_STATE_CLEAN() (m5_cache.status == B_CLEAN) +#define M5_MARK_DIRTY() (m5_cache.status = B_DIRTY) +#define M5_MARK_CLEAN() (m5_cache.status = B_CLEAN) +#define M5_MARK_NOCACHED() (m5_cache.blk = -1) +#define M5_MARK_CACHED(blk, addr) (m5_cache.blk = (blk), \ + m5_cache.addr = (addr)) +#define M5_CACHED_BLK m5_cache.blk +#define M5_CACHED_ADDR m5_cache.addr +#define M5_CACHED_BASE m5_cache.cache + +/* + * Prototype declarations + */ +static int m5_erase_blk(m5_t *reg); +static void m5_led_toggle(void); +static void m5_led_on(void); +static void m5_led_off(void); +static m5_t m5_in(m5_t *addr); +static void m5_out(m5_t val, m5_t *addr); +static int m5_probe(m5_t *addr); +static int m5_get_blk_num(m5_t *addr); +static int m5_get_blk_offset(int blk, m5_t *addr); +static int m5_get_blk_size(int blk); +static int m5_read_blk_cache(m5_t *addr); +static int m5_write_blk_cache(void); +static int m5_full_status_check(m5_t status, m5_t *reg); +static void m5_clear_status(m5_t *reg); +#if 0 +static int m5_status_check(m5_t *reg); +#endif +static int m5_wait_for_ready(m5_t *reg); +static int m5_write_page(m5_t *addr, const m5_t *buf); +static int m5_write(const m5_t *buf, int offset, int len); +static int m5_read_page(m5_t *buf, m5_t *addr); +static int m5_read(m5_t *buf, int offset, int len); +static int m5_erase_blk(m5_t *addr); +static void m5_request(request_queue_t *req); +static int m5_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, unsigned long arg); +static int m5_open(struct inode *inode, struct file *fp); +static int m5_release(struct inode *inode, struct file *fp); +static int proc_m5_read(char *buf, char **start, off_t offset, int len, int *eof, void *unused); +static int __init m5_init(void); +static int __init m5_init_module(void); +static void __exit m5_cleanup_module(void); + +/* + * special function + */ +static inline void m5_led_toggle(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + if (status & PLD_IOLED_2_ON) + status &= ~PLD_IOLED_2_ON; + else + status |= PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +static inline void m5_led_on(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + status |= PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +static inline void m5_led_off(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + status &= ~PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +/* + * I/O function + */ +static inline m5_t m5_in(m5_t *addr) +{ + return *addr; +} + +static inline void m5_out(m5_t val, m5_t *addr) +{ + *addr = val; +} + +#if M5_SUPPORT_PROBE +/* + * int m5_probe() + * m5_t *addr: probed address + * int SUCCESS: supported device + * int FAILED: unsupported device + */ +static int m5_probe(m5_t *addr) +{ +#if 1 + /* + * FIXME: cannot read maker & device codes. + */ + m5_t val; + m5_out(M5_CMD_DEVICE_IDENT, addr); + val = m5_in((m5_t *)M5_IDENT_ADDR); + val &= 0xff; + if (val == M5_MAKER) + printk("m5: detected M5M29GT320VP\n"); + else + printk("m5: unknown maker(0x%02x)\n", val); + m5_out(M5_CMD_READ_ARRAY, addr); /* array mode */ + /* always success */ + return SUCCESS; +#else + + int result; + m5_t val; + unsigned char maker, device; + + result = SUCCESS; + m5_out(M5_CMD_DEVICE_IDENT, addr); + val = m5_in((m5_t *)M5_IDENT_ADDR); + maker = (val >> 16); + device = (val & 0xff); + if (maker != M5_MAKER) { + printk("m5: unknown maker(0x%02x)\n", maker); + // result = FAILED; + // ignore error + } + if (device != M5_M5M29GT320VP) { + printk("m5: unknown device(0x%02x)\n", device); + // result = FAILED; + // ignore error + } + if (result != FAILED) + printk("m5: detected M5M29GT320VP\n"); + m5_out(M5_CMD_READ_ARRAY, addr); + return result; +#endif +} +#endif /* M5_SUPPORT_PROBE */ + +/* + * int m5_get_blk_num() + * m5_t *addr: + * blk: OK, return block number + * -1: NG + */ +static int m5_get_blk_num(m5_t *addr) +{ + int blk; + + blk = (((int)addr & 0x0fff0000) >> 16); + if (blk > 0x3f) { + printk("m5: out of block address (0x%08x)\n", (int)addr); + return -1; + } + if (blk == 0x3f) + blk += (int)(((int)addr & 0x0000e000) >> 13); + if (blk > MAX_BLOCK_NUM) { + printk("m5: out of block address (addr=0x%08x, blk=%d)\n", + (int)addr, blk); + return -1; + } + return blk; +} + +/* + * m5_t *m5_get_blk_base() + * return block base address + */ +static inline m5_t *m5_get_blk_base(int blk, m5_t *addr) +{ + if (blk < 0x3f) return (m5_t *)((int)addr & 0xffff0000); + return (m5_t *)((int)addr & 0xffffe000); +} + +/* + * int m5_get_blk_offset() + * return offset of specified address in blk + */ +static inline int m5_get_blk_offset(int blk, m5_t *addr) +{ + if (blk < 0x3f) return ((int)addr & 0xffff); + return ((int)addr & 0x1fff); +} + +/* + * int m5_get_blk_size() + * return block size in byte + */ +static inline int m5_get_blk_size(int blk) +{ + if (blk >= 63) return M5_BLOCK_SIZE8; + return M5_BLOCK_SIZE64; +} + +/* + * cache operations + */ +static int m5_read_blk_cache(m5_t *addr) +{ + int blk; + int size; + int result; + + result = SUCCESS; + blk = m5_get_blk_num(addr); + if (blk < 0) return FAILED; + if (M5_BLK_CACHED(blk)) + return result; + if (M5_STATE_DIRTY()) { /* cached other block */ + result = m5_write_blk_cache(); + if (result != SUCCESS) return result; + } + /* ok, we can use cache */ + size = m5_get_blk_size(blk); + addr = m5_get_blk_base(blk, addr); + memcpy((void *)M5_CACHED_BASE, (void *)addr, size); + M5_MARK_CACHED(blk, addr); + M5_MARK_CLEAN(); + return result; +} + +static int m5_write_blk_cache(void) +{ + int size; + int pages; + int i; + m5_t *reg, *addr, *buf; + int result; + + result = SUCCESS; + + if (M5_BLK_NOCACHED()) + return result; + if (! M5_STATE_DIRTY()) + return result; + + /* we have to write cache */ + m5_led_on(); + size = m5_get_blk_size(M5_CACHED_BLK); + addr = M5_CACHED_ADDR; + buf = M5_CACHED_BASE; + reg = addr; + + result = m5_erase_blk(reg); + if (result != SUCCESS) return result; + + DEBUG(1, "m5: wrting addr=0x%08x, buf=0x%08x, size=%d\n",\ + (int)addr, (int)buf, size); + for (pages = 0; pages < (size/M5_PAGE_SIZE); pages++) { + m5_out(M5_CMD_PROGRAM_PAGE, reg); + for (i = 0; i < (M5_PAGE_SIZE/sizeof(m5_t)); i++) + *addr++ = *buf++; + if (m5_wait_for_ready(reg) != SUCCESS) + result = FAILED; + reg = addr; + } + m5_out(M5_CMD_READ_ARRAY, reg); /* array mode */ + if (result == SUCCESS) + M5_MARK_CLEAN(); + m5_led_off(); + return result; /* SUCCESS or FAILED */ +} + +/* + * int m5_full_status_check() + * m5_t status: status + * m5_t *reg: bank address + * SUCCESS: no error + * FAILED: error happen + */ +static inline int m5_full_status_check(m5_t status, m5_t *reg) +{ + if ((status & M5_STATUS_PROGRAM) && + (status & M5_STATUS_ERASE)) { + printk("m5: command sequence error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_ERASE){ + printk("m5: erase error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_PROGRAM){ + printk("m5: program write error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_BLOCK){ + printk("m5: block write error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + /* passed */ + return SUCCESS; +} + +/* + * void m5_clear_status() + * m5_t *reg: address of status register + */ +static inline void m5_clear_status(m5_t *reg) +{ + m5_out(M5_CMD_CLEAR_STATUS, reg); +} + +#if 0 +/* + * int m5_status_check() + * m5_t *reg: address of command register + * SUCCESS: ready now + * FAILED: error happen while waiting + */ +static int m5_status_check(m5_t *reg) +{ + m5_t status; + int result; + int n; + static int error_count = 0; + + m5_out(M5_CMD_READ_STATUS, reg); + for (n = WAIT_COUNT; n > 0; n--) { + status = m5_in(reg); + if (status & M5_STATUS_READY) + break; + udelay(WAIT_TIME); + } + if (n <= 0) { + if (error_count++ < M5_MAX_ERROR) + printk("m5: time out (sts=0x%02x).\n", status); + m5_clear_status(reg); + return FAILED; + } + result = m5_full_status_check(status, reg); + if (result != SUCCESS) { + m5_clear_status(reg); + return FAILED; + } + m5_clear_status(reg); + return SUCCESS; +} +#endif + +/* + * int m5_wait_for_ready() + * m5_t *reg: address of command register + * SUCCESS: ready now + * FAILED: error happen while waiting + */ +static int m5_wait_for_ready(m5_t *reg) +{ + m5_t status; + int result; + int n; + static int error_count = 0; + + for (n = WAIT_COUNT; n > 0; n--) { + status = m5_in(reg); + if (status & M5_STATUS_READY) + break; + udelay(WAIT_TIME); + } + if (n <= 0) { + if (error_count++ < M5_MAX_ERROR) + printk("m5: time out (sts=0x%02x).\n", status); + m5_clear_status(reg); + return FAILED; + } + result = m5_full_status_check(status, reg); + if (result != SUCCESS) { + m5_clear_status(reg); + return FAILED; + } + return SUCCESS; +} + +/* + * int m5_write_page(m5_t *addr, const m5_t *buf) + * m5_t *addr: sector address + * m5_t *buf: buffer address + * SUCCESS: ok + * FAILED: error + */ +static int m5_write_page(m5_t *addr, const m5_t *buf) +{ + int blk; + int offset; + + if (((int)addr % M5_PAGE_SIZE) != 0) + printk("m5: invalid sector addres (0x%08x)\n", (int)addr); + + if (m5_read_blk_cache(addr) != SUCCESS) + return FAILED; + if ((blk = m5_get_blk_num(addr)) < 0) + return FAILED; + offset = m5_get_blk_offset(blk, addr); + memcpy((void *)M5_CACHED_BASE + offset, (void *)buf, M5_PAGE_SIZE); + M5_MARK_DIRTY(); + return SUCCESS; +} + +/* + * int m5_write(const m5_t *buf, int offset, int len) + * m5_t *buf: write buffer address + * int offset: offset from flash base address + * int len: write length + * SUCCESS: ok + * FAILE: error + */ +static int m5_write(const m5_t *buf, int offset, int len) +{ + m5_t *addr; + int result; + + if (len % M5_PAGE_SIZE) { + printk("m5: invalid write size (%d).\n", len); + return FAILED; + } + addr = (m5_t *)(m5_addr[MINOR(CURRENT_DEV)] + offset); + + DEBUG(1, "m5: writing 0x%08x - 0x%08x\n", \ + (int)addr, (int)addr + len); + + for (; len > 0; len -= M5_PAGE_SIZE) { + result = m5_write_page(addr, buf); + if (result != SUCCESS) + return result; + addr = (m5_t *)((int)addr + M5_PAGE_SIZE); + buf = (m5_t *)((int)buf + M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_read_page() + * m5_t *buf: read buffer address + * m5_t *addr: page address + * SUCCESS: ok + * FAILED: error + */ +static int m5_read_page(m5_t *buf, m5_t *addr) +{ + int blk; + int offset; + + if ((blk = m5_get_blk_num(addr)) < 0) + return FAILED; + if (M5_BLK_CACHED(blk)) { + offset = m5_get_blk_offset(blk, addr); + memcpy((void *)buf, (void *)M5_CACHED_BASE + offset, + M5_PAGE_SIZE); + } else { + /* read from flash memory directory */ + memcpy((void *)buf, (void *)addr, M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_read() + * m5_t *buf: read buffer address + * int offset: offset from flash base address + * int len: read length + * SUCCESS: ok + * FAILED: error + */ +static int m5_read(m5_t *buf, int offset, int len) +{ + m5_t *addr; + + if (len % M5_PAGE_SIZE) { + printk("m5: invalid read size (%d).\n", len); + return FAILED; + } + + addr = (m5_t *)(m5_addr[MINOR(CURRENT_DEV)] + offset); + + DEBUG(1, "m5: reading 0x%08x - 0x%08x\n", \ + (int)addr, (int)addr + len); + + for (; len > 0; len -= M5_PAGE_SIZE) { + if (m5_read_page(buf, addr) != SUCCESS) + return FAILED; + buf = (m5_t *)((int)buf + M5_PAGE_SIZE); + addr = (m5_t *)((int)addr + M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_erase_blk() + * m5_t *addr: + */ +static int m5_erase_blk(m5_t *addr) +{ + int result; + + DEBUG(1, "m5: erasing addr=0x%08x\n", (int)addr); + m5_out(M5_CMD_BLOCK_ERASE, addr); + m5_out(M5_CMD_CONFIRM, addr); + result = m5_wait_for_ready(addr); + return result; +} + +/* + * void m5_request() + * request_queue_t *req: I/O request + * end_request(0): error (-EIO) + * end_request(1): ok + */ +static void m5_request(request_queue_t *req) +{ + unsigned int minor; + int offset; + int len; + static int error_count = 0; + + sti(); + while (1) { + INIT_REQUEST; + minor = MINOR(CURRENT_DEV); + if (minor >= M5_PARTITIONS) { + printk( "m5: out of partition (%d)\n", minor ); + end_request(0); + continue; + } + offset = CURRENT->sector * m5_hardsect_size[minor]; + len = (CURRENT->current_nr_sectors * + m5_hardsect_size[minor]); + if ((offset + len) > m5_len[minor]) { + printk( "m5: out of sector (sector=%d, nr=%d)\n", + (int)(CURRENT->sector), + (int)(CURRENT->current_nr_sectors)); + end_request(0); + continue; + } + switch(CURRENT->cmd) { + case READ: + if (m5_read((m5_t *)CURRENT->buffer, + offset, len) != SUCCESS) + end_request(0); + else + end_request(1); + break; + case WRITE: + if (m5_write((m5_t *)(CURRENT->buffer), + offset, len) != SUCCESS) + end_request(0); + else + end_request(1); + break; + default: + if (error_count++ < M5_MAX_ERROR) { + printk("m5: invalid I/O request(%d)\n", + CURRENT->cmd); + } + end_request(0); + break; + } + } +} + +/* + * int m5_ioctl() + * struct inode *inode: + * struct file *file: + * unsigned int cmd: + * unsigned long arg: + */ +static int m5_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, unsigned long arg) +{ + int size; + + DEBUG(2, "m5_ioctl()\n"); + switch (cmd) { + case BLKGETSIZE: + if (!arg) return -EINVAL; + size = (1024 * m5_blk_size[MINOR(inode->i_rdev)] / + m5_hardsect_size[MINOR(inode->i_rdev)]); + return put_user(size, (long __user *)arg); + case BLKFLSBUF: + if (!capable(CAP_SYS_ADMIN)) return -EACCES; + fsync_dev(inode->i_rdev); + invalidate_buffers(inode->i_rdev); + return 0; + case BLKRRPART: + return -EINVAL; + + case BLKRAGET: + case BLKRASET: + case BLKGETSIZE64: + case BLKROSET: + case BLKROGET: + case BLKSSZGET: + return blk_ioctl(inode->i_rdev, cmd, arg); + default: + printk( "m5: unsupported ioctl(0x%08x)\n", cmd); + return -EINVAL; + } + return 0; +} + +/* + * int m5_open() + * struct inode *inode: + * struct file *fp: + */ +static int m5_open(struct inode *inode, struct file *fp) +{ + if (DEVICE_NR(inode->i_rdev) >= M5_PARTITIONS) return -ENXIO; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * int m5_release() + * struct inode *inode: + * struct file *fp: + */ +static int m5_release(struct inode *inode, struct file *fp) +{ + sync_dev(inode->i_rdev); + MOD_DEC_USE_COUNT; + return 0; +} + +#ifdef CONFIG_PROC_FS +/* + * int proc_m5_read() + * char *buf: + * char **start: + * off_t offset: + * int len: + * int *eof: + * void *unused: + */ +static int proc_m5_read(char *buf, char **start, off_t offset, int len, int *eof, void *unused) +{ + len = sprintf(buf, "partition: %d\n", M5_PARTITIONS); + return len; +} +#endif + +static struct block_device_operations m5_fops = { + open: m5_open, + release: m5_release, + ioctl: m5_ioctl, + /* check_media_change: */ + /* revalidate: */ + owner: THIS_MODULE, +}; + +/* + * int m5_init() + */ +static int __init m5_init(void) +{ + int i; + int result; + + result = -EIO; + + printk("%s (%s %s)\n", version, date, time); +#if M5_SUPPORT_PROBE + if (m5_probe((m5_t *)M5_BASE_ADDR) != SUCCESS) + return result; +#endif /* M5_SUPPORT_PROBE */ + + if (register_blkdev(major, DEVICE_NAME, &m5_fops) ) { + printk("m5: can not not get major %d", major); + return result; + } + + if (devfs_register_blkdev(major, DEVICE_NAME, &m5_fops) ) { + printk("m5: can not not get major %d", major); + goto fail_devfs; + } + devfs_handle = devfs_mk_dir(NULL, "m5", NULL); + devfs_register_series(devfs_handle, "%u", M5_PARTITIONS, + DEVFS_FL_DEFAULT, major, 0, + S_IFBLK | S_IRUSR | S_IWUSR, + &m5_fops, NULL); + + for (i = 0; i < M5_PARTITIONS; i++) { + if (i) { + m5_addr[i] = m5_addr[i-1] + m5_len[i-1]; + } else { + m5_addr[i] = M5_BASE_ADDR; + } + m5_blk_size[i] = m5_len[i]/1024; /* KB order */ + m5_blksize_size[i] = BLOCK_SIZE; /* 1024 byte */ + m5_hardsect_size[i] = BLOCK_SIZE/2; /* 512 byte */ + } + /* defined in ll_rw_blk.c */ + blk_size[major] = m5_blk_size; + blksize_size[major] = m5_blksize_size; + hardsect_size[major] = m5_hardsect_size; + read_ahead[major] = m5_read_ahead; + + blk_init_queue(BLK_DEFAULT_QUEUE(major), &m5_request); + + for (i = 0; i < M5_PARTITIONS; i++) + register_disk( NULL, MKDEV(major,i), 1, + &m5_fops, m5_len[i]>>9 ); + +#ifdef CONFIG_PROC_FS +#if 1 + proc_m5 = proc_mkdir("m5", proc_root_driver); + if (!proc_m5) { + printk(KERN_ERR "m5: unable to register driver/m5\n"); + goto fail_proc; + } + create_proc_read_entry("0", 0, proc_m5, proc_m5_read, 0); + create_proc_read_entry("1", 0, proc_m5, proc_m5_read, 0); + create_proc_read_entry("2", 0, proc_m5, proc_m5_read, 0); +#else + proc_m5 = create_proc_entry("driver/m5", 666, 0); + if (!proc_m5) { + printk(KERN_ERR "m5: unable to register driver/m5\n"); + goto fail_proc; + } + proc_m5->read_proc = proc_m5_read; +#endif +#endif + + printk("m5: Major=%d Partitions=%d\n", major,M5_PARTITIONS); + for (i = 0; i < M5_PARTITIONS; i++) { + printk(" %d: 0x%08x-0x%08x (all=%dKB,blk=%dB,sect=%dB,ahead=%d)\n", + i, m5_addr[i], + m5_addr[i] + m5_len[i], + m5_blk_size[i], + m5_blksize_size[i], + m5_hardsect_size[i], + m5_read_ahead); + } + + /* clear cache */ + M5_MARK_CLEAN(); + M5_MARK_NOCACHED(); + + m5_led_off(); + return 0; + +fail_proc: + devfs_unregister(devfs_handle); +fail_devfs: + unregister_blkdev(major, DEVICE_NAME); + return result; +} + +static int __init m5_init_module(void) +{ + return m5_init(); +} + +static void __exit m5_cleanup_module(void) +{ + int i; + + for (i = 0 ; i < M5_PARTITIONS; i++) { + fsync_dev(MKDEV(major, i)); /* flush buffer */ + destroy_buffers(MKDEV(major, i)); + } + m5_write_blk_cache(); /* flush m5 cache */ + devfs_unregister(devfs_handle); + unregister_blkdev(major, DEVICE_NAME); +#ifdef CONFIG_PROC_FS + remove_proc_entry("0", proc_m5); + remove_proc_entry("1", proc_m5); + remove_proc_entry("2", proc_m5); + remove_proc_entry("m5", proc_root_driver); +#endif + blk_cleanup_queue(BLK_DEFAULT_QUEUE(major)); + blk_size[major] = NULL; + blksize_size[major] = NULL; + hardsect_size[major] = NULL; + read_ahead[major] = 0; +} + +module_init(m5_init_module); +module_exit(m5_cleanup_module); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("M5 Flash Driver for M32700UT-CPU"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; + diff -Nru a/arch/m32r/drivers/m5.h b/arch/m32r/drivers/m5.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,73 @@ +/* + * Flash Memory Driver for M32700UT-CPU + * + * Copyright 2003 (C) Takeo Takahashi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * 2003-02-01: Takeo Takahashi, support M5M29GT320VP. + */ + +#include + +#ifdef __KERNEL__ +#undef DEBUG +/* debug routine: + * 0x00000001: print debug information + */ +# define DEBUG(n, args...) if ((n) & debug) \ + printk(KERN_DEBUG args) +#endif /* __KERNEL__ */ + +/* + * data type to access flash memory + */ +typedef volatile unsigned short m5_t; + +/* + * - Page program buffer size in byte + * - block size in byte + * - number of block + */ +#define M5_PAGE_SIZE (256) +#define M5_BLOCK_SIZE8 (8*1024) +#define M5_BLOCK_SIZE64 (64*1024) +#define MAX_BLOCK_NUM 70 + +/* + * Software commands + */ +#define M5_CMD_READ_ARRAY 0xff +#define M5_CMD_DEVICE_IDENT 0x90 +#define M5_CMD_READ_STATUS 0x70 +#define M5_CMD_CLEAR_STATUS 0x50 +#define M5_CMD_BLOCK_ERASE 0x20 +#define M5_CMD_CONFIRM 0xd0 +#define M5_CMD_PROGRAM_BYTE 0x40 +#define M5_CMD_PROGRAM_WORD M5_CMD_PROGRAM_BYTE +#define M5_CMD_PROGRAM_PAGE 0x41 +#define M5_CMD_SINGLE_LOAD_DATA 0x74 +#define M5_CMD_BUFF2FLASH 0x0e +#define M5_CMD_FLASH2BUFF 0xf1 +#define M5_CMD_CLEAR_BUFF 0x55 +#define M5_CMD_SUSPEND 0xb0 +#define M5_CMD_RESUME 0xd0 + +/* + * Status + */ +#define M5_STATUS_READY 0x80 /* 0:busy 1:ready */ +#define M5_STATUS_SUSPEND 0x40 /* 0:progress/complete 1:suspend */ +#define M5_STATUS_ERASE 0x20 /* 0:pass 1:error */ +#define M5_STATUS_PROGRAM 0x10 /* 0:pass 1:error */ +#define M5_STATUS_BLOCK 0x08 /* 0:pass 1:error */ + +/* + * Device Code + */ +#define M5_MAKER (0x1c) +#define M5_M5M29GT320VP (0x20) +#define M5_M5M29GB320VP (0x21) diff -Nru a/arch/m32r/drivers/m5drv.c b/arch/m32r/drivers/m5drv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5drv.c 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,664 @@ +/* + * MTD chip driver for M5M29GT320VP + * + * Copyright (C) 2003 Takeo Takahashi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * $Id$ + */ + +#ifndef __KERNEL__ +# define __KERNEL__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define M5DRV_DEBUG(n, args...) if ((n) & m5drv_debug) printk(KERN_DEBUG args) + +#undef UNLOCK_BEFORE_ERASE + +#define M5DRV_PAGE_SIZE (256) /* page program size */ +#define M5DRV_BLOCK_SIZE8 (8*1024) /* 8K block size in byte */ +#define M5DRV_BLOCK_SIZE64 (64*1024) /* 64K block size in byte */ +#define M5DRV_MAX_BLOCK_NUM 70 /* number of blocks */ +#define M5DRV_ERASE_REGION 2 /* 64KB and 8KB */ + +/* + * Software commands + */ +#define CMD_READ_ARRAY 0xff +#define CMD_DEVICE_IDENT 0x90 +#define CMD_READ_STATUS 0x70 +#define CMD_CLEAR_STATUS 0x50 +#define CMD_BLOCK_ERASE 0x20 +#define CMD_CONFIRM 0xd0 +#define CMD_PROGRAM_BYTE 0x40 +#define CMD_PROGRAM_WORD CMD_PROGRAM_BYTE +#define CMD_PROGRAM_PAGE 0x41 +#define CMD_SINGLE_LOAD_DATA 0x74 +#define CMD_BUFF2FLASH 0x0e +#define CMD_FLASH2BUFF 0xf1 +#define CMD_CLEAR_BUFF 0x55 +#define CMD_SUSPEND 0xb0 +#define CMD_RESUME 0xd0 +#define IDENT_OFFSET 0 /* indent command offset */ + +/* + * Status + */ +#define STATUS_READY 0x80 /* 0:busy 1:ready */ +#define STATUS_SUSPEND 0x40 /* 0:progress/complete 1:suspend */ +#define STATUS_ERASE 0x20 /* 0:pass 1:error */ +#define STATUS_PROGRAM 0x10 /* 0:pass 1:error */ +#define STATUS_BLOCK 0x08 /* 0:pass 1:error */ + +/* + * Device Code + */ +#define MAKER (0x1c) +#define M5M29GT320VP (0x20) +#define M5M29GB320VP (0x21) + +static const char version[] = "M5DRV Flash Driver"; +static const char date[] = __DATE__; +static const char time[] = __TIME__; +static int m5drv_debug = 0; +MODULE_PARM(m5drv_debug, "i"); + +struct m5drv_info { + struct flchip *chip; + int chipshift; + int numchips; + struct flchip chips[1]; + unsigned char buf[M5DRV_BLOCK_SIZE64]; +#define M5BUF (m5drv->buf) +}; + +struct mtd_info *m5drv_probe(struct map_info *map); +static int m5drv_probe_map(struct map_info *map, struct mtd_info *mtd); +static int m5drv_wait(struct map_info *map, struct flchip *chip, loff_t adr); +static void m5drv_release(struct flchip *chip); +static int m5drv_query_blksize(loff_t ofs); +static int m5drv_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); +static int m5drv_read_oneblock(struct map_info *map, loff_t from); +static int m5drv_write(struct mtd_info *mtd, loff_t adr, size_t len, size_t *retlen, const u_char *buf); +static int m5drv_write_oneblock(struct map_info *map, loff_t adr, size_t len, const u_char *buf); +static int m5drv_write_onepage(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf); +static int m5drv_erase(struct mtd_info *mtd, struct erase_info *instr); +static int m5drv_do_wait_for_ready(struct map_info *map, struct flchip *chip, unsigned long adr); +static int m5drv_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr); +static void m5drv_sync(struct mtd_info *mtd); +static int m5drv_suspend(struct mtd_info *mtd); +static void m5drv_resume(struct mtd_info *mtd); +static void m5drv_destroy(struct mtd_info *mtd); +#ifdef UNLOCK_BEFORE_ERASE +static void m5drv_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr); +#endif + +static struct mtd_chip_driver m5drv_chipdrv = { + probe: m5drv_probe, + destroy: m5drv_destroy, + name: "m5drv", + module: THIS_MODULE +}; + +struct mtd_info *m5drv_probe(struct map_info *map) +{ + struct mtd_info *mtd = NULL; + struct m5drv_info *m5drv = NULL; + int width; + + mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); + if (!mtd) { + printk("m5drv: can not allocate memory for mtd_info\n"); + return NULL; + } + + m5drv = kmalloc(sizeof(*m5drv), GFP_KERNEL); + if (!m5drv) { + printk("m5drv: can not allocate memory for m5drv_info\n"); + kfree(mtd); + return NULL; + } + + memset(mtd, 0, sizeof(*mtd)); + width = m5drv_probe_map(map, mtd); + if (!width) { + printk("m5drv: m5drv_probe_map error (width=%d)\n", width); + kfree(mtd); + kfree(m5drv); + return NULL; + } + mtd->priv = map; + mtd->type = MTD_OTHER; + mtd->erase = m5drv_erase; + mtd->read = m5drv_read; + mtd->write = m5drv_write; + mtd->sync = m5drv_sync; + mtd->suspend = m5drv_suspend; + mtd->resume = m5drv_resume; + mtd->flags = MTD_CAP_NORFLASH; /* ??? */ + mtd->name = map->name; + + memset(m5drv, 0, sizeof(*m5drv)); + m5drv->chipshift = 23; + m5drv->numchips = 1; + m5drv->chips[0].start = 0; + m5drv->chips[0].state = FL_READY; + m5drv->chips[0].mutex = &m5drv->chips[0]._spinlock; + m5drv->chips[0].word_write_time = 0; + init_waitqueue_head(&m5drv->chips[0].wq); + spin_lock_init(&m5drv->chips[0]._spinlock); + + map->fldrv = &m5drv_chipdrv; + map->fldrv_priv = m5drv; + + MOD_INC_USE_COUNT; + return mtd; +} + +static int m5drv_probe_map(struct map_info *map, struct mtd_info *mtd) +{ + u16 tmp; + u16 maker, device; + int width = 2; + struct mtd_erase_region_info *einfo; + + map->write16(map, CMD_READ_ARRAY, IDENT_OFFSET); + tmp = map->read16(map, IDENT_OFFSET); + map->write16(map, CMD_DEVICE_IDENT, IDENT_OFFSET); + maker = map->read16(map, IDENT_OFFSET); + maker &= 0xff; + if (maker == MAKER) { + /* FIXME: check device */ + device = maker >> 8; + printk("m5drv: detected M5M29GT320VP\n"); + einfo = kmalloc(sizeof(*einfo) * M5DRV_ERASE_REGION, GFP_KERNEL); + if (!einfo) { + printk("m5drv: cannot allocate memory for erase_region\n"); + return 0; + } + /* 64KB erase block (blk no# 0-62) */ + einfo[0].offset = 0; + einfo[0].erasesize = 0x8000 * width; + einfo[0].numblocks = (7 + 8 + 24 + 24); + /* 8KB erase block (blk no# 63-70) */ + einfo[1].offset = 0x3f0000; + einfo[1].erasesize = 0x1000 * width; + einfo[1].numblocks = (2 + 8); + mtd->numeraseregions = M5DRV_ERASE_REGION; + mtd->eraseregions = einfo; + mtd->size = 0x200000 * width; /* total 4MB */ + /* + * mtd->erasesize is used in parse_xxx_partitions. + * last erase block has a partition table. + */ + mtd->erasesize = 0x8000 * width; + return width; + } else if (map->read16(map, IDENT_OFFSET) == CMD_DEVICE_IDENT) { + printk("m5drv: looks like RAM\n"); + map->write16(map, tmp, IDENT_OFFSET); + } else { + printk("m5drv: can not detect flash memory (0x%04x)\n", maker); + } + map->write16(map, CMD_READ_ARRAY, IDENT_OFFSET); + return 0; +} + +static int m5drv_query_blksize(loff_t ofs) +{ + int blk; + + blk = ofs >> 16; + if (blk > 0x3f) { + printk("m5drv: out of block address (0x%08x)\n", (u32)ofs); + return M5DRV_BLOCK_SIZE64; + } + if (blk == 63) blk += ((ofs & 0x0000e000) >> 13); + if (blk > M5DRV_MAX_BLOCK_NUM) { + printk("m5drv: out of block address (0x%08x)\n", (u32)ofs); + return M5DRV_BLOCK_SIZE64; + } + return ((blk >= 63)? M5DRV_BLOCK_SIZE8:M5DRV_BLOCK_SIZE64); +} + +static int m5drv_wait(struct map_info *map, struct flchip *chip, loff_t adr) +{ + __u16 status; + unsigned long timeo; + DECLARE_WAITQUEUE(wait, current); + + timeo = jiffies + HZ; + adr &= ~1; /* align 2 */ + +retry: + spin_lock_bh(chip->mutex); + + switch (chip->state) { + case FL_READY: + map->write16(map, CMD_READ_STATUS, adr); + chip->state = FL_STATUS; + case FL_STATUS: + status = map->read16(map, adr); + if ((status & STATUS_READY) != STATUS_READY) { + udelay(100); + } + break; + default: + printk("m5drv: waiting for chip\n"); + if (time_after(jiffies, timeo)) { /* jiffies is after timeo */ + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&chip->wq, &wait); + spin_unlock_bh(chip->mutex); + schedule(); + remove_wait_queue(&chip->wq, &wait); + spin_lock_bh(chip->mutex); // by takeo + if (signal_pending(current)) { + printk("m5drv: canceled\n"); + map->write16(map, CMD_CLEAR_STATUS, adr); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + return -EINTR; + } + } + timeo = jiffies + HZ; + goto retry; + } + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + return 0; +} + +static void m5drv_release(struct flchip *chip) +{ + M5DRV_DEBUG(1, "m5drv_release\n"); + wake_up(&chip->wq); + spin_unlock_bh(chip->mutex); +} + +static int m5drv_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + int chipnum; + int ret; + + *retlen = 0; + + chipnum = (from >> m5drv->chipshift); + if (chipnum >= m5drv->numchips) { + printk("m5drv: out of chip number (%d)\n", chipnum); + return -EIO; + } + + /* We don't support erase suspend */ + ret = m5drv_wait(map, &m5drv->chips[chipnum], from); + if (ret < 0) return ret; + + map->copy_from(map, buf, from, len); + + m5drv_release(&m5drv->chips[chipnum]); + *retlen = len; + return 0; +} + +static int m5drv_read_oneblock(struct map_info *map, loff_t from) +{ + struct m5drv_info *m5drv = map->fldrv_priv; + int ofs; + int ret; + int blksize; + int chipnum; + + M5DRV_DEBUG(1, "m5drv_read_oneblock(0x%08x)\n", (u32)from); + chipnum = (from >> m5drv->chipshift); + blksize = m5drv_query_blksize(from); + ofs = (from & ~(blksize - 1)); + + ret = m5drv_wait(map, &m5drv->chips[chipnum], from); + if (ret < 0) return ret; + + map->copy_from(map, M5BUF, ofs, blksize); + + m5drv_release(&m5drv->chips[chipnum]); + return 0; +} + +static int m5drv_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + int ret = 0; + int blksize; + int chipnum; + int thislen; + + M5DRV_DEBUG(1, "m5drv_write(to=0x%08x, len=%d, buf=0x%08x\n", (u32)to, (u32)len, (u32)buf); + *retlen = 0; + blksize = m5drv_query_blksize(to); + chipnum = (to >> m5drv->chipshift); + + /* + * we does not support byte/word program yet. + */ + for (thislen = len; thislen > 0; thislen -= blksize) { + thislen = ((thislen >= blksize)? blksize:thislen); + ret = m5drv_write_oneblock(map, to, thislen, buf); + if (ret < 0) return ret; + to += blksize; + buf += blksize; + *retlen += thislen; + } + return 0; +} + +static int m5drv_write_oneblock(struct map_info *map, loff_t adr, size_t len, const u_char *buf) +{ + struct m5drv_info *m5drv = map->fldrv_priv; + int ofs; + int blksize; + int ret; + int chipnum; + int i; + + M5DRV_DEBUG(1, "m5drv_write_oneblock(0x%08x, %d)\n", (u32)adr, (u32)len); + chipnum = (adr >> m5drv->chipshift); + ret = m5drv_read_oneblock(map, adr); + if (ret < 0) return ret; + blksize = m5drv_query_blksize(adr); + ofs = (adr & (blksize - 1)); + adr = adr & ~(blksize - 1); + memcpy(M5BUF + ofs, buf, len); /* copy to block buffer */ +#if 0 /* + * FIXME: erasing is unnecessary. + */ + ret = m5drv_erase_oneblock(map, &m5drv->chips[chipnum], adr); + if (ret < 0) return ret; +#endif + for (i = 0; i < len; i += M5DRV_PAGE_SIZE) { + ret = m5drv_write_onepage(map, &m5drv->chips[chipnum], adr, M5BUF+i); + if (ret < 0) return ret; + adr += M5DRV_PAGE_SIZE; + } + return 0; +} + +static int m5drv_write_onepage(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf) +{ + int ret; + int i; + u_short data; + long padr; /* page address */ + u_short status; + int chipnum; + struct m5drv_info *m5drv = map->fldrv_priv; + + M5DRV_DEBUG(1, "m5drv_write_onepage(0x%08x, 0x%08x)\n", (u32)adr, (u32)buf); + padr = adr; + padr &= ~1; /* align 2 */ + chipnum = (adr >> m5drv->chipshift); + + ret = m5drv_wait(map, chip, padr); + if (ret < 0) return ret; + + map->write16(map, CMD_PROGRAM_PAGE, padr); + chip->state = FL_WRITING; + for (i = 0; i < M5DRV_PAGE_SIZE; i += map->buswidth) { + data = ((*buf << 8)| *(buf + 1)); + /* + * FIXME: convert be->le ? + */ + map->write16(map, data, adr); + adr += map->buswidth; + buf += map->buswidth; + } + + ret = m5drv_do_wait_for_ready(map, chip, padr); + if (ret < 0) { + m5drv_release(&m5drv->chips[chipnum]); + return ret; + } + + status = map->read16(map, padr); + if ((status & STATUS_READY) != STATUS_READY) { + printk("m5drv: error page writing at addr=0x%08x status=0x%08x\n", + (u32)padr, (u32)status); + map->write16(map, CMD_CLEAR_STATUS, padr); + } + map->write16(map, CMD_READ_ARRAY, padr); + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return 0; +} + +static int m5drv_erase(struct mtd_info *mtd, struct erase_info *instr) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + unsigned long adr,len; + int chipnum, ret=0; + int erasesize = 0; + int i; + + M5DRV_DEBUG(2, "m5drv_erase(0x%08x)\n", instr->addr); + chipnum = instr->addr >> m5drv->chipshift; + if (chipnum >= m5drv->numchips) { + printk("m5drv: out of chip number (%d)\n", chipnum); + return -EIO; + } + adr = instr->addr & ((1<chipshift)-1); + len = instr->len; + if (mtd->numeraseregions == 0) { + erasesize = mtd->erasesize; + } else if (mtd->numeraseregions == 1) { + erasesize = mtd->eraseregions->erasesize; + } else { + for (i = 0; i < (mtd->numeraseregions - 1); i++) { + if (adr < mtd->eraseregions[i+1].offset) { + erasesize = mtd->eraseregions[i].erasesize; + break; + } + } + if (i == (mtd->numeraseregions - 1)) { /* last region */ + erasesize = mtd->eraseregions[i].erasesize; + } + } + M5DRV_DEBUG(2, "erasesize=%d, len=%ld\n", erasesize, len); + if (erasesize == 0) return -EINVAL; + if(instr->addr & (erasesize - 1)) + return -EINVAL; + if(instr->len & (erasesize - 1)) + return -EINVAL; + if(instr->len + instr->addr > mtd->size) + return -EINVAL; + + while (len) { + ret = m5drv_erase_oneblock(map, &m5drv->chips[chipnum], adr); + if (ret < 0) return ret; + + adr += erasesize; + len -= erasesize; + if(adr >> m5drv->chipshift){ + adr = 0; + chipnum++; + if(chipnum >= m5drv->numchips) + break; + } + } + instr->state = MTD_ERASE_DONE; + if(instr->callback) { + M5DRV_DEBUG(1, "m5drv: call callback\n"); + instr->callback(instr); + } + return 0; +} + +static int m5drv_do_wait_for_ready(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + int ret; + int timeo; + u_short status; + DECLARE_WAITQUEUE(wait, current); + + /* unnecessary CMD_READ_STATUS */ +/* + map->write16(map, CMD_READ_STATUS, adr); + status = map->read16(map, adr); +*/ + + timeo = jiffies + HZ; + + while (time_before(jiffies, timeo)) { +/* + map->write16(map, CMD_READ_STATUS, adr); +*/ + status = map->read16(map, adr); + if ((status & STATUS_READY) == STATUS_READY) { + M5DRV_DEBUG(1, "m5drv_wait_for_ready: ok, ready\n"); + /* + * FIXME: do full status check + */ + ret = 0; + goto out; + } + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&chip->wq, &wait); + + // enabled by takeo + spin_unlock_bh(chip->mutex); + + schedule_timeout(1); + schedule(); + remove_wait_queue(&chip->wq, &wait); + + // enabled by takeo + spin_lock_bh(chip->mutex); + + if (signal_pending(current)) { + ret = -EINTR; + goto out; + } + //timeo = jiffies + HZ; + } + ret = -ETIME; +out: + if (ret < 0) { + map->write16(map, CMD_CLEAR_STATUS, adr); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + } + return ret; +} + +static int m5drv_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + int ret; + u_short status; + struct m5drv_info *m5drv = map->fldrv_priv; + int chipnum; + + M5DRV_DEBUG(1, "m5drv_erase_oneblock()\n"); + +#ifdef UNLOCK_BEFORE_ERASE + m5drv_unlock_oneblock(map, chip, adr); +#endif + + chipnum = (adr >> m5drv->chipshift); + adr &= ~1; /* align 2 */ + + ret = m5drv_wait(map, chip, adr); + if (ret < 0) return ret; + + map->write16(map, CMD_BLOCK_ERASE, adr); + map->write16(map, CMD_CONFIRM, adr); + chip->state = FL_ERASING; + + ret = m5drv_do_wait_for_ready(map, chip, adr); + if(ret < 0) { + m5drv_release(&m5drv->chips[chipnum]); + return ret; + } + + status = map->read16(map, adr); + if ((status & STATUS_READY) == STATUS_READY) { + M5DRV_DEBUG(1, "m5drv: erase completed status=%04x\n", status); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return 0; /* ok, erasing completed */ + } + + printk("m5drv: error erasing block at addr=%08lx status=%08x\n", + adr,status); + map->write16(map, CMD_READ_ARRAY, adr); /* cancel erasing */ + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return -EIO; +} + + +#ifdef UNLOCK_BEFORE_ERASE +/* + * we don't support unlock yet + */ +static void m5drv_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + M5DRV_DEBUG(1, "m5drv_unlock_oneblock\n"); +} +#endif + +static void m5drv_sync(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_sync()\n"); +} + +static int m5drv_suspend(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_suspend()\n"); + return -EINVAL; +} + +static void m5drv_resume(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_resume()\n"); +} + +static void m5drv_destroy(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_destroy()\n"); +} + +int __init m5drv_probe_init(void) +{ + printk("MTD chip driver\n"); + register_mtd_chip_driver(&m5drv_chipdrv); + return 0; +} + +static void __exit m5drv_probe_exit(void) +{ + M5DRV_DEBUG(1, "m5drv_probe_exit()\n"); + unregister_mtd_chip_driver(&m5drv_chipdrv); +} + +module_init(m5drv_probe_init); +module_exit(m5drv_probe_exit); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("MTD chip driver for M5M29GT320VP"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; diff -Nru a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,20 @@ +# +# Makefile for the Linux/M32R kernel. +# + +extra-y := head.o init_task.o vmlinux.lds + +obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ + m32r_ksyms.o sys_m32r.o semaphore.o signal.o ptrace.o + +obj-$(CONFIG_SMP) += smp.o smpboot.o +obj-$(CONFIG_PLAT_MAPPI) += setup_mappi.o io_mappi.o +obj-$(CONFIG_PLAT_MAPPI2) += setup_mappi2.o io_mappi2.o +obj-$(CONFIG_PLAT_USRV) += setup_usrv.o io_usrv.o +obj-$(CONFIG_PLAT_M32700UT) += setup_m32700ut.o io_m32700ut.o +obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o +obj-$(CONFIG_MODULES) += module.o +obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o + +EXTRA_AFLAGS := -traditional + diff -Nru a/arch/m32r/kernel/align.c b/arch/m32r/kernel/align.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/align.c 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,585 @@ +/* + * align.c - address exception handler for M32R + * + * Copyright (c) 2003 Hitoshi Yamamoto + */ + +#include +#include +#include + +static int get_reg(struct pt_regs *regs, int nr) +{ + int val; + + if (nr < 4) + val = *(unsigned long *)(®s->r0 + nr); + else if (nr < 7) + val = *(unsigned long *)(®s->r4 + (nr - 4)); + else if (nr < 13) + val = *(unsigned long *)(®s->r7 + (nr - 7)); + else + val = *(unsigned long *)(®s->fp + (nr - 13)); + + return val; +} + +static void set_reg(struct pt_regs *regs, int nr, int val) +{ + if (nr < 4) + *(unsigned long *)(®s->r0 + nr) = val; + else if (nr < 7) + *(unsigned long *)(®s->r4 + (nr - 4)) = val; + else if (nr < 13) + *(unsigned long *)(®s->r7 + (nr - 7)) = val; + else + *(unsigned long *)(®s->fp + (nr - 13)) = val; +} + +#define REG1(insn) (((insn) & 0x0f00) >> 8) +#define REG2(insn) ((insn) & 0x000f) +#define PSW_BC 0x100 + +/* O- instruction */ +#define ISA_LD1 0x20c0 /* ld Rdest, @Rsrc */ +#define ISA_LD2 0x20e0 /* ld Rdest, @Rsrc+ */ +#define ISA_LDH 0x20a0 /* ldh Rdest, @Rsrc */ +#define ISA_LDUH 0x20b0 /* lduh Rdest, @Rsrc */ +#define ISA_ST1 0x2040 /* st Rsrc1, @Rsrc2 */ +#define ISA_ST2 0x2060 /* st Rsrc1, @+Rsrc2 */ +#define ISA_ST3 0x2070 /* st Rsrc1, @-Rsrc2 */ +#define ISA_STH1 0x2020 /* sth Rsrc1, @Rsrc2 */ +#define ISA_STH2 0x2030 /* sth Rsrc1, @Rsrc2+ */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +/* OS instruction */ +#define ISA_ADD 0x00a0 /* add Rdest, Rsrc */ +#define ISA_ADDI 0x4000 /* addi Rdest, #imm8 */ +#define ISA_ADDX 0x0090 /* addx Rdest, Rsrc */ +#define ISA_AND 0x00c0 /* and Rdest, Rsrc */ +#define ISA_CMP 0x0040 /* cmp Rsrc1, Rsrc2 */ +#define ISA_CMPEQ 0x0060 /* cmpeq Rsrc1, Rsrc2 */ +#define ISA_CMPU 0x0050 /* cmpu Rsrc1, Rsrc2 */ +#define ISA_CMPZ 0x0070 /* cmpz Rsrc */ +#define ISA_LDI 0x6000 /* ldi Rdest, #imm8 */ +#define ISA_MV 0x1080 /* mv Rdest, Rsrc */ +#define ISA_NEG 0x0030 /* neg Rdest, Rsrc */ +#define ISA_NOP 0x7000 /* nop */ +#define ISA_NOT 0x00b0 /* not Rdest, Rsrc */ +#define ISA_OR 0x00e0 /* or Rdest, Rsrc */ +#define ISA_SUB 0x0020 /* sub Rdest, Rsrc */ +#define ISA_SUBX 0x0010 /* subx Rdest, Rsrc */ +#define ISA_XOR 0x00d0 /* xor Rdest, Rsrc */ + +/* -S instruction */ +#define ISA_MUL 0x1060 /* mul Rdest, Rsrc */ +#define ISA_MULLO_A0 0x3010 /* mullo Rsrc1, Rsrc2, A0 */ +#define ISA_MULLO_A1 0x3090 /* mullo Rsrc1, Rsrc2, A1 */ +#define ISA_MVFACMI_A0 0x50f2 /* mvfacmi Rdest, A0 */ +#define ISA_MVFACMI_A1 0x50f6 /* mvfacmi Rdest, A1 */ + +static int emu_addi(unsigned short insn, struct pt_regs *regs) +{ + char imm = (char)(insn & 0xff); + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val += imm; + set_reg(regs, dest, val); + + return 0; +} + +static int emu_ldi(unsigned short insn, struct pt_regs *regs) +{ + char imm = (char)(insn & 0xff); + + set_reg(regs, REG1(insn), (int)imm); + + return 0; +} + +static int emu_add(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int src = REG2(insn); + int val; + + val = get_reg(regs, dest); + val += get_reg(regs, src); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_addx(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val, tmp; + + val = regs->psw & PSW_BC ? 1 : 0; + tmp = get_reg(regs, dest); + val += tmp; + val += (unsigned int)get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + /* C bit set */ + if (val < tmp) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_and(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val &= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_cmp(unsigned short insn, struct pt_regs *regs) +{ + if (get_reg(regs, REG1(insn)) < get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpeq(unsigned short insn, struct pt_regs *regs) +{ + if (get_reg(regs, REG1(insn)) == get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpu(unsigned short insn, struct pt_regs *regs) +{ + if ((unsigned int)get_reg(regs, REG1(insn)) + < (unsigned int)get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpz(unsigned short insn, struct pt_regs *regs) +{ + if (!get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_mv(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), val); + + return 0; +} + +static int emu_neg(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), 0 - val); + + return 0; +} + +static int emu_not(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), ~val); + + return 0; +} + +static int emu_or(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val |= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_sub(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val -= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_subx(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val, tmp; + + val = tmp = get_reg(regs, dest); + val -= (unsigned int)get_reg(regs, REG2(insn)); + val -= regs->psw & PSW_BC ? 1 : 0; + set_reg(regs, dest, val); + + /* C bit set */ + if (val > tmp) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_xor(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val; + + val = (unsigned int)get_reg(regs, dest); + val ^= (unsigned int)get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_mul(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int reg1, reg2; + + reg1 = get_reg(regs, dest); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mul %0, %1; \n\t" + : "+r" (reg1) : "r" (reg2) + ); + + set_reg(regs, dest, reg1); + + return 0; +} + +static int emu_mullo_a0(unsigned short insn, struct pt_regs *regs) +{ + int reg1, reg2; + + reg1 = get_reg(regs, REG1(insn)); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mullo %0, %1, a0; \n\t" + "mvfachi %0, a0; \n\t" + "mvfaclo %1, a0; \n\t" + : "+r" (reg1), "+r" (reg2) + ); + + regs->acc0h = reg1; + regs->acc0l = reg2; + + return 0; +} + +static int emu_mullo_a1(unsigned short insn, struct pt_regs *regs) +{ + int reg1, reg2; + + reg1 = get_reg(regs, REG1(insn)); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mullo %0, %1, a0; \n\t" + "mvfachi %0, a0; \n\t" + "mvfaclo %1, a0; \n\t" + : "+r" (reg1), "+r" (reg2) + ); + + regs->acc1h = reg1; + regs->acc1l = reg2; + + return 0; +} + +static int emu_mvfacmi_a0(unsigned short insn, struct pt_regs *regs) +{ + unsigned long val; + + val = (regs->acc0h << 16) | (regs->acc0l >> 16); + set_reg(regs, REG1(insn), (int)val); + + return 0; +} + +static int emu_mvfacmi_a1(unsigned short insn, struct pt_regs *regs) +{ + unsigned long val; + + val = (regs->acc1h << 16) | (regs->acc1l >> 16); + set_reg(regs, REG1(insn), (int)val); + + return 0; +} + +static int emu_m32r2(unsigned short insn, struct pt_regs *regs) +{ + int res = -1; + + if ((insn & 0x7fff) == ISA_NOP) /* nop */ + return 0; + + switch(insn & 0x7000) { + case ISA_ADDI: /* addi Rdest, #imm8 */ + res = emu_addi(insn, regs); + break; + case ISA_LDI: /* ldi Rdest, #imm8 */ + res = emu_ldi(insn, regs); + break; + default: + break; + } + + if (!res) + return 0; + + switch(insn & 0x70f0) { + case ISA_ADD: /* add Rdest, Rsrc */ + res = emu_add(insn, regs); + break; + case ISA_ADDX: /* addx Rdest, Rsrc */ + res = emu_addx(insn, regs); + break; + case ISA_AND: /* and Rdest, Rsrc */ + res = emu_and(insn, regs); + break; + case ISA_CMP: /* cmp Rsrc1, Rsrc2 */ + res = emu_cmp(insn, regs); + break; + case ISA_CMPEQ: /* cmpeq Rsrc1, Rsrc2 */ + res = emu_cmpeq(insn, regs); + break; + case ISA_CMPU: /* cmpu Rsrc1, Rsrc2 */ + res = emu_cmpu(insn, regs); + break; + case ISA_CMPZ: /* cmpz Rsrc */ + res = emu_cmpz(insn, regs); + break; + case ISA_MV: /* mv Rdest, Rsrc */ + res = emu_mv(insn, regs); + break; + case ISA_NEG: /* neg Rdest, Rsrc */ + res = emu_neg(insn, regs); + break; + case ISA_NOT: /* not Rdest, Rsrc */ + res = emu_not(insn, regs); + break; + case ISA_OR: /* or Rdest, Rsrc */ + res = emu_or(insn, regs); + break; + case ISA_SUB: /* sub Rdest, Rsrc */ + res = emu_sub(insn, regs); + break; + case ISA_SUBX: /* subx Rdest, Rsrc */ + res = emu_subx(insn, regs); + break; + case ISA_XOR: /* xor Rdest, Rsrc */ + res = emu_xor(insn, regs); + break; + case ISA_MUL: /* mul Rdest, Rsrc */ + res = emu_mul(insn, regs); + break; + case ISA_MULLO_A0: /* mullo Rsrc1, Rsrc2 */ + res = emu_mullo_a0(insn, regs); + break; + case ISA_MULLO_A1: /* mullo Rsrc1, Rsrc2 */ + res = emu_mullo_a1(insn, regs); + break; + default: + break; + } + + if (!res) + return 0; + + switch(insn & 0x70ff) { + case ISA_MVFACMI_A0: /* mvfacmi Rdest */ + res = emu_mvfacmi_a0(insn, regs); + break; + case ISA_MVFACMI_A1: /* mvfacmi Rdest */ + res = emu_mvfacmi_a1(insn, regs); + break; + default: + break; + } + + return res; +} + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + +/* + * ld : ?010 dest 1100 src + * 0010 dest 1110 src : ld Rdest, @Rsrc+ + * ldh : ?010 dest 1010 src + * lduh : ?010 dest 1011 src + * st : ?010 src1 0100 src2 + * 0010 src1 0110 src2 : st Rsrc1, @+Rsrc2 + * 0010 src1 0111 src2 : st Rsrc1, @-Rsrc2 + * sth : ?010 src1 0010 src2 + */ + +static int insn_check(unsigned long insn, struct pt_regs *regs, + unsigned char **ucp) +{ + int res = 0; + + /* + * 32bit insn + * ld Rdest, @(disp16, Rsrc) + * st Rdest, @(disp16, Rsrc) + */ + if (insn & 0x80000000) { /* 32bit insn */ + *ucp += (short)(insn & 0x0000ffff); + regs->bpc += 4; + } else { /* 16bit insn */ +#ifdef CONFIG_ISA_DUAL_ISSUE + /* parallel exec check */ + if (!(regs->bpc & 0x2) && insn & 0x8000) { + res = emu_m32r2((unsigned short)insn, regs); + regs->bpc += 4; + } else +#endif /* CONFIG_ISA_DUAL_ISSUE */ + regs->bpc += 2; + } + + return res; +} + +static int emu_ld(unsigned long insn32, struct pt_regs *regs) +{ + unsigned char *ucp; + unsigned long val; + unsigned short insn16; + int size, src; + + insn16 = insn32 >> 16; + src = REG2(insn16); + ucp = (unsigned char *)get_reg(regs, src); + + if (insn_check(insn32, regs, &ucp)) + return -1; + + size = insn16 & 0x0040 ? 4 : 2; + if (copy_from_user(&val, ucp, size)) + return -1; + + if (size == 2) + val >>= 16; + + /* ldh sign check */ + if ((insn16 & 0x00f0) == 0x00a0 && (val & 0x8000)) + val |= 0xffff0000; + + set_reg(regs, REG1(insn16), val); + + /* ld increment check */ + if ((insn16 & 0xf0f0) == ISA_LD2) /* ld Rdest, @Rsrc+ */ + set_reg(regs, src, (unsigned long)(ucp + 4)); + + return 0; +} + +static int emu_st(unsigned long insn32, struct pt_regs *regs) +{ + unsigned char *ucp; + unsigned long val; + unsigned short insn16; + int size, src2; + + insn16 = insn32 >> 16; + src2 = REG2(insn16); + + ucp = (unsigned char *)get_reg(regs, src2); + + if (insn_check(insn32, regs, &ucp)) + return -1; + + size = insn16 & 0x0040 ? 4 : 2; + val = get_reg(regs, REG1(insn16)); + if (size == 2) + val <<= 16; + + /* st inc/dec check */ + if ((insn16 & 0xf0e0) == 0x2060) { + if (insn16 & 0x0010) + ucp -= 4; + else + ucp += 4; + + set_reg(regs, src2, (unsigned long)ucp); + } + + if (copy_to_user(ucp, &val, size)) + return -1; + + /* sth inc check */ + if ((insn16 & 0xf0f0) == ISA_STH2) { + ucp += 2; + set_reg(regs, src2, (unsigned long)ucp); + } + + return 0; +} + +int handle_unaligned_access(unsigned long insn32, struct pt_regs *regs) +{ + unsigned short insn16; + int res; + + insn16 = insn32 >> 16; + + /* ld or st check */ + if ((insn16 & 0x7000) != 0x2000) + return -1; + + /* insn alignment check */ + if ((insn16 & 0x8000) && (regs->bpc & 3)) + return -1; + + if (insn16 & 0x0080) /* ld */ + res = emu_ld(insn32, regs); + else /* st */ + res = emu_st(insn32, regs); + + return res; +} + diff -Nru a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/entry.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,997 @@ +/* + * linux/arch/m32r/kernel/entry.S + * + * Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo + * Copyright (c) 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +/* + * entry.S contains the system-call and fault low-level handling routines. + * This also contains the timer-interrupt handler, as well as all interrupts + * and faults that can result in a task-switch. + * + * NOTE: This code handles signal-recognition, which happens every time + * after a timer-interrupt and after each system call. + * + * Stack layout in 'ret_from_system_call': + * ptrace needs to have all regs on the stack. + * if the order here is changed, it needs to be + * updated in fork.c:copy_process, signal.c:do_signal, + * ptrace.c and ptrace.h + * + * M32Rx/M32R2 M32R + * @(sp) - r4 ditto + * @(0x04,sp) - r5 ditto + * @(0x08,sp) - r6 ditto + * @(0x0c,sp) - *pt_regs ditto + * @(0x10,sp) - r0 ditto + * @(0x14,sp) - r1 ditto + * @(0x18,sp) - r2 ditto + * @(0x1c,sp) - r3 ditto + * @(0x20,sp) - r7 ditto + * @(0x24,sp) - r8 ditto + * @(0x28,sp) - r9 ditto + * @(0x2c,sp) - r10 ditto + * @(0x30,sp) - r11 ditto + * @(0x34,sp) - r12 ditto + * @(0x38,sp) - syscall_nr ditto + * @(0x3c,sp) - acc0h @(0x3c,sp) - acch + * @(0x40,sp) - acc0l @(0x40,sp) - accl + * @(0x44,sp) - acc1h @(0x44,sp) - psw + * @(0x48,sp) - acc1l @(0x48,sp) - bpc + * @(0x4c,sp) - psw @(0x4c,sp) - bbpsw + * @(0x50,sp) - bpc @(0x50,sp) - bbpc + * @(0x54,sp) - bbpsw @(0x54,sp) - spu (cr3) + * @(0x58,sp) - bbpc @(0x58,sp) - fp (r13) + * @(0x5c,sp) - spu (cr3) @(0x5c,sp) - lr (r14) + * @(0x60,sp) - fp (r13) @(0x60,sp) - spi (cr12) + * @(0x64,sp) - lr (r14) @(0x64,sp) - orig_r0 + * @(0x68,sp) - spi (cr2) + * @(0x6c,sp) - orig_r0 + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(CONFIG_MMU) +#define sys_madvise sys_ni_syscall +#define sys_readahead sys_ni_syscall +#define sys_mprotect sys_ni_syscall +#define sys_msync sys_ni_syscall +#define sys_mlock sys_ni_syscall +#define sys_munlock sys_ni_syscall +#define sys_mlockall sys_ni_syscall +#define sys_munlockall sys_ni_syscall +#define sys_mremap sys_ni_syscall +#define sys_mincore sys_ni_syscall +#endif /* CONFIG_MMU */ + +#define R4(reg) @reg +#define R5(reg) @(0x04,reg) +#define R6(reg) @(0x08,reg) +#define PTREGS(reg) @(0x0C,reg) +#define R0(reg) @(0x10,reg) +#define R1(reg) @(0x14,reg) +#define R2(reg) @(0x18,reg) +#define R3(reg) @(0x1C,reg) +#define R7(reg) @(0x20,reg) +#define R8(reg) @(0x24,reg) +#define R9(reg) @(0x28,reg) +#define R10(reg) @(0x2C,reg) +#define R11(reg) @(0x30,reg) +#define R12(reg) @(0x34,reg) +#define SYSCALL_NR(reg) @(0x38,reg) +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) +#define ACC0H(reg) @(0x3C,reg) +#define ACC0L(reg) @(0x40,reg) +#define ACC1H(reg) @(0x44,reg) +#define ACC1L(reg) @(0x48,reg) +#define PSW(reg) @(0x4C,reg) +#define BPC(reg) @(0x50,reg) +#define BBPSW(reg) @(0x54,reg) +#define BBPC(reg) @(0x58,reg) +#define SPU(reg) @(0x5C,reg) +#define FP(reg) @(0x60,reg) /* FP = R13 */ +#define LR(reg) @(0x64,reg) +#define SP(reg) @(0x68,reg) +#define ORIG_R0(reg) @(0x6C,reg) +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define ACCH(reg) @(0x3C,reg) +#define ACCL(reg) @(0x40,reg) +#define PSW(reg) @(0x44,reg) +#define BPC(reg) @(0x48,reg) +#define BBPSW(reg) @(0x4C,reg) +#define BBPC(reg) @(0x50,reg) +#define SPU(reg) @(0x54,reg) +#define FP(reg) @(0x58,reg) /* FP = R13 */ +#define LR(reg) @(0x5C,reg) +#define SP(reg) @(0x60,reg) +#define ORIG_R0(reg) @(0x64,reg) +#else +#error unknown isa configuration +#endif + +CF_MASK = 0x00000001 +TF_MASK = 0x00000100 +IF_MASK = 0x00000200 +DF_MASK = 0x00000400 +NT_MASK = 0x00004000 +VM_MASK = 0x00020000 + +#ifdef CONFIG_PREEMPT +#define preempt_stop(x) CLI(x) +#else +#define preempt_stop(x) +#define resume_kernel restore_all +#endif + +ENTRY(ret_from_fork) + ld r0, @sp+ + bl schedule_tail + GET_THREAD_INFO(r8) + bra syscall_exit + +/* + * Return to user mode is not as complex as all this looks, + * but we want the default path for a system call return to + * go as quickly as possible which is why some of this is + * less clear than it otherwise should be. + */ + + ; userspace resumption stub bypassing syscall exit tracing + ALIGN +ret_from_exception: + preempt_stop(r4) +ret_from_intr: + ld r4, PSW(sp) +#ifdef CONFIG_ISA_M32R2 + and3 r4, r4, #0x8800 ; check BSM and BPM bits +#else + and3 r4, r4, #0x8000 ; check BSM bit +#endif + beqz r4, resume_kernel +ENTRY(resume_userspace) + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + GET_THREAD_INFO(r8) + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done on + ; int/exception return? + bnez r4, work_pending + bra restore_all + +#ifdef CONFIG_PREEMPT +ENTRY(resume_kernel) + GET_THREAD_INFO(r8) + ld r9, @(TI_PRE_COUNT, r8) ; non-zero preempt_count ? + bnez r9, restore_all +need_resched: + ld r9, @(TI_FLAGS, r8) ; need_resched set ? + and3 r4, r9, #_TIF_NEED_RESCHED + beqz r4, restore_all + ld r4, PSW(sp) ; interrupts off (exception path) ? + and3 r4, r4, #0x4000 + beqz r4, restore_all + LDIMM (r4, PREEMPT_ACTIVE) + st r4, @(TI_PRE_COUNT, r8) + STI(r4) + bl schedule + ldi r4, #0 + st r4, @(TI_PRE_COUNT, r8) + CLI(r4) + bra need_resched +#endif + + ; system call handler stub +ENTRY(system_call) + SWITCH_TO_KERNEL_STACK + SAVE_ALL + STI(r4) ; Enable interrupt + st sp, PTREGS(sp) ; implicit pt_regs parameter + cmpui r7, #NR_syscalls + bnc syscall_badsys + st r7, SYSCALL_NR(sp) ; syscall_nr + ; system call tracing in operation + GET_THREAD_INFO(r8) + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_SYSCALL_TRACE + bnez r4, syscall_trace_entry +syscall_call: + slli r7, #2 ; table jump for the system call + LDIMM (r4, sys_call_table) + add r7, r4 + ld r7, @r7 + jl r7 ; execute system call + st r0, R0(sp) ; save the return value +syscall_exit: + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_ALLWORK_MASK ; current->work + bnez r4, syscall_exit_work +restore_all: + RESTORE_ALL + + # perform work that needs to be done immediately before resumption + # r9 : frags + ALIGN +work_pending: + and3 r4, r9, #_TIF_NEED_RESCHED + beqz r4, work_notifysig +work_resched: + bl schedule + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done other + ; than syscall tracing? + beqz r4, restore_all + and3 r4, r4, #_TIF_NEED_RESCHED + bnez r4, work_resched + +work_notifysig: ; deal with pending signals and + ; notify-resume requests + mv r0, sp ; arg1 : struct pt_regs *regs + ldi r1, #0 ; arg2 : sigset_t *oldset + mv r2, r9 ; arg3 : __u32 thread_info_flags + bl do_notify_resume + bra restore_all + + ; perform syscall exit tracing + ALIGN +syscall_trace_entry: + ldi r4, #-ENOSYS + st r4, R0(sp) + bl do_syscall_trace + ld r0, ORIG_R0(sp) + ld r1, R1(sp) + ld r2, R2(sp) + ld r3, R3(sp) + ld r4, R4(sp) + ld r5, R5(sp) + ld r6, R6(sp) + ld r7, SYSCALL_NR(sp) + cmpui r7, #NR_syscalls + bc syscall_call + bra syscall_exit + + ; perform syscall exit tracing + ALIGN +syscall_exit_work: + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_SYSCALL_TRACE + beqz r4, work_pending + STI(r4) ; could let do_syscall_trace() call + ; schedule() instead + bl do_syscall_trace + bra resume_userspace + + ALIGN +syscall_fault: + SAVE_ALL + GET_THREAD_INFO(r8) + ldi r4, #-EFAULT + st r4, R0(sp) + bra resume_userspace + + ALIGN +syscall_badsys: + ldi r4, #-ENOSYS + st r4, R0(sp) + bra resume_userspace + + .global eit_vector + + .equ ei_vec_table, eit_vector + 0x0200 + +/* + * EI handler routine + */ +ENTRY(ei_handler) +#if defined(CONFIG_CHIP_M32700) + SWITCH_TO_KERNEL_STACK + ; WORKAROUND: force to clear SM bit and use the kernel stack (SPI). +#endif + SAVE_ALL + mv r1, sp ; arg1(regs) +#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) + +; GET_ICU_STATUS; + seth r0, #shigh(M32R_ICU_ISTS_ADDR) + ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) + st r0, @-sp +#if defined(CONFIG_SMP) + /* + * If IRQ == 0 --> Nothing to do, Not write IMASK + * If IRQ == IPI --> Do IPI handler, Not write IMASK + * If IRQ != 0, IPI --> Do do_IRQ(), Write IMASK + */ + slli r0, #4 + srli r0, #24 ; r0(irq_num<<2) + ;; IRQ exist check +#if defined(CONFIG_CHIP_M32700) + /* WORKAROUND: IMASK bug M32700-TS1, TS2 chip. */ + beqz r0, 3f ; if (!irq_num) goto exit +#else + beqz r0, 1f ; if (!irq_num) goto exit +#endif /* WORKAROUND */ + ;; IPI check + cmpi r0, #(M32R_IRQ_IPI0<<2) ; ISN < IPI0 check + bc 2f + cmpi r0, #((M32R_IRQ_IPI7+1)<<2) ; ISN > IPI7 check + bnc 2f + LDIMM (r2, ei_vec_table) + add r2, r0 + ld r2, @r2 + beqz r2, 1f ; if (no IPI handler) goto exit + mv r0, r1 ; arg0(regs) + jl r2 + .fillinsn +1: + addi sp, #4 + bra ret_to_intr +#if defined(CONFIG_CHIP_M32700) + /* WORKAROUND: IMASK bug M32700-TS1, TS2 chip. */ + .fillinsn +3: + ld24 r14, #0x00070000 + seth r0, #shigh(M32R_ICU_IMASK_ADDR) + st r14, @(low(M32R_ICU_IMASK_ADDR), r0) + addi sp, #4 + bra ret_to_intr +#endif /* WORKAROUND */ + ;; do_IRQ + .fillinsn +2: + srli r0, #2 +#if defined(CONFIG_PLAT_USRV) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, 9f + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + .fillinsn +9: +#elif defined(CONFIG_PLAT_M32700UT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(M32700UT_LAN_ICUISTS) + or3 r0, r0, #low(M32700UT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(M32700UT_LCD_ICUISTS) + or3 r0, r0, #low(M32700UT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#elif defined(CONFIG_PLAT_OPSPUT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(OPSPUT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(OPSPUT_LAN_ICUISTS) + or3 r0, r0, #low(OPSPUT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(OPSPUT_LCD_ICUISTS) + or3 r0, r0, #low(OPSPUT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#endif /* CONFIG_PLAT_OPSPUT */ + bl do_IRQ ; r0(irq), r1(regs) +#else /* not CONFIG_SMP */ + srli r0, #22 ; r0(irq) +#if defined(CONFIG_PLAT_USRV) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, 1f + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + .fillinsn +1: +#elif defined(CONFIG_PLAT_M32700UT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(M32700UT_LAN_ICUISTS) + or3 r0, r0, #low(M32700UT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(M32700UT_LCD_ICUISTS) + or3 r0, r0, #low(M32700UT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#elif defined(CONFIG_PLAT_OPSPUT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(OPSPUT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(OPSPUT_LAN_ICUISTS) + or3 r0, r0, #low(OPSPUT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(OPSPUT_LCD_ICUISTS) + or3 r0, r0, #low(OPSPUT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#endif /* CONFIG_PLAT_OPSPUT */ + bl do_IRQ +#endif /* CONFIG_SMP */ + ld r14, @sp+ + seth r0, #shigh(M32R_ICU_IMASK_ADDR) + st r14, @(low(M32R_ICU_IMASK_ADDR),r0) +#else +#error no chip configuration +#endif +ret_to_intr: + bra ret_from_intr + +/* + * Default EIT handler + */ + ALIGN +int_msg: + .asciz "Unknown interrupt\n" + .byte 0 + +ENTRY(default_eit_handler) + push r0 + mvfc r0, psw + push r1 + push r2 + push r3 + push r0 + LDIMM (r0, __KERNEL_DS) + mv r0, r1 + mv r0, r2 + LDIMM (r0, int_msg) + bl printk + pop r0 + pop r3 + pop r2 + pop r1 + mvtc r0, psw + pop r0 +infinit: + bra infinit + +#ifdef CONFIG_MMU +/* + * Access Exception handler + */ +ENTRY(ace_handler) + SWITCH_TO_KERNEL_STACK + SAVE_ALL + + seth r2, #shigh(MMU_REG_BASE) /* Check status register */ + ld r4, @(low(MESTS_offset),r2) + st r4, @(low(MESTS_offset),r2) + srl3 r1, r4, #4 +#ifdef CONFIG_CHIP_M32700 + and3 r1, r1, #0x0000ffff + ; WORKAROUND: ignore TME bit for the M32700(TS1). +#endif /* CONFIG_CHIP_M32700 */ + beqz r1, inst +oprand: + ld r2, @(low(MDEVA_offset),r2) ; set address + srli r2, #12 + slli r2, #12 + srli r1, #1 + bra 1f +inst: + and3 r1, r4, #2 + srli r1, #1 + or3 r1, r1, #8 + mvfc r2, bpc ; set address + .fillinsn +1: + mvfc r3, psw + mv r0, sp + and3 r3, r3, 0x800 + srli r3, #9 + or r1, r3 + /* + * do_page_fault(): + * r0 : struct pt_regs *regs + * r1 : unsigned long error-code + * r2 : unsigned long address + * error-code: + * +------+------+------+------+ + * | bit3 | bit2 | bit1 | bit0 | + * +------+------+------+------+ + * bit 3 == 0:means data, 1:means instruction + * bit 2 == 0:means kernel, 1:means user-mode + * bit 1 == 0:means read, 1:means write + * bit 0 == 0:means no page found 1:means protection fault + * + */ + bl do_page_fault + bra ret_from_intr +#endif /* CONFIG_MMU */ + + +ENTRY(alignment_check) +/* void alignment_check(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + ldi r1, #0x30 ; error_code + mv r0, sp ; pt_regs + bl do_alignment_check +error_code: + bra ret_from_exception + +ENTRY(rie_handler) +/* void rie_handler(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + mvfc r0, bpc + ld r1, @r0 + seth r0, #0xa0f0 + st r1, @r0 + ldi r1, #0x20 ; error_code + mv r0, sp ; pt_regs + bl do_rie_handler + bra error_code + +ENTRY(pie_handler) +/* void pie_handler(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + ldi r1, #0 ; error_code ; FIXME + mv r0, sp ; pt_regs + bl do_pie_handler + bra error_code + +ENTRY(debug_trap) + .global withdraw_debug_trap + /* void debug_trap(void) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + mv r0, sp ; pt_regs + bl withdraw_debug_trap + ldi r1, #0 ; error_code + mv r0, sp ; pt_regs + bl do_debug_trap + bra error_code + + +/* Cache flushing handler */ +ENTRY(cache_flushing_handler) + .global _flush_cache_all + /* void _flush_cache_all(void); */ + SWITCH_TO_KERNEL_STACK + push r0 + push r1 + push r2 + push r3 + push r4 + push r5 + push r6 + push r7 + push lr + bl _flush_cache_all + pop lr + pop r7 + pop r6 + pop r5 + pop r4 + pop r3 + pop r2 + pop r1 + pop r0 + rte + +.data +ENTRY(sys_call_table) + .long sys_restart_syscall /* 0 - old "setup()" system call*/ + .long sys_exit + .long sys_fork + .long sys_read + .long sys_write + .long sys_open /* 5 */ + .long sys_close + .long sys_waitpid + .long sys_creat + .long sys_link + .long sys_unlink /* 10 */ + .long sys_execve + .long sys_chdir + .long sys_time + .long sys_mknod + .long sys_chmod /* 15 */ + .long sys_lchown + .long sys_ni_syscall /* old break syscall holder */ + .long sys_stat + .long sys_lseek + .long sys_getpid /* 20 */ + .long sys_mount + .long sys_oldumount + .long sys_setuid + .long sys_getuid + .long sys_stime /* 25 */ + .long sys_ptrace + .long sys_alarm + .long sys_fstat + .long sys_pause + .long sys_utime /* 30 */ + .long sys_cacheflush /* for M32R */ /* old stty syscall holder */ + .long sys_cachectl /* for M32R */ /* old gtty syscall holder */ + .long sys_access + .long sys_nice + .long sys_ni_syscall /* 35 - old ftime syscall holder */ + .long sys_sync + .long sys_kill + .long sys_rename + .long sys_mkdir + .long sys_rmdir /* 40 */ + .long sys_dup + .long sys_pipe + .long sys_times + .long sys_ni_syscall /* old prof syscall holder */ + .long sys_brk /* 45 */ + .long sys_setgid + .long sys_getgid + .long sys_signal + .long sys_geteuid + .long sys_getegid /* 50 */ + .long sys_acct + .long sys_umount /* recycled never used phys() */ + .long sys_ni_syscall /* old lock syscall holder */ + .long sys_ioctl + .long sys_fcntl /* 55 */ + .long sys_ni_syscall /* old mpx syscall holder */ + .long sys_setpgid + .long sys_ni_syscall /* old ulimit syscall holder */ + .long sys_ni_syscall /* sys_olduname */ + .long sys_umask /* 60 */ + .long sys_chroot + .long sys_ustat + .long sys_dup2 + .long sys_getppid + .long sys_getpgrp /* 65 */ + .long sys_setsid + .long sys_sigaction + .long sys_sgetmask + .long sys_ssetmask + .long sys_setreuid /* 70 */ + .long sys_setregid + .long sys_sigsuspend + .long sys_sigpending + .long sys_sethostname + .long sys_setrlimit /* 75 */ + .long sys_getrlimit + .long sys_getrusage + .long sys_gettimeofday + .long sys_settimeofday + .long sys_getgroups /* 80 */ + .long sys_setgroups + .long sys_ni_syscall /* sys_oldselect */ + .long sys_symlink + .long sys_lstat + .long sys_readlink /* 85 */ + .long sys_uselib + .long sys_swapon + .long sys_reboot + .long old_readdir + .long old_mmap /* 90 */ + .long sys_munmap + .long sys_truncate + .long sys_ftruncate + .long sys_fchmod + .long sys_fchown /* 95 */ + .long sys_getpriority + .long sys_setpriority + .long sys_ni_syscall /* old profil syscall holder */ + .long sys_statfs + .long sys_fstatfs /* 100 */ + .long sys_ni_syscall /* ioperm */ + .long sys_socketcall + .long sys_syslog + .long sys_setitimer + .long sys_getitimer /* 105 */ + .long sys_newstat + .long sys_newlstat + .long sys_newfstat + .long sys_uname + .long sys_ni_syscall /* 110 - iopl */ + .long sys_vhangup + .long sys_ni_syscall /* for idle */ + .long sys_ni_syscall /* for vm86old */ + .long sys_wait4 + .long sys_swapoff /* 115 */ + .long sys_sysinfo + .long sys_ipc + .long sys_fsync + .long sys_sigreturn + .long sys_clone /* 120 */ + .long sys_setdomainname + .long sys_newuname + .long sys_ni_syscall /* sys_modify_ldt */ + .long sys_adjtimex + .long sys_mprotect /* 125 */ + .long sys_sigprocmask + .long sys_ni_syscall /* sys_create_module */ + .long sys_init_module + .long sys_delete_module + .long sys_ni_syscall /* 130 sys_get_kernel_syms */ + .long sys_quotactl + .long sys_getpgid + .long sys_fchdir + .long sys_bdflush + .long sys_sysfs /* 135 */ + .long sys_personality + .long sys_ni_syscall /* for afs_syscall */ + .long sys_setfsuid + .long sys_setfsgid + .long sys_llseek /* 140 */ + .long sys_getdents + .long sys_select + .long sys_flock + .long sys_msync + .long sys_readv /* 145 */ + .long sys_writev + .long sys_getsid + .long sys_fdatasync + .long sys_sysctl + .long sys_mlock /* 150 */ + .long sys_munlock + .long sys_mlockall + .long sys_munlockall + .long sys_sched_setparam + .long sys_sched_getparam /* 155 */ + .long sys_sched_setscheduler + .long sys_sched_getscheduler + .long sys_sched_yield + .long sys_sched_get_priority_max + .long sys_sched_get_priority_min /* 160 */ + .long sys_sched_rr_get_interval + .long sys_nanosleep + .long sys_mremap + .long sys_setresuid + .long sys_getresuid /* 165 */ + .long sys_tas /* vm86 */ + .long sys_ni_syscall /* sys_query_module */ + .long sys_poll + .long sys_nfsservctl + .long sys_setresgid /* 170 */ + .long sys_getresgid + .long sys_prctl + .long sys_rt_sigreturn + .long sys_rt_sigaction + .long sys_rt_sigprocmask /* 175 */ + .long sys_rt_sigpending + .long sys_rt_sigtimedwait + .long sys_rt_sigqueueinfo + .long sys_rt_sigsuspend + .long sys_pread64 /* 180 */ + .long sys_pwrite64 + .long sys_chown + .long sys_getcwd + .long sys_capget + .long sys_capset /* 185 */ + .long sys_sigaltstack + .long sys_sendfile + .long sys_ni_syscall /* streams1 */ + .long sys_ni_syscall /* streams2 */ + .long sys_vfork /* 190 */ + .long sys_getrlimit + .long sys_mmap2 + .long sys_truncate64 + .long sys_ftruncate64 + .long sys_stat64 /* 195 */ + .long sys_lstat64 + .long sys_fstat64 + .long sys_lchown + .long sys_getuid + .long sys_getgid /* 200 */ + .long sys_geteuid + .long sys_getegid + .long sys_setreuid + .long sys_setregid + .long sys_getgroups /* 205 */ + .long sys_setgroups + .long sys_fchown + .long sys_setresuid + .long sys_getresuid + .long sys_setresgid /* 210 */ + .long sys_getresgid + .long sys_chown + .long sys_setuid + .long sys_setgid + .long sys_setfsuid /* 215 */ + .long sys_setfsgid + .long sys_pivot_root + .long sys_mincore + .long sys_madvise + .long sys_getdents64 /* 220 */ + .long sys_fcntl64 + .long sys_ni_syscall /* reserved for TUX */ + .long sys_ni_syscall /* Reserved for Security */ + .long sys_gettid + .long sys_readahead /* 225 */ + .long sys_setxattr + .long sys_lsetxattr + .long sys_fsetxattr + .long sys_getxattr + .long sys_lgetxattr /* 230 */ + .long sys_fgetxattr + .long sys_listxattr + .long sys_llistxattr + .long sys_flistxattr + .long sys_removexattr /* 235 */ + .long sys_lremovexattr + .long sys_fremovexattr + .long sys_tkill + .long sys_sendfile64 + .long sys_futex /* 240 */ + .long sys_sched_setaffinity + .long sys_sched_getaffinity + .long sys_ni_syscall /* reserved for "set_thread_area" system call */ + .long sys_ni_syscall /* reserved for "get_thread_area" system call */ + .long sys_io_setup /* 245 */ + .long sys_io_destroy + .long sys_io_getevents + .long sys_io_submit + .long sys_io_cancel + .long sys_fadvise64 /* 250 */ + .long sys_ni_syscall + .long sys_exit_group + .long sys_lookup_dcookie + .long sys_epoll_create + .long sys_epoll_ctl /* 255 */ + .long sys_epoll_wait + .long sys_remap_file_pages + .long sys_set_tid_address + .long sys_timer_create + .long sys_timer_settime /* 260 */ + .long sys_timer_gettime + .long sys_timer_getoverrun + .long sys_timer_delete + .long sys_clock_settime + .long sys_clock_gettime /* 265 */ + .long sys_clock_getres + .long sys_clock_nanosleep + .long sys_statfs64 + .long sys_fstatfs64 + .long sys_tgkill /* 270 */ + .long sys_utimes + .long sys_fadvise64_64 + .long sys_ni_syscall /* Reserved for sys_vserver */ + .long sys_ni_syscall /* Reserved for sys_mbind */ + .long sys_ni_syscall /* Reserved for sys_get_mempolicy */ + .long sys_ni_syscall /* Reserved for sys_set_mempolicy */ + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend + .long sys_mq_timedreceive /* 280 */ + .long sys_mq_notify + .long sys_mq_getsetattr + .long sys_ni_syscall /* reserved for kexec */ + +syscall_table_size=(.-sys_call_table) + diff -Nru a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/head.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,287 @@ +/* + * linux/arch/m32r/kernel/head.S + * + * M32R startup code. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +__INIT +__INITDATA + + .text +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * References to members of the boot_cpu_data structure. + */ + .text + .global start_kernel + .global __bss_start + .global _end +ENTRY(stext) +ENTRY(_stext) +ENTRY(startup_32) + /* Setup up the stack pointer */ + LDIMM (r0, spi_stack_top) + LDIMM (r1, spu_stack_top) + mvtc r0, spi + mvtc r1, spu + + /* Initilalize PSW */ + ldi r0, #0x0000 /* use SPI, disable EI */ + mvtc r0, psw + + /* Set up the stack pointer */ + LDIMM (r0, stack_start) + ld r0, @r0 + mvtc r0, spi + +/* + * Clear BSS first so that there are no surprises... + */ +#ifdef CONFIG_ISA_DUAL_ISSUE + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + ; R4 = BSS size in longwords (rounded down) + mv r4, r3 || ldi r1, #0 + srli r4, #4 || addi r2, #-4 + beqz r4, .Lendloop1 +.Lloop1: +#ifndef CONFIG_CHIP_M32310 + ; Touch memory for the no-write-allocating cache. + ld r0, @(4,r2) +#endif + st r1, @+r2 || addi r4, #-1 + st r1, @+r2 + st r1, @+r2 + st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? + bnc .Lloop1 +.Lendloop1: + and3 r4, r3, #15 + addi r2, #4 + beqz r4, .Lendloop2 +.Lloop2: + stb r1, @r2 || addi r4, #-1 + addi r2, #1 + bnez r4, .Lloop2 +.Lendloop2: + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + mv r4, r3 + srli r4, #2 ; R4 = BSS size in longwords (rounded down) + ldi r1, #0 ; clear R1 for longwords store + addi r2, #-4 ; account for pre-inc store + beqz r4, .Lendloop1 ; any more to go? +.Lloop1: + st r1, @+r2 ; yep, zero out another longword + addi r4, #-1 ; decrement count + bnez r4, .Lloop1 ; go do some more +.Lendloop1: + and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear + addi r2, #4 ; account for pre-inc store + beqz r4, .Lendloop2 ; any more to go? +.Lloop2: + stb r1, @r2 ; yep, zero out another byte + addi r2, #1 ; bump address + addi r4, #-1 ; decrement count + bnez r4, .Lloop2 ; go do some more +.Lendloop2: + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +#if 0 /* M32R_FIXME */ +/* + * Copy data segment from ROM to RAM. + */ + .global ROM_D, TOP_DATA, END_DATA + + LDIMM (r1, ROM_D) + LDIMM (r2, TOP_DATA) + LDIMM (r3, END_DATA) + addi r2, #-4 + addi r3, #-4 +loop1: + ld r0, @r1+ + st r0, @+r2 + cmp r2, r3 + bc loop1 +#endif /* 0 */ + +/* Jump to kernel */ + LDIMM (r2, start_kernel) + jl r2 + .fillinsn +1: + bra 1b ; main should never return here, but + ; just in case, we know what happens. + +#ifdef CONFIG_SMP +/* + * AP startup routine + */ + .text + .global eit_vector +ENTRY(startup_AP) +;; setup EVB + LDIMM (r4, eit_vector) + mvtc r4, cr5 + +;; enable MMU + LDIMM (r2, init_tlb) + jl r2 + seth r4, #high(MATM) + or3 r4, r4, #low(MATM) + ldi r5, #0x01 + st r5, @r4 ; Set MATM Reg(T bit ON) + ld r6, @r4 ; MATM Check + LDIMM (r5, 1f) + jmp r5 ; enable MMU + nop + .fillinsn +1: +;; ISN check + ld r6, @r4 ; MATM Check + seth r4, #high(M32R_ICU_ISTS_ADDR) + or3 r4, r4, #low(M32R_ICU_ISTS_ADDR) + ld r5, @r4 ; Read ISTSi reg. + mv r6, r5 + slli r5, #13 ; PIML check + srli r5, #13 ; + seth r4, #high(M32R_ICU_IMASK_ADDR) + or3 r4, r4, #low(M32R_ICU_IMASK_ADDR) + st r5, @r4 ; Write IMASKi reg. + slli r6, #4 ; ISN check + srli r6, #26 ; + seth r4, #high(M32R_IRQ_IPI5) + or3 r4, r4, #low(M32R_IRQ_IPI5) + bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep; + +;; check cpu_bootout_map and set cpu_bootin_map + LDIMM (r4, cpu_bootout_map) + ld r4, @r4 + seth r5, #high(M32R_CPUID_PORTL) + or3 r5, r5, #low(M32R_CPUID_PORTL) + ld r5, @r5 + ldi r6, #1 + sll r6, r5 + and r4, r6 + beqz r4, 2f + LDIMM (r4, cpu_bootin_map) + ld r5, @r4 + or r5, r6 + st r6, @r4 + +;; clear PSW + ldi r4, #0 + mvtc r4, psw + +;; setup SPI + LDIMM (r4, stack_start) + ld r4, @r4 + mvtc r4, spi + +;; setup BPC (start_secondary) + LDIMM (r4, start_secondary) + mvtc r4, bpc + + rte ; goto startup_secondary + nop + nop + + .fillinsn +2: + ;; disable MMU + seth r4, #high(MATM) + or3 r4, r4, #low(MATM) + ldi r5, #0 + st r5, @r4 ; Set MATM Reg(T bit OFF) + ld r6, @r4 ; MATM Check + LDIMM (r4, 3f) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + jmp r4 ; disable MMU + nop + .fillinsn +3: + ;; SLEEP and wait IPI + LDIMM (r4, AP_loop) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + jmp r4 + nop + nop +#endif /* CONFIG_SMP */ + +ENTRY(stack_start) + .long init_thread_union+8192 + .long __KERNEL_DS + +/* + * This is initialized to create a identity-mapping at 0-4M (for bootup + * purposes) and another mapping of the 0-4M area at virtual address + * PAGE_OFFSET. + */ + .text + +#define MOUNT_ROOT_RDONLY 1 +#define RAMDISK_FLAGS 0 ; 1024KB +#define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00) +#define LOADER_TYPE 1 ; (??? - non-zero value seems + ; to be needed to boot from initrd) + +#define COMMAND_LINE "" + + .section .empty_zero_page, "aw" +ENTRY(empty_zero_page) + .long MOUNT_ROOT_RDONLY /* offset: +0x00 */ + .long RAMDISK_FLAGS + .long ORIG_ROOT_DEV + .long LOADER_TYPE + .long 0 /* INITRD_START */ /* +0x10 */ + .long 0 /* INITRD_SIZE */ + .long 0 /* CPU_CLOCK */ + .long 0 /* BUS_CLOCK */ + .long 0 /* TIMER_DIVIDE */ /* +0x20 */ + .balign 256,0 + .asciz COMMAND_LINE + .byte 0 + .balign 4096,0,4096 + +/*------------------------------------------------------------------------ + * Stack area + */ + .section .spi + ALIGN + .global spi_stack_top + .zero 1024 +spi_stack_top: + + .section .spu + ALIGN + .global spu_stack_top + .zero 1024 +spu_stack_top: + + .end diff -Nru a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/init_task.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,41 @@ +/* orig : i386 init_task.c */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static struct fs_struct init_fs = INIT_FS; +static struct files_struct init_files = INIT_FILES; +static struct signal_struct init_signals = INIT_SIGNALS(init_signals); +static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); +struct mm_struct init_mm = INIT_MM(init_mm); + +EXPORT_SYMBOL(init_mm); + +/* + * Initial thread structure. + * + * We need to make sure that this is 8192-byte aligned due to the + * way process stacks are handled. This is done by having a special + * "init_task" linker map entry.. + */ +union thread_union init_thread_union + __attribute__((__section__(".data.init_task"))) = + { INIT_THREAD_INFO(init_task) }; + +/* + * Initial task structure. + * + * All other task structs will be allocated on slabs in fork.c + */ +struct task_struct init_task = INIT_TASK(init_task); + +EXPORT_SYMBOL(init_task); + diff -Nru a/arch/m32r/kernel/io_m32102.c b/arch/m32r/kernel/io_m32102.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_m32102.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,277 @@ +/* + * Mitsubishi M32R 32102 group + * Typical I/O routines. + * + * Copyright (c) 2001 Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) +#define M32R_PCC_IOSTART1 0x2000 +#define M32R_PCC_IOEND1 (M32R_PCC_IOSTART1 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32RPCC */ + + +/* + * Function prototypes + */ +unsigned char ne_inb(unsigned long); +void ne_outb(unsigned char, unsigned long); +void ne_insb(unsigned int, void *, unsigned long); +void ne_insw(unsigned int, void *, unsigned long); +void ne_outsb(unsigned int, const void *, unsigned long); +void ne_outsw(unsigned int, const void *, unsigned long); + +#define PORT2ADDR(port) m32102_port2addr(port) + +static __inline__ unsigned long +m32102_port2addr(unsigned long port) +{ + unsigned long ul; + ul = port + PAGE_OFFSET + 0x20000000; + return (ul); +} + +unsigned char +m32102_inb(unsigned long port) +{ +#ifdef CONFIG_PLAT_MAPPI + if(port >= 0x300 && port < 0x320) + return ne_inb(port); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif +#endif /* CONFIG_PLAT_MAPPI */ + return *(unsigned char *)PORT2ADDR(port); +} + +unsigned short +m32102_inw(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(unsigned short *)PORT2ADDR(port); +} + +unsigned long +m32102_inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread(0, port, &l, sizeof(l), 1, 0); + return l; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short l; + pcc_ioread(1, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(unsigned long *)PORT2ADDR(port); +} + +void +m32102_outb(unsigned char b, unsigned long port) +{ +#ifdef CONFIG_PLAT_MAPPI + if(port >= 0x300 && port < 0x320) + ne_outb(b,port); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif +#endif /* CONFIG_PLAT_MAPPI */ + *(unsigned volatile char *)PORT2ADDR(port) = b; +} + +void +m32102_outw(unsigned short w, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif +*(unsigned volatile short *)PORT2ADDR(port) = w; +} + +void +m32102_outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &l, sizeof(l), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &l, sizeof(l), 1, 0); + } else +#endif + *(unsigned volatile long *)PORT2ADDR(port) = l; +} + +void +m32102_insb(unsigned int port, void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned char), count, 1); + } else +#endif + while(count--){ + *(unsigned char *)addr = *(unsigned volatile char *)PORT2ADDR(port); + addr+=1; + } +} + +void +m32102_insw(unsigned int port, void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned short), count, 1); + } else +#endif +while(count--){ + *(unsigned short *)addr = *(unsigned volatile short *)PORT2ADDR(port); + addr+=2; + } +} + +void +m32102_outsb(unsigned int port, const void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned char), count, 1); + } else +#endif +while(count--){ + *(unsigned volatile char *)PORT2ADDR(port) = *(unsigned char *)addr; + addr+=1; + } +} +void +m32102_outsw(unsigned int port, const void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned short), count, 1); + } else +#endif +while(count--){ + *(unsigned volatile short *)PORT2ADDR(port) = *(unsigned short *)addr; + addr+=2; + } +} + +#ifdef CONFIG_PLAT_MAPPI +unsigned char +ne_inb(unsigned long port) +{ + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + tmp = *(unsigned short *)port; + return (unsigned char)tmp; +} +void +ne_outb(unsigned char b, unsigned long port) +{ + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + *(unsigned volatile short *)port = (unsigned short)b; +} +void +ne_insb(unsigned int port, void * addr, unsigned long count) +{ + + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + tmp = *(unsigned short *)port; + while(count--){ + *(unsigned char *)addr = *(unsigned volatile char *)port; + addr+=1; + } +} + +void +ne_insw(unsigned int port, void * addr, unsigned long count) { + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + tmp = *(unsigned volatile short *)port; + *(unsigned short *)addr = (tmp>>8) | (tmp <<8); + addr+=2; + } +} + +void +ne_outsb(unsigned int port, const void * addr, unsigned long count) +{ + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + *(unsigned volatile short *)port = *(unsigned char *)addr; + addr+=1; + } +} +void +ne_outsw(unsigned int port, const void * addr, unsigned long count) +{ + unsigned short tmp; + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + tmp = *(unsigned short *)addr; + *(unsigned volatile short *)port = (tmp>>8)|(tmp<<8); + addr+=2; + } +} + +#endif /* CONFIG_PLAT_MAPPI */ diff -Nru a/arch/m32r/kernel/io_m32700ut.c b/arch/m32r/kernel/io_m32700ut.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_m32700ut.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,455 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for M32700UT board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) +static __inline__ void *__port2addr_ata(unsigned long port) +{ + static int dummy_reg; + + switch (port) { + case 0x1f0: return (void *)0xac002000; + case 0x1f1: return (void *)0xac012800; + case 0x1f2: return (void *)0xac012002; + case 0x1f3: return (void *)0xac012802; + case 0x1f4: return (void *)0xac012004; + case 0x1f5: return (void *)0xac012804; + case 0x1f6: return (void *)0xac012006; + case 0x1f7: return (void *)0xac012806; + case 0x3f6: return (void *)0xac01200e; + default: return (void *)&dummy_reg; + } +} +#endif + +/* + * M32700UT-LAN is located in the extended bus space + * from 0x10000000 to 0x13ffffff on physical address. + * The base address of LAN controller(LAN91C111) is 0x300. + */ +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)((port & 0x0f) + NONCACHE_OFFSET + 0x10303000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = (unsigned char *)addr; + + while (count--) *buf++ = _ne_inb(portp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); + +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned char *)__port2addr_ata(port); + } +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned short *)__port2addr_ata(port); + } +#endif +#if defined(CONFIG_USB) + else if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned char *)__port2addr_ata(port); + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned short *)__port2addr_ata(port); + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned char *)__port2addr_ata(port) = b; + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned short *)__port2addr_ata(port) = w; + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned char *)__port2addr_ata(port) = b; + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned short *)__port2addr_ata(port) = w; + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + unsigned char *buf = addr; + unsigned char *portp = __port2addr_ata(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to read data + * from the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while(count--) *(volatile unsigned char *)portp = *buf++; +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to write data + * into the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_mappi.c b/arch/m32r/kernel/io_mappi.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_mappi.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,368 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for Mappi board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id: io_mappi.c,v 1.9 2003/12/02 07:18:08 fujiwara Exp $ */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) +#define M32R_PCC_IOSTART1 0x2000 +#define M32R_PCC_IOEND1 (M32R_PCC_IOSTART1 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32RPCC */ + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)((port<<1) + NONCACHE_OFFSET + 0x0C000000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return (unsigned char) *(volatile unsigned short *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + unsigned short tmp; + + tmp = *(volatile unsigned short *)portp; + return le16_to_cpu(tmp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned short *)portp = (unsigned short)b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread(0, port, &l, sizeof(l), 1, 0); + return l; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short l; + pcc_ioread(1, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &l, sizeof(l), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320){ + portp = PORT2ADDR_NE(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = _ne_inw(portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outw(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_mappi2.c b/arch/m32r/kernel/io_mappi2.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_mappi2.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,370 @@ +/* + * linux/arch/m32r/kernel/io_mappi2.c + * + * Typical I/O routines for Mappi2 board. + * + * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +/* $Id:$ */ + +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_MAPPI2_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_NE(port) _port2addr_ne(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +#ifdef CONFIG_CHIP_OPSP +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +#else +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x04000000); +} +#endif +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x14000000); +} +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return (unsigned char) *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ +#if 1 /* byte swap */ + unsigned short tmp,tmp2; + tmp = *(volatile unsigned short *)portp; + tmp2 = (tmp>>8|tmp<<8); + return tmp2; +#else + return *(volatile unsigned short *)portp; +#endif +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned short tmp; + unsigned char *buf = addr; + + tmp = *(volatile unsigned char *)portp; + while (count--) *buf++ = *(volatile unsigned char *)portp; +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = (unsigned char)b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = (w>>8|w<<8); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_USB) + else if (port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + v = *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_oaks32r.c b/arch/m32r/kernel/io_oaks32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_oaks32r.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,243 @@ +/* + * linux/arch/m32r/kernel/io_oaks32r.c + * + * Typical I/O routines for OAKS32R board. + * + * Copyright (c) 2001-2004 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +/* $Id$ */ + +#include +#include +#include +#include + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)((port<<1) + NONCACHE_OFFSET + 0x02000000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)(portp+1); +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + unsigned short tmp; + + tmp = *(unsigned short *)(portp) & 0xff; + tmp |= *(unsigned short *)(portp+2) << 8; + return tmp; +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = addr; + while (count--) *buf++ = *(volatile unsigned char *)(portp+1); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)(portp+1) = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = (w >> 8); + *(volatile unsigned short *)(portp+2) = (w & 0xff); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inb(PORT2ADDR_NE(port)); + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inw(PORT2ADDR_NE(port)); + + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= 0x300 && port < 0x320) + _ne_insb(PORT2ADDR_NE(port), addr, count); + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = _ne_inw(portp); + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outw(*buf++, portp); + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_opsput.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,377 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for OPSPUT board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +/* + * OPSPUT-LAN is located in the extended bus space + * from 0x10000000 to 0x13ffffff on physical address. + * The base address of LAN controller(LAN91C111) is 0x300. + */ +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)((port & 0x0f) + NONCACHE_OFFSET + 0x10303000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = (unsigned char *)addr; + + while (count--) *buf++ = _ne_inb(portp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_USB) + else if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to read data + * from the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to write data + * into the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_usrv.c b/arch/m32r/kernel/io_usrv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_usrv.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,247 @@ +/* + * linux/arch/m32r/kernel/io_usrv.c + * + * Typical I/O routines for uServer board. + * + * Copyright (c) 2001 - 2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + */ + +#include +#include +#include +#include + +#include +#include "../drivers/m32r_cfc.h" + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#define CFC_IOSTART CFC_IOPORT_BASE +#define CFC_IOEND (CFC_IOSTART + (M32R_PCC_MAPSIZE * M32R_MAX_PCC) - 1) + +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) +#define UART0_REGSTART 0x04c20000 +#define UART1_REGSTART 0x04c20100 +#define UART_IOMAP_SIZE 8 +#define UART0_IOSTART 0x3f8 +#define UART0_IOEND (UART0_IOSTART + UART_IOMAP_SIZE - 1) +#define UART1_IOSTART 0x2f8 +#define UART1_IOEND (UART1_IOSTART + UART_IOMAP_SIZE - 1) +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) + if (port >= UART0_IOSTART && port <= UART0_IOEND) + port = ((port - UART0_IOSTART) << 1) + UART0_REGSTART; + else if (port >= UART1_IOSTART && port <= UART1_IOEND) + port = ((port - UART1_IOSTART) << 1) + UART1_REGSTART; +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char b; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else { + b = *(volatile unsigned char *)PORT2ADDR(port); + delay(); + return b; + } +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short w; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else { + w = *(volatile unsigned short *)PORT2ADDR(port); + delay(); + return w; + } +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + + return v; +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + else + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_ioread_byte(0, port, addr, sizeof(unsigned char), count, 1); + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_ioread_word(0, port, addr, sizeof(unsigned short), count, + 1); + else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) + *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), + count, 1); + else { + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, (void *)addr, sizeof(unsigned short), + count, 1); + else { + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/irq.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,1018 @@ +/* + * linux/arch/m32r/kernel/irq.c + * + * Copyright (c) 2003, 2004 Hitoshi Yamamoto + * + * Taken from i386 2.6.4 version. + */ + +/* + * linux/arch/i386/kernel/irq.c + * + * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar + * + * This file contains the code used by various IRQ handling routines: + * asking for different IRQ's should be done through these routines + * instead of just grabbing them. Thus setups with different IRQ numbers + * shouldn't result in any weird surprises, and installing new handlers + * should be easier. + */ + +/* + * (mostly architecture independent, will move to kernel/irq.c in 2.5.) + * + * IRQs are in fact implemented a bit like signal handlers for the kernel. + * Naturally it's not a 1:1 relation, but there are similarities. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Linux has a controller-independent x86 interrupt architecture. + * every controller has a 'controller-template', that is used + * by the main code to do the right thing. Each driver-visible + * interrupt source is transparently wired to the apropriate + * controller. Thus drivers need not be aware of the + * interrupt-controller. + * + * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC, + * PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC. + * (IO-APICs assumed to be messaging to Pentium local-APICs) + * + * the code is designed to be easily extended with new/different + * interrupt controllers, without having to do assembly magic. + */ + +/* + * Controller mappings for all interrupt sources: + */ +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { + [0 ... NR_IRQS-1] = { + .handler = &no_irq_type, + .lock = SPIN_LOCK_UNLOCKED + } +}; + +static void register_irq_proc (unsigned int irq); + +/* + * Special irq handlers. + */ + +irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs) +{ return IRQ_NONE; } + +/* + * Generic no controller code + */ + +static void enable_none(unsigned int irq) { } +static unsigned int startup_none(unsigned int irq) { return 0; } +static void disable_none(unsigned int irq) { } +static void ack_none(unsigned int irq) +{ +/* + * 'what should we do if we get a hw irq event on an illegal vector'. + * each architecture has to answer this themselves, it doesn't deserve + * a generic callback i think. + */ + printk("unexpected IRQ trap at vector %02x\n", irq); +} + +/* startup is the same as "enable", shutdown is same as "disable" */ +#define shutdown_none disable_none +#define end_none enable_none + +struct hw_interrupt_type no_irq_type = { + "none", + startup_none, + shutdown_none, + enable_none, + disable_none, + ack_none, + end_none +}; + +atomic_t irq_err_count; +atomic_t irq_mis_count; + +/* + * Generic, controller-independent functions: + */ + +int show_interrupts(struct seq_file *p, void *v) +{ + int i = *(loff_t *) v, j; + struct irqaction * action; + unsigned long flags; + + if (i == 0) { + seq_printf(p, " "); + for (j=0; jtypename); + seq_printf(p, " %s", action->name); + + for (action=action->next; action; action = action->next) + seq_printf(p, ", %s", action->name); + + seq_putc(p, '\n'); +skip: + spin_unlock_irqrestore(&irq_desc[i].lock, flags); + } else if (i == NR_IRQS) { + seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); + seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); + } + return 0; +} + +#ifdef CONFIG_SMP +inline void synchronize_irq(unsigned int irq) +{ + while (irq_desc[irq].status & IRQ_INPROGRESS) + cpu_relax(); +} +#endif + +/* + * This should really return information about whether + * we should do bottom half handling etc. Right now we + * end up _always_ checking the bottom half, which is a + * waste of time and is not what some drivers would + * prefer. + */ +int handle_IRQ_event(unsigned int irq, + struct pt_regs *regs, struct irqaction *action) +{ + int status = 1; /* Force the "do bottom halves" bit */ + int retval = 0; + + if (!(action->flags & SA_INTERRUPT)) + local_irq_enable(); + + do { + status |= action->flags; + retval |= action->handler(irq, action->dev_id, regs); + action = action->next; + } while (action); + if (status & SA_SAMPLE_RANDOM) + add_interrupt_randomness(irq); + local_irq_disable(); + return retval; +} + +static void __report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + struct irqaction *action; + + if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE) { + printk(KERN_ERR "irq event %d: bogus return value %x\n", + irq, action_ret); + } else { + printk(KERN_ERR "irq %d: nobody cared!\n", irq); + } + dump_stack(); + printk(KERN_ERR "handlers:\n"); + action = desc->action; + do { + printk(KERN_ERR "[<%p>]", action->handler); + print_symbol(" (%s)", + (unsigned long)action->handler); + printk("\n"); + action = action->next; + } while (action); +} + +static void report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + static int count = 100; + + if (count) { + count--; + __report_bad_irq(irq, desc, action_ret); + } +} + +static int noirqdebug; + +static int __init noirqdebug_setup(char *str) +{ + noirqdebug = 1; + printk("IRQ lockup detection disabled\n"); + return 1; +} + +__setup("noirqdebug", noirqdebug_setup); + +/* + * If 99,900 of the previous 100,000 interrupts have not been handled then + * assume that the IRQ is stuck in some manner. Drop a diagnostic and try to + * turn the IRQ off. + * + * (The other 100-of-100,000 interrupts may have been a correctly-functioning + * device sharing an IRQ with the failing one) + * + * Called under desc->lock + */ +static void note_interrupt(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + if (action_ret != IRQ_HANDLED) { + desc->irqs_unhandled++; + if (action_ret != IRQ_NONE) + report_bad_irq(irq, desc, action_ret); + } + + desc->irq_count++; + if (desc->irq_count < 100000) + return; + + desc->irq_count = 0; + if (desc->irqs_unhandled > 99900) { + /* + * The interrupt is stuck + */ + __report_bad_irq(irq, desc, action_ret); + /* + * Now kill the IRQ + */ + printk(KERN_EMERG "Disabling IRQ #%d\n", irq); + desc->status |= IRQ_DISABLED; + desc->handler->disable(irq); + } + desc->irqs_unhandled = 0; +} + +/* + * Generic enable/disable code: this just calls + * down into the PIC-specific version for the actual + * hardware disable after having gotten the irq + * controller lock. + */ + +/** + * disable_irq_nosync - disable an irq without waiting + * @irq: Interrupt to disable + * + * Disable the selected interrupt line. Disables and Enables are + * nested. + * Unlike disable_irq(), this function does not ensure existing + * instances of the IRQ handler have completed before returning. + * + * This function may be called from IRQ context. + */ + +inline void disable_irq_nosync(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + unsigned long flags; + + spin_lock_irqsave(&desc->lock, flags); + if (!desc->depth++) { + desc->status |= IRQ_DISABLED; + desc->handler->disable(irq); + } + spin_unlock_irqrestore(&desc->lock, flags); +} + +/** + * disable_irq - disable an irq and wait for completion + * @irq: Interrupt to disable + * + * Disable the selected interrupt line. Enables and Disables are + * nested. + * This function waits for any pending IRQ handlers for this interrupt + * to complete before returning. If you use this function while + * holding a resource the IRQ handler may need you will deadlock. + * + * This function may be called - with care - from IRQ context. + */ + +void disable_irq(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + disable_irq_nosync(irq); + if (desc->action) + synchronize_irq(irq); +} + +/** + * enable_irq - enable handling of an irq + * @irq: Interrupt to enable + * + * Undoes the effect of one call to disable_irq(). If this + * matches the last disable, processing of interrupts on this + * IRQ line is re-enabled. + * + * This function may be called from IRQ context. + */ + +void enable_irq(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + unsigned long flags; + + spin_lock_irqsave(&desc->lock, flags); + switch (desc->depth) { + case 1: { + unsigned int status = desc->status & ~IRQ_DISABLED; + desc->status = status; + if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { + desc->status = status | IRQ_REPLAY; + hw_resend_irq(desc->handler,irq); + } + desc->handler->enable(irq); + /* fall-through */ + } + default: + desc->depth--; + break; + case 0: + printk("enable_irq(%u) unbalanced from %p\n", irq, + __builtin_return_address(0)); + } + spin_unlock_irqrestore(&desc->lock, flags); +} + +/* + * do_IRQ handles all normal device IRQ's (the special + * SMP cross-CPU interrupts have their own specific + * handlers). + */ +asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) +{ + /* + * We ack quickly, we don't want the irq controller + * thinking we're snobs just because some other CPU has + * disabled global interrupts (we have already done the + * INT_ACK cycles, it's too late to try to pretend to the + * controller that we aren't taking the interrupt). + * + * 0 return value means that this irq is already being + * handled by some other CPU. (or is disabled) + */ + irq_desc_t *desc = irq_desc + irq; + struct irqaction * action; + unsigned int status; + + irq_enter(); + +#ifdef CONFIG_DEBUG_STACKOVERFLOW + /* FIXME M32R */ +#endif + kstat_this_cpu.irqs[irq]++; + spin_lock(&desc->lock); + desc->handler->ack(irq); + /* + REPLAY is when Linux resends an IRQ that was dropped earlier + WAITING is used by probe to mark irqs that are being tested + */ + status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING); + status |= IRQ_PENDING; /* we _want_ to handle it */ + + /* + * If the IRQ is disabled for whatever reason, we cannot + * use the action we have. + */ + action = NULL; + if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) { + action = desc->action; + status &= ~IRQ_PENDING; /* we commit to handling */ + status |= IRQ_INPROGRESS; /* we are handling it */ + } + desc->status = status; + + /* + * If there is no IRQ handler or it was disabled, exit early. + Since we set PENDING, if another processor is handling + a different instance of this same irq, the other processor + will take care of it. + */ + if (unlikely(!action)) + goto out; + + /* + * Edge triggered interrupts need to remember + * pending events. + * This applies to any hw interrupts that allow a second + * instance of the same irq to arrive while we are in do_IRQ + * or in the handler. But the code here only handles the _second_ + * instance of the irq, not the third or fourth. So it is mostly + * useful for irq hardware that does not mask cleanly in an + * SMP environment. + */ + for (;;) { + irqreturn_t action_ret; + + spin_unlock(&desc->lock); + action_ret = handle_IRQ_event(irq, regs, action); + spin_lock(&desc->lock); + if (!noirqdebug) + note_interrupt(irq, desc, action_ret); + if (likely(!(desc->status & IRQ_PENDING))) + break; + desc->status &= ~IRQ_PENDING; + } + desc->status &= ~IRQ_INPROGRESS; + +out: + /* + * The ->end() handler has to deal with interrupts which got + * disabled while the handler was running. + */ + desc->handler->end(irq); + spin_unlock(&desc->lock); + + irq_exit(); + +#if defined(CONFIG_SMP) + if (irq == M32R_IRQ_MFT2) + smp_send_timer(); +#endif /* CONFIG_SMP */ + + return 1; +} + +int can_request_irq(unsigned int irq, unsigned long irqflags) +{ + struct irqaction *action; + + if (irq >= NR_IRQS) + return 0; + action = irq_desc[irq].action; + if (action) { + if (irqflags & action->flags & SA_SHIRQ) + action = NULL; + } + return !action; +} + +/** + * request_irq - allocate an interrupt line + * @irq: Interrupt line to allocate + * @handler: Function to be called when the IRQ occurs + * @irqflags: Interrupt type flags + * @devname: An ascii name for the claiming device + * @dev_id: A cookie passed back to the handler function + * + * This call allocates interrupt resources and enables the + * interrupt line and IRQ handling. From the point this + * call is made your handler function may be invoked. Since + * your handler function must clear any interrupt the board + * raises, you must take care both to initialise your hardware + * and to set up the interrupt handler in the right order. + * + * Dev_id must be globally unique. Normally the address of the + * device data structure is used as the cookie. Since the handler + * receives this value it makes sense to use it. + * + * If your interrupt is shared you must pass a non NULL dev_id + * as this is required when freeing the interrupt. + * + * Flags: + * + * SA_SHIRQ Interrupt is shared + * + * SA_INTERRUPT Disable local interrupts while processing + * + * SA_SAMPLE_RANDOM The interrupt can be used for entropy + * + */ + +int request_irq(unsigned int irq, + irqreturn_t (*handler)(int, void *, struct pt_regs *), + unsigned long irqflags, + const char * devname, + void *dev_id) +{ + int retval; + struct irqaction * action; + +#if 1 + /* + * Sanity-check: shared interrupts should REALLY pass in + * a real dev-ID, otherwise we'll have trouble later trying + * to figure out which interrupt is which (messes up the + * interrupt freeing logic etc). + */ + if (irqflags & SA_SHIRQ) { + if (!dev_id) + printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]); + } +#endif + + if (irq >= NR_IRQS) + return -EINVAL; + if (!handler) + return -EINVAL; + + action = (struct irqaction *) + kmalloc(sizeof(struct irqaction), GFP_ATOMIC); + if (!action) + return -ENOMEM; + + action->handler = handler; + action->flags = irqflags; + cpus_clear(action->mask); + action->name = devname; + action->next = NULL; + action->dev_id = dev_id; + + retval = setup_irq(irq, action); + if (retval) + kfree(action); + return retval; +} + +EXPORT_SYMBOL(request_irq); + +/** + * free_irq - free an interrupt + * @irq: Interrupt line to free + * @dev_id: Device identity to free + * + * Remove an interrupt handler. The handler is removed and if the + * interrupt line is no longer in use by any driver it is disabled. + * On a shared IRQ the caller must ensure the interrupt is disabled + * on the card it drives before calling this function. The function + * does not return until any executing interrupts for this IRQ + * have completed. + * + * This function must not be called from interrupt context. + */ + +void free_irq(unsigned int irq, void *dev_id) +{ + irq_desc_t *desc; + struct irqaction **p; + unsigned long flags; + + if (irq >= NR_IRQS) + return; + + desc = irq_desc + irq; + spin_lock_irqsave(&desc->lock,flags); + p = &desc->action; + for (;;) { + struct irqaction * action = *p; + if (action) { + struct irqaction **pp = p; + p = &action->next; + if (action->dev_id != dev_id) + continue; + + /* Found it - now remove it from the list of entries */ + *pp = action->next; + if (!desc->action) { + desc->status |= IRQ_DISABLED; + desc->handler->shutdown(irq); + } + spin_unlock_irqrestore(&desc->lock,flags); + + /* Wait to make sure it's not being used on another CPU */ + synchronize_irq(irq); + kfree(action); + return; + } + printk("Trying to free free IRQ%d\n",irq); + spin_unlock_irqrestore(&desc->lock,flags); + return; + } +} + +EXPORT_SYMBOL(free_irq); + +/* + * IRQ autodetection code.. + * + * This depends on the fact that any interrupt that + * comes in on to an unassigned handler will get stuck + * with "IRQ_WAITING" cleared and the interrupt + * disabled. + */ + +static DECLARE_MUTEX(probe_sem); + +/** + * probe_irq_on - begin an interrupt autodetect + * + * Commence probing for an interrupt. The interrupts are scanned + * and a mask of potential interrupt lines is returned. + * + */ + +unsigned long probe_irq_on(void) +{ + unsigned int i; + irq_desc_t *desc; + unsigned long val; + unsigned long delay; + + down(&probe_sem); + /* + * something may have generated an irq long ago and we want to + * flush such a longstanding irq before considering it as spurious. + */ + for (i = NR_IRQS-1; i > 0; i--) { + desc = irq_desc + i; + + spin_lock_irq(&desc->lock); + if (!irq_desc[i].action) + irq_desc[i].handler->startup(i); + spin_unlock_irq(&desc->lock); + } + + /* Wait for longstanding interrupts to trigger. */ + for (delay = jiffies + HZ/50; time_after(delay, jiffies); ) + /* about 20ms delay */ barrier(); + + /* + * enable any unassigned irqs + * (we must startup again here because if a longstanding irq + * happened in the previous stage, it may have masked itself) + */ + for (i = NR_IRQS-1; i > 0; i--) { + desc = irq_desc + i; + + spin_lock_irq(&desc->lock); + if (!desc->action) { + desc->status |= IRQ_AUTODETECT | IRQ_WAITING; + if (desc->handler->startup(i)) + desc->status |= IRQ_PENDING; + } + spin_unlock_irq(&desc->lock); + } + + /* + * Wait for spurious interrupts to trigger + */ + for (delay = jiffies + HZ/10; time_after(delay, jiffies); ) + /* about 100ms delay */ barrier(); + + /* + * Now filter out any obviously spurious interrupts + */ + val = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + /* It triggered already - consider it spurious. */ + if (!(status & IRQ_WAITING)) { + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } else + if (i < 32) + val |= 1 << i; + } + spin_unlock_irq(&desc->lock); + } + + return val; +} + +EXPORT_SYMBOL(probe_irq_on); + +/* + * Return a mask of triggered interrupts (this + * can handle only legacy ISA interrupts). + */ + +/** + * probe_irq_mask - scan a bitmap of interrupt lines + * @val: mask of interrupts to consider + * + * Scan the ISA bus interrupt lines and return a bitmap of + * active interrupts. The interrupt probe logic state is then + * returned to its previous value. + * + * Note: we need to scan all the irq's even though we will + * only return ISA irq numbers - just so that we reset them + * all to a known state. + */ +unsigned int probe_irq_mask(unsigned long val) +{ + int i; + unsigned int mask; + + mask = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + if (i < 16 && !(status & IRQ_WAITING)) + mask |= 1 << i; + + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } + spin_unlock_irq(&desc->lock); + } + up(&probe_sem); + + return mask & val; +} + +/* + * Return the one interrupt that triggered (this can + * handle any interrupt source). + */ + +/** + * probe_irq_off - end an interrupt autodetect + * @val: mask of potential interrupts (unused) + * + * Scans the unused interrupt lines and returns the line which + * appears to have triggered the interrupt. If no interrupt was + * found then zero is returned. If more than one interrupt is + * found then minus the first candidate is returned to indicate + * their is doubt. + * + * The interrupt probe logic state is returned to its previous + * value. + * + * BUGS: When used in a module (which arguably shouldnt happen) + * nothing prevents two IRQ probe callers from overlapping. The + * results of this are non-optimal. + */ + +int probe_irq_off(unsigned long val) +{ + int i, irq_found, nr_irqs; + + nr_irqs = 0; + irq_found = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + if (!(status & IRQ_WAITING)) { + if (!nr_irqs) + irq_found = i; + nr_irqs++; + } + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } + spin_unlock_irq(&desc->lock); + } + up(&probe_sem); + + if (nr_irqs > 1) + irq_found = -irq_found; + return irq_found; +} + +EXPORT_SYMBOL(probe_irq_off); + +/* this was setup_x86_irq but it seems pretty generic */ +int setup_irq(unsigned int irq, struct irqaction * new) +{ + int shared = 0; + unsigned long flags; + struct irqaction *old, **p; + irq_desc_t *desc = irq_desc + irq; + + if (desc->handler == &no_irq_type) + return -ENOSYS; + /* + * Some drivers like serial.c use request_irq() heavily, + * so we have to be careful not to interfere with a + * running system. + */ + if (new->flags & SA_SAMPLE_RANDOM) { + /* + * This function might sleep, we want to call it first, + * outside of the atomic block. + * Yes, this might clear the entropy pool if the wrong + * driver is attempted to be loaded, without actually + * installing a new handler, but is this really a problem, + * only the sysadmin is able to do this. + */ + rand_initialize_irq(irq); + } + + /* + * The following block of code has to be executed atomically + */ + spin_lock_irqsave(&desc->lock,flags); + p = &desc->action; + if ((old = *p) != NULL) { + /* Can't share interrupts unless both agree to */ + if (!(old->flags & new->flags & SA_SHIRQ)) { + spin_unlock_irqrestore(&desc->lock,flags); + return -EBUSY; + } + + /* add new interrupt at end of irq queue */ + do { + p = &old->next; + old = *p; + } while (old); + shared = 1; + } + + *p = new; + + if (!shared) { + desc->depth = 0; + desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS); + desc->handler->startup(irq); + } + spin_unlock_irqrestore(&desc->lock,flags); + + register_irq_proc(irq); + return 0; +} + +static struct proc_dir_entry * root_irq_dir; +static struct proc_dir_entry * irq_dir [NR_IRQS]; + +#ifdef CONFIG_SMP + +static struct proc_dir_entry *smp_affinity_entry[NR_IRQS]; + +cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL }; + +static int irq_affinity_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); + if (count - len < 2) + return -EINVAL; + len += sprintf(page + len, "\n"); + return len; +} + +static int irq_affinity_write_proc(struct file *file, const char __user *buffer, + unsigned long count, void *data) +{ + int irq = (long)data, full_count = count, err; + cpumask_t new_value, tmp; + + if (!irq_desc[irq].handler->set_affinity) + return -EIO; + + err = cpumask_parse(buffer, count, new_value); + if (err) + return err; + + /* + * Do not allow disabling IRQs completely - it's a too easy + * way to make the system unusable accidentally :-) At least + * one online CPU still has to be targeted. + */ + cpus_and(tmp, new_value, cpu_online_map); + if (cpus_empty(tmp)) + return -EINVAL; + + irq_affinity[irq] = new_value; + irq_desc[irq].handler->set_affinity(irq, + cpumask_of_cpu(first_cpu(new_value))); + + return full_count; +} + +#endif + +static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); + if (count - len < 2) + return -EINVAL; + len += sprintf(page + len, "\n"); + return len; +} + +static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, + unsigned long count, void *data) +{ + cpumask_t *mask = (cpumask_t *)data; + unsigned long full_count = count, err; + cpumask_t new_value; + + err = cpumask_parse(buffer, count, new_value); + if (err) + return err; + + *mask = new_value; + return full_count; +} + +#define MAX_NAMELEN 10 + +static void register_irq_proc (unsigned int irq) +{ + char name [MAX_NAMELEN]; + + if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) || + irq_dir[irq]) + return; + + memset(name, 0, MAX_NAMELEN); + sprintf(name, "%d", irq); + + /* create /proc/irq/1234 */ + irq_dir[irq] = proc_mkdir(name, root_irq_dir); + +#ifdef CONFIG_SMP + { + struct proc_dir_entry *entry; + + /* create /proc/irq/1234/smp_affinity */ + entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]); + + if (entry) { + entry->nlink = 1; + entry->data = (void *)(long)irq; + entry->read_proc = irq_affinity_read_proc; + entry->write_proc = irq_affinity_write_proc; + } + + smp_affinity_entry[irq] = entry; + } +#endif +} + +unsigned long prof_cpu_mask = -1; + +void init_irq_proc (void) +{ + struct proc_dir_entry *entry; + int i; + + /* create /proc/irq */ + root_irq_dir = proc_mkdir("irq", NULL); + + /* create /proc/irq/prof_cpu_mask */ + entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir); + + if (!entry) + return; + + entry->nlink = 1; + entry->data = (void *)&prof_cpu_mask; + entry->read_proc = prof_cpu_mask_read_proc; + entry->write_proc = prof_cpu_mask_write_proc; + + /* + * Create entries for all existing IRQs. + */ + for (i = 0; i < NR_IRQS; i++) + register_irq_proc(i); +} + diff -Nru a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/m32r_ksyms.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,141 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +extern void dump_thread(struct pt_regs *, struct user *); + +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) +extern struct drive_info_struct drive_info; +EXPORT_SYMBOL(drive_info); +#endif + +/* platform dependent support */ +EXPORT_SYMBOL(boot_cpu_data); +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(dump_fpu); +EXPORT_SYMBOL(__ioremap); +EXPORT_SYMBOL(iounmap); +EXPORT_SYMBOL(enable_irq); +EXPORT_SYMBOL(disable_irq); +EXPORT_SYMBOL(disable_irq_nosync); +EXPORT_SYMBOL(kernel_thread); +EXPORT_SYMBOL(__down); +EXPORT_SYMBOL(__down_interruptible); +EXPORT_SYMBOL(__up); +EXPORT_SYMBOL(__down_trylock); + +/* Networking helper routines. */ +/* Delay loops */ +EXPORT_SYMBOL(__udelay); +EXPORT_SYMBOL(__delay); +EXPORT_SYMBOL(__const_udelay); + +EXPORT_SYMBOL(__get_user_1); +EXPORT_SYMBOL(__get_user_2); +EXPORT_SYMBOL(__get_user_4); + +EXPORT_SYMBOL(strpbrk); +EXPORT_SYMBOL(strstr); + +EXPORT_SYMBOL(strncpy_from_user); +EXPORT_SYMBOL(__strncpy_from_user); +EXPORT_SYMBOL(clear_user); +EXPORT_SYMBOL(__clear_user); +EXPORT_SYMBOL(__generic_copy_from_user); +EXPORT_SYMBOL(__generic_copy_to_user); +EXPORT_SYMBOL(strnlen_user); + +#ifdef CONFIG_SMP +#ifdef CONFIG_CHIP_M32700_TS1 +extern void *dcache_dummy; +EXPORT_SYMBOL(dcache_dummy); +#endif +EXPORT_SYMBOL(cpu_data); +EXPORT_SYMBOL(cpu_online_map); +EXPORT_SYMBOL(cpu_callout_map); + +/* Global SMP stuff */ +EXPORT_SYMBOL(synchronize_irq); +EXPORT_SYMBOL(smp_call_function); + +/* TLB flushing */ +EXPORT_SYMBOL(smp_flush_tlb_page); +EXPORT_SYMBOL_GPL(smp_flush_tlb_all); +#endif + +/* compiler generated symbol */ +extern void __ashldi3(void); +extern void __ashrdi3(void); +extern void __lshldi3(void); +extern void __lshrdi3(void); +extern void __muldi3(void); +EXPORT_SYMBOL(__ashldi3); +EXPORT_SYMBOL(__ashrdi3); +EXPORT_SYMBOL(__lshldi3); +EXPORT_SYMBOL(__lshrdi3); +EXPORT_SYMBOL(__muldi3); + +/* memory and string operations */ +EXPORT_SYMBOL(memchr); +EXPORT_SYMBOL(memcpy); +/* EXPORT_SYMBOL(memcpy_fromio); // not implement yet */ +/* EXPORT_SYMBOL(memcpy_toio); // not implement yet */ +EXPORT_SYMBOL(memset); +/* EXPORT_SYMBOL(memset_io); // not implement yet */ +EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memscan); +EXPORT_SYMBOL(copy_page); +EXPORT_SYMBOL(clear_page); + +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strncat); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(strncpy); + +EXPORT_SYMBOL(_inb); +EXPORT_SYMBOL(_inw); +EXPORT_SYMBOL(_inl); +EXPORT_SYMBOL(_outb); +EXPORT_SYMBOL(_outw); +EXPORT_SYMBOL(_outl); +EXPORT_SYMBOL(_inb_p); +EXPORT_SYMBOL(_inw_p); +EXPORT_SYMBOL(_inl_p); +EXPORT_SYMBOL(_outb_p); +EXPORT_SYMBOL(_outw_p); +EXPORT_SYMBOL(_outl_p); +EXPORT_SYMBOL(_insb); +EXPORT_SYMBOL(_insw); +EXPORT_SYMBOL(_insl); +EXPORT_SYMBOL(_outsb); +EXPORT_SYMBOL(_outsw); +EXPORT_SYMBOL(_outsl); +EXPORT_SYMBOL(_readb); +EXPORT_SYMBOL(_readw); +EXPORT_SYMBOL(_readl); +EXPORT_SYMBOL(_writeb); +EXPORT_SYMBOL(_writew); +EXPORT_SYMBOL(_writel); + diff -Nru a/arch/m32r/kernel/module.c b/arch/m32r/kernel/module.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/module.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,253 @@ +/* Kernel module help for M32R. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include +#include +#include +#include +#include +#include + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt...) +#endif + +void *module_alloc(unsigned long size) +{ + if (size == 0) + return NULL; + return vmalloc_exec(size); +} + + +/* Free memory returned from module_alloc */ +void module_free(struct module *mod, void *module_region) +{ + vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ +} + +/* We don't need anything special. */ +int module_frob_arch_sections(Elf_Ehdr *hdr, + Elf_Shdr *sechdrs, + char *secstrings, + struct module *mod) +{ + return 0; +} + +#define COPY_UNALIGNED_WORD(sw, tw, align) \ +{ \ + void *__s = &(sw), *__t = &(tw); \ + unsigned short *__s2 = __s, *__t2 =__t; \ + unsigned char *__s1 = __s, *__t1 =__t; \ + switch ((align)) \ + { \ + case 0: \ + *(unsigned long *) __t = *(unsigned long *) __s; \ + break; \ + case 2: \ + *__t2++ = *__s2++; \ + *__t2 = *__s2; \ + break; \ + default: \ + *__t1++ = *__s1++; \ + *__t1++ = *__s1++; \ + *__t1++ = *__s1++; \ + *__t1 = *__s1; \ + break; \ + } \ +} + +#define COPY_UNALIGNED_HWORD(sw, tw, align) \ + { \ + void *__s = &(sw), *__t = &(tw); \ + unsigned short *__s2 = __s, *__t2 =__t; \ + unsigned char *__s1 = __s, *__t1 =__t; \ + switch ((align)) \ + { \ + case 0: \ + *__t2 = *__s2; \ + break; \ + default: \ + *__t1++ = *__s1++; \ + *__t1 = *__s1; \ + break; \ + } \ + } + +int apply_relocate_add(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + unsigned int i; + Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; + Elf32_Sym *sym; + Elf32_Addr relocation; + uint32_t *location; + uint32_t value; + unsigned short *hlocation; + unsigned short hvalue; + int svalue; + int align; + + DEBUGP("Applying relocate section %u to %u\n", relsec, + sechdrs[relsec].sh_info); + for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { + /* This is where to make the change */ + location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + + rel[i].r_offset; + /* This is the symbol it is referring to. Note that all + undefined symbols have been resolved. */ + sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + + ELF32_R_SYM(rel[i].r_info); + relocation = sym->st_value + rel[i].r_addend; + align = (int)location & 3; + + switch (ELF32_R_TYPE(rel[i].r_info)) { + case R_M32R_32_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_HI16_ULO_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = (relocation >>16) & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_HI16_SLO_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + if (relocation & 0x8000) relocation += 0x10000; + relocation = (relocation >>16) & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_16_RELA: + hlocation = (unsigned short *)location; + relocation = relocation & 0xffff; + /* RELA must has 0 at relocation field. */ + hvalue = relocation; + COPY_UNALIGNED_WORD (hvalue, *hlocation, align); + break; + case R_M32R_SDA16_RELA: + case R_M32R_LO16_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = relocation & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_24_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = relocation & 0xffffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_18_PCREL_RELA: + relocation = (relocation - (Elf32_Addr) location); + if (relocation < -0x20000 || 0x1fffc < relocation) + { + printk(KERN_ERR "module %s: relocation overflow: %u\n", + me->name, relocation); + return -ENOEXEC; + } + COPY_UNALIGNED_WORD (*location, value, align); + if (value & 0xffff) + { + /* RELA must has 0 at relocation field. */ + printk(KERN_ERR "module %s: illegal relocation field: %u\n", + me->name, value); + return -ENOEXEC; + } + relocation = (relocation >> 2) & 0xffff; + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_10_PCREL_RELA: + hlocation = (unsigned short *)location; + relocation = (relocation - (Elf32_Addr) location); + COPY_UNALIGNED_HWORD (*hlocation, hvalue, align); + svalue = (int)hvalue; + svalue = (signed char)svalue << 2; + relocation += svalue; + relocation = (relocation >> 2) & 0xff; + hvalue = hvalue & 0xff00; + hvalue += relocation; + COPY_UNALIGNED_HWORD (hvalue, *hlocation, align); + break; + case R_M32R_26_PCREL_RELA: + relocation = (relocation - (Elf32_Addr) location); + if (relocation < -0x2000000 || 0x1fffffc < relocation) + { + printk(KERN_ERR "module %s: relocation overflow: %u\n", + me->name, relocation); + return -ENOEXEC; + } + COPY_UNALIGNED_WORD (*location, value, align); + if (value & 0xffffff) + { + /* RELA must has 0 at relocation field. */ + printk(KERN_ERR "module %s: illegal relocation field: %u\n", + me->name, value); + return -ENOEXEC; + } + relocation = (relocation >> 2) & 0xffffff; + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + default: + printk(KERN_ERR "module %s: Unknown relocation: %u\n", + me->name, ELF32_R_TYPE(rel[i].r_info)); + return -ENOEXEC; + } + } + return 0; +} + +int apply_relocate(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ +#if 0 + printk(KERN_ERR "module %s: REL RELOCATION unsupported\n", + me->name); + return -ENOEXEC; +#endif + return 0; + +} + +int module_finalize(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + struct module *me) +{ + return 0; +} + +void module_arch_cleanup(struct module *mod) +{ +} diff -Nru a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/process.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,356 @@ +/* + * linux/arch/m32r/kernel/process.c + * orig : sh + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + * Taken from sh version. + * Copyright (C) 1995 Linus Torvalds + * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima + */ + +#undef DEBUG_PROCESS +#ifdef DEBUG_PROCESS +#define DPRINTK(fmt, args...) printk("%s:%d:%s: " fmt, __FILE__, __LINE__, \ + __FUNCTION__, ##args) +#else +#define DPRINTK(fmt, args...) +#endif + +/* + * This file handles the architecture-dependent parts of process handling.. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +static int hlt_counter=0; + +/* + * Return saved PC of a blocked thread. + */ +unsigned long thread_saved_pc(struct task_struct *tsk) +{ + return tsk->thread.lr; +} + +/* + * Powermanagement idle function, if any.. + */ +void (*pm_idle)(void) = NULL; + +void disable_hlt(void) +{ + hlt_counter++; +} + +EXPORT_SYMBOL(disable_hlt); + +void enable_hlt(void) +{ + hlt_counter--; +} + +EXPORT_SYMBOL(enable_hlt); + +/* + * We use this is we don't have any better + * idle routine.. + */ +void default_idle(void) +{ + /* M32R_FIXME: Please use "cpu_sleep" mode. */ + cpu_relax(); +} + +/* + * On SMP it's slightly faster (but much more power-consuming!) + * to poll the ->work.need_resched flag instead of waiting for the + * cross-CPU IPI to arrive. Use this option with caution. + */ +static void poll_idle (void) +{ + /* M32R_FIXME */ + cpu_relax(); +} + +/* + * The idle thread. There's no useful work to be + * done, so just try to conserve power and have a + * low exit latency (ie sit in a loop waiting for + * somebody to say that they'd like to reschedule) + */ +void cpu_idle (void) +{ + /* endless idle loop with no priority at all */ + while (1) { + while (!need_resched()) { + void (*idle)(void) = pm_idle; + + if (!idle) + idle = default_idle; + + idle(); + } + schedule(); + } +} + +void machine_restart(char *__unused) +{ + printk("Please push reset button!\n"); + while (1) + cpu_relax(); +} + +EXPORT_SYMBOL(machine_restart); + +void machine_halt(void) +{ + printk("Please push reset button!\n"); + while (1) + cpu_relax(); +} + +EXPORT_SYMBOL(machine_halt); + +void machine_power_off(void) +{ + /* M32R_FIXME */ +} + +EXPORT_SYMBOL(machine_power_off); + +static int __init idle_setup (char *str) +{ + if (!strncmp(str, "poll", 4)) { + printk("using poll in idle threads.\n"); + pm_idle = poll_idle; + } else if (!strncmp(str, "sleep", 4)) { + printk("using sleep in idle threads.\n"); + pm_idle = default_idle; + } + + return 1; +} + +__setup("idle=", idle_setup); + +void show_regs(struct pt_regs * regs) +{ + printk("\n"); + printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ + regs->bpc, regs->psw, regs->lr, regs->fp); + printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ + regs->bbpc, regs->bbpsw, regs->spu, regs->spi); + printk("R0 [%08lx]:R1 [%08lx]:R2 [%08lx]:R3 [%08lx]\n", \ + regs->r0, regs->r1, regs->r2, regs->r3); + printk("R4 [%08lx]:R5 [%08lx]:R6 [%08lx]:R7 [%08lx]\n", \ + regs->r4, regs->r5, regs->r6, regs->r7); + printk("R8 [%08lx]:R9 [%08lx]:R10[%08lx]:R11[%08lx]\n", \ + regs->r8, regs->r9, regs->r10, regs->r11); + printk("R12[%08lx]\n", \ + regs->r12); + +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + printk("ACC0H[%08lx]:ACC0L[%08lx]\n", \ + regs->acc0h, regs->acc0l); + printk("ACC1H[%08lx]:ACC1L[%08lx]\n", \ + regs->acc1h, regs->acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + printk("ACCH[%08lx]:ACCL[%08lx]\n", \ + regs->acch, regs->accl); +#else +#error unknown isa configuration +#endif +} + +/* + * Create a kernel thread + */ + +/* + * This is the mechanism for creating a new kernel thread. + * + * NOTE! Only a kernel-only process(ie the swapper or direct descendants + * who haven't done an "execve()") should use this: it will work within + * a system call from a "real" process, but the process memory space will + * not be free'd until both the parent and the child have exited. + */ +static void kernel_thread_helper(void *nouse, int (*fn)(void *), void *arg) +{ + fn(arg); + do_exit(-1); +} + +int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +{ + struct pt_regs regs; + + memset(®s, 0, sizeof (regs)); + regs.r1 = (unsigned long)fn; + regs.r2 = (unsigned long)arg; + + regs.bpc = (unsigned long)kernel_thread_helper; + + regs.psw = M32R_PSW_BIE; + + /* Ok, create the new process. */ + return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, + NULL); +} + +/* + * Free current thread data structures etc.. + */ +void exit_thread(void) +{ + /* Nothing to do. */ + DPRINTK("pid = %d\n", current->pid); +} + +void flush_thread(void) +{ + DPRINTK("pid = %d\n", current->pid); + memset(¤t->thread.debug_trap, 0, sizeof(struct debug_trap)); +} + +void release_thread(struct task_struct *dead_task) +{ + /* do nothing */ + DPRINTK("pid = %d\n", dead_task->pid); +} + +/* Fill in the fpu structure for a core dump.. */ +int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) +{ + return 0; /* Task didn't use the fpu at all. */ +} + +int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, + unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) +{ + struct pt_regs *childregs; + unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE; + extern void ret_from_fork(void); + + tsk->set_child_tid = tsk->clear_child_tid = NULL; + + /* Copy registers */ + sp -= sizeof (struct pt_regs); + childregs = (struct pt_regs *)sp; + *childregs = *regs; + + childregs->spu = spu; + childregs->r0 = 0; /* Child gets zero as return value */ + regs->r0 = tsk->pid; + tsk->thread.sp = (unsigned long)childregs; + tsk->thread.lr = (unsigned long)ret_from_fork; + + return 0; +} + +/* + * fill in the user structure for a core dump.. + */ +void dump_thread(struct pt_regs * regs, struct user * dump) +{ + /* M32R_FIXME */ +} + +/* + * Capture the user space registers if the task is not running (in user space) + */ +int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) +{ + /* M32R_FIXME */ + return 1; +} + +asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ +#ifdef CONFIG_MMU + return do_fork(SIGCHLD, regs.spu, ®s, 0, NULL, NULL); +#else + return -EINVAL; +#endif /* CONFIG_MMU */ +} + +asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, + unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, struct pt_regs regs) +{ + if (!newsp) + newsp = regs.spu; + + return do_fork(clone_flags, newsp, ®s, 0, NULL, NULL); +} + +/* + * This is trivial, and on the face of it looks like it + * could equally well be done in user mode. + * + * Not so, for quite unobvious reasons - register pressure. + * In user mode vfork() cannot have a stack frame, and if + * done by calling the "clone()" system call directly, you + * do not have enough call-clobbered registers to hold all + * the information you need. + */ +asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.spu, ®s, 0, + NULL, NULL); +} + +/* + * sys_execve() executes a new program. + */ +asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, char __user * __user *uenvp, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ + int error; + char *filename; + + filename = getname(ufilename); + error = PTR_ERR(filename); + if (IS_ERR(filename)) + goto out; + + error = do_execve(filename, uargv, uenvp, ®s); + if (error == 0) + current->ptrace &= ~PT_DTRACE; + putname(filename); +out: + return error; +} + +/* + * These bracket the sleeping functions.. + */ +#define first_sched ((unsigned long) scheduling_functions_start_here) +#define last_sched ((unsigned long) scheduling_functions_end_here) + +unsigned long get_wchan(struct task_struct *p) +{ + /* M32R_FIXME */ + return (0); +} + diff -Nru a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/ptrace.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,828 @@ +/* + * linux/arch/sh/kernel/ptrace.c + * + * Copyright (C) 2002 Hirokazu Takata, Takeo Takahashi + * + * Original x86 implementation: + * By Ross Biro 1/23/92 + * edited by Linus Torvalds + * + * Some code taken from sh version: + * Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka + * + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_PTRACE 0 + +/* + * does not yet catch signals sent when the child dies. + * in exit.c or in signal.c. + */ + +/* + * This routine will get a word off of the process kernel stack. + */ +static __inline__ unsigned long int get_stack_long(struct task_struct *task, + int offset) +{ + + unsigned char *stack; + + stack = (unsigned char *)(task->thread_info) + THREAD_SIZE + - sizeof(struct pt_regs); + stack += offset; + + return *((unsigned long *)stack); +} + +/* + * This routine will put a word on the process kernel stack. + */ +static __inline__ int put_stack_long(struct task_struct *task, int offset, + unsigned long data) +{ + unsigned char *stack; + + stack = (unsigned char *)(task->thread_info) + THREAD_SIZE + - sizeof(struct pt_regs); + stack += offset; + *((unsigned long *)stack) = data; + + return 0; +} + +static int reg_offset[] = { + (4 * PT_R0), (4 * PT_R1), (4 * PT_R2), (4 * PT_R3), + (4 * PT_R4), (4 * PT_R5), (4 * PT_R6), (4 * PT_R7), + (4 * PT_R8), (4 * PT_R9), (4 * PT_R10), (4 * PT_R11), + (4 * PT_R12), (4 * PT_FP), (4 * PT_LR), (4 * PT_SPU), +}; + +static __inline__ int +check_condition_bit(struct task_struct *child) +{ + return (int)((get_stack_long(child, (4 * PT_PSW)) >> 8) & 1); +} + +static int +check_condition_src(unsigned long op, unsigned long regno1, unsigned long regno2, struct task_struct *child) +{ + unsigned long reg1, reg2; + + reg2 = get_stack_long(child, reg_offset[regno2]); + + switch (op) { + case 0x0: /* BEQ */ + reg1 = get_stack_long(child, reg_offset[regno1]); + return reg1 == reg2; + case 0x1: /* BNE */ + reg1 = get_stack_long(child, reg_offset[regno1]); + return reg1 != reg2; + case 0x8: /* BEQZ */ + return reg2 == 0; + case 0x9: /* BNEZ */ + return reg2 != 0; + case 0xa: /* BLTZ */ + return (int)reg2 < 0; + case 0xb: /* BGEZ */ + return (int)reg2 >= 0; + case 0xc: /* BLEZ */ + return (int)reg2 <= 0; + case 0xd: /* BGTZ */ + return (int)reg2 > 0; + default: + /* never reached */ + return 0; + } +} + +static void +compute_next_pc_for_16bit_insn(unsigned long insn, unsigned long pc, + unsigned long *next_pc, struct task_struct *child) +{ + unsigned long op, op2, op3; + unsigned long disp; + unsigned long regno; + int parallel = 0; + + if (insn & 0x00008000) + parallel = 1; + if (pc & 3) + insn &= 0x7fff; /* right slot */ + else + insn >>= 16; /* left slot */ + + op = (insn >> 12) & 0xf; + op2 = (insn >> 8) & 0xf; + op3 = (insn >> 4) & 0xf; + + if (op == 0x7) { + switch (op2) { + case 0xd: /* BNC */ + case 0x9: /* BNCL */ + if (!check_condition_bit(child)) { + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0x8: /* BCL */ + case 0xc: /* BC */ + if (check_condition_bit(child)) { + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0xe: /* BL */ + case 0xf: /* BRA */ + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + break; + } + } else if (op == 0x1) { + switch (op2) { + case 0x0: + if (op3 == 0xf) { /* TRAP */ +#if 1 + /* pass through */ +#else + /* kernel space is not allowed as next_pc */ + unsigned long evb; + unsigned long trapno; + trapno = insn & 0xf; + __asm__ __volatile__ ( + "mvfc %0, cr5\n" + :"=r"(evb) + : + ); + *next_pc = evb + (trapno << 2); + return; +#endif + } else if (op3 == 0xd) { /* RTE */ + *next_pc = get_stack_long(child, (4 * PT_BPC)); + return; + } + break; + case 0xc: /* JC */ + if (op3 == 0xc && check_condition_bit(child)) { + regno = insn & 0xf; + *next_pc = get_stack_long(child, reg_offset[regno]); + return; + } + break; + case 0xd: /* JNC */ + if (op3 == 0xc && !check_condition_bit(child)) { + regno = insn & 0xf; + *next_pc = get_stack_long(child, reg_offset[regno]); + return; + } + break; + case 0xe: /* JL */ + case 0xf: /* JMP */ + if (op3 == 0xc) { /* JMP */ + regno = insn & 0xf; + *next_pc = get_stack_long(child, reg_offset[regno]); + return; + } + break; + } + } + if (parallel) + *next_pc = pc + 4; + else + *next_pc = pc + 2; +} + +static void +compute_next_pc_for_32bit_insn(unsigned long insn, unsigned long pc, + unsigned long *next_pc, struct task_struct *child) +{ + unsigned long op; + unsigned long op2; + unsigned long disp; + unsigned long regno1, regno2; + + op = (insn >> 28) & 0xf; + if (op == 0xf) { /* branch 24-bit relative */ + op2 = (insn >> 24) & 0xf; + switch (op2) { + case 0xd: /* BNC */ + case 0x9: /* BNCL */ + if (!check_condition_bit(child)) { + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0x8: /* BCL */ + case 0xc: /* BC */ + if (check_condition_bit(child)) { + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0xe: /* BL */ + case 0xf: /* BRA */ + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + } else if (op == 0xb) { /* branch 16-bit relative */ + op2 = (insn >> 20) & 0xf; + switch (op2) { + case 0x0: /* BEQ */ + case 0x1: /* BNE */ + case 0x8: /* BEQZ */ + case 0x9: /* BNEZ */ + case 0xa: /* BLTZ */ + case 0xb: /* BGEZ */ + case 0xc: /* BLEZ */ + case 0xd: /* BGTZ */ + regno1 = ((insn >> 24) & 0xf); + regno2 = ((insn >> 16) & 0xf); + if (check_condition_src(op2, regno1, regno2, child)) { + disp = (long)(insn << 16) >> 14; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + } + } + *next_pc = pc + 4; +} + +static __inline__ void +compute_next_pc(unsigned long insn, unsigned long pc, + unsigned long *next_pc, struct task_struct *child) +{ + if (insn & 0x80000000) + compute_next_pc_for_32bit_insn(insn, pc, next_pc, child); + else + compute_next_pc_for_16bit_insn(insn, pc, next_pc, child); +} + +static int +register_debug_trap(struct task_struct *child, unsigned long next_pc, + unsigned long next_insn, unsigned long *code) +{ + struct debug_trap *p = &child->thread.debug_trap; + unsigned long addr = next_pc & ~3; + + if (p->nr_trap != 0) { + printk("kernel BUG at %s %d: p->nr_trap = %d\n", + __FILE__, __LINE__, p->nr_trap); + return -1; + } + p->addr = addr; + p->insn = next_insn; + p->nr_trap++; + if (next_pc & 3) { + *code = (next_insn & 0xffff0000) | 0x10f1; + /* xxx --> TRAP1 */ + } else { + if ((next_insn & 0x80000000) || (next_insn & 0x8000)) { + *code = 0x10f17000; + /* TRAP1 --> NOP */ + } else { + *code = (next_insn & 0xffff) | 0x10f10000; + /* TRAP1 --> xxx */ + } + } + return 0; +} + +int withdraw_debug_trap_for_signal(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + int nr_trap = p->nr_trap; + + if (nr_trap) { + access_process_vm(child, p->addr, &p->insn, sizeof(p->insn), 1); + p->nr_trap = 0; + p->addr = 0; + p->insn = 0; + } + return nr_trap; +} + +static int +unregister_debug_trap(struct task_struct *child, unsigned long addr, unsigned long *code) +{ + struct debug_trap *p = &child->thread.debug_trap; + + if (p->nr_trap != 1 || p->addr != addr) { + /* The trap may be requested from debugger. + * ptrace should do nothing in this case. + */ + return 0; + } + *code = p->insn; + p->insn = 0; + p->addr = 0; + p->nr_trap--; + return 1; +} + +static void +unregister_all_debug_traps(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + + if (p->nr_trap) { + access_process_vm(child, p->addr, &p->insn, sizeof(p->insn), 1); + p->addr = 0; + p->insn = 0; + p->nr_trap = 0; + } +} + +static void +invalidate_cache(void) +{ +#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) + + _flush_cache_copyback_all(); + +#else /* ! CONFIG_CHIP_M32700 */ + + /* Invalidate cache */ + __asm__ __volatile__ ( + "ldi r0, #-1 \n\t" + "ldi r1, #0 \n\t" + "stb r1, @r0 ; cache off \n\t" + "; \n\t" + "ldi r0, #-2 \n\t" + "ldi r1, #1 \n\t" + "stb r1, @r0 ; cache invalidate \n\t" + ".fillinsn \n" + "0: \n\t" + "ldb r1, @r0 ; invalidate check \n\t" + "bnez r1, 0b \n\t" + "; \n\t" + "ldi r0, #-1 \n\t" + "ldi r1, #1 \n\t" + "stb r1, @r0 ; cache on \n\t" + : : : "r0", "r1", "memory" + ); + /* FIXME: copying-back d-cache and invalidating i-cache are needed. + */ +#endif /* CONFIG_CHIP_M32700 */ +} + +/* Embed a debug trap (TRAP1) code */ +static int +embed_debug_trap(struct task_struct *child, unsigned long next_pc) +{ + unsigned long next_insn, code; + unsigned long addr = next_pc & ~3; + + if (access_process_vm(child, addr, &next_insn, sizeof(next_insn), 0) + != sizeof(next_insn)) { + return -1; /* error */ + } + + /* Set a trap code. */ + if (register_debug_trap(child, next_pc, next_insn, &code)) { + return -1; /* error */ + } + if (access_process_vm(child, addr, &code, sizeof(code), 1) + != sizeof(code)) { + return -1; /* error */ + } + return 0; /* success */ +} + +void +embed_debug_trap_for_signal(struct task_struct *child) +{ + unsigned long next_pc; + unsigned long pc, insn; + int ret; + + pc = get_stack_long(child, (4 * PT_BPC)); + ret = access_process_vm(child, pc&~3, &insn, sizeof(insn), 0); + if (ret != sizeof(insn)) { + printk("kernel BUG at %s %d: access_process_vm returns %d\n", + __FILE__, __LINE__, ret); + return; + } + compute_next_pc(insn, pc, &next_pc, child); + if (next_pc & 0x80000000) { + printk("kernel BUG at %s %d: next_pc = 0x%08x\n", + __FILE__, __LINE__, (int)next_pc); + return; + } + if (embed_debug_trap(child, next_pc)) { + printk("kernel BUG at %s %d: embed_debug_trap error\n", + __FILE__, __LINE__); + return; + } + invalidate_cache(); +} + +void +withdraw_debug_trap(struct pt_regs *regs) +{ + unsigned long addr; + unsigned long code; + + addr = (regs->bpc - 2) & ~3; + regs->bpc -= 2; + if (unregister_debug_trap(current, addr, &code)) { + access_process_vm(current, addr, &code, sizeof(code), 1); + invalidate_cache(); + } +} + + +/* + * Called by kernel/ptrace.c when detaching.. + * + * Make sure single step bits etc are not set. + */ +void ptrace_disable(struct task_struct *child) +{ + /* nothing to do.. */ +} + +static void +init_debug_traps(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + p->nr_trap = 0; + p->addr = 0; + p->insn = 0; +} + +asmlinkage int sys_ptrace(long request, long pid, long addr, long data) +{ + struct task_struct *child; + int ret; +#ifndef NO_FPU + struct user * dummy = NULL; +#endif + + lock_kernel(); + ret = -EPERM; + if (request == PTRACE_TRACEME) { + /* are we already being traced? */ + if (current->ptrace & PT_PTRACED) + goto out; + /* set the ptrace bit in the process flags. */ + current->ptrace |= PT_PTRACED; + ret = 0; + goto out; + } + ret = -ESRCH; + read_lock(&tasklist_lock); + child = find_task_by_pid(pid); + if (child) + get_task_struct(child); + read_unlock(&tasklist_lock); + if (!child) + goto out; + + ret = -EPERM; + if (pid == 1) /* you may not mess with init */ + goto out; + + if (request == PTRACE_ATTACH) { +#if (DEBUG_PTRACE > 1) +printk("ptrace: PTRACE_ATTACH: child:%08lx\n", (unsigned long)child); +#endif + ret = ptrace_attach(child); + if (ret == 0) + init_debug_traps(child); + goto out_tsk; + } + + ret = ptrace_check_attach(child, request == PTRACE_KILL); + if (ret < 0) + goto out_tsk; + + switch (request) { + /* when I and D space are separate, these will need to be fixed. */ + case PTRACE_PEEKTEXT: /* read word at location addr. */ + case PTRACE_PEEKDATA: { + unsigned long tmp; + int copied; + +#if (DEBUG_PTRACE > 1) +printk("ptrace: PTRACE_PEEKTEXT/PEEKDATA: child:%08lx, addr:%08lx\n", + (unsigned long)child, addr); +#endif + copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); + ret = -EIO; + if (copied != sizeof(tmp)) + break; + ret = put_user(tmp,(unsigned long __user *) data); + break; + } + + /* read the word at location addr in the USER area. */ + case PTRACE_PEEKUSR: { + unsigned long tmp; + +#if DEBUG_PTRACE +printk("ptrace: PTRACE_PEEKUSER: child:%08lx, addr:%08lx\n", + (unsigned long)child, addr); +#endif + ret = -EIO; + if ((addr & 3) || addr < 0 || + addr > sizeof(struct user) - 3) + break; + + switch (addr) { + case (4 * PT_BPC): + addr = (4 * PT_BBPC); + break; + case (4 * PT_EVB): + __asm__ __volatile__ ( + "mvfc %0, cr5\n" + :"=r"(tmp) + : + ); + ret = put_user(tmp, (unsigned long __user *)data); + goto out_tsk; + break; + case (4 * PT_CBR): { + unsigned long psw; + psw = get_stack_long(child, (4 * PT_PSW)); + tmp = ((psw >> 8) & 1); + ret = put_user(tmp, (unsigned long __user *)data); + goto out_tsk; + } + break; + case (4 * PT_PSW): { + unsigned long psw, bbpsw; + psw = get_stack_long(child, (4 * PT_PSW)); + bbpsw = get_stack_long(child, (4 * PT_BBPSW)); + tmp = ((psw >> 8) & 0xff) | ((bbpsw & 0xff) << 8); + ret = put_user(tmp, (unsigned long __user *)data); + goto out_tsk; + } + break; + case (4 * PT_PC): { + unsigned long pc; + pc = get_stack_long(child, (4 * PT_BPC)); + ret = put_user(pc, (unsigned long __user *)data); + goto out_tsk; + } + break; + } + + if (addr < sizeof(struct pt_regs)) + tmp = get_stack_long(child, addr); +#ifndef NO_FPU + else if (addr >= (long) &dummy->fpu && + addr < (long) &dummy->u_fpvalid) { + if (!child->used_math) { + if (addr == (long)&dummy->fpu.fpscr) + tmp = FPSCR_INIT; + else + tmp = 0; + } else + tmp = ((long *)&child->thread.fpu) + [(addr - (long)&dummy->fpu) >> 2]; + } else if (addr == (long) &dummy->u_fpvalid) + tmp = child->used_math; +#endif /* not NO_FPU */ + else + tmp = 0; + ret = put_user(tmp, (unsigned long __user *)data); + break; + } + + /* when I and D space are separate, this will have to be fixed. */ + case PTRACE_POKETEXT: /* write the word at location addr. */ + case PTRACE_POKEDATA: +#if DEBUG_PTRACE +printk("ptrace: PTRACE_POKETEXT/POKEDATA: child:%08lx, addr:%08lx, data:%08lx\n", + (unsigned long)child, addr, data); +#endif + ret = -EIO; + if (access_process_vm(child, addr, &data, sizeof(data), 1) + != sizeof(data)) { + break; + } + ret = 0; + if (request == PTRACE_POKETEXT) { + invalidate_cache(); + } + break; + + case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ +#if DEBUG_PTRACE +printk("ptrace: PTRACE_POKEUSR: child:%08lx, addr:%08lx, data:%08lx\n", + (unsigned long)child, addr, data); +#endif + ret = -EIO; + if ((addr & 3) || addr < 0 || + addr > sizeof(struct user) - 3) + break; + + switch (addr) { + case (4 * PT_EVB): + case (4 * PT_BPC): + case (4 * PT_SPI): + /* We don't allow to modify evb. */ + ret = 0; + goto out_tsk; + break; + case (4 * PT_PSW): + case (4 * PT_CBR): { + /* We allow to modify only cbr in psw */ + unsigned long psw; + psw = get_stack_long(child, (4 * PT_PSW)); + psw = (psw & ~0x100) | ((data & 1) << 8); + ret = put_stack_long(child, (4 * PT_PSW), psw); + goto out_tsk; + } + break; + case (4 * PT_PC): + addr = (4 * PT_BPC); + data &= ~1; + break; + } + + if (addr < sizeof(struct pt_regs)) + ret = put_stack_long(child, addr, data); +#ifndef NO_FPU + else if (addr >= (long) &dummy->fpu && + addr < (long) &dummy->u_fpvalid) { + child->used_math = 1; + ((long *)&child->thread.fpu) + [(addr - (long)&dummy->fpu) >> 2] = data; + ret = 0; + } else if (addr == (long) &dummy->u_fpvalid) { + child->used_math = data?1:0; + ret = 0; + } +#endif /* not NO_FPU */ + break; + + case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ + case PTRACE_CONT: { /* restart after signal. */ +#if DEBUG_PTRACE +printk("ptrace: PTRACE_SYSCALL/CONT: child:%08lx, data:%08lx\n", + (unsigned long)child, data); +#endif + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + if (request == PTRACE_SYSCALL) + set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + else + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + child->exit_code = data; + wake_up_process(child); + ret = 0; + break; + } + +/* + * make the child exit. Best I can do is send it a sigkill. + * perhaps it should be put in the status that it wants to + * exit. + */ + case PTRACE_KILL: { +#if DEBUG_PTRACE +printk("ptrace: PTRACE_KILL: child:%08lx\n", (unsigned long)child); +#endif + ret = 0; + unregister_all_debug_traps(child); + invalidate_cache(); + if (child->state == TASK_ZOMBIE) /* already dead */ + break; + child->exit_code = SIGKILL; + wake_up_process(child); + break; + } + + case PTRACE_SINGLESTEP: { /* set the trap flag. */ + unsigned long next_pc; + unsigned long pc, insn; + + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + if ((child->ptrace & PT_DTRACE) == 0) { + /* Spurious delayed TF traps may occur */ + child->ptrace |= PT_DTRACE; + } + + /* Compute next pc. */ + pc = get_stack_long(child, (4 * PT_BPC)); + +#if DEBUG_PTRACE +printk("ptrace: PTRACE_SINGLESTEP: child:%08lx, pc:%08lx, ", + (unsigned long)child, pc); +#endif + if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) != sizeof(insn)) + break; + +#if DEBUG_PTRACE +printk("(pc&~3):%08lx, insn:%08lx, ", (pc & ~3), insn); +#endif + + compute_next_pc(insn, pc, &next_pc, child); +#if DEBUG_PTRACE +printk("nextpc:%08lx\n", next_pc); +#endif + if (next_pc & 0x80000000) + break; + + if (embed_debug_trap(child, next_pc)) + break; + + invalidate_cache(); + child->exit_code = data; + /* give it a chance to run. */ + wake_up_process(child); + ret = 0; + break; + } + + case PTRACE_DETACH: /* detach a process that was attached. */ +#if DEBUG_PTRACE +printk("ptrace: PTRACE_DETACH: child:%08lx, data:%08lx\n", + (unsigned long)child, data); +#endif + ret = 0; + ret = ptrace_detach(child, data); + break; + + case PTRACE_SETOPTIONS: { +#if DEBUG_PTRACE +printk("ptrace: PTRACE_SETOPTIONS:\n"); +#endif + if (data & PTRACE_O_TRACESYSGOOD) + child->ptrace |= PT_TRACESYSGOOD; + else + child->ptrace &= ~PT_TRACESYSGOOD; + ret = 0; + break; + } + + default: + ret = -EIO; + break; + } +out_tsk: + put_task_struct(child); +out: + unlock_kernel(); + + return ret; +} + +/* notification of system call entry/exit + * - triggered by current->work.syscall_trace + */ +void do_syscall_trace(void) +{ + if (!test_thread_flag(TIF_SYSCALL_TRACE)) + return; + if (!(current->ptrace & PT_PTRACED)) + return; + /* the 0x80 provides a way for the tracing parent to distinguish + between a syscall stop and SIGTRAP delivery */ + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) + ? 0x80 : 0)); + + /* + * this isn't the same as continuing with a signal, but it will do + * for normal use. strace only continues with a signal if the + * stopping signal is not SIGTRAP. -brl + */ + if (current->exit_code) { + send_sig(current->exit_code, current, 1); + current->exit_code = 0; + } +} + diff -Nru a/arch/m32r/kernel/semaphore.c b/arch/m32r/kernel/semaphore.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/semaphore.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,186 @@ +/* + * linux/arch/m32r/semaphore.c + * orig : i386 2.6.4 + * + * M32R semaphore implementation. + * + * Copyright (c) 2002 - 2004 Hitoshi Yamamoto + */ + +/* + * i386 semaphore implementation. + * + * (C) Copyright 1999 Linus Torvalds + * + * Portions Copyright 1999 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * rw semaphores implemented November 1999 by Benjamin LaHaise + */ +#include +#include +#include +#include +#include + +/* + * Semaphores are implemented using a two-way counter: + * The "count" variable is decremented for each process + * that tries to acquire the semaphore, while the "sleeping" + * variable is a count of such acquires. + * + * Notably, the inline "up()" and "down()" functions can + * efficiently test if they need to do any extra work (up + * needs to do something only if count was negative before + * the increment operation. + * + * "sleeping" and the contention routine ordering is protected + * by the spinlock in the semaphore's waitqueue head. + * + * Note that these functions are only called when there is + * contention on the lock, and as such all this is the + * "non-critical" part of the whole semaphore business. The + * critical part is the inline stuff in + * where we want to avoid any extra jumps and calls. + */ + +/* + * Logic: + * - only on a boundary condition do we need to care. When we go + * from a negative count to a non-negative, we wake people up. + * - when we go from a non-negative count to a negative do we + * (a) synchronize with the "sleeper" count and (b) make sure + * that we're on the wakeup list before we synchronize so that + * we cannot lose wakeup events. + */ + +asmlinkage void __up(struct semaphore *sem) +{ + wake_up(&sem->wait); +} + +asmlinkage void __sched __down(struct semaphore * sem) +{ + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + unsigned long flags; + + tsk->state = TASK_UNINTERRUPTIBLE; + spin_lock_irqsave(&sem->wait.lock, flags); + add_wait_queue_exclusive_locked(&sem->wait, &wait); + + sem->sleepers++; + for (;;) { + int sleepers = sem->sleepers; + + /* + * Add "everybody else" into it. They aren't + * playing, because we own the spinlock in + * the wait_queue_head. + */ + if (!atomic_add_negative(sleepers - 1, &sem->count)) { + sem->sleepers = 0; + break; + } + sem->sleepers = 1; /* us - see -1 above */ + spin_unlock_irqrestore(&sem->wait.lock, flags); + + schedule(); + + spin_lock_irqsave(&sem->wait.lock, flags); + tsk->state = TASK_UNINTERRUPTIBLE; + } + remove_wait_queue_locked(&sem->wait, &wait); + wake_up_locked(&sem->wait); + spin_unlock_irqrestore(&sem->wait.lock, flags); + tsk->state = TASK_RUNNING; +} + +asmlinkage int __sched __down_interruptible(struct semaphore * sem) +{ + int retval = 0; + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + unsigned long flags; + + tsk->state = TASK_INTERRUPTIBLE; + spin_lock_irqsave(&sem->wait.lock, flags); + add_wait_queue_exclusive_locked(&sem->wait, &wait); + + sem->sleepers++; + for (;;) { + int sleepers = sem->sleepers; + + /* + * With signals pending, this turns into + * the trylock failure case - we won't be + * sleeping, and we* can't get the lock as + * it has contention. Just correct the count + * and exit. + */ + if (signal_pending(current)) { + retval = -EINTR; + sem->sleepers = 0; + atomic_add(sleepers, &sem->count); + break; + } + + /* + * Add "everybody else" into it. They aren't + * playing, because we own the spinlock in + * wait_queue_head. The "-1" is because we're + * still hoping to get the semaphore. + */ + if (!atomic_add_negative(sleepers - 1, &sem->count)) { + sem->sleepers = 0; + break; + } + sem->sleepers = 1; /* us - see -1 above */ + spin_unlock_irqrestore(&sem->wait.lock, flags); + + schedule(); + + spin_lock_irqsave(&sem->wait.lock, flags); + tsk->state = TASK_INTERRUPTIBLE; + } + remove_wait_queue_locked(&sem->wait, &wait); + wake_up_locked(&sem->wait); + spin_unlock_irqrestore(&sem->wait.lock, flags); + + tsk->state = TASK_RUNNING; + return retval; +} + +/* + * Trylock failed - make sure we correct for + * having decremented the count. + * + * We could have done the trylock with a + * single "cmpxchg" without failure cases, + * but then it wouldn't work on a 386. + */ +asmlinkage int __down_trylock(struct semaphore * sem) +{ + int sleepers; + unsigned long flags; + + spin_lock_irqsave(&sem->wait.lock, flags); + sleepers = sem->sleepers + 1; + sem->sleepers = 0; + + /* + * Add "everybody else" and us into it. They aren't + * playing, because we own the spinlock in the + * wait_queue_head. + */ + if (!atomic_add_negative(sleepers, &sem->count)) { + wake_up_locked(&sem->wait); + } + + spin_unlock_irqrestore(&sem->wait.lock, flags); + return 1; +} diff -Nru a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,403 @@ +/* + * linux/arch/m32r/kernel/setup.c + * + * Setup routines for MITSUBISHI M32R + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_MMU +extern void init_mmu(void); +#endif + +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) \ + || defined(CONFIG_BLK_DEV_IDE_MODULE) \ + || defined(CONFIG_BLK_DEV_HD_MODULE) +struct drive_info_struct { char dummy[32]; } drive_info; +#endif + +extern char _end[]; + +/* + * Machine setup.. + */ +struct cpuinfo_m32r boot_cpu_data; + +#ifdef CONFIG_BLK_DEV_RAM +extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ +extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ +extern int rd_image_start; /* starting block # of image */ +#endif + +#if defined(CONFIG_VGA_CONSOLE) +struct screen_info screen_info = { + .orig_video_lines = 25, + .orig_video_cols = 80, + .orig_video_mode = 0, + .orig_video_ega_bx = 0, + .orig_video_isVGA = 1, + .orig_video_points = 8 +}; +#endif + +extern int root_mountflags; + +static char command_line[COMMAND_LINE_SIZE]; + +static struct resource data_resource = { + .name = "Kernel data", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource code_resource = { + .name = "Kernel code", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +unsigned long memory_start; +unsigned long memory_end; + +void __init setup_arch(char **); +int get_cpuinfo(char *); + +static __inline__ void parse_mem_cmdline(char ** cmdline_p) +{ + char c = ' '; + char *to = command_line; + char *from = COMMAND_LINE; + int len = 0; + int usermem = 0; + + /* Save unparsed command line copy for /proc/cmdline */ + memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); + saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; + + memory_start = (unsigned long)CONFIG_MEMORY_START+PAGE_OFFSET; + memory_end = memory_start+(unsigned long)CONFIG_MEMORY_SIZE; + + for ( ; ; ) { + if (c == ' ' && !memcmp(from, "mem=", 4)) { + if (to != command_line) + to--; + + { + unsigned long mem_size; + + usermem = 1; + mem_size = memparse(from+4, &from); + memory_end = memory_start + mem_size; + } + } + c = *(from++); + if (!c) + break; + + if (COMMAND_LINE_SIZE <= ++len) + break; + + *(to++) = c; + } + *to = '\0'; + *cmdline_p = command_line; + if (usermem) + printk(KERN_INFO "user-defined physical RAM map:\n"); +} + +#ifndef CONFIG_DISCONTIGMEM +static unsigned long __init setup_memory(void) +{ + unsigned long start_pfn, max_low_pfn, bootmap_size; + + start_pfn = PFN_UP( __pa(_end) ); + max_low_pfn = PFN_DOWN( __pa(memory_end) ); + + /* + * Initialize the boot-time allocator (with low memory only): + */ + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, + CONFIG_MEMORY_START>>PAGE_SHIFT, max_low_pfn); + + /* + * Register fully available low RAM pages with the bootmem allocator. + */ + { + unsigned long curr_pfn; + unsigned long last_pfn; + unsigned long pages; + + /* + * We are rounding up the start address of usable memory: + */ + curr_pfn = PFN_UP(__pa(memory_start)); + + /* + * ... and at the end of the usable range downwards: + */ + last_pfn = PFN_DOWN(__pa(memory_end)); + + if (last_pfn > max_low_pfn) + last_pfn = max_low_pfn; + + pages = last_pfn - curr_pfn; + free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages)); + } + + /* + * Reserve the kernel text and + * Reserve the bootmem bitmap. We do this in two steps (first step + * was init_bootmem()), because this catches the (definitely buggy) + * case of us accidentally initializing the bootmem allocator with + * an invalid RAM area. + */ + reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE, + (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1) + - CONFIG_MEMORY_START); + + /* + * reserve physical page 0 - it's a special BIOS page on many boxes, + * enabling clean reboots, SMP operation, laptop functions. + */ + reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE); + + /* + * reserve memory hole + */ +#ifdef CONFIG_MEMHOLE + reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE); +#endif + +#ifdef CONFIG_BLK_DEV_INITRD + if (LOADER_TYPE && INITRD_START) { + if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { + reserve_bootmem(INITRD_START, INITRD_SIZE); + initrd_start = INITRD_START ? + INITRD_START + PAGE_OFFSET : 0; + + initrd_end = initrd_start + INITRD_SIZE; + printk("initrd:start[%08lx],size[%08lx]\n", + initrd_start, INITRD_SIZE); + } else { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + INITRD_START + INITRD_SIZE, + max_low_pfn << PAGE_SHIFT); + + initrd_start = 0; + } + } +#endif + + return max_low_pfn; +} +#else /* CONFIG_DISCONTIGMEM */ +extern unsigned long setup_memory(void); +#endif /* CONFIG_DISCONTIGMEM */ + +#define M32R_PCC_PCATCR 0x00ef7014 /* will move to m32r.h */ + +void __init setup_arch(char **cmdline_p) +{ + ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); + + boot_cpu_data.cpu_clock = M32R_CPUCLK; + boot_cpu_data.bus_clock = M32R_BUSCLK; + boot_cpu_data.timer_divide = M32R_TIMER_DIVIDE; + +#ifdef CONFIG_BLK_DEV_RAM + rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; + rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); + rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); +#endif + + if (!MOUNT_ROOT_RDONLY) + root_mountflags &= ~MS_RDONLY; + +#ifdef CONFIG_VT +#if defined(CONFIG_VGA_CONSOLE) + conswitchp = &vga_con; +#elif defined(CONFIG_DUMMY_CONSOLE) + conswitchp = &dummy_con; +#endif +#endif + +#ifdef CONFIG_DISCONTIGMEM + numnodes = 2; +#endif /* CONFIG_DISCONTIGMEM */ + + init_mm.start_code = (unsigned long) _text; + init_mm.end_code = (unsigned long) _etext; + init_mm.end_data = (unsigned long) _edata; + init_mm.brk = (unsigned long) _end; + + code_resource.start = virt_to_phys(_text); + code_resource.end = virt_to_phys(_etext)-1; + data_resource.start = virt_to_phys(_etext); + data_resource.end = virt_to_phys(_edata)-1; + + parse_mem_cmdline(cmdline_p); + + setup_memory(); + + paging_init(); +} + +#ifdef CONFIG_PROC_FS +/* + * Get CPU information for use by the procfs. + */ +static int show_cpuinfo(struct seq_file *m, void *v) +{ + struct cpuinfo_m32r *c = v; + unsigned long cpu = c - cpu_data; + +#ifdef CONFIG_SMP + if (!cpu_online(cpu)) + return 0; +#endif /* CONFIG_SMP */ + + seq_printf(m, "processor\t: %ld\n", cpu); + +#ifdef CONFIG_CHIP_VDEC2 + seq_printf(m, "cpu family\t: VDEC2\n" + "cache size\t: Unknown\n"); +#elif CONFIG_CHIP_M32700 + seq_printf(m,"cpu family\t: M32700\n" + "cache size\t: I-8KB/D-8KB\n"); +#elif CONFIG_CHIP_M32102 + seq_printf(m,"cpu family\t: M32102\n" + "cache size\t: I-8KB\n"); +#elif CONFIG_CHIP_OPSP + seq_printf(m,"cpu family\t: OPSP\n" + "cache size\t: I-8KB/D-8KB\n"); +#elif CONFIG_CHIP_MP + seq_printf(m, "cpu family\t: M32R-MP\n" + "cache size\t: I-xxKB/D-xxKB\n"); +#else + seq_printf(m, "cpu family\t: Unknown\n"); +#endif + seq_printf(m, "bogomips\t: %lu.%02lu\n", + c->loops_per_jiffy/(500000/HZ), + (c->loops_per_jiffy/(5000/HZ)) % 100); +#ifdef CONFIG_PLAT_MAPPI + seq_printf(m, "Machine\t\t: Mappi Evaluation board\n"); +#elif CONFIG_PLAT_MAPPI2 + seq_printf(m, "Machine\t\t: Mappi-II Evaluation board\n"); +#elif CONFIG_PLAT_M32700UT + seq_printf(m, "Machine\t\t: M32700UT Evaluation board\n"); +#elif CONFIG_PLAT_OPSPUT + seq_printf(m, "Machine\t\t: OPSPUT Evaluation board\n"); +#elif CONFIG_PLAT_USRV + seq_printf(m, "Machine\t\t: uServer\n"); +#elif CONFIG_PLAT_OAKS32R + seq_printf(m, "Machine\t\t: OAKS32R\n"); +#else + seq_printf(m, "Machine\t\t: Unknown\n"); +#endif + +#define PRINT_CLOCK(name, value) \ + seq_printf(m, name " clock\t: %d.%02dMHz\n", \ + ((value) / 1000000), ((value) % 1000000)/10000) + + PRINT_CLOCK("CPU", (int)c->cpu_clock); + PRINT_CLOCK("Bus", (int)c->bus_clock); + + seq_printf(m, "\n"); + + return 0; +} + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + return *pos < NR_CPUS ? cpu_data + *pos : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return c_start(m, pos); +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +struct seq_operations cpuinfo_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_cpuinfo, +}; +#endif /* CONFIG_PROC_FS */ + +unsigned long cpu_initialized __initdata = 0; + +/* + * cpu_init() initializes state that is per-CPU. Some data is already + * initialized (naturally) in the bootstrap process. + * We reload them nevertheless, this function acts as a + * 'CPU state barrier', nothing should get across. + */ +#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) +void __init cpu_init (void) +{ + int cpu_id = smp_processor_id(); + + if (test_and_set_bit(cpu_id, &cpu_initialized)) { + printk(KERN_WARNING "CPU#%d already initialized!\n", cpu_id); + for ( ; ; ) + local_irq_enable(); + } + printk(KERN_INFO "Initializing CPU#%d\n", cpu_id); + + /* Set up and load the per-CPU TSS and LDT */ + atomic_inc(&init_mm.mm_count); + current->active_mm = &init_mm; + if (current->mm) + BUG(); + + /* Force FPU initialization */ + current_thread_info()->status = 0; + current->used_math = 0; + +#ifdef CONFIG_MMU + /* Set up MMU */ + init_mmu(); +#endif + + /* Set up ICUIMASK */ + outl(0x00070000, M32R_ICU_IMASK_PORTL); /* imask=111 */ +} +#endif /* defined(CONFIG_CHIP_VDEC2) ... */ + diff -Nru a/arch/m32r/kernel/setup_m32700ut.c b/arch/m32r/kernel/setup_m32700ut.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_m32700ut.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,480 @@ +/* + * linux/arch/m32r/kernel/setup_m32700ut.c + * + * Setup routines for MITSUBISHI M32700UT Board + * + * Copyright (c) 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + * $Id: setup_m32700ut.c,v 1.6 2003/11/27 10:18:49 takeo Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * M32700 Interrupt Control Unit (Level 1) + */ +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +static icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; + +static void disable_m32700ut_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_m32700ut_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_m32700ut(unsigned int irq) +{ + disable_m32700ut_irq(irq); +} + +static void end_m32700ut_irq(unsigned int irq) +{ + enable_m32700ut_irq(irq); +} + +static unsigned int startup_m32700ut_irq(unsigned int irq) +{ + enable_m32700ut_irq(irq); + return (0); +} + +static void shutdown_m32700ut_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_irq_type = +{ + "M32700UT-IRQ", + startup_m32700ut_irq, + shutdown_m32700ut_irq, + enable_m32700ut_irq, + disable_m32700ut_irq, + mask_and_ack_m32700ut, + end_m32700ut_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT (Level 2) + */ +#define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ]; + +static void disable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// disable_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// enable_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_pld(unsigned int irq) +{ + disable_m32700ut_pld_irq(irq); +// mask_and_ack_m32700ut(M32R_IRQ_INT1); +} + +static void end_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// shutdown_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_pld_irq_type = +{ + "M32700UT-PLD-IRQ", + startup_m32700ut_pld_irq, + shutdown_m32700ut_pld_irq, + enable_m32700ut_pld_irq, + disable_m32700ut_pld_irq, + mask_and_ack_m32700ut_pld, + end_m32700ut_pld_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT-LAN (Level 2) + */ +#define irq2lanpldirq(x) ((x) - M32700UT_LAN_PLD_IRQ_BASE) +#define lanpldirq2port(x) (unsigned long)((int)M32700UT_LAN_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lanpld_icu_data[M32700UT_NUM_LAN_PLD_IRQ]; + +static void disable_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_lanpld(unsigned int irq) +{ + disable_m32700ut_lanpld_irq(irq); +} + +static void end_m32700ut_lanpld_irq(unsigned int irq) +{ + enable_m32700ut_lanpld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT0); +} + +static unsigned int startup_m32700ut_lanpld_irq(unsigned int irq) +{ + enable_m32700ut_lanpld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_lanpld_irq_type = +{ + "M32700UT-PLD-LAN-IRQ", + startup_m32700ut_lanpld_irq, + shutdown_m32700ut_lanpld_irq, + enable_m32700ut_lanpld_irq, + disable_m32700ut_lanpld_irq, + mask_and_ack_m32700ut_lanpld, + end_m32700ut_lanpld_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT-LCD (Level 2) + */ +#define irq2lcdpldirq(x) ((x) - M32700UT_LCD_PLD_IRQ_BASE) +#define lcdpldirq2port(x) (unsigned long)((int)M32700UT_LCD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lcdpld_icu_data[M32700UT_NUM_LCD_PLD_IRQ]; + +static void disable_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_lcdpld(unsigned int irq) +{ + disable_m32700ut_lcdpld_irq(irq); +} + +static void end_m32700ut_lcdpld_irq(unsigned int irq) +{ + enable_m32700ut_lcdpld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT2); +} + +static unsigned int startup_m32700ut_lcdpld_irq(unsigned int irq) +{ + enable_m32700ut_lcdpld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_lcdpld_irq_type = +{ + "M32700UT-PLD-LCD-IRQ", + startup_m32700ut_lcdpld_irq, + shutdown_m32700ut_lcdpld_irq, + enable_m32700ut_lcdpld_irq, + disable_m32700ut_lcdpld_irq, + mask_and_ack_m32700ut_lcdpld, + end_m32700ut_lcdpld_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/ + irq_desc[M32700UT_LAN_IRQ_LAN].status = IRQ_DISABLED; + irq_desc[M32700UT_LAN_IRQ_LAN].handler = &m32700ut_lanpld_irq_type; + irq_desc[M32700UT_LAN_IRQ_LAN].action = 0; + irq_desc[M32700UT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */ + lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ + disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_m32700ut_irq(M32R_IRQ_MFT2); + + /* SIO0 : receive */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO0_R); + + /* SIO0 : send */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO0_S); + + /* SIO1 : receive */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO1_R); + + /* SIO1 : send */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO1_S); + + /* DMA1 : */ + irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_DMA1].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_DMA1].action = 0; + irq_desc[M32R_IRQ_DMA1].depth = 1; + icu_data[M32R_IRQ_DMA1].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_DMA1); + +#ifdef CONFIG_SERIAL_M32R_PLDSIO + /* INT#1: SIO0 Receive on PLD */ + irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_RCV].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_RCV].action = 0; + irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV); + + /* INT#1: SIO0 Send on PLD */ + irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_SND].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_SND].action = 0; + irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND); +#endif /* CONFIG_SERIAL_M32R_PLDSIO */ + + /* INT#1: CFC IREQ on PLD */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ); + + /* INT#1: CFC Insert on PLD */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT); + + /* INT#1: CFC Eject on PLD */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT); + + /* + * INT0# is used for LAN, DIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_m32700ut_irq(M32R_IRQ_INT0); + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_m32700ut_irq(M32R_IRQ_INT1); + +#if defined(CONFIG_USB) + outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ + + irq_desc[M32700UT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].handler = &m32700ut_lcdpld_irq_type; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].action = 0; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].depth = 1; + lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ + disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1); +#endif + /* + * INT2# is used for BAT, USB, AUDIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + enable_m32700ut_irq(M32R_IRQ_INT2); + +//#if defined(CONFIG_M32R_AR_VGA) + /* + * INT3# is used for AR + */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_m32700ut_irq(M32R_IRQ_INT3); +//#endif /* CONFIG_M32R_ARV */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = M32700UT_LAN_IRQ_LAN, + .end = M32700UT_LAN_IRQ_LAN, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_mappi.c b/arch/m32r/kernel/setup_mappi.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_mappi.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,164 @@ +/* + * linux/arch/m32r/kernel/setup_mappi.c + * + * Setup routines for MITSUBISHI MAPPI Board + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_mappi_irq(irq); +} + +static void end_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); +} + +static unsigned int startup_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); + return (0); +} + +static void shutdown_mappi_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi_irq_type = +{ + "MAPPI-IRQ", + startup_mappi_irq, + shutdown_mappi_irq, + enable_mappi_irq, + disable_mappi_irq, + mask_and_ack_mappi, + end_mappi_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + + if (once) + return; + else + once++; + +#ifdef CONFIG_NE2000 + /* INT0 : LAN controller (RTL8019AS) */ + irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT0].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT0].action = 0; + irq_desc[M32R_IRQ_INT0].depth = 1; + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_mappi_irq(M32R_IRQ_INT0); +#endif /* CONFIG_M32R_NE2000 */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + +#if defined(CONFIG_M32RPCC) + /* INT1 : pccard0 interrupt */ + irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT1].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT1].action = 0; + irq_desc[M32R_IRQ_INT1].depth = 1; + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; + disable_mappi_irq(M32R_IRQ_INT1); + + /* INT2 : pccard1 interrupt */ + irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT2].action = 0; + irq_desc[M32R_IRQ_INT2].depth = 1; + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; + disable_mappi_irq(M32R_IRQ_INT2); +#endif /* CONFIG_M32RPCC */ +} diff -Nru a/arch/m32r/kernel/setup_mappi2.c b/arch/m32r/kernel/setup_mappi2.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_mappi2.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,216 @@ +/* + * linux/arch/m32r/kernel/setup_mappi.c + * + * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_mappi2_irq(unsigned int irq) +{ + unsigned long port, data; + + if ((irq == 0) ||(irq >= NR_IRQS)) { + printk("bad irq 0x%08x\n", irq); + return; + } + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi2_irq(unsigned int irq) +{ + unsigned long port, data; + + if ((irq == 0) ||(irq >= NR_IRQS)) { + printk("bad irq 0x%08x\n", irq); + return; + } + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi2(unsigned int irq) +{ + disable_mappi2_irq(irq); +} + +static void end_mappi2_irq(unsigned int irq) +{ + enable_mappi2_irq(irq); +} + +static unsigned int startup_mappi2_irq(unsigned int irq) +{ + enable_mappi2_irq(irq); + return (0); +} + +static void shutdown_mappi2_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi2_irq_type = +{ + "MAPPI2-IRQ", + startup_mappi2_irq, + shutdown_mappi2_irq, + enable_mappi2_irq, + disable_mappi2_irq, + mask_and_ack_mappi2, + end_mappi2_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT0 : LAN controller (SMC91111) */ + irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT0].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_INT0].action = 0; + irq_desc[M32R_IRQ_INT0].depth = 1; + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_mappi2_irq(M32R_IRQ_INT0); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi2_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO0_S); + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_M32R_USE_DBG_CONSOLE */ + +#if defined(CONFIG_USB) + /* INT1 : USB Host controller interrupt */ + irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT1].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_INT1].action = 0; + irq_desc[M32R_IRQ_INT1].depth = 1; + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01; + disable_mappi2_irq(M32R_IRQ_INT1); +#endif /* CONFIG_USB */ + +#if defined(CONFIG_M32R_CFC) + /* ICUCR40: CFC IREQ */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ +// icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; + icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + disable_mappi2_irq(PLD_IRQ_CFIREQ); + + /* ICUCR41: CFC Insert */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; +// icu_data[PLD_IRQ_CFC_INSERT].icucr = 0; + disable_mappi2_irq(PLD_IRQ_CFC_INSERT); + + /* ICUCR42: CFC Eject */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; +// icu_data[PLD_IRQ_CFC_EJECT].icucr = 0; + disable_mappi2_irq(PLD_IRQ_CFC_EJECT); + +#endif /* CONFIG_MAPPI2_CFC */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = M32R_IRQ_INT0, + .end = M32R_IRQ_INT0, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_oaks32r.c b/arch/m32r/kernel/setup_oaks32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_oaks32r.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,147 @@ +/* + * linux/arch/m32r/kernel/setup_oaks32r.c + * + * Setup routines for OAKS32R Board + * + * Copyright (c) 2002-2004 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +static char *rcsid = +"$Id: setup_oaks32r.c,v 1.1 2004/03/31 05:06:18 sakugawa Exp $"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_oaks32r_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_oaks32r_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_oaks32r_irq(irq); +} + +static void end_oaks32r_irq(unsigned int irq) +{ + enable_oaks32r_irq(irq); +} + +static unsigned int startup_oaks32r_irq(unsigned int irq) +{ + enable_oaks32r_irq(irq); + return (0); +} + +static void shutdown_oaks32r_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type oaks32r_irq_type = +{ + "OAKS32R-IRQ", + startup_oaks32r_irq, + shutdown_oaks32r_irq, + enable_oaks32r_irq, + disable_oaks32r_irq, + mask_and_ack_mappi, + end_oaks32r_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + + if (once) + return; + else + once++; + +#ifdef CONFIG_NE2000 + /* INT3 : LAN controller (RTL8019AS) */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_oaks32r_irq(M32R_IRQ_INT3); +#endif /* CONFIG_M32R_NE2000 */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_oaks32r_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + +} diff -Nru a/arch/m32r/kernel/setup_opsput.c b/arch/m32r/kernel/setup_opsput.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_opsput.c 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,484 @@ +/* + * linux/arch/m32r/kernel/setup_opsput.c + * + * Setup routines for Renesas OPSPUT Board + * + * Copyright (c) 2002-2004 + * Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + * $Id: setup_opsput.c,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * OPSP Interrupt Control Unit (Level 1) + */ +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +static icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ]; + +static void disable_opsput_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_opsput_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_opsput(unsigned int irq) +{ + disable_opsput_irq(irq); +} + +static void end_opsput_irq(unsigned int irq) +{ + enable_opsput_irq(irq); +} + +static unsigned int startup_opsput_irq(unsigned int irq) +{ + enable_opsput_irq(irq); + return (0); +} + +static void shutdown_opsput_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_irq_type = +{ + "OPSPUT-IRQ", + startup_opsput_irq, + shutdown_opsput_irq, + enable_opsput_irq, + disable_opsput_irq, + mask_and_ack_opsput, + end_opsput_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT (Level 2) + */ +#define irq2pldirq(x) ((x) - OPSPUT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[OPSPUT_NUM_PLD_IRQ]; + +static void disable_opsput_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// disable_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// enable_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_pld(unsigned int irq) +{ + disable_opsput_pld_irq(irq); +// mask_and_ack_opsput(M32R_IRQ_INT1); +} + +static void end_opsput_pld_irq(unsigned int irq) +{ + enable_opsput_pld_irq(irq); + end_opsput_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_opsput_pld_irq(unsigned int irq) +{ + enable_opsput_pld_irq(irq); + return (0); +} + +static void shutdown_opsput_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// shutdown_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_pld_irq_type = +{ + "OPSPUT-PLD-IRQ", + startup_opsput_pld_irq, + shutdown_opsput_pld_irq, + enable_opsput_pld_irq, + disable_opsput_pld_irq, + mask_and_ack_opsput_pld, + end_opsput_pld_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT-LAN (Level 2) + */ +#define irq2lanpldirq(x) ((x) - OPSPUT_LAN_PLD_IRQ_BASE) +#define lanpldirq2port(x) (unsigned long)((int)OPSPUT_LAN_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lanpld_icu_data[OPSPUT_NUM_LAN_PLD_IRQ]; + +static void disable_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_lanpld(unsigned int irq) +{ + disable_opsput_lanpld_irq(irq); +} + +static void end_opsput_lanpld_irq(unsigned int irq) +{ + enable_opsput_lanpld_irq(irq); + end_opsput_irq(M32R_IRQ_INT0); +} + +static unsigned int startup_opsput_lanpld_irq(unsigned int irq) +{ + enable_opsput_lanpld_irq(irq); + return (0); +} + +static void shutdown_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_lanpld_irq_type = +{ + "OPSPUT-PLD-LAN-IRQ", + startup_opsput_lanpld_irq, + shutdown_opsput_lanpld_irq, + enable_opsput_lanpld_irq, + disable_opsput_lanpld_irq, + mask_and_ack_opsput_lanpld, + end_opsput_lanpld_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT-LCD (Level 2) + */ +#define irq2lcdpldirq(x) ((x) - OPSPUT_LCD_PLD_IRQ_BASE) +#define lcdpldirq2port(x) (unsigned long)((int)OPSPUT_LCD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lcdpld_icu_data[OPSPUT_NUM_LCD_PLD_IRQ]; + +static void disable_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_lcdpld(unsigned int irq) +{ + disable_opsput_lcdpld_irq(irq); +} + +static void end_opsput_lcdpld_irq(unsigned int irq) +{ + enable_opsput_lcdpld_irq(irq); + end_opsput_irq(M32R_IRQ_INT2); +} + +static unsigned int startup_opsput_lcdpld_irq(unsigned int irq) +{ + enable_opsput_lcdpld_irq(irq); + return (0); +} + +static void shutdown_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_lcdpld_irq_type = +{ + "OPSPUT-PLD-LCD-IRQ", + startup_opsput_lcdpld_irq, + shutdown_opsput_lcdpld_irq, + enable_opsput_lcdpld_irq, + disable_opsput_lcdpld_irq, + mask_and_ack_opsput_lcdpld, + end_opsput_lcdpld_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/ + irq_desc[OPSPUT_LAN_IRQ_LAN].status = IRQ_DISABLED; + irq_desc[OPSPUT_LAN_IRQ_LAN].handler = &opsput_lanpld_irq_type; + irq_desc[OPSPUT_LAN_IRQ_LAN].action = 0; + irq_desc[OPSPUT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */ + lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ + disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_opsput_irq(M32R_IRQ_MFT2); + + /* SIO0 : receive */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO0_R); + + /* SIO0 : send */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO0_S); + + /* SIO1 : receive */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO1_R); + + /* SIO1 : send */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO1_S); + + /* DMA1 : */ + irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_DMA1].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_DMA1].action = 0; + irq_desc[M32R_IRQ_DMA1].depth = 1; + icu_data[M32R_IRQ_DMA1].icucr = 0; + disable_opsput_irq(M32R_IRQ_DMA1); + +#ifdef CONFIG_SERIAL_M32R_PLDSIO + /* INT#1: SIO0 Receive on PLD */ + irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_RCV].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_RCV].action = 0; + irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV); + + /* INT#1: SIO0 Send on PLD */ + irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_SND].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_SND].action = 0; + irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); +#endif /* CONFIG_SERIAL_M32R_PLDSIO */ + +#if defined(CONFIG_M32R_CFC) + /* INT#1: CFC IREQ on PLD */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_opsput_pld_irq(PLD_IRQ_CFIREQ); + + /* INT#1: CFC Insert on PLD */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ + disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT); + + /* INT#1: CFC Eject on PLD */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ + disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); +#endif /* CONFIG_M32R_CFC */ + + + /* + * INT0# is used for LAN, DIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_opsput_irq(M32R_IRQ_INT0); + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_opsput_irq(M32R_IRQ_INT1); + +#if defined(CONFIG_USB) + outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ + + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].handler = &opsput_lcdpld_irq_type; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].action = 0; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].depth = 1; + lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ + disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1); +#endif + /* + * INT2# is used for BAT, USB, AUDIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + enable_opsput_irq(M32R_IRQ_INT2); + +//#if defined(CONFIG_M32R_AR_VGA) + /* + * INT3# is used for AR + */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_opsput_irq(M32R_IRQ_INT3); +//#endif /* CONFIG_M32R_ARV */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = OPSPUT_LAN_IRQ_LAN, + .end = OPSPUT_LAN_IRQ_LAN, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_usrv.c b/arch/m32r/kernel/setup_usrv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_usrv.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,260 @@ +/* + * linux/arch/m32r/kernel/setup_usrv.c + * + * Setup routines for MITSUBISHI uServer + * + * Copyright (c) 2001, 2002, 2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#if !defined(CONFIG_SMP) +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; + +static void disable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_mappi_irq(irq); +} + +static void end_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); +} + +static unsigned int startup_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); + return 0; +} + +static void shutdown_mappi_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi_irq_type = +{ + "M32700-IRQ", + startup_mappi_irq, + shutdown_mappi_irq, + enable_mappi_irq, + disable_mappi_irq, + mask_and_ack_mappi, + end_mappi_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT (Level 2) + */ +#define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ]; + +static void disable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_pld(unsigned int irq) +{ + disable_m32700ut_pld_irq(irq); +} + +static void end_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + end_mappi_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + return 0; +} + +static void shutdown_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_pld_irq_type = +{ + "USRV-PLD-IRQ", + startup_m32700ut_pld_irq, + shutdown_m32700ut_pld_irq, + enable_m32700ut_pld_irq, + disable_m32700ut_pld_irq, + mask_and_ack_m32700ut_pld, + end_m32700ut_pld_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + int i; + + if (once) + return; + else + once++; + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi_irq(M32R_IRQ_MFT2); + +#if defined(CONFIG_SERIAL_M32R_SIO) + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + + /* INT#67-#71: CFC#0 IREQ on PLD */ + for (i = 0 ; i < CONFIG_CFC_NUM ; i++ ) { + irq_desc[PLD_IRQ_CF0 + i].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CF0 + i].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CF0 + i].action = 0; + irq_desc[PLD_IRQ_CF0 + i].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr + = PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i); + } + +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) + /* INT#76: 16552D#0 IREQ on PLD */ + irq_desc[PLD_IRQ_UART0].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_UART0].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_UART0].action = 0; + irq_desc[PLD_IRQ_UART0].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr + = PLD_ICUCR_ISMOD03; /* 'H' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_UART0); + + /* INT#77: 16552D#1 IREQ on PLD */ + irq_desc[PLD_IRQ_UART1].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_UART1].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_UART1].action = 0; + irq_desc[PLD_IRQ_UART1].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr + = PLD_ICUCR_ISMOD03; /* 'H' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_UART1); +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + +#if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE) + /* INT#80: AK4524 IREQ on PLD */ + irq_desc[PLD_IRQ_SNDINT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SNDINT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SNDINT].action = 0; + irq_desc[PLD_IRQ_SNDINT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr + = PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_SNDINT); +#endif /* CONFIG_IDC_AK4524 || CONFIG_IDC_AK4524_MODULE */ + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD11; + enable_mappi_irq(M32R_IRQ_INT1); +} + diff -Nru a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/signal.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,628 @@ +/* + * linux/arch/m32r/kernel/signal.c + * + * Copyright (c) 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * Copyright (C) 1991, 1992 Linus Torvalds + * + * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson + * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_SIG 0 + +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) + +int do_signal(struct pt_regs *, sigset_t *); + +/* + * Atomically swap in the new signal mask, and wait for a signal. + */ +asmlinkage int +sys_sigsuspend(old_sigset_t mask, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + sigset_t saveset; + + mask &= _BLOCKABLE; + spin_lock_irq(¤t->sighand->siglock); + saveset = current->blocked; + siginitset(¤t->blocked, mask); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs.r0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(®s, &saveset)) + return regs.r0; + } +} + +asmlinkage int +sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + sigset_t saveset, newset; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (copy_from_user(&newset, unewset, sizeof(newset))) + return -EFAULT; + sigdelsetmask(&newset, ~_BLOCKABLE); + + spin_lock_irq(¤t->sighand->siglock); + saveset = current->blocked; + current->blocked = newset; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs.r0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(®s, &saveset)) + return regs.r0; + } +} + +asmlinkage int +sys_sigaction(int sig, const struct old_sigaction __user *act, + struct old_sigaction __user *oact) +{ + struct k_sigaction new_ka, old_ka; + int ret; + + if (act) { + old_sigset_t mask; + if (verify_area(VERIFY_READ, act, sizeof(*act)) || + __get_user(new_ka.sa.sa_handler, &act->sa_handler) || + __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) + return -EFAULT; + __get_user(new_ka.sa.sa_flags, &act->sa_flags); + __get_user(mask, &act->sa_mask); + siginitset(&new_ka.sa.sa_mask, mask); + } + + ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); + + if (!ret && oact) { + if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || + __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || + __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) + return -EFAULT; + __put_user(old_ka.sa.sa_flags, &oact->sa_flags); + __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); + } + + return ret; +} + +asmlinkage int +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + return do_sigaltstack(uss, uoss, regs.spu); +} + + +/* + * Do a signal return; undo the signal stack. + */ + +struct sigframe +{ +// char *pretcode; + int sig; + struct sigcontext sc; +// struct _fpstate fpstate; + unsigned long extramask[_NSIG_WORDS-1]; + char retcode[4]; +}; + +struct rt_sigframe +{ +// char *pretcode; + int sig; + struct siginfo *pinfo; + void *puc; + struct siginfo info; + struct ucontext uc; +// struct _fpstate fpstate; + char retcode[8]; +}; + +static int +restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, + int *r0_p) +{ + unsigned int err = 0; + + /* Always make any pending restarted system calls return -EINTR */ + current_thread_info()->restart_block.fn = do_no_restart_syscall; + +#define COPY(x) err |= __get_user(regs->x, &sc->sc_##x) + COPY(r4); + COPY(r5); + COPY(r6); + COPY(pt_regs); + /* COPY(r0); Skip r0 */ + COPY(r1); + COPY(r2); + COPY(r3); + COPY(r7); + COPY(r8); + COPY(r9); + COPY(r10); + COPY(r11); + COPY(r12); +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + COPY(acc0h); + COPY(acc0l); + COPY(acc1h); + COPY(acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + COPY(acch); + COPY(accl); +#else +#error unknown isa configuration +#endif + COPY(psw); + COPY(bpc); + COPY(bbpsw); + COPY(bbpc); + COPY(spu); + COPY(fp); + COPY(lr); + COPY(spi); +#undef COPY + + regs->syscall_nr = -1; /* disable syscall checks */ + err |= __get_user(*r0_p, &sc->sc_r0); + + return err; +} + +asmlinkage int +sys_sigreturn(unsigned long r0, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + struct sigframe __user *frame = (struct sigframe __user *)regs.spu; + sigset_t set; + int result; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__get_user(set.sig[0], &frame->sc.oldmask) + || (_NSIG_WORDS > 1 + && __copy_from_user(&set.sig[1], &frame->extramask, + sizeof(frame->extramask)))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + if (restore_sigcontext(®s, &frame->sc, &result)) + goto badframe; + return result; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +asmlinkage int +sys_rt_sigreturn(unsigned long r0, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; + sigset_t set; + stack_t st; + int result; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + if (restore_sigcontext(®s, &frame->uc.uc_mcontext, &result)) + goto badframe; + + if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) + goto badframe; + /* It is more difficult to avoid calling this function than to + call it and ignore errors. */ + do_sigaltstack(&st, NULL, regs.spu); + + return result; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +/* + * Set up a signal frame. + */ + +static int +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, + unsigned long mask) +{ + int err = 0; + +#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x) + COPY(r4); + COPY(r5); + COPY(r6); + COPY(pt_regs); + COPY(r0); + COPY(r1); + COPY(r2); + COPY(r3); + COPY(r7); + COPY(r8); + COPY(r9); + COPY(r10); + COPY(r11); + COPY(r12); +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + COPY(acc0h); + COPY(acc0l); + COPY(acc1h); + COPY(acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + COPY(acch); + COPY(accl); +#else +#error unknown isa configuration +#endif + COPY(psw); + COPY(bpc); + COPY(bbpsw); + COPY(bbpc); + COPY(spu); + COPY(fp); + COPY(lr); + COPY(spi); +#undef COPY + + err |= __put_user(mask, &sc->oldmask); + + return err; +} + +/* + * Determine which stack to use.. + */ +static inline void __user * +get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) +{ + /* This is the X/Open sanctioned signal stack switching. */ + if (ka->sa.sa_flags & SA_ONSTACK) { + if (sas_ss_flags(sp) == 0) + sp = current->sas_ss_sp + current->sas_ss_size; + } + + return (void __user *)((sp - frame_size) & -8ul); +} + +static void setup_frame(int sig, struct k_sigaction *ka, + sigset_t *set, struct pt_regs *regs) +{ + struct sigframe __user *frame; + int err = 0; + int signal; + + frame = get_sigframe(ka, regs->spu, sizeof(*frame)); + + if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) + goto give_sigsegv; + + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig; + + err |= __put_user(signal, &frame->sig); + if (err) + goto give_sigsegv; + + err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); + if (err) + goto give_sigsegv; + + if (_NSIG_WORDS > 1) { + err |= __copy_to_user(frame->extramask, &set->sig[1], + sizeof(frame->extramask)); + if (err) + goto give_sigsegv; + } + + if (ka->sa.sa_flags & SA_RESTORER) + regs->lr = (unsigned long)ka->sa.sa_restorer; + else { + /* This is : ldi r7, #__NR_sigreturn ; trap #2 */ + unsigned long code = 0x670010f2 | (__NR_sigreturn << 16); + + regs->lr = (unsigned long)frame->retcode; + err |= __put_user(code, (long __user *)(frame->retcode+0)); + if (err) + goto give_sigsegv; + flush_cache_sigtramp((unsigned long)frame->retcode); + } + + /* Set up registers for signal handler */ + regs->spu = (unsigned long)frame; + regs->r0 = signal; /* Arg for signal handler */ + regs->r1 = (unsigned long)&frame->sc; + regs->bpc = (unsigned long)ka->sa.sa_handler; + + set_fs(USER_DS); + +#if DEBUG_SIG + printk("SIG deliver (%s:%d): sp=%p pc=%p\n", + current->comm, current->pid, frame, regs->pc); +#endif + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *set, struct pt_regs *regs) +{ + struct rt_sigframe __user *frame; + int err = 0; + int signal; + + frame = get_sigframe(ka, regs->spu, sizeof(*frame)); + + if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) + goto give_sigsegv; + + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig; + + err |= __put_user(signal, &frame->sig); + if (err) + goto give_sigsegv; + + err |= __put_user(&frame->info, &frame->pinfo); + err |= __put_user(&frame->uc, &frame->puc); + err |= copy_siginfo_to_user(&frame->info, info); + if (err) + goto give_sigsegv; + + /* Create the ucontext. */ + err |= __put_user(0, &frame->uc.uc_flags); + err |= __put_user(0, &frame->uc.uc_link); + err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); + err |= __put_user(sas_ss_flags(regs->spu), + &frame->uc.uc_stack.ss_flags); + err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); + err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); + err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); + if (err) + goto give_sigsegv; + + /* Set up to return from userspace. */ + if (ka->sa.sa_flags & SA_RESTORER) + regs->lr = (unsigned long)ka->sa.sa_restorer; + else { + /* This is : ldi r7, #__NR_rt_sigreturn ; trap #2 */ + unsigned long code1 = 0x97f00000 | (__NR_rt_sigreturn); + unsigned long code2 = 0x10f2f000; + + regs->lr = (unsigned long)frame->retcode; + err |= __put_user(code1, (long __user *)(frame->retcode+0)); + err |= __put_user(code2, (long __user *)(frame->retcode+4)); + if (err) + goto give_sigsegv; + flush_cache_sigtramp((unsigned long)frame->retcode); + } + + /* Set up registers for signal handler */ + regs->spu = (unsigned long)frame; + regs->r0 = signal; /* Arg for signal handler */ + regs->r1 = (unsigned long)&frame->info; + regs->r2 = (unsigned long)&frame->uc; + regs->bpc = (unsigned long)ka->sa.sa_handler; + + set_fs(USER_DS); + +#if DEBUG_SIG + printk("SIG deliver (%s:%d): sp=%p pc=%p\n", + current->comm, current->pid, frame, regs->pc); +#endif + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +/* + * OK, we're invoking a handler + */ + +static void +handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *oldset, struct pt_regs *regs) +{ + unsigned short inst; + + /* Are we from a system call? */ + if (regs->syscall_nr >= 0) { + /* If so, check system call restarting.. */ + switch (regs->r0) { + case -ERESTART_RESTARTBLOCK: + case -ERESTARTNOHAND: + regs->r0 = -EINTR; + break; + + case -ERESTARTSYS: + if (!(ka->sa.sa_flags & SA_RESTART)) { + regs->r0 = -EINTR; + break; + } + /* fallthrough */ + case -ERESTARTNOINTR: + regs->r0 = regs->orig_r0; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + } + + /* Set up the stack frame */ + if (ka->sa.sa_flags & SA_SIGINFO) + setup_rt_frame(sig, ka, info, oldset, regs); + else + setup_frame(sig, ka, oldset, regs); + + if (ka->sa.sa_flags & SA_ONESHOT) + ka->sa.sa_handler = SIG_DFL; + + if (!(ka->sa.sa_flags & SA_NODEFER)) { + spin_lock_irq(¤t->sighand->siglock); + sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); + sigaddset(¤t->blocked,sig); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + } +} + +/* + * Note that 'init' is a special process: it doesn't get signals it doesn't + * want to handle. Thus you cannot kill init even with a SIGKILL even by + * mistake. + */ +int do_signal(struct pt_regs *regs, sigset_t *oldset) +{ + siginfo_t info; + int signr; + struct k_sigaction ka; + unsigned short inst; + + /* + * We want the common case to go fast, which + * is why we may in certain cases get here from + * kernel mode. Just return without doing anything + * if so. + */ + if (!user_mode(regs)) + return 1; + + if (current->flags & PF_FREEZE) { + refrigerator(0); + goto no_signal; + } + + if (!oldset) + oldset = ¤t->blocked; + + signr = get_signal_to_deliver(&info, &ka, regs, NULL); + if (signr > 0) { + /* Reenable any watchpoints before delivering the + * signal to user space. The processor register will + * have been cleared if the watchpoint triggered + * inside the kernel. + */ + + /* Whee! Actually deliver the signal. */ + handle_signal(signr, &ka, &info, oldset, regs); + return 1; + } + + no_signal: + /* Did we come from a system call? */ + if (regs->syscall_nr >= 0) { + /* Restart the system call - no handlers present */ + if (regs->r0 == -ERESTARTNOHAND || + regs->r0 == -ERESTARTSYS || + regs->r0 == -ERESTARTNOINTR) { + regs->r0 = regs->orig_r0; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + if (regs->r0 == -ERESTART_RESTARTBLOCK){ + regs->r0 = regs->orig_r0; + regs->r7 = __NR_restart_syscall; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + } + return 0; +} + +/* + * notification of userspace execution resumption + * - triggered by current->work.notify_resume + */ +void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, + __u32 thread_info_flags) +{ + /* Pending single-step? */ + if (thread_info_flags & _TIF_SINGLESTEP) + clear_thread_flag(TIF_SINGLESTEP); + + /* deal with pending signal delivery */ + if (thread_info_flags & _TIF_SIGPENDING) + do_signal(regs,oldset); + + clear_thread_flag(TIF_IRET); +} diff -Nru a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/smp.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,964 @@ +/* + * linux/arch/m32r/kernel/smp.c + * + * M32R SMP support routines. + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto + * + * Taken from i386 version. + * (c) 1995 Alan Cox, Building #3 + * (c) 1998-99, 2000 Ingo Molnar + * + * This code is released under the GNU General Public License version 2 or + * later. + */ + +#undef DEBUG_SMP + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Data structures and variables */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/* + * Structure and data for smp_call_function(). This is designed to minimise + * static memory requirements. It also looks cleaner. + */ +static spinlock_t call_lock = SPIN_LOCK_UNLOCKED; + +struct call_data_struct { + void (*func) (void *info); + void *info; + atomic_t started; + atomic_t finished; + int wait; +} __attribute__ ((__aligned__(SMP_CACHE_BYTES))); + +static struct call_data_struct *call_data; + +/* + * For flush_cache_all() + */ +static spinlock_t flushcache_lock = SPIN_LOCK_UNLOCKED; +static volatile unsigned long flushcache_cpumask = 0; + +/* + * For flush_tlb_others() + */ +static volatile cpumask_t flush_cpumask; +static struct mm_struct *flush_mm; +static struct vm_area_struct *flush_vma; +static volatile unsigned long flush_va; +static spinlock_t tlbstate_lock = SPIN_LOCK_UNLOCKED; +#define FLUSH_ALL 0xffffffff + +DECLARE_PER_CPU(int, prof_multiplier); +DECLARE_PER_CPU(int, prof_old_multiplier); +DECLARE_PER_CPU(int, prof_counter); + +extern spinlock_t ipi_lock[]; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Function Prototypes */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +void smp_send_reschedule(int); +void smp_reschedule_interrupt(void); + +void smp_flush_cache_all(void); +void smp_flush_cache_all_interrupt(void); + +void smp_flush_tlb_all(void); +static void flush_tlb_all_ipi(void *); + +void smp_flush_tlb_mm(struct mm_struct *); +void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, \ + unsigned long); +void smp_flush_tlb_page(struct vm_area_struct *, unsigned long); +static void flush_tlb_others(cpumask_t, struct mm_struct *, + struct vm_area_struct *, unsigned long); +void smp_invalidate_interrupt(void); + +void smp_send_stop(void); +static void stop_this_cpu(void *); + +int smp_call_function(void (*) (void *), void *, int, int); +void smp_call_function_interrupt(void); + +void smp_send_timer(void); +void smp_ipi_timer_interrupt(struct pt_regs *); +void smp_local_timer_interrupt(struct pt_regs *); + +void send_IPI_allbutself(int, int); +static void send_IPI_mask(cpumask_t, int, int); +unsigned long send_IPI_mask_phys(cpumask_t, int, int); + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Rescheduling request Routines */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_reschedule + * + * Description: This routine requests other CPU to execute rescheduling. + * 1.Send 'RESCHEDULE_IPI' to other CPU. + * Request other CPU to execute 'smp_reschedule_interrupt()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_id - Target CPU ID + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_reschedule(int cpu_id) +{ + WARN_ON(cpu_is_offline(cpu_id)); + send_IPI_mask(cpumask_of_cpu(cpu_id), RESCHEDULE_IPI, 1); +} + +/*==========================================================================* + * Name: smp_reschedule_interrupt + * + * Description: This routine executes on CPU which received + * 'RESCHEDULE_IPI'. + * Rescheduling is processed at the exit of interrupt + * operation. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_reschedule_interrupt(void) +{ + /* nothing to do */ +} + +/*==========================================================================* + * Name: smp_flush_cache_all + * + * Description: This routine sends a 'INVALIDATE_CACHE_IPI' to all other + * CPUs in the system. + * + * Born on Date: 2003-05-28 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_cache_all(void) +{ + cpumask_t cpumask; + unsigned long *mask; + + preempt_disable(); + cpumask = cpu_online_map; + cpu_clear(smp_processor_id(), cpumask); + spin_lock(&flushcache_lock); + mask=cpus_addr(cpumask); + atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); + send_IPI_mask(cpumask, INVALIDATE_CACHE_IPI, 0); + _flush_cache_copyback_all(); + while (flushcache_cpumask) + mb(); + spin_unlock(&flushcache_lock); + preempt_enable(); +} + +void smp_flush_cache_all_interrupt(void) +{ + _flush_cache_copyback_all(); + clear_bit(smp_processor_id(), &flushcache_cpumask); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* TLB flush request Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_flush_tlb_all + * + * Description: This routine flushes all processes TLBs. + * 1.Request other CPU to execute 'flush_tlb_all_ipi()'. + * 2.Execute 'do_flush_tlb_all_local()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_all(void) +{ + unsigned long flags; + + preempt_disable(); + local_irq_save(flags); + __flush_tlb_all(); + local_irq_restore(flags); + smp_call_function(flush_tlb_all_ipi, 0, 1, 1); + preempt_enable(); +} + +/*==========================================================================* + * Name: flush_tlb_all_ipi + * + * Description: This routine flushes all local TLBs. + * 1.Execute 'do_flush_tlb_all_local()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: *info - not used + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void flush_tlb_all_ipi(void *info) +{ + __flush_tlb_all(); +} + +/*==========================================================================* + * Name: smp_flush_tlb_mm + * + * Description: This routine flushes the specified mm context TLB's. + * + * Born on Date: 2002.02.05 + * + * Arguments: *mm - a pointer to the mm struct for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_mm(struct mm_struct *mm) +{ + int cpu_id = smp_processor_id(); + cpumask_t cpu_mask; + unsigned long *mmc = &mm->context[cpu_id]; + unsigned long flags; + + preempt_disable(); + cpu_mask = mm->cpu_vm_mask; + cpu_clear(cpu_id, cpu_mask); + + if (*mmc != NO_CONTEXT) { + local_irq_save(flags); + *mmc = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + else + cpu_clear(cpu_id, mm->cpu_vm_mask); + local_irq_restore(flags); + } + if (!cpus_empty(cpu_mask)) + flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); + + preempt_enable(); +} + +/*==========================================================================* + * Name: smp_flush_tlb_range + * + * Description: This routine flushes a range of pages. + * + * Born on Date: 2002.02.05 + * + * Arguments: *mm - a pointer to the mm struct for flush TLB + * start - not used + * end - not used + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + smp_flush_tlb_mm(vma->vm_mm); +} + +/*==========================================================================* + * Name: smp_flush_tlb_page + * + * Description: This routine flushes one page. + * + * Born on Date: 2002.02.05 + * + * Arguments: *vma - a pointer to the vma struct include va + * va - virtual address for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) +{ + struct mm_struct *mm = vma->vm_mm; + int cpu_id = smp_processor_id(); + cpumask_t cpu_mask; + unsigned long *mmc = &mm->context[cpu_id]; + unsigned long flags; + + preempt_disable(); + cpu_mask = mm->cpu_vm_mask; + cpu_clear(cpu_id, cpu_mask); + +#ifdef DEBUG_SMP + if (!mm) + BUG(); +#endif + + if (*mmc != NO_CONTEXT) { + local_irq_save(flags); + va &= PAGE_MASK; + va |= (*mmc & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(va); + local_irq_restore(flags); + } + if (!cpus_empty(cpu_mask)) + flush_tlb_others(cpu_mask, mm, vma, va); + + preempt_enable(); +} + +/*==========================================================================* + * Name: flush_tlb_others + * + * Description: This routine requests other CPU to execute flush TLB. + * 1.Setup parmeters. + * 2.Send 'INVALIDATE_TLB_IPI' to other CPU. + * Request other CPU to execute 'smp_invalidate_interrupt()'. + * 3.Wait for other CPUs operation finished. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpumask - bitmap of target CPUs + * *mm - a pointer to the mm struct for flush TLB + * *vma - a pointer to the vma struct include va + * va - virtual address for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, + struct vm_area_struct *vma, unsigned long va) +{ + unsigned long *mask; +#ifdef DEBUG_SMP + unsigned long flags; + __save_flags(flags); + if (!(flags & 0x0040)) /* Interrupt Disable NONONO */ + BUG(); +#endif /* DEBUG_SMP */ + + /* + * A couple of (to be removed) sanity checks: + * + * - we do not send IPIs to not-yet booted CPUs. + * - current CPU must not be in mask + * - mask must exist :) + */ + BUG_ON(cpus_empty(cpumask)); + + BUG_ON(cpu_isset(smp_processor_id(), cpumask)); + BUG_ON(!mm); + + /* If a CPU which we ran on has gone down, OK. */ + cpus_and(cpumask, cpumask, cpu_online_map); + if (cpus_empty(cpumask)) + return; + + /* + * i'm not happy about this global shared spinlock in the + * MM hot path, but we'll see how contended it is. + * Temporarily this turns IRQs off, so that lockups are + * detected by the NMI watchdog. + */ + spin_lock(&tlbstate_lock); + + flush_mm = mm; + flush_vma = vma; + flush_va = va; + mask=cpus_addr(cpumask); + atomic_set_mask(*mask, (atomic_t *)&flush_cpumask); + + /* + * We have to send the IPI only to + * CPUs affected. + */ + send_IPI_mask(cpumask, INVALIDATE_TLB_IPI, 0); + + while (!cpus_empty(flush_cpumask)) + /* nothing. lockup detection does not belong here */ + mb(); + + flush_mm = NULL; + flush_vma = NULL; + flush_va = 0; + spin_unlock(&tlbstate_lock); +} + +/*==========================================================================* + * Name: smp_invalidate_interrupt + * + * Description: This routine executes on CPU which received + * 'INVALIDATE_TLB_IPI'. + * 1.Flush local TLB. + * 2.Report flush TLB process was finished. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_invalidate_interrupt(void) +{ + int cpu_id = smp_processor_id(); + unsigned long *mmc = &flush_mm->context[cpu_id]; + + if (!cpu_isset(cpu_id, flush_cpumask)) + return; + + if (flush_va == FLUSH_ALL) { + *mmc = NO_CONTEXT; + if (flush_mm == current->active_mm) + activate_context(flush_mm); + else + cpu_clear(cpu_id, flush_mm->cpu_vm_mask); + } else { + unsigned long va = flush_va; + + if (*mmc != NO_CONTEXT) { + va &= PAGE_MASK; + va |= (*mmc & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(va); + } + } + cpu_clear(cpu_id, flush_cpumask); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Stop CPU request Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_stop + * + * Description: This routine requests stop all CPUs. + * 1.Request other CPU to execute 'stop_this_cpu()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_stop(void) +{ + smp_call_function(stop_this_cpu, NULL, 1, 0); +} + +/*==========================================================================* + * Name: stop_this_cpu + * + * Description: This routine halt CPU. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void stop_this_cpu(void *dummy) +{ + int cpu_id = smp_processor_id(); + + /* + * Remove this CPU: + */ + cpu_clear(cpu_id, cpu_online_map); + + /* + * PSW IE = 1; + * IMASK = 0; + * goto SLEEP + */ + local_irq_disable(); + outl(0, M32R_ICU_IMASK_PORTL); + inl(M32R_ICU_IMASK_PORTL); /* dummy read */ + local_irq_enable(); + + for ( ; ; ); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Call function Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_call_function + * + * Description: This routine sends a 'CALL_FUNCTION_IPI' to all other CPUs + * in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: *func - The function to run. This must be fast and + * non-blocking. + * *info - An arbitrary pointer to pass to the function. + * nonatomic - currently unused. + * wait - If true, wait (atomically) until function has + * completed on other CPUs. + * + * Returns: 0 on success, else a negative status code. Does not return + * until remote CPUs are nearly ready to execute <> or + * are or have executed. + * + * Cautions: You must not call this function with disabled interrupts or + * from a hardware interrupt handler, you may call it from a + * bottom half handler. + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +int smp_call_function(void (*func) (void *info), void *info, int nonatomic, + int wait) +{ + struct call_data_struct data; + int cpus; + +#ifdef DEBUG_SMP + unsigned long flags; + __save_flags(flags); + if (!(flags & 0x0040)) /* Interrupt Disable NONONO */ + BUG(); +#endif /* DEBUG_SMP */ + + /* Holding any lock stops cpus from going down. */ + spin_lock(&call_lock); + cpus = num_online_cpus() - 1; + + if (!cpus) { + spin_unlock(&call_lock); + return 0; + } + + /* Can deadlock when called with interrupts disabled */ + WARN_ON(irqs_disabled()); + + data.func = func; + data.info = info; + atomic_set(&data.started, 0); + data.wait = wait; + if (wait) + atomic_set(&data.finished, 0); + + call_data = &data; + mb(); + + /* Send a message to all other CPUs and wait for them to respond */ + send_IPI_allbutself(CALL_FUNCTION_IPI, 0); + + /* Wait for response */ + while (atomic_read(&data.started) != cpus) + barrier(); + + if (wait) + while (atomic_read(&data.finished) != cpus) + barrier(); + spin_unlock(&call_lock); + + return 0; +} + +/*==========================================================================* + * Name: smp_call_function_interrupt + * + * Description: This routine executes on CPU which received + * 'CALL_FUNCTION_IPI'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_call_function_interrupt(void) +{ + void (*func) (void *info) = call_data->func; + void *info = call_data->info; + int wait = call_data->wait; + + /* + * Notify initiating CPU that I've grabbed the data and am + * about to execute the function + */ + mb(); + atomic_inc(&call_data->started); + /* + * At this point the info structure may be out of scope unless wait==1 + */ + irq_enter(); + (*func)(info); + irq_exit(); + + if (wait) { + mb(); + atomic_inc(&call_data->finished); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Timer Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_timer + * + * Description: This routine sends a 'LOCAL_TIMER_IPI' to all other CPUs + * in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_timer(void) +{ + send_IPI_allbutself(LOCAL_TIMER_IPI, 1); +} + +/*==========================================================================* + * Name: smp_send_timer + * + * Description: This routine executes on CPU which received + * 'LOCAL_TIMER_IPI'. + * + * Born on Date: 2002.02.05 + * + * Arguments: *regs - a pointer to the saved regster info + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_ipi_timer_interrupt(struct pt_regs *regs) +{ + irq_enter(); + smp_local_timer_interrupt(regs); + irq_exit(); +} + +/*==========================================================================* + * Name: smp_local_timer_interrupt + * + * Description: Local timer interrupt handler. It does both profiling and + * process statistics/rescheduling. + * We do profiling in every local tick, statistics/rescheduling + * happen only every 'profiling multiplier' ticks. The default + * multiplier is 1 and it can be changed by writing the new + * multiplier value into /proc/profile. + * + * Born on Date: 2002.02.05 + * + * Arguments: *regs - a pointer to the saved regster info + * + * Returns: void (cannot fail) + * + * Original: arch/i386/kernel/apic.c + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy use per_cpu structure. + *==========================================================================*/ +void smp_local_timer_interrupt(struct pt_regs *regs) +{ + int user = user_mode(regs); + int cpu_id = smp_processor_id(); + + /* + * The profiling function is SMP safe. (nothing can mess + * around with "current", and the profiling counters are + * updated with atomic operations). This is especially + * useful with a profiling multiplier != 1 + */ + + profile_tick(CPU_PROFILING, regs); + + if (--per_cpu(prof_counter, cpu_id) <= 0) { + /* + * The multiplier may have changed since the last time we got + * to this point as a result of the user writing to + * /proc/profile. In this case we need to adjust the APIC + * timer accordingly. + * + * Interrupts are already masked off at this point. + */ + per_cpu(prof_counter, cpu_id) + = per_cpu(prof_multiplier, cpu_id); + if (per_cpu(prof_counter, cpu_id) + != per_cpu(prof_old_multiplier, cpu_id)) + { + per_cpu(prof_old_multiplier, cpu_id) + = per_cpu(prof_counter, cpu_id); + } + + update_process_times(user); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Send IPI Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: send_IPI_allbutself + * + * Description: This routine sends a IPI to all other CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void send_IPI_allbutself(int ipi_num, int try) +{ + cpumask_t cpumask; + + cpumask = cpu_online_map; + cpu_clear(smp_processor_id(), cpumask); + + send_IPI_mask(cpumask, ipi_num, try); +} + +/*==========================================================================* + * Name: send_IPI_mask + * + * Description: This routine sends a IPI to CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_mask - Bitmap of target CPUs logical ID + * ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void send_IPI_mask(cpumask_t cpumask, int ipi_num, int try) +{ + cpumask_t physid_mask, tmp; + int cpu_id, phys_id; + int num_cpus = num_online_cpus(); + + if (num_cpus <= 1) /* NO MP */ + return; + + cpus_and(tmp, cpumask, cpu_online_map); + BUG_ON(!cpus_equal(cpumask, tmp)); + + physid_mask = CPU_MASK_NONE; + for_each_cpu_mask(cpu_id, cpumask){ + if ((phys_id = cpu_to_physid(cpu_id)) != -1) + cpu_set(phys_id, physid_mask); + } + + send_IPI_mask_phys(physid_mask, ipi_num, try); +} + +/*==========================================================================* + * Name: send_IPI_mask_phys + * + * Description: This routine sends a IPI to other CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_mask - Bitmap of target CPUs physical ID + * ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: IPICRi regster value. + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, + int try) +{ + spinlock_t *ipilock; + unsigned long flags = 0; + volatile unsigned long *ipicr_addr; + unsigned long ipicr_val; + unsigned long my_physid_mask; + unsigned long mask = cpus_addr(physid_mask)[0]; + + + if (mask & ~physids_coerce(phys_cpu_present_map)) + BUG(); + if (ipi_num >= NR_IPIS) + BUG(); + + mask <<= IPI_SHIFT; + ipilock = &ipi_lock[ipi_num]; + ipicr_addr = (volatile unsigned long *)(M32R_ICU_IPICR_ADDR + + (ipi_num << 2)); + my_physid_mask = ~(1 << smp_processor_id()); + + /* + * lock ipi_lock[i] + * check IPICRi == 0 + * write IPICRi (send IPIi) + * unlock ipi_lock[i] + */ + __asm__ __volatile__ ( + ";; LOCK ipi_lock[i] \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc %1, psw \n\t" + "clrpsw #0x40 -> nop \n\t" + DCACHE_CLEAR("r4", "r5", "%2") + "lock r4, @%2 \n\t" + "addi r4, #-1 \n\t" + "unlock r4, @%2 \n\t" + "mvtc %1, psw \n\t" + "bnez r4, 2f \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "ld r4, @%2 \n\t" + "blez r4, 2b \n\t" + "bra 1b \n\t" + LOCK_SECTION_END + ";; CHECK IPICRi == 0 \n\t" + ".fillinsn \n" + "3: \n\t" + "ld %0, @%3 \n\t" + "and %0, %6 \n\t" + "beqz %0, 4f \n\t" + "bnez %5, 5f \n\t" + "bra 3b \n\t" + ";; WRITE IPICRi (send IPIi) \n\t" + ".fillinsn \n" + "4: \n\t" + "st %4, @%3 \n\t" + ";; UNLOCK ipi_lock[i] \n\t" + ".fillinsn \n" + "5: \n\t" + "ldi r4, #1 \n\t" + "st r4, @%2 \n\t" + : "=&r"(ipicr_val) + : "r"(flags), "r"(&ipilock->lock), "r"(ipicr_addr), + "r"(mask), "r"(try), "r"(my_physid_mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + + return ipicr_val; +} diff -Nru a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/smpboot.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,635 @@ +/* + * linux/arch/m32r/kernel/smpboot.c + * orig : i386 2.4.10 + * + * M32R SMP booting functions + * + * Copyright (c) 2001, 2002, 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * (c) 1995 Alan Cox, Building #3 + * (c) 1998, 1999, 2000 Ingo Molnar + * + * Much of the core SMP work is based on previous work by Thomas Radke, to + * whom a great many thanks are extended. + * + * Thanks to Intel for making available several different Pentium, + * Pentium Pro and Pentium-II/Xeon MP machines. + * Original development of Linux SMP code supported by Caldera. + * + * This code is released under the GNU General Public License version 2 or + * later. + * + * Fixes + * Felix Koop : NR_CPUS used properly + * Jose Renau : Handle single CPU case. + * Alan Cox : By repeated request + * 8) - Total BogoMIP report. + * Greg Wright : Fix for kernel stacks panic. + * Erich Boleyn : MP v1.4 and additional changes. + * Matthias Sattler : Changes for 2.1 kernel map. + * Michel Lespinasse : Changes for 2.1 kernel map. + * Michael Chastain : Change trampoline.S to gnu as. + * Alan Cox : Dumb bug: 'B' step PPro's are fine + * Ingo Molnar : Added APIC timers, based on code + * from Jose Renau + * Ingo Molnar : various cleanups and rewrites + * Tigran Aivazian : fixed "0.00 in /proc/uptime on SMP" bug. + * Maciej W. Rozycki : Bits for genuine 82489DX APICs + * Martin J. Bligh : Added support for multi-quad systems + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DEBUG_SMP +#ifdef DEBUG_SMP +#define Dprintk(x...) printk(x) +#else +#define Dprintk(x...) +#endif + +extern int cpu_idle(void); +extern cpumask_t cpu_initialized; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Data structures and variables */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/* Processor that is doing the boot up */ +static unsigned int bsp_phys_id = -1; + +/* Bitmask of physically existing CPUs */ +physid_mask_t phys_cpu_present_map; + +/* Bitmask of currently online CPUs */ +cpumask_t cpu_online_map; + +cpumask_t cpu_bootout_map; +cpumask_t cpu_bootin_map; +cpumask_t cpu_callout_map; +static cpumask_t cpu_callin_map; + +/* Per CPU bogomips and other parameters */ +struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned; + +/* Set when the idlers are all forked */ +int smp_threads_ready; + +static int cpucount; +static cpumask_t smp_commenced_mask; + +extern struct { + void * spi; + unsigned short ss; +} stack_start; + +/* which physical physical ID maps to which logical CPU number */ +static volatile int physid_2_cpu[NR_CPUS]; + +/* which logical CPU number maps to which physical ID */ +volatile int cpu_2_physid[NR_CPUS]; + +DEFINE_PER_CPU(int, prof_multiplier) = 1; +DEFINE_PER_CPU(int, prof_old_multiplier) = 1; +DEFINE_PER_CPU(int, prof_counter) = 1; + +spinlock_t ipi_lock[NR_IPIS]; + +static unsigned int calibration_result; + +unsigned long cache_decay_ticks = HZ / 100; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Function Prototypes */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +void smp_prepare_boot_cpu(void); +void smp_prepare_cpus(unsigned int); +static void smp_tune_scheduling(void); +static void init_ipi_lock(void); +static void do_boot_cpu(int); +int __cpu_up(unsigned int); +void smp_cpus_done(unsigned int); + +int start_secondary(void *); +static void smp_callin(void); +static void smp_online(void); + +static void show_mp_info(int); +static void smp_store_cpu_info(int); +static void show_cpu_info(int); +int setup_profiling_timer(unsigned int); +static void init_cpu_to_physid(void); +static void map_cpu_to_physid(int, int); +static void unmap_cpu_to_physid(int, int); + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Boot up APs Routins : BSP */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +void __devinit smp_prepare_boot_cpu(void) +{ + bsp_phys_id = hard_smp_processor_id(); + physid_set(bsp_phys_id, phys_cpu_present_map); + cpu_set(0, cpu_online_map); /* BSP's cpu_id == 0 */ + cpu_set(0, cpu_callout_map); + cpu_set(0, cpu_callin_map); + + /* + * Initialize the logical to physical CPU number mapping + */ + init_cpu_to_physid(); + map_cpu_to_physid(0, bsp_phys_id); + current_thread_info()->cpu = 0; +} + +/*==========================================================================* + * Name: smp_prepare_cpus (old smp_boot_cpus) + * + * Description: This routine boot up APs. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +void __init smp_prepare_cpus(unsigned int max_cpus) +{ + int phys_id; + unsigned long nr_cpu; + + nr_cpu = inl(M32R_FPGA_NUM_OF_CPUS_PORTL); + if (nr_cpu > NR_CPUS) { + printk(KERN_INFO "NUM_OF_CPUS reg. value [%ld] > NR_CPU [%d]", + nr_cpu, NR_CPUS); + goto smp_done; + } + for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) + physid_set(phys_id, phys_cpu_present_map); + + show_mp_info(nr_cpu); + + init_ipi_lock(); + + /* + * Setup boot CPU information + */ + smp_store_cpu_info(0); /* Final full version of the data */ + smp_tune_scheduling(); + + /* + * If SMP should be disabled, then really disable it! + */ + if (!max_cpus) { + printk(KERN_INFO "SMP mode deactivated by commandline.\n"); + goto smp_done; + } + + /* + * Now scan the CPU present map and fire up the other CPUs. + */ + Dprintk("CPU present map : %lx\n", physids_coerce(phys_cpu_present_map)); + + for (phys_id = 0 ; phys_id < NR_CPUS ; phys_id++) { + /* + * Don't even attempt to start the boot CPU! + */ + if (phys_id == bsp_phys_id) + continue; + + if (!physid_isset(phys_id, phys_cpu_present_map)) + continue; + + if ((max_cpus >= 0) && (max_cpus <= cpucount + 1)) + continue; + + do_boot_cpu(phys_id); + + /* + * Make sure we unmap all failed CPUs + */ + if (physid_to_cpu(phys_id) == -1) { + physid_clear(phys_id, phys_cpu_present_map); + printk("phys CPU#%d not responding - " \ + "cannot use it.\n", phys_id); + } + } + +smp_done: + Dprintk("Boot done.\n"); +} + +static void __init smp_tune_scheduling(void) +{ + /* Nothing to do. */ +} + +/* + * init_ipi_lock : Initialize IPI locks. + */ +static void __init init_ipi_lock(void) +{ + int ipi; + + for (ipi = 0 ; ipi < NR_IPIS ; ipi++) + ipi_lock[ipi] = SPIN_LOCK_UNLOCKED; +} + +/*==========================================================================* + * Name: do_boot_cpu + * + * Description: This routine boot up one AP. + * + * Born on Date: 2002.02.05 + * + * Arguments: phys_id - Target CPU physical ID + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +static void __init do_boot_cpu(int phys_id) +{ + struct task_struct *idle; + unsigned long send_status, boot_status; + int timeout, cpu_id; + + cpu_id = ++cpucount; + + /* + * We can't use kernel_thread since we must avoid to + * reschedule the child. + */ + idle = fork_idle(cpu_id); + if (IS_ERR(idle)) + panic("failed fork for CPU#%d.", cpu_id); + + idle->thread.lr = (unsigned long)start_secondary; + + map_cpu_to_physid(cpu_id, phys_id); + + /* So we see what's up */ + printk("Booting processor %d/%d\n", phys_id, cpu_id); + stack_start.spi = (void *)idle->thread.sp; + idle->thread_info->cpu = cpu_id; + + /* + * Send Startup IPI + * 1.IPI received by CPU#(phys_id). + * 2.CPU#(phys_id) enter startup_AP (arch/m32r/kernel/head.S) + * 3.CPU#(phys_id) enter start_secondary() + */ + send_status = 0; + boot_status = 0; + + cpu_set(phys_id, cpu_bootout_map); + + /* Send Startup IPI */ + send_IPI_mask_phys(cpumask_of_cpu(phys_id), CPU_BOOT_IPI, 0); + + Dprintk("Waiting for send to finish...\n"); + timeout = 0; + + /* Wait 100[ms] */ + do { + Dprintk("+"); + udelay(1000); + send_status = !cpu_isset(phys_id, cpu_bootin_map); + } while (send_status && (timeout++ < 100)); + + Dprintk("After Startup.\n"); + + if (!send_status) { + /* + * allow APs to start initializing. + */ + Dprintk("Before Callout %d.\n", cpu_id); + cpu_set(cpu_id, cpu_callout_map); + Dprintk("After Callout %d.\n", cpu_id); + + /* + * Wait 5s total for a response + */ + for (timeout = 0; timeout < 5000; timeout++) { + if (cpu_isset(cpu_id, cpu_callin_map)) + break; /* It has booted */ + udelay(1000); + } + + if (cpu_isset(cpu_id, cpu_callin_map)) { + /* number CPUs logically, starting from 1 (BSP is 0) */ + Dprintk("OK.\n"); + } else { + boot_status = 1; + printk("Not responding.\n"); + } + } else + printk("IPI never delivered???\n"); + + if (send_status || boot_status) { + unmap_cpu_to_physid(cpu_id, phys_id); + cpu_clear(cpu_id, cpu_callout_map); + cpu_clear(cpu_id, cpu_callin_map); + cpu_clear(cpu_id, cpu_initialized); + cpucount--; + } +} + +int __devinit __cpu_up(unsigned int cpu_id) +{ + int timeout; + + cpu_set(cpu_id, smp_commenced_mask); + + /* + * Wait 5s total for a response + */ + for (timeout = 0; timeout < 5000; timeout++) { + if (cpu_isset(cpu_id, cpu_online_map)) + break; + udelay(1000); + } + if (!cpu_isset(cpu_id, cpu_online_map)) + BUG(); + + return 0; +} + +void __init smp_cpus_done(unsigned int max_cpus) +{ + int cpu_id, timeout; + unsigned long bogosum = 0; + + for (timeout = 0; timeout < 5000; timeout++) { + if (cpus_equal(cpu_callin_map, cpu_online_map)) + break; + udelay(1000); + } + if (!cpus_equal(cpu_callin_map, cpu_online_map)) + BUG(); + + for (cpu_id = 0 ; cpu_id < num_online_cpus() ; cpu_id++) + show_cpu_info(cpu_id); + + /* + * Allow the user to impress friends. + */ + Dprintk("Before bogomips.\n"); + if (cpucount) { + for_each_cpu_mask(cpu_id, cpu_online_map) + bogosum += cpu_data[cpu_id].loops_per_jiffy; + + printk(KERN_INFO "Total of %d processors activated " \ + "(%lu.%02lu BogoMIPS).\n", cpucount + 1, + bogosum / (500000 / HZ), + (bogosum / (5000 / HZ)) % 100); + Dprintk("Before bogocount - setting activated=1.\n"); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Activate a secondary processor Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: start_secondary + * + * Description: This routine activate a secondary processor. + * + * Born on Date: 2002.02.05 + * + * Arguments: *unused - currently unused. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +int __init start_secondary(void *unused) +{ + cpu_init(); + smp_callin(); + while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) + rep_nop(); + + smp_online(); + + /* + * low-memory mappings have been cleared, flush them from + * the local TLBs too. + */ + local_flush_tlb_all(); + + return cpu_idle(); +} + +/*==========================================================================* + * Name: smp_callin + * + * Description: This routine activate a secondary processor. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +static void __init smp_callin(void) +{ + int phys_id = hard_smp_processor_id(); + int cpu_id = smp_processor_id(); + unsigned long timeout; + + if (cpu_isset(cpu_id, cpu_callin_map)) { + printk("huh, phys CPU#%d, CPU#%d already present??\n", + phys_id, cpu_id); + BUG(); + } + Dprintk("CPU#%d (phys ID: %d) waiting for CALLOUT\n", cpu_id, phys_id); + + /* Waiting 2s total for startup (udelay is not yet working) */ + timeout = jiffies + (2 * HZ); + while (time_before(jiffies, timeout)) { + /* Has the boot CPU finished it's STARTUP sequence ? */ + if (cpu_isset(cpu_id, cpu_callout_map)) + break; + rep_nop(); + } + + if (!time_before(jiffies, timeout)) { + printk("BUG: CPU#%d started up but did not get a callout!\n", + cpu_id); + BUG(); + } + + /* Allow the master to continue. */ + cpu_set(cpu_id, cpu_callin_map); +} + +static void __init smp_online(void) +{ + int cpu_id = smp_processor_id(); + + local_irq_enable(); + + /* Get our bogomips. */ + calibrate_delay(); + + /* Save our processor parameters */ + smp_store_cpu_info(cpu_id); + + cpu_set(cpu_id, cpu_online_map); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Boot up CPUs common Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +static void __init show_mp_info(int nr_cpu) +{ + int i; + char cpu_model0[17], cpu_model1[17], cpu_ver[9]; + + strncpy(cpu_model0, (char *)M32R_FPGA_CPU_NAME_ADDR, 16); + strncpy(cpu_model1, (char *)M32R_FPGA_MODEL_ID_ADDR, 16); + strncpy(cpu_ver, (char *)M32R_FPGA_VERSION_ADDR, 8); + + cpu_model0[16] = '\0'; + for (i = 15 ; i >= 0 ; i--) { + if (cpu_model0[i] != ' ') + break; + cpu_model0[i] = '\0'; + } + cpu_model1[16] = '\0'; + for (i = 15 ; i >= 0 ; i--) { + if (cpu_model1[i] != ' ') + break; + cpu_model1[i] = '\0'; + } + cpu_ver[8] = '\0'; + for (i = 7 ; i >= 0 ; i--) { + if (cpu_ver[i] != ' ') + break; + cpu_ver[i] = '\0'; + } + + printk(KERN_INFO "M32R-mp information\n"); + printk(KERN_INFO " On-chip CPUs : %d\n", nr_cpu); + printk(KERN_INFO " CPU model : %s/%s(%s)\n", cpu_model0, + cpu_model1, cpu_ver); +} + +/* + * The bootstrap kernel entry code has set these up. Save them for + * a given CPU + */ +static void __init smp_store_cpu_info(int cpu_id) +{ + struct cpuinfo_m32r *ci = cpu_data + cpu_id; + + *ci = boot_cpu_data; + ci->loops_per_jiffy = loops_per_jiffy; +} + +static void __init show_cpu_info(int cpu_id) +{ + struct cpuinfo_m32r *ci = &cpu_data[cpu_id]; + + printk("CPU#%d : ", cpu_id); + +#define PRINT_CLOCK(name, value) \ + printk(name " clock %d.%02dMHz", \ + ((value) / 1000000), ((value) % 1000000) / 10000) + + PRINT_CLOCK("CPU", (int)ci->cpu_clock); + PRINT_CLOCK(", Bus", (int)ci->bus_clock); + printk(", loops_per_jiffy[%ld]\n", ci->loops_per_jiffy); +} + +/* + * the frequency of the profiling timer can be changed + * by writing a multiplier value into /proc/profile. + */ +int setup_profiling_timer(unsigned int multiplier) +{ + int i; + + /* + * Sanity check. [at least 500 APIC cycles should be + * between APIC interrupts as a rule of thumb, to avoid + * irqs flooding us] + */ + if ( (!multiplier) || (calibration_result / multiplier < 500)) + return -EINVAL; + + /* + * Set the new multiplier for each CPU. CPUs don't start using the + * new values until the next timer interrupt in which they do process + * accounting. At that time they also adjust their APIC timers + * accordingly. + */ + for (i = 0; i < NR_CPUS; ++i) + per_cpu(prof_multiplier, i) = multiplier; + + return 0; +} + +/* Initialize all maps between cpu number and apicids */ +static void __init init_cpu_to_physid(void) +{ + int i; + + for (i = 0 ; i < NR_CPUS ; i++) { + cpu_2_physid[i] = -1; + physid_2_cpu[i] = -1; + } +} + +/* + * set up a mapping between cpu and apicid. Uses logical apicids for multiquad, + * else physical apic ids + */ +static void __init map_cpu_to_physid(int cpu_id, int phys_id) +{ + physid_2_cpu[phys_id] = cpu_id; + cpu_2_physid[cpu_id] = phys_id; +} + +/* + * undo a mapping between cpu and apicid. Uses logical apicids for multiquad, + * else physical apic ids + */ +static void __init unmap_cpu_to_physid(int cpu_id, int phys_id) +{ + physid_2_cpu[phys_id] = -1; + cpu_2_physid[cpu_id] = -1; +} + diff -Nru a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/sys_m32r.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,276 @@ +/* + * linux/arch/m32r/kernel/sys_m32r.c + * + * This file contains various random system calls that + * have a non-standard calling sequence on the Linux/M32R platform. + * + * Taken from i386 version. + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * sys_tas() - test-and-set + * linuxthreads testing version + */ +#ifndef CONFIG_SMP +asmlinkage int sys_tas(int *addr) +{ + int oldval; + unsigned long flags; + + if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) + return -EFAULT; + local_irq_save(flags); + oldval = *addr; + *addr = 1; + local_irq_restore(flags); + return oldval; +} +#else /* CONFIG_SMP */ +#include + +static spinlock_t tas_lock = SPIN_LOCK_UNLOCKED; + +asmlinkage int sys_tas(int *addr) +{ + int oldval; + + if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) + return -EFAULT; + + spin_lock(&tas_lock); + oldval = *addr; + *addr = 1; + spin_unlock(&tas_lock); + + return oldval; +} +#endif /* CONFIG_SMP */ + +/* + * sys_pipe() is the normal C calling standard for creating + * a pipe. It's not the way Unix traditionally does this, though. + */ +asmlinkage int +sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, struct pt_regs regs) +{ + int fd[2]; + int error; + + error = do_pipe(fd); + if (!error) { + if (copy_to_user((void *)r0, (void *)fd, 2*sizeof(int))) + error = -EFAULT; + } + return error; +} + +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + int fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file *file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + up_write(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + +/* + * Perform the select(nd, in, out, ex, tv) and mmap() system + * calls. Linux/M32R didn't use to be able to handle more than + * 4 system call parameters, so these system calls used a memory + * block for parameter passing.. + */ + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +asmlinkage int old_mmap(struct mmap_arg_struct *arg) +{ + struct mmap_arg_struct a; + int err = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + err = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; + err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, + a.offset>>PAGE_SHIFT); +out: + return err; +} + +struct sel_arg_struct { + unsigned long n; + fd_set __user *inp, *outp, *exp; + struct timeval __user *tvp; +}; + +asmlinkage int old_select(struct sel_arg_struct __user *arg) +{ + struct sel_arg_struct a; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + /* sys_select() does the appropriate kernel locking */ + return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* + * sys_ipc() is the de-multiplexer for the SysV IPC calls.. + * + * This is really horribly ugly. + */ +asmlinkage int sys_ipc(uint call, int first, int second, + int third, void __user *ptr, long fifth) +{ + int version, ret; + + version = call >> 16; /* hack for backward compatibility */ + call &= 0xffff; + + switch (call) { + case SEMOP: + return sys_semtimedop(first, (struct sembuf __user *)ptr, + second, NULL); + case SEMTIMEDOP: + return sys_semtimedop(first, (struct sembuf __user *)ptr, + second, (const struct timespec __user *)fifth); + case SEMGET: + return sys_semget (first, second, third); + case SEMCTL: { + union semun fourth; + if (!ptr) + return -EINVAL; + if (get_user(fourth.__pad, (void __user * __user *) ptr)) + return -EFAULT; + return sys_semctl (first, second, third, fourth); + } + + case MSGSND: + return sys_msgsnd (first, (struct msgbuf __user *) ptr, + second, third); + case MSGRCV: + switch (version) { + case 0: { + struct ipc_kludge tmp; + if (!ptr) + return -EINVAL; + + if (copy_from_user(&tmp, + (struct ipc_kludge __user *) ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); + } + default: + return sys_msgrcv (first, + (struct msgbuf __user *) ptr, + second, fifth, third); + } + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, + (struct msqid_ds __user *) ptr); + case SHMAT: { + ulong raddr; + + if ((ret = verify_area(VERIFY_WRITE, (ulong __user *) third, + sizeof(ulong)))) + return ret; + ret = do_shmat (first, (char __user *) ptr, second, &raddr); + if (ret) + return ret; + return put_user (raddr, (ulong __user *) third); + } + case SHMDT: + return sys_shmdt ((char __user *)ptr); + case SHMGET: + return sys_shmget (first, second, third); + case SHMCTL: + return sys_shmctl (first, second, + (struct shmid_ds __user *) ptr); + default: + return -ENOSYS; + } +} + +asmlinkage int sys_uname(struct old_utsname * name) +{ + int err; + if (!name) + return -EFAULT; + down_read(&uts_sem); + err=copy_to_user(name, &system_utsname, sizeof (*name)); + up_read(&uts_sem); + return err?-EFAULT:0; +} + +asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) +{ + /* This should flush more selectivly ... */ + _flush_cache_all(); + return 0; +} + +asmlinkage int sys_cachectl(char *addr, int nbytes, int op) +{ + /* Not implemented yet. */ + return -ENOSYS; +} + diff -Nru a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/time.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,317 @@ +/* + * linux/arch/m32r/kernel/time.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + * Taken from i386 version. + * Copyright (C) 1991, 1992, 1995 Linus Torvalds + * Copyright (C) 1996, 1997, 1998 Ralf Baechle + * + * This file contains the time handling details for PC-style clocks as + * found in some MIPS systems. + * + * Some code taken from sh version. + * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka + * Copyright (C) 2000 Philipp Rumpf + */ + +#undef DEBUG_TIMER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#ifdef CONFIG_SMP +extern void send_IPI_allbutself(int, int); +extern void smp_local_timer_interrupt(struct pt_regs *); +#endif + +u64 jiffies_64 = INITIAL_JIFFIES; + +EXPORT_SYMBOL(jiffies_64); + +extern unsigned long wall_jiffies; +#define TICK_SIZE (tick_nsec / 1000) + +/* + * Change this if you have some constant time drift + */ + +/* This is for machines which generate the exact clock. */ +#define USECS_PER_JIFFY (1000000/HZ) + +static unsigned long latch; + +static unsigned long do_gettimeoffset(void) +{ + unsigned long elapsed_time = 0; /* [us] */ + +#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ + || defined(CONFIG_CHIP_OPSP) +#ifndef CONFIG_SMP + + unsigned long count; + + /* timer count may underflow right here */ + count = inl(M32R_MFT2CUT_PORTL); + + if (inl(M32R_ICU_CR18_PORTL) & 0x00000100) /* underflow check */ + count = 0; + + count = (latch - count) * TICK_SIZE; + elapsed_time = (count + latch / 2) / latch; + /* NOTE: LATCH is equal to the "interval" value (= reload count). */ + +#else /* CONFIG_SMP */ + unsigned long count; + static unsigned long p_jiffies = -1; + static unsigned long p_count = 0; + + /* timer count may underflow right here */ + count = inl(M32R_MFT2CUT_PORTL); + + if (jiffies == p_jiffies && count > p_count) + count = 0; + + p_jiffies = jiffies; + p_count = count; + + count = (latch - count) * TICK_SIZE; + elapsed_time = (count + latch / 2) / latch; + /* NOTE: LATCH is equal to the "interval" value (= reload count). */ +#endif /* CONFIG_SMP */ +#elif defined(CONFIG_CHIP_M32310) +#warning do_gettimeoffse not implemented +#else +#error no chip configuration +#endif + + return elapsed_time; +} + +/* + * This version of gettimeofday has near microsecond resolution. + */ +void do_gettimeofday(struct timeval *tv) +{ + unsigned long seq; + unsigned long usec, sec; + unsigned long max_ntp_tick = tick_usec - tickadj; + + do { + unsigned long lost; + + seq = read_seqbegin(&xtime_lock); + + usec = do_gettimeoffset(); + lost = jiffies - wall_jiffies; + + /* + * If time_adjust is negative then NTP is slowing the clock + * so make sure not to go into next possible interval. + * Better to lose some accuracy than have time go backwards.. + */ + if (unlikely(time_adjust < 0)) { + usec = min(usec, max_ntp_tick); + if (lost) + usec += lost * max_ntp_tick; + } else if (unlikely(lost)) + usec += lost * tick_usec; + + sec = xtime.tv_sec; + usec += (xtime.tv_nsec / 1000); + } while (read_seqretry(&xtime_lock, seq)); + + while (usec >= 1000000) { + usec -= 1000000; + sec++; + } + + tv->tv_sec = sec; + tv->tv_usec = usec; +} + +EXPORT_SYMBOL(do_gettimeofday); + +int do_settimeofday(struct timespec *tv) +{ + time_t wtm_sec, sec = tv->tv_sec; + long wtm_nsec, nsec = tv->tv_nsec; + + if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) + return -EINVAL; + + write_seqlock_irq(&xtime_lock); + /* + * This is revolting. We need to set "xtime" correctly. However, the + * value in this location is the value at the most recent update of + * wall time. Discover what correction gettimeofday() would have + * made, and then undo it! + */ + nsec -= do_gettimeoffset() * NSEC_PER_USEC; + nsec -= (jiffies - wall_jiffies) * TICK_NSEC; + + wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); + wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); + + set_normalized_timespec(&xtime, sec, nsec); + set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); + + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + write_sequnlock_irq(&xtime_lock); + clock_was_set(); + + return 0; +} + +EXPORT_SYMBOL(do_settimeofday); + +/* + * In order to set the CMOS clock precisely, set_rtc_mmss has to be + * called 500 ms after the second nowtime has started, because when + * nowtime is written into the registers of the CMOS clock, it will + * jump to the next second precisely 500 ms later. Check the Motorola + * MC146818A or Dallas DS12887 data sheet for details. + * + * BUG: This routine does not handle hour overflow properly; it just + * sets the minutes. Usually you won't notice until after reboot! + */ +static __inline__ int set_rtc_mmss(unsigned long nowtime) +{ + return 0; +} + +/* last time the cmos clock got updated */ +static long last_rtc_update = 0; + +/* + * timer_interrupt() needs to keep up the real-time clock, + * as well as call the "do_timer()" routine every clocktick + */ +static __inline__ void do_timer_interrupt(int irq, void *dev_id, + struct pt_regs * regs) +{ + do_timer(regs); + + /* + * If we have an externally synchronized Linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 + && xtime.tv_sec > last_rtc_update + 660 + && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2 + && (xtime.tv_nsec / 1000) <= 500000 + ((unsigned)TICK_SIZE) / 2) + { + if (set_rtc_mmss(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else /* do it again in 60 s */ + last_rtc_update = xtime.tv_sec - 600; + } + /* As we return to user mode fire off the other CPU schedulers.. + this is basically because we don't yet share IRQ's around. + This message is rigged to be safe on the 386 - basically it's + a hack, so don't look closely for now.. */ + +#ifdef CONFIG_SMP + smp_local_timer_interrupt(regs); +#endif +} + +irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + write_seqlock(&xtime_lock); + do_timer_interrupt(irq, NULL, regs); + write_sequnlock(&xtime_lock); + +#ifndef CONFIG_SMP + profile_tick(CPU_PROFILING, regs); +#endif + + return IRQ_HANDLED; +} + +struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, + "MFT2", NULL, NULL }; + +void __init time_init(void) +{ + unsigned int epoch, year, mon, day, hour, min, sec; + + sec = min = hour = day = mon = year = 0; + epoch = 0; + + year = 23; + mon = 4; + day = 17; + + /* Attempt to guess the epoch. This is the same heuristic as in rtc.c + so no stupid things will happen to timekeeping. Who knows, maybe + Ultrix also uses 1952 as epoch ... */ + if (year > 10 && year < 44) + epoch = 1980; + else if (year < 96) + epoch = 1952; + year += epoch; + + xtime.tv_sec = mktime(year, mon, day, hour, min, sec); + xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); + wall_to_monotonic.tv_sec = -xtime.tv_sec; + wall_to_monotonic.tv_nsec = -xtime.tv_nsec; + +#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ + || defined(CONFIG_CHIP_OPSP) + + /* M32102 MFT setup */ + setup_irq(M32R_IRQ_MFT2, &irq0); + { + unsigned long bus_clock; + unsigned short divide; + + bus_clock = boot_cpu_data.bus_clock; + divide = boot_cpu_data.timer_divide; + latch = (bus_clock/divide + HZ / 2) / HZ; + + printk("Timer start : latch = %ld\n", latch); + + outl((M32R_MFTMOD_CC_MASK | M32R_MFTMOD_TCCR \ + |M32R_MFTMOD_CSSEL011), M32R_MFT2MOD_PORTL); + outl(latch, M32R_MFT2RLD_PORTL); + outl(latch, M32R_MFT2CUT_PORTL); + outl(0, M32R_MFT2CMPRLD_PORTL); + outl((M32R_MFTCR_MFT2MSK|M32R_MFTCR_MFT2EN), M32R_MFTCR_PORTL); + } + +#elif defined(CONFIG_CHIP_M32310) +#warning time_init not implemented +#else +#error no chip configuration +#endif +} + +/* + * Scheduler clock - returns current time in nanosec units. + */ +unsigned long long sched_clock(void) +{ + return (unsigned long long)jiffies * (1000000000 / HZ); +} + diff -Nru a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/traps.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,330 @@ +/* + * linux/arch/m32r/kernel/traps.c + * + * Copyright (C) 2001, 2002 Hirokazu Takata, Hiroyuki Kondo, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +/* + * 'traps.c' handles hardware traps and faults after we have saved some + * state in 'entry.S'. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +asmlinkage void alignment_check(void); +asmlinkage void ei_handler(void); +asmlinkage void rie_handler(void); +asmlinkage void debug_trap(void); +asmlinkage void cache_flushing_handler(void); + +#ifdef CONFIG_SMP +extern void smp_reschedule_interrupt(void); +extern void smp_invalidate_interrupt(void); +extern void smp_call_function_interrupt(void); +extern void smp_ipi_timer_interrupt(void); +extern void smp_flush_cache_all_interrupt(void); + +/* + * for Boot AP function + */ +asm ( + " .section .eit_vector4,\"ax\" \n" + " .global _AP_RE \n" + " .global startup_AP \n" + "_AP_RE: \n" + " .fill 32, 4, 0 \n" + "_AP_EI: bra startup_AP \n" + " .previous \n" +); +#endif /* CONFIG_SMP */ + +extern unsigned long eit_vector[]; +#define BRA_INSN(func, entry) \ + ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ + + 0xff000000UL + +void set_eit_vector_entries(void) +{ + extern void default_eit_handler(void); + extern void system_call(void); + extern void pie_handler(void); + extern void ace_handler(void); + extern void tme_handler(void); + extern void _flush_cache_copyback_all(void); + + eit_vector[0] = 0xd0c00001; /* seth r0, 0x01 */ + eit_vector[1] = BRA_INSN(default_eit_handler, 1); + eit_vector[4] = 0xd0c00010; /* seth r0, 0x10 */ + eit_vector[5] = BRA_INSN(default_eit_handler, 5); + eit_vector[8] = BRA_INSN(rie_handler, 8); + eit_vector[12] = BRA_INSN(alignment_check, 12); + eit_vector[16] = 0xff000000UL; + eit_vector[17] = BRA_INSN(debug_trap, 17); + eit_vector[18] = BRA_INSN(system_call, 18); + eit_vector[19] = 0xff000000UL; + eit_vector[20] = 0xff000000UL; + eit_vector[21] = 0xff000000UL; + eit_vector[22] = 0xff000000UL; + eit_vector[23] = 0xff000000UL; + eit_vector[24] = 0xff000000UL; + eit_vector[25] = 0xff000000UL; + eit_vector[26] = 0xff000000UL; + eit_vector[27] = 0xff000000UL; + eit_vector[28] = BRA_INSN(cache_flushing_handler, 28); + eit_vector[29] = 0xff000000UL; + eit_vector[30] = 0xff000000UL; + eit_vector[31] = 0xff000000UL; + eit_vector[32] = BRA_INSN(ei_handler, 32); + eit_vector[64] = BRA_INSN(pie_handler, 64); + eit_vector[68] = BRA_INSN(ace_handler, 68); + eit_vector[72] = BRA_INSN(tme_handler, 72); +#ifdef CONFIG_SMP + eit_vector[184] = (unsigned long)smp_reschedule_interrupt; + eit_vector[185] = (unsigned long)smp_invalidate_interrupt; + eit_vector[186] = (unsigned long)smp_call_function_interrupt; + eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt; + eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt; + eit_vector[189] = 0; + eit_vector[190] = 0; + eit_vector[191] = 0; +#endif + _flush_cache_copyback_all(); +} + +void __init trap_init(void) +{ + set_eit_vector_entries(); + + /* + * Should be a barrier for any external CPU state. + */ + cpu_init(); +} + +int kstack_depth_to_print = 24; + +void show_trace(struct task_struct *task, unsigned long *stack) +{ + unsigned long addr; + + if (!stack) + stack = (unsigned long*)&stack; + + printk("Call Trace: "); + while (!kstack_end(stack)) { + addr = *stack++; + if (__kernel_text_address(addr)) { + printk("[<%08lx>] ", addr); + print_symbol("%s\n", addr); + } + } + printk("\n"); +} + +void show_stack(struct task_struct *task, unsigned long *sp) +{ + unsigned long *stack; + int i; + + /* + * debugging aid: "show_stack(NULL);" prints the + * back trace for this cpu. + */ + + if(sp==NULL) { + if (task) + sp = (unsigned long *)task->thread.sp; + else + sp=(unsigned long*)&sp; + } + + stack = sp; + for(i=0; i < kstack_depth_to_print; i++) { + if (kstack_end(stack)) + break; + if (i && ((i % 4) == 0)) + printk("\n "); + printk("%08lx ", *stack++); + } + printk("\n"); + show_trace(task, sp); +} + +void dump_stack(void) +{ + unsigned long stack; + + show_trace(current, &stack); +} + +EXPORT_SYMBOL(dump_stack); + +static void show_registers(struct pt_regs *regs) +{ + int i = 0; + int in_kernel = 1; + unsigned long sp; + + printk("CPU: %d\n", smp_processor_id()); + show_regs(regs); + + sp = (unsigned long) (1+regs); + if (user_mode(regs)) { + in_kernel = 0; + sp = regs->spu; + printk("SPU: %08lx\n", sp); + } else { + printk("SPI: %08lx\n", sp); + } + printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", + current->comm, current->pid, 0xffff & i, 4096+(unsigned long)current); + + /* + * When in-kernel, we also print out the stack and code at the + * time of the fault.. + */ + if (in_kernel) { + printk("\nStack: "); + show_stack(current, (unsigned long*) sp); + + printk("\nCode: "); + if (regs->bpc < PAGE_OFFSET) + goto bad; + + for(i=0;i<20;i++) { + unsigned char c; + if (__get_user(c, &((unsigned char*)regs->bpc)[i])) { +bad: + printk(" Bad PC value."); + break; + } + printk("%02x ", c); + } + } + printk("\n"); +} + +spinlock_t die_lock = SPIN_LOCK_UNLOCKED; + +void die(const char * str, struct pt_regs * regs, long err) +{ + console_verbose(); + spin_lock_irq(&die_lock); + bust_spinlocks(1); + printk("%s: %04lx\n", str, err & 0xffff); + show_registers(regs); + bust_spinlocks(0); + spin_unlock_irq(&die_lock); + do_exit(SIGSEGV); +} + +static __inline__ void die_if_kernel(const char * str, + struct pt_regs * regs, long err) +{ + if (!user_mode(regs)) + die(str, regs, err); +} + +static __inline__ void do_trap(int trapnr, int signr, const char * str, + struct pt_regs * regs, long error_code, siginfo_t *info) +{ + if (user_mode(regs)) { + /* trap_signal */ + struct task_struct *tsk = current; + tsk->thread.error_code = error_code; + tsk->thread.trap_no = trapnr; + if (info) + force_sig_info(signr, info, tsk); + else + force_sig(signr, tsk); + return; + } else { + /* kernel_trap */ + if (!fixup_exception(regs)) + die(str, regs, error_code); + return; + } +} + +#define DO_ERROR(trapnr, signr, str, name) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +{ \ + do_trap(trapnr, signr, 0, regs, error_code, NULL); \ +} + +#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +{ \ + siginfo_t info; \ + info.si_signo = signr; \ + info.si_errno = 0; \ + info.si_code = sicode; \ + info.si_addr = (void __user *)siaddr; \ + do_trap(trapnr, signr, str, regs, error_code, &info); \ +} + +DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap) +DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc) +DO_ERROR_INFO(0x100, SIGILL, "privilege instruction", pie_handler, ILL_PRVOPC, regs->bpc) + +extern int handle_unaligned_access(unsigned long, struct pt_regs *); + +/* This code taken from arch/sh/kernel/traps.c */ +asmlinkage void do_alignment_check(struct pt_regs *regs, long error_code) +{ + mm_segment_t oldfs; + unsigned long insn; + int tmp; + + oldfs = get_fs(); + + if (user_mode(regs)) { + local_irq_enable(); + current->thread.error_code = error_code; + current->thread.trap_no = 0x17; + + set_fs(USER_DS); + if (copy_from_user(&insn, (void *)regs->bpc, 4)) { + set_fs(oldfs); + goto uspace_segv; + } + tmp = handle_unaligned_access(insn, regs); + set_fs(oldfs); + + if (!tmp) + return; + + uspace_segv: + printk(KERN_NOTICE "Killing process \"%s\" due to unaligned " + "access\n", current->comm); + force_sig(SIGSEGV, current); + } else { + set_fs(KERNEL_DS); + if (copy_from_user(&insn, (void *)regs->bpc, 4)) { + set_fs(oldfs); + die("insn faulting in do_address_error", regs, 0); + } + handle_unaligned_access(insn, regs); + set_fs(oldfs); + } +} + diff -Nru a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/vmlinux.lds.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,145 @@ +/* ld script to make M32R Linux kernel + */ + +#include +#include +#include +#include + +OUTPUT_ARCH(m32r) +ENTRY(startup_32) +#if defined(__LITTLE_ENDIAN__) + jiffies = jiffies_64; +#else + jiffies = jiffies_64 + 4; +#endif +SECTIONS +{ + . = CONFIG_MEMORY_START + __PAGE_OFFSET; + eit_vector = .; + + . = . + 0x1000; + .empty_zero_page : { *(.empty_zero_page) } = 0 + + /* read-only */ + _text = .; /* Text and read-only data */ + .boot : { *(.boot) } = 0 + .text : { + *(.text) + SCHED_TEXT + *(.fixup) + *(.gnu.warning) + } = 0x9090 +#ifdef CONFIG_SMP + . = ALIGN(65536); + .eit_vector4 : { *(.eit_vector4) } +#endif + _etext = .; /* End of text section */ + + . = ALIGN(16); /* Exception table */ + __start___ex_table = .; + __ex_table : { *(__ex_table) } + __stop___ex_table = .; + + RODATA + + /* writeable */ + .data : { /* Data */ + *(.spu) + *(.spi) + *(.data) + CONSTRUCTORS + } + + . = ALIGN(4096); + __nosave_begin = .; + .data_nosave : { *(.data.nosave) } + . = ALIGN(4096); + __nosave_end = .; + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + + _edata = .; /* End of data section */ + + . = ALIGN(8192); /* init_task */ + .data.init_task : { *(.data.init_task) } + + /* will be freed after init */ + . = ALIGN(4096); /* Init code and data */ + __init_begin = .; + .init.text : { + _sinittext = .; + *(.init.text) + _einittext = .; + } + .init.data : { *(.init.data) } + . = ALIGN(16); + __setup_start = .; + .init.setup : { *(.init.setup) } + __setup_end = .; + __start___param = .; + __param : { *(__param) } + __stop___param = .; + __initcall_start = .; + .initcall.init : { + *(.initcall1.init) + *(.initcall2.init) + *(.initcall3.init) + *(.initcall4.init) + *(.initcall5.init) + *(.initcall6.init) + *(.initcall7.init) + } + __initcall_end = .; + __con_initcall_start = .; + .con_initcall.init : { *(.con_initcall.init) } + __con_initcall_end = .; + SECURITY_INIT + . = ALIGN(4); + __alt_instructions = .; + .altinstructions : { *(.altinstructions) } + __alt_instructions_end = .; + .altinstr_replacement : { *(.altinstr_replacement) } + /* .exit.text is discard at runtime, not link time, to deal with references + from .altinstructions and .eh_frame */ + .exit.text : { *(.exit.text) } + .exit.data : { *(.exit.data) } + . = ALIGN(4096); + __initramfs_start = .; + .init.ramfs : { *(.init.ramfs) } + __initramfs_end = .; + . = ALIGN(32); + __per_cpu_start = .; + .data.percpu : { *(.data.percpu) } + __per_cpu_end = .; + . = ALIGN(4096); + __init_end = .; + /* freed after init ends here */ + + __bss_start = .; /* BSS */ + .bss : { *(.bss) } + . = ALIGN(4); + __bss_stop = .; + + _end = . ; + + /* Sections to be discarded */ + /DISCARD/ : { + *(.exit.text) + *(.exit.data) + *(.exitcall.exit) + } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } +} diff -Nru a/arch/m32r/lib/Makefile b/arch/m32r/lib/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,7 @@ +# +# Makefile for M32R-specific library files.. +# + +lib-y := checksum.o ashxdi3.o memset.o memcpy.o getuser.o \ + putuser.o delay.o strlen.o usercopy.o csum_partial_copy.o + diff -Nru a/arch/m32r/lib/ashxdi3.S b/arch/m32r/lib/ashxdi3.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/ashxdi3.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,297 @@ +/* + * linux/arch/m32r/lib/ashxdi3.S + * + * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata + * + */ +/* $Id$ */ + +#include + +; +; input (r0,r1) src +; input r2 shift val +; r3 scratch +; output (r0,r1) +; + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#ifndef __LITTLE_ENDIAN__ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || srai r0, #31 + addi r2, #-32 + sra r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || srl r1, r2 + sra r0, r2 || neg r2, r2 + sll r3, r2 + or r1, r3 || jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || addi r2, #-32 + sll r0, r2 || ldi r1, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || sll r0, r2 + sll r1, r2 || neg r2, r2 + srl r3, r2 + or r0, r3 || jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || addi r2, #-32 + ldi r0, #0 || srl r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || srl r1, r2 + srl r0, r2 || neg r2, r2 + sll r3, r2 + or r1, r3 || jmp r14 + +#else /* LITTLE_ENDIAN */ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || srai r1, #31 + addi r2, #-32 + sra r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || srl r0, r2 + sra r1, r2 || neg r2, r2 + sll r3, r2 + or r0, r3 || jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || addi r2, #-32 + sll r1, r2 || ldi r0, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || sll r1, r2 + sll r0, r2 || neg r2, r2 + srl r3, r2 + or r1, r3 || jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || addi r2, #-32 + ldi r1, #0 || srl r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || srl r0, r2 + srl r1, r2 || neg r2, r2 + sll r3, r2 + or r0, r3 || jmp r14 + +#endif + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#ifndef __LITTLE_ENDIAN__ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + srai r0, #31 + addi r2, #-32 + sra r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + srl r1, r2 + sra r0, r2 + neg r2, r2 + sll r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + addi r2, #-32 + sll r0, r2 + ldi r1, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + sll r0, r2 + sll r1, r2 + neg r2, r2 + srl r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + ldi r0, #0 + addi r2, #-32 + srl r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + srl r1, r2 + srl r0, r2 + neg r2, r2 + sll r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + +#else + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + srai r1, #31 + addi r2, #-32 + sra r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + srl r0, r2 + sra r1, r2 + neg r2, r2 + sll r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + addi r2, #-32 + sll r1, r2 + ldi r0, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + sll r1, r2 + sll r0, r2 + neg r2, r2 + srl r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + ldi r1, #0 + addi r2, #-32 + srl r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + srl r0, r2 + srl r1, r2 + neg r2, r2 + sll r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + +#endif + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end + diff -Nru a/arch/m32r/lib/checksum.S b/arch/m32r/lib/checksum.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/checksum.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,322 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * IP/TCP/UDP checksumming routines + * + * Authors: Jorge Cwik, + * Arnt Gulbrandsen, + * Tom May, + * Pentium Pro/II routines: + * Alexander Kjeldaas + * Finn Arne Gangstad + * Lots of code moved from tcp.c and ip.c; see those files + * for more names. + * + * Changes: Ingo Molnar, converted csum_partial_copy() to 2.1 exception + * handling. + * Andi Kleen, add zeroing on error + * converted to pure assembler + * Hirokazu Takata,Hiroyuki Kondo rewrite for the m32r architecture. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +/* $Id$ */ + + +#include +#include +#include +#include + +/* + * computes a partial checksum, e.g. for TCP/UDP fragments + */ + +/* +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) + */ + + +#ifdef CONFIG_ISA_DUAL_ISSUE + + /* + * Experiments with Ethernet and SLIP connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. We get at + * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. + * Fortunately, it is easy to convert 2-byte alignment to 4-byte + * alignment for the unrolled loop. + */ + + .text +ENTRY(csum_partial) + ; Function args + ; r0: unsigned char *buff + ; r1: int len + ; r2: unsigned int sum + + push r2 || ldi r2, #0 + and3 r7, r0, #1 ; Check alignment. + beqz r7, 1f ; Jump if alignment is ok. + ; 1-byte mis aligned + ldub r4, @r0 || addi r0, #1 + ; clear c-bit || Alignment uses up bytes. + cmp r0, r0 || addi r1, #-1 + ldi r3, #0 || addx r2, r4 + addx r2, r3 + .fillinsn +1: + and3 r4, r0, #2 ; Check alignment. + beqz r4, 2f ; Jump if alignment is ok. + ; clear c-bit || Alignment uses up two bytes. + cmp r0, r0 || addi r1, #-2 + bgtz r1, 1f ; Jump if we had at least two bytes. + bra 4f || addi r1, #2 + .fillinsn ; len(r1) was < 2. Deal with it. +1: + ; 2-byte aligned + lduh r4, @r0 || ldi r3, #0 + addx r2, r4 || addi r0, #2 + addx r2, r3 + .fillinsn +2: + ; 4-byte aligned + cmp r0, r0 ; clear c-bit + srl3 r6, r1, #5 + beqz r6, 2f + .fillinsn + +1: ld r3, @r0+ + ld r4, @r0+ ; +4 + ld r5, @r0+ ; +8 + ld r3, @r0+ || addx r2, r3 ; +12 + ld r4, @r0+ || addx r2, r4 ; +16 + ld r5, @r0+ || addx r2, r5 ; +20 + ld r3, @r0+ || addx r2, r3 ; +24 + ld r4, @r0+ || addx r2, r4 ; +28 + addx r2, r5 || addi r6, #-1 + addx r2, r3 + addx r2, r4 + bnez r6, 1b + + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn +2: and3 r6, r1, #0x1c ; withdraw len + beqz r6, 4f + srli r6, #2 + .fillinsn + +3: ld r4, @r0+ || addi r6, #-1 + addx r2, r4 + bnez r6, 3b + + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn +4: and3 r1, r1, #3 + beqz r1, 7f ; if len == 0 goto end + and3 r6, r1, #2 + beqz r6, 5f ; if len < 2 goto 5f(1byte) + lduh r4, @r0 || addi r0, #2 + addi r1, #-2 || slli r4, #16 + addx r2, r4 + beqz r1, 6f + .fillinsn +5: ldub r4, @r0 || ldi r1, #0 +#ifndef __LITTLE_ENDIAN__ + slli r4, #8 +#endif + addx r2, r4 + .fillinsn +6: addx r2, r1 + .fillinsn +7: + and3 r0, r2, #0xffff + srli r2, #16 + add r0, r2 + srl3 r2, r0, #16 + beqz r2, 1f + addi r0, #1 + and3 r0, r0, #0xffff + .fillinsn +1: + beqz r7, 1f ; swap the upper byte for the lower + and3 r2, r0, #0xff + srl3 r0, r0, #8 + slli r2, #8 + or r0, r2 + .fillinsn +1: + pop r2 || cmp r0, r0 + addx r0, r2 || ldi r2, #0 + addx r0, r2 + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + /* + * Experiments with Ethernet and SLIP connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. We get at + * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. + * Fortunately, it is easy to convert 2-byte alignment to 4-byte + * alignment for the unrolled loop. + */ + + .text +ENTRY(csum_partial) + ; Function args + ; r0: unsigned char *buff + ; r1: int len + ; r2: unsigned int sum + + push r2 + ldi r2, #0 + and3 r7, r0, #1 ; Check alignment. + beqz r7, 1f ; Jump if alignment is ok. + ; 1-byte mis aligned + ldub r4, @r0 + addi r0, #1 + addi r1, #-1 ; Alignment uses up bytes. + cmp r0, r0 ; clear c-bit + ldi r3, #0 + addx r2, r4 + addx r2, r3 + .fillinsn +1: + and3 r4, r0, #2 ; Check alignment. + beqz r4, 2f ; Jump if alignment is ok. + addi r1, #-2 ; Alignment uses up two bytes. + cmp r0, r0 ; clear c-bit + bgtz r1, 1f ; Jump if we had at least two bytes. + addi r1, #2 ; len(r1) was < 2. Deal with it. + bra 4f + .fillinsn +1: + ; 2-byte aligned + lduh r4, @r0 + addi r0, #2 + ldi r3, #0 + addx r2, r4 + addx r2, r3 + .fillinsn +2: + ; 4-byte aligned + cmp r0, r0 ; clear c-bit + srl3 r6, r1, #5 + beqz r6, 2f + .fillinsn + +1: ld r3, @r0+ + ld r4, @r0+ ; +4 + ld r5, @r0+ ; +8 + addx r2, r3 + addx r2, r4 + addx r2, r5 + ld r3, @r0+ ; +12 + ld r4, @r0+ ; +16 + ld r5, @r0+ ; +20 + addx r2, r3 + addx r2, r4 + addx r2, r5 + ld r3, @r0+ ; +24 + ld r4, @r0+ ; +28 + addi r6, #-1 + addx r2, r3 + addx r2, r4 + bnez r6, 1b + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn + +2: and3 r6, r1, #0x1c ; withdraw len + beqz r6, 4f + srli r6, #2 + .fillinsn + +3: ld r4, @r0+ + addi r6, #-1 + addx r2, r4 + bnez r6, 3b + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn + +4: and3 r1, r1, #3 + beqz r1, 7f ; if len == 0 goto end + and3 r6, r1, #2 + beqz r6, 5f ; if len < 2 goto 5f(1byte) + + lduh r4, @r0 + addi r0, #2 + addi r1, #-2 + slli r4, #16 + addx r2, r4 + beqz r1, 6f + .fillinsn +5: ldub r4, @r0 +#ifndef __LITTLE_ENDIAN__ + slli r4, #8 +#endif + addx r2, r4 + .fillinsn +6: ldi r5, #0 + addx r2, r5 + .fillinsn +7: + and3 r0, r2, #0xffff + srli r2, #16 + add r0, r2 + srl3 r2, r0, #16 + beqz r2, 1f + addi r0, #1 + and3 r0, r0, #0xffff + .fillinsn +1: + beqz r7, 1f + mv r2, r0 + srl3 r0, r2, #8 + and3 r2, r2, #0xff + slli r2, #8 + or r0, r2 + .fillinsn +1: + pop r2 + cmp r0, r0 + addx r0, r2 + ldi r2, #0 + addx r0, r2 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +/* +unsigned int csum_partial_copy_generic (const char *src, char *dst, + int len, int sum, int *src_err_ptr, int *dst_err_ptr) + */ + +/* + * Copy from ds while checksumming, otherwise like csum_partial + * + * The macros SRC and DST specify the type of access for the instruction. + * thus we can call a custom exception handler for all access types. + * + * FIXME: could someone double-check whether I haven't mixed up some SRC and + * DST definitions? It's damn hard to trigger all cases. I hope I got + * them all but there's no guarantee. + */ + +ENTRY(csum_partial_copy_generic) + nop + nop + nop + nop + jmp r14 + nop + nop + nop + diff -Nru a/arch/m32r/lib/csum_partial_copy.c b/arch/m32r/lib/csum_partial_copy.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/csum_partial_copy.c 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,58 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * MIPS specific IP/TCP/UDP checksumming routines + * + * Authors: Ralf Baechle, + * Lots of code moved from tcp.c and ip.c; see those files + * for more names. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#include +#include + +#include +#include +#include +#include + +/* + * Copy while checksumming, otherwise like csum_partial + */ +unsigned int csum_partial_copy_nocheck (const char *src, char *dst, + int len, unsigned int sum) +{ + sum = csum_partial(src, len, sum); + memcpy(dst, src, len); + + return sum; +} +EXPORT_SYMBOL(csum_partial_copy_nocheck); + +/* + * Copy from userspace and compute checksum. If we catch an exception + * then zero the rest of the buffer. + */ +unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, + int len, unsigned int sum, + int *err_ptr) +{ + int missing; + + missing = copy_from_user(dst, src, len); + if (missing) { + memset(dst + len - missing, 0, missing); + *err_ptr = -EFAULT; + } + + return csum_partial(dst, len-missing, sum); +} +EXPORT_SYMBOL(csum_partial_copy_from_user); diff -Nru a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/delay.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,126 @@ +/* + * linux/arch/m32r/lib/delay.c + * + * Copyright (c) 2002 Hitoshi Yamamoto, Hirokazu Takata + * Copyright (c) 2004 Hirokazu Takata + */ + +/* $Id$ */ + +#include +#include +#ifdef CONFIG_SMP +#include +#include +#include +#endif /* CONFIG_SMP */ +#include + +void __delay(unsigned long loops) +{ +#ifdef CONFIG_ISA_DUAL_ISSUE + __asm__ __volatile__ ( + "beqz %0, 2f \n\t" + "addi %0, #-1 \n\t" + + " .fillinsn \n\t" + "1: \n\t" + "cmpz %0 || addi %0, #-1 \n\t" + "bc 2f || cmpz %0 \n\t" + "bc 2f || addi %0, #-1 \n\t" + "cmpz %0 || addi %0, #-1 \n\t" + "bc 2f || cmpz %0 \n\t" + "bnc 1b || addi %0, #-1 \n\t" + " .fillinsn \n\t" + "2: \n\t" + : "+r" (loops) + : "r" (0) + : "cbit" + ); +#else + __asm__ __volatile__ ( + "beqz %0, 2f \n\t" + " .fillinsn \n\t" + "1: \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "bgtz %0, 1b \n\t" + " .fillinsn \n\t" + "2:i \n\t" + : "+r" (loops) + : "r" (0) + ); +#endif +} + +void __const_udelay(unsigned long xloops) +{ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + /* + * loops [1] = (xloops >> 32) [sec] * loops_per_jiffy [1/jiffy] + * * HZ [jiffy/sec] + * = (xloops >> 32) [sec] * (loops_per_jiffy * HZ) [1/sec] + * = (((xloops * loops_per_jiffy) >> 32) * HZ) [1] + * + * NOTE: + * - '[]' depicts variable's dimension in the above equation. + * - "rac" instruction rounds the accumulator in word size. + */ + __asm__ __volatile__ ( + "srli %0, #1 \n\t" + "mulwhi %0, %1 ; a0 \n\t" + "mulwu1 %0, %1 ; a1 \n\t" + "sadd ; a0 += (a1 >> 16) \n\t" + "rac a0, a0, #1 \n\t" + "mvfacmi %0, a0 \n\t" + : "+r" (xloops) + : "r" (current_cpu_data.loops_per_jiffy) + : "a0", "a1" + ); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + /* + * u64 ull; + * ull = (u64)xloops * (u64)current_cpu_data.loops_per_jiffy; + * xloops = (ull >> 32); + */ + __asm__ __volatile__ ( + "and3 r4, %0, #0xffff \n\t" + "and3 r5, %1, #0xffff \n\t" + "mul r4, r5 \n\t" + "srl3 r6, %0, #16 \n\t" + "srli r4, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "and3 r5, %0, #0xffff \n\t" + "srl3 r6, %1, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "srl3 r5, %0, #16 \n\t" + "srli r4, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "mv %0, r4 \n\t" + : "+r" (xloops) + : "r" (current_cpu_data.loops_per_jiffy) + : "r4", "r5", "r6" + ); +#else +#error unknown isa configuration +#endif + __delay(xloops * HZ); +} + +void __udelay(unsigned long usecs) +{ + __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ +} + +void __ndelay(unsigned long nsecs) +{ + __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ +} diff -Nru a/arch/m32r/lib/getuser.S b/arch/m32r/lib/getuser.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/getuser.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,88 @@ +/* + * __get_user functions. + * + * (C) Copyright 2001 Hirokazu Takata + * + * These functions have a non-standard call interface + * to make them more efficient, especially as they + * return an error value in addition to the "real" + * return value. + */ + +#include + +/* + * __get_user_X + * + * Inputs: r0 contains the address + * + * Outputs: r0 is error code (0 or -EFAULT) + * r1 contains zero-extended value + * + * These functions should not modify any other registers, + * as they get called from within inline assembly. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text + .balign 4 + .globl __get_user_1 +__get_user_1: +1: ldub r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_2 +__get_user_2: +2: lduh r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_4 +__get_user_4: +3: ld r1, @r0 || ldi r0, #0 + jmp r14 + +bad_get_user: + ldi r1, #0 || ldi r0, #-14 + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text + .balign 4 + .globl __get_user_1 +__get_user_1: +1: ldub r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_2 +__get_user_2: +2: lduh r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_4 +__get_user_4: +3: ld r1, @r0 + ldi r0, #0 + jmp r14 + +bad_get_user: + ldi r1, #0 + ldi r0, #-14 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +.section __ex_table,"a" + .long 1b,bad_get_user + .long 2b,bad_get_user + .long 3b,bad_get_user +.previous + + .end diff -Nru a/arch/m32r/lib/memcpy.S b/arch/m32r/lib/memcpy.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/memcpy.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,95 @@ +/* + * linux/arch/m32r/lib/memcpy.S + * + * Copyright (C) 2001 Hiroyuki Kondo, and Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + * + * void *memcopy(void *dst, const void *src, int n); + * + * dst: r0 + * src: r1 + * n : r2 + */ +/* $Id$ */ + + + .text +#include +#include +#include + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text +ENTRY(memcpy) +memcopy: + mv r4, r0 || mv r7, r0 + or r7, r1 || cmpz r2 + jc r14 || cmpeq r0, r1 ; return if r2=0 + jc r14 ; return if r0=r1 + + and3 r7, r7, #3 + bnez r7, byte_copy + srl3 r3, r2, #2 + and3 r2, r2, #3 + beqz r3, byte_copy + addi r4, #-4 +word_copy: + ld r7, @r1+ || addi r3, #-1 + st r7, @+r4 || cmpz r2 + bnez r3, word_copy + addi r4, #4 || jc r14 ; return if r2=0 +#if defined(CONFIG_ISA_M32R2) +byte_copy: + ldb r7, @r1 || addi r1, #1 + addi r2, #-1 || stb r7, @r4+ + bnez r2, byte_copy +#elif defined(CONFIG_ISA_M32R) +byte_copy: + ldb r7, @r1 || addi r1, #1 + addi r2, #-1 || stb r7, @r4 + addi r4, #1 + bnez r2, byte_copy +#else +#error unknown isa configuration +#endif +end_memcopy: + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text +ENTRY(memcpy) +memcopy: + mv r4, r0 + mv r7, r0 + or r7, r1 + beq r0, r1, end_memcopy + beqz r2, end_memcopy + + and3 r7, r7, #3 + bnez r7, byte_copy + srl3 r3, r2, #2 + and3 r2, r2, #3 + beqz r3, byte_copy + addi r4, #-4 +word_copy: + ld r7, @r1+ + addi r3, #-1 + st r7, @+r4 + bnez r3, word_copy + beqz r2, end_memcopy + addi r4, #4 +byte_copy: + ldb r7, @r1 + addi r1, #1 + addi r2, #-1 + stb r7, @r4 + addi r4, #1 + bnez r2, byte_copy +end_memcopy: + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/memset.S b/arch/m32r/lib/memset.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/memset.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,178 @@ +/* + * linux/arch/m32r/lib/memset.S + * + * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + * + * void *memset(void *dst, int val, int len); + * + * dst: r0 + * val: r1 + * len: r2 + * ret: r0 + * + */ +/* $Id$ */ + +#include + + .text + .global memset + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .align 4 +memset: + mv r4, r0 || cmpz r2 + jc r14 + cmpui r2, #16 + bnc qword_align_check + cmpui r2, #4 + bc byte_set +word_align_check: /* len >= 4 */ + and3 r3, r4, #3 + beqz r3, word_set + addi r3, #-4 + neg r3, r3 /* r3 = -(r3 - 4) */ +align_word: + stb r1, @r4 || addi r4, #1 + addi r2, #-1 || addi r3, #-1 + bnez r3, align_word + cmpui r2, #4 + bc byte_set +word_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 || addi r4, #-4 + sll3 r3, r1, #16 + or r1, r3 || addi r2, #-4 +word_set_loop: + st r1, @+r4 || addi r2, #-4 + bgtz r2, word_set_loop + bnez r2, byte_set_wrap + st r1, @+r4 + jmp r14 + +qword_align_check: /* len >= 16 */ + and3 r3, r4, #15 + bnez r3, word_align_check +qword_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 || addi r4, #-4 + sll3 r3, r1, #16 + or r1, r3 || ldi r5, #16 +qword_set_loop: + ld r3, @(4,r4) /* cache line allocate */ + st r1, @+r4 || addi r2, #-16 + st r1, @+r4 || cmpu r2, r5 + st r1, @+r4 + st r1, @+r4 + bnc qword_set_loop || cmpz r2 + jc r14 +word_set_wrap: + cmpui r2, #4 + bc byte_set + addi r2, #-4 + bra word_set_loop + +byte_set_wrap: + addi r2, #4 + addi r4, #4 || cmpz r2 + jc r14 +#if defined(CONFIG_ISA_M32R2) +byte_set: + addi r2, #-1 || stb r1, @r4+ + bnez r2, byte_set +#elif defined(CONFIG_ISA_M32R) +byte_set: + addi r2, #-1 || stb r1, @r4 + addi r4, #1 + bnez r2, byte_set +#else +#error unknown isa configuration +#endif +end_memset: + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .align 4 +memset: + mv r4, r0 + beqz r2, end_memset + cmpui r2, #16 + bnc qword_align_check + cmpui r2, #4 + bc byte_set +word_align_check: /* len >= 4 */ + and3 r3, r4, #3 + beqz r3, word_set + addi r3, #-4 + neg r3, r3 /* r3 = -(r3 - 4) */ +align_word: + stb r1, @r4 + addi r4, #1 + addi r2, #-1 + addi r3, #-1 + bnez r3, align_word + cmpui r2, #4 + bc byte_set +word_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 + sll3 r3, r1, #16 + or r1, r3 + addi r2, #-4 + addi r4, #-4 +word_set_loop: + st r1, @+r4 + addi r2, #-4 + bgtz r2, word_set_loop + bnez r2, byte_set_wrap + st r1, @+r4 + jmp r14 + +qword_align_check: /* len >= 16 */ + and3 r3, r4, #15 + bnez r3, word_align_check +qword_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 + sll3 r3, r1, #16 + or r1, r3 + addi r4, #-4 +qword_set_loop: + ld r3, @(4,r4) /* cache line allocate */ + addi r2, #-16 + st r1, @+r4 + st r1, @+r4 + cmpui r2, #16 + st r1, @+r4 + st r1, @+r4 + bnc qword_set_loop + bnez r2, word_set_wrap + jmp r14 +word_set_wrap: + cmpui r2, #4 + bc byte_set + addi r2, #-4 + bra word_set_loop + +byte_set_wrap: + addi r2, #4 + addi r4, #4 + beqz r2, end_memset +byte_set: + addi r2, #-1 + stb r1, @r4 + addi r4, #1 + bnez r2, byte_set +end_memset: + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/putuser.S b/arch/m32r/lib/putuser.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/putuser.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,84 @@ +/* + * __put_user functions. + * + * (C) Copyright 1998 Linus Torvalds + * (C) Copyright 2001 Hirokazu Takata + * + * These functions have a non-standard call interface + * to make them more efficient. + */ + +#include + +/* + * __put_user_X + * + * Inputs: r0 contains the address + * r1 contains the value + * + * Outputs: r0 is error code (0 or -EFAULT) + * r1 is corrupted (will contain "current_task"). + * + * These functions should not modify any other registers, + * as they get called from within inline assembly. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text + .balign 4 + .globl __put_user_1 +__put_user_1: +1: stb r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_2 +__put_user_2: +2: sth r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_4 +__put_user_4: +3: st r1, @r0 || ldi r0, #0 + jmp r14 + +bad_put_user: + ldi r0, #-14 || jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text + .balign 4 + .globl __put_user_1 +__put_user_1: +1: stb r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_2 +__put_user_2: +2: sth r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_4 +__put_user_4: +3: st r1, @r0 + ldi r0, #0 + jmp r14 + +bad_put_user: + ldi r0, #-14 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +.section __ex_table,"a" + .long 1b,bad_put_user + .long 2b,bad_put_user + .long 3b,bad_put_user +.previous diff -Nru a/arch/m32r/lib/strlen.S b/arch/m32r/lib/strlen.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/strlen.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,120 @@ +/* + * linux/arch/m32r/strlen.S -- strlen code. + * + * Copyright (C) 2001 Hirokazu Takata + * + * size_t strlen(const char *s); + * + */ +/* $Id$ */ + + +#include +#include +#include + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text +ENTRY(strlen) + mv r6, r0 || ldi r2, #0 + and3 r0, r0, #3 + bnez r0, strlen_byte +; +strlen_word: + ld r0, @r6+ +; + seth r5, #high(0x01010101) + or3 r5, r5, #low(0x01010101) + sll3 r7, r5, #7 +strlen_word_loop: + ld r1, @r6+ || not r4, r0 + sub r0, r5 || and r4, r7 + and r4, r0 + bnez r4, strlen_last_bytes + ld r0, @r6+ || not r4, r1 + sub r1, r5 || and r4, r7 + and r4, r1 || addi r2, #4 + bnez r4, strlen_last_bytes + addi r2, #4 || bra.s strlen_word_loop + + ; NOTE: If a null char. exists, return 0. + ; if ((x - 0x01010101) & ~x & 0x80808080) + ; return 0; +; +strlen_byte: + ldb r1, @r6 || addi r6, #1 + beqz r1, strlen_exit + addi r2, #1 || bra.s strlen_byte +; +strlen_last_bytes: + ldi r0, #4 || addi r6, #-8 +; +strlen_byte_loop: + ldb r1, @r6 || addi r6, #1 + addi r0, #-1 || cmpz r1 + bc.s strlen_exit || cmpz r0 + addi r2, #1 || bnc.s strlen_byte_loop +; +strlen_exit: + mv r0, r2 || jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text +ENTRY(strlen) + mv r6, r0 + ldi r2, #0 + and3 r0, r0, #3 + bnez r0, strlen_byte +; +strlen_word: + ld r0, @r6+ +; + seth r5, #high(0x01010101) + or3 r5, r5, #low(0x01010101) + sll3 r7, r5, #7 +strlen_word_loop: + ld r1, @r6+ + not r4, r0 ; NOTE: If a null char. exists, return 0. + sub r0, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) + and r4, r7 ; return 0; + and r4, r0 + bnez r4, strlen_last_bytes + addi r2, #4 +; + ld r0, @r6+ + not r4, r1 ; NOTE: If a null char. exists, return 0. + sub r1, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) + and r4, r7 ; return 0; + and r4, r1 + bnez r4, strlen_last_bytes + addi r2, #4 + bra strlen_word_loop +; +strlen_byte: + ldb r1, @r6 + addi r6, #1 + beqz r1, strlen_exit + addi r2, #1 + bra strlen_byte +; +strlen_last_bytes: + ldi r0, #4 + addi r6, #-8 +; +strlen_byte_loop: + ldb r1, @r6 + addi r6, #1 + addi r0, #-1 + beqz r1, strlen_exit + addi r2, #1 + bnez r0, strlen_byte_loop +; +strlen_exit: + mv r0, r2 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/usercopy.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,391 @@ +/* + * User address space access functions. + * The non inlined parts of asm-m32r/uaccess.h are here. + * + * Copyright 1997 Andi Kleen + * Copyright 1997 Linus Torvalds + * Copyright 2001, 2002, 2004 Hirokazu Takata + */ +#include +#include +#include +#include +#include + +unsigned long +__generic_copy_to_user(void *to, const void *from, unsigned long n) +{ + prefetch(from); + if (access_ok(VERIFY_WRITE, to, n)) + __copy_user(to,from,n); + return n; +} + +unsigned long +__generic_copy_from_user(void *to, const void *from, unsigned long n) +{ + prefetchw(to); + if (access_ok(VERIFY_READ, from, n)) + __copy_user_zeroing(to,from,n); + else + memset(to, 0, n); + return n; +} + + +/* + * Copy a null terminated string from userspace. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#define __do_strncpy_from_user(dst,src,count,res) \ +do { \ + int __d0, __d1, __d2; \ + __asm__ __volatile__( \ + " beqz %1, 2f\n" \ + " .fillinsn\n" \ + "0: ldb r14, @%3 || addi %3, #1\n" \ + " stb r14, @%4 || addi %4, #1\n" \ + " beqz r14, 1f\n" \ + " addi %1, #-1\n" \ + " bnez %1, 0b\n" \ + " .fillinsn\n" \ + "1: sub %0, %1\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: seth r14, #high(2b)\n" \ + " or3 r14, r14, #low(2b)\n" \ + " jmp r14 || ldi %0, #%5\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,3b\n" \ + ".previous" \ + : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ + "=&r" (__d2) \ + : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ + "4"(dst) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#define __do_strncpy_from_user(dst,src,count,res) \ +do { \ + int __d0, __d1, __d2; \ + __asm__ __volatile__( \ + " beqz %1, 2f\n" \ + " .fillinsn\n" \ + "0: ldb r14, @%3\n" \ + " stb r14, @%4\n" \ + " addi %3, #1\n" \ + " addi %4, #1\n" \ + " beqz r14, 1f\n" \ + " addi %1, #-1\n" \ + " bnez %1, 0b\n" \ + " .fillinsn\n" \ + "1: sub %0, %1\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0, #%5\n" \ + " seth r14, #high(2b)\n" \ + " or3 r14, r14, #low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,3b\n" \ + ".previous" \ + : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ + "=&r" (__d2) \ + : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ + "4"(dst) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + +long +__strncpy_from_user(char *dst, const char *src, long count) +{ + long res; + __do_strncpy_from_user(dst, src, count, res); + return res; +} + +long +strncpy_from_user(char *dst, const char *src, long count) +{ + long res = -EFAULT; + if (access_ok(VERIFY_READ, src, 1)) + __do_strncpy_from_user(dst, src, count, res); + return res; +} + + +/* + * Zero Userspace + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#define __do_clear_user(addr,size) \ +do { \ + int __dst, __c; \ + __asm__ __volatile__( \ + " beqz %1, 9f\n" \ + " and3 r14, %0, #3\n" \ + " bnez r14, 2f\n" \ + " and3 r14, %1, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %1, %1, #3\n" \ + " beqz %2, 2f\n" \ + " addi %0, #-4\n" \ + " .fillinsn\n" \ + "0: ; word clear \n" \ + " st %6, @+%0 || addi %2, #-1\n" \ + " bnez %2, 0b\n" \ + " beqz %1, 9f\n" \ + " .fillinsn\n" \ + "2: ; byte clear \n" \ + " stb %6, @%0 || addi %1, #-1\n" \ + " addi %0, #1\n" \ + " bnez %1, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: slli %2, #2\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14 || add %1, %2\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,4b\n" \ + " .long 2b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ + : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#define __do_clear_user(addr,size) \ +do { \ + int __dst, __c; \ + __asm__ __volatile__( \ + " beqz %1, 9f\n" \ + " and3 r14, %0, #3\n" \ + " bnez r14, 2f\n" \ + " and3 r14, %1, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %1, %1, #3\n" \ + " beqz %2, 2f\n" \ + " addi %0, #-4\n" \ + " .fillinsn\n" \ + "0: st %6, @+%0 ; word clear \n" \ + " addi %2, #-1\n" \ + " bnez %2, 0b\n" \ + " beqz %1, 9f\n" \ + " .fillinsn\n" \ + "2: stb %6, @%0 ; byte clear \n" \ + " addi %1, #-1\n" \ + " addi %0, #1\n" \ + " bnez %1, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: slli %2, #2\n" \ + " add %1, %2\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,4b\n" \ + " .long 2b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ + : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +unsigned long +clear_user(void *to, unsigned long n) +{ + if (access_ok(VERIFY_WRITE, to, n)) + __do_clear_user(to, n); + return n; +} + +unsigned long +__clear_user(void *to, unsigned long n) +{ + __do_clear_user(to, n); + return n; +} + +/* + * Return the size of a string (including the ending 0) + * + * Return 0 on exception, a value greater than N if too long + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +long strnlen_user(const char *s, long n) +{ + unsigned long mask = -__addr_ok(s); + unsigned long res; + + __asm__ __volatile__( + " and %0, %5 || mv r1, %1\n" + " beqz %0, strnlen_exit\n" + " and3 r0, %1, #3\n" + " bnez r0, strnlen_byte_loop\n" + " cmpui %0, #4\n" + " bc strnlen_byte_loop\n" + "strnlen_word_loop:\n" + "0: ld r0, @%1+\n" + " pcmpbz r0\n" + " bc strnlen_last_bytes_fixup\n" + " addi %0, #-4\n" + " beqz %0, strnlen_exit\n" + " bgtz %0, strnlen_word_loop\n" + "strnlen_last_bytes:\n" + " mv %0, %4\n" + "strnlen_last_bytes_fixup:\n" + " addi %1, #-4\n" + "strnlen_byte_loop:\n" + "1: ldb r0, @%1 || addi %0, #-1\n" + " beqz r0, strnlen_exit\n" + " addi %1, #1\n" + " bnez %0, strnlen_byte_loop\n" + "strnlen_exit:\n" + " sub %1, r1\n" + " add3 %0, %1, #1\n" + " .fillinsn\n" + "9:\n" + ".section .fixup,\"ax\"\n" + " .balign 4\n" + "4: addi %1, #-4\n" + " .fillinsn\n" + "5: seth r1, #high(9b)\n" + " or3 r1, r1, #low(9b)\n" + " jmp r1 || ldi %0, #0\n" + ".previous\n" + ".section __ex_table,\"a\"\n" + " .balign 4\n" + " .long 0b,4b\n" + " .long 1b,5b\n" + ".previous" + : "=&r" (res), "=r" (s) + : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) + : "r0", "r1", "cbit"); + + /* NOTE: strnlen_user() algorism: + * { + * char *p; + * for (p = s; n-- && *p != '\0'; ++p) + * ; + * return p - s + 1; + * } + */ + + /* NOTE: If a null char. exists, return 0. + * if ((x - 0x01010101) & ~x & 0x80808080)\n" + * return 0;\n" + */ + + return res & mask; +} + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +long strnlen_user(const char *s, long n) +{ + unsigned long mask = -__addr_ok(s); + unsigned long res; + + __asm__ __volatile__( + " and %0, %5\n" + " mv r1, %1\n" + " beqz %0, strnlen_exit\n" + " and3 r0, %1, #3\n" + " bnez r0, strnlen_byte_loop\n" + " cmpui %0, #4\n" + " bc strnlen_byte_loop\n" + " sll3 r3, %6, #7\n" + "strnlen_word_loop:\n" + "0: ld r0, @%1+\n" + " not r2, r0\n" + " sub r0, %6\n" + " and r2, r3\n" + " and r2, r0\n" + " bnez r2, strnlen_last_bytes_fixup\n" + " addi %0, #-4\n" + " beqz %0, strnlen_exit\n" + " bgtz %0, strnlen_word_loop\n" + "strnlen_last_bytes:\n" + " mv %0, %4\n" + "strnlen_last_bytes_fixup:\n" + " addi %1, #-4\n" + "strnlen_byte_loop:\n" + "1: ldb r0, @%1\n" + " addi %0, #-1\n" + " beqz r0, strnlen_exit\n" + " addi %1, #1\n" + " bnez %0, strnlen_byte_loop\n" + "strnlen_exit:\n" + " sub %1, r1\n" + " add3 %0, %1, #1\n" + " .fillinsn\n" + "9:\n" + ".section .fixup,\"ax\"\n" + " .balign 4\n" + "4: addi %1, #-4\n" + " .fillinsn\n" + "5: ldi %0, #0\n" + " seth r1, #high(9b)\n" + " or3 r1, r1, #low(9b)\n" + " jmp r1\n" + ".previous\n" + ".section __ex_table,\"a\"\n" + " .balign 4\n" + " .long 0b,4b\n" + " .long 1b,5b\n" + ".previous" + : "=&r" (res), "=r" (s) + : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) + : "r0", "r1", "r2", "r3", "cbit"); + + /* NOTE: strnlen_user() algorism: + * { + * char *p; + * for (p = s; n-- && *p != '\0'; ++p) + * ; + * return p - s + 1; + * } + */ + + /* NOTE: If a null char. exists, return 0. + * if ((x - 0x01010101) & ~x & 0x80808080)\n" + * return 0;\n" + */ + + return res & mask; +} + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + diff -Nru a/arch/m32r/m32700ut/defconfig.m32700ut.smp b/arch/m32r/m32700ut/defconfig.m32700ut.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/defconfig.m32700ut.smp 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,662 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y +CONFIG_STOP_MACHINE=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +CONFIG_SMP=y +CONFIG_CHIP_M32700_TS1=y +CONFIG_NR_CPUS=2 +# CONFIG_NUMA is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set + +# +# SCSI low-level drivers +# +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_SATA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_DEBUG is not set + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +CONFIG_FB=y +CONFIG_FB_EPSON_S1D13806=y +# CONFIG_FB_VIRTUAL is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Logo configuration +# +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_LOGO_M32R_CLUT224=y + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/m32700ut/defconfig.m32700ut.up b/arch/m32r/m32700ut/defconfig.m32700ut.up --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/defconfig.m32700ut.up 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,659 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set + +# +# SCSI low-level drivers +# +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_SATA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_DEBUG is not set + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +CONFIG_FB=y +CONFIG_FB_EPSON_S1D13806=y +# CONFIG_FB_VIRTUAL is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Logo configuration +# +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_LOGO_M32R_CLUT224=y + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB b/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,249 @@ +# .gdbinit file +# $Id: dot.gdbinit_200MHz_16MB,v 1.1 2004/08/17 02:58:11 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ +#----- +# target platform: m32700ut + +# setting +set width 0d70 +set radix 0d16 + +debug_chaos + +# clk xin:cpu:bif:bus=25:200:50:50 +define clock_init + set *(unsigned long *)0x00ef4008 = 0x00000000 + set *(unsigned long *)0x00ef4004 = 0 + shell sleep 0.1 + # NOTE: Please change the master clock source from PLL-clock to Xin-clock + # and switch off PLL, before resetting the clock gear ratio. + + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00041302 + # Ch0-ADR (size:16MB) + set *(unsigned long *)0x00ef6020 = 0x08000002 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010517 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x08ffffff (16MB) +end + +# Initialize BSEL3 for UT-CFC +define cfc_init + set $sfrbase = 0xa0ef0000 +# too fast +# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f +end +document cfc_init + CF controller initialization +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Initialize TLB entries +define init_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set *(unsigned long *)($addr + 0x4) = 0 + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define tlb_init + set $itlb=0xfe000000 + init_tlb_entries $itlb 0d32 + set $dtlb=0xfe000800 + init_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + # SDRAM: 16MB + set *(unsigned long *)0x00ef6020 = 0x08000002 + cfc_init + # USB + set *(unsigned short *)0xb0301000 = 0x100 + + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x console=tty1 video=s1d13xxxfb:mode:240x320-16 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=16M \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x08001000 + set *(unsigned char *)0xffffffff = 0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + set $pc = 0 + b *0x04001000 + b *0x08001000 + b *0x08002000 + si + c + tlb_init + del + setup + load_modules + boot +end + +define si + stepi + x/i $pc + show_reg +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc = 0 +b *0x04001000 +b *0x08001000 +b *0x08002000 +c +tlb_init +del +setup +load_modules +boot + diff -Nru a/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB b/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,249 @@ +# .gdbinit file +# $Id: dot.gdbinit_300MHz_32MB,v 1.1 2004/08/17 02:58:11 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ +#----- +# target platform: m32700ut + +# setting +set width 0d70 +set radix 0d16 + +debug_chaos + +# clk xin:cpu:bif:bus=25:300:75:75 +define clock_init + set *(unsigned long *)0x00ef4008 = 0x00000000 + set *(unsigned long *)0x00ef4004 = 0 + shell sleep 0.1 + # NOTE: Please change the master clock source from PLL-clock to Xin-clock + # and switch off PLL, before resetting the clock gear ratio. + + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 5 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:16MB) + set *(unsigned long *)0x00ef6020 = 0x08000002 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010e24 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x08ffffff (16MB) +end + +# Initialize BSEL3 for UT-CFC +define cfc_init + set $sfrbase = 0xa0ef0000 +# too fast +# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f +end +document cfc_init + CF controller initialization +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Initialize TLB entries +define init_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set *(unsigned long *)($addr + 0x4) = 0 + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define tlb_init + set $itlb=0xfe000000 + init_tlb_entries $itlb 0d32 + set $dtlb=0xfe000800 + init_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + # SDRAM: 16MB + set *(unsigned long *)0x00ef6020 = 0x08000002 + cfc_init + # USB + set *(unsigned short *)0xb0301000 = 0x100 + + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d300000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d75000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x console=tty1 video=s1d13xxxfb:mode:240x320-16 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=16M \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x08001000 + set *(unsigned char *)0xffffffff = 0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + set $pc = 0 + b *0x04001000 + b *0x08001000 + b *0x08002000 + si + c + tlb_init + del + setup + load_modules + boot +end + +define si + stepi + x/i $pc + show_reg +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc = 0 +b *0x04001000 +b *0x08001000 +b *0x08002000 +c +tlb_init +del +setup +load_modules +boot + diff -Nru a/arch/m32r/m32700ut/m32r-flash.c b/arch/m32r/m32700ut/m32r-flash.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/m32r-flash.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,227 @@ +/* + * Flash memory access on M32R based devices + * + * Copyright (C) 2003 Takeo Takahashi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * $Id$ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#define WINDOW_ADDR (0xa0000000) /* start of flash memory */ + +static __u8 m32r_read8(struct map_info *map, unsigned long ofs) +{ + return readb(map->map_priv_1 + ofs); +} + +static __u16 m32r_read16(struct map_info *map, unsigned long ofs) +{ + return readw(map->map_priv_1 + ofs); +} + +static __u32 m32r_read32(struct map_info *map, unsigned long ofs) +{ + return readl(map->map_priv_1 + ofs); +} + +static void m32r_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) +{ + memcpy(to, (void *)(map->map_priv_1 + from), len); +} + +static void m32r_write8(struct map_info *map, __u8 d, unsigned long adr) +{ + writeb(d, map->map_priv_1 + adr); +} + +static void m32r_write16(struct map_info *map, __u16 d, unsigned long adr) +{ + writew(d, map->map_priv_1 + adr); +} + +static void m32r_write32(struct map_info *map, __u32 d, unsigned long adr) +{ + writel(d, map->map_priv_1 + adr); +} + +static void m32r_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) +{ + memcpy((void *)(map->map_priv_1 + to), from, len); +} + +static struct map_info m32r_map = { + name: "M32R flash", + read8: m32r_read8, + read16: m32r_read16, + read32: m32r_read32, + copy_from: m32r_copy_from, + write8: m32r_write8, + write16: m32r_write16, + write32: m32r_write32, + copy_to: m32r_copy_to, + + map_priv_1: WINDOW_ADDR, + map_priv_2: -1, +}; + +#ifdef CONFIG_PLAT_M32700UT +#define M32700UT_FLASH_SIZE 0x00400000 +static struct mtd_partition m32700ut_partitions[] = { + { + name: "M32700UT boot firmware", + size: 0x30000, /* 192KB */ + offset: 0, + mask_flags: MTD_WRITEABLE, /* force read-only */ + }, { + name: "M32700UT kernel", + size: 0xd0000, /* 832KB */ + offset: MTDPART_OFS_APPEND, + }, { + name: "M32700UT root", + size: 0x2f0000, /* 3008KB */ + offset: MTDPART_OFS_APPEND, + }, { + name: "M32700UT params", + size: MTDPART_SIZ_FULL, /* 64KB */ + offset: MTDPART_OFS_APPEND, + } +}; +#endif + +extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts); +extern int parse_bootldr_partitions(struct mtd_info *master, struct mtd_partition **pparts); + +static struct mtd_partition *parsed_parts; +static struct mtd_info *mymtd; + +int __init m32r_mtd_init(void) +{ + struct mtd_partition *parts; + int nb_parts = 0, ret; + int parsed_nr_parts = 0; + const char *part_type; + unsigned long base = -1UL; + + + /* Default flash buswidth */ + m32r_map.buswidth = 2; + + /* + * Static partition definition selection + */ + part_type = "static"; + +#ifdef CONFIG_PLAT_M32700UT + parts = m32700ut_partitions; + nb_parts = ARRAY_SIZE(m32700ut_partitions); + m32r_map.size = M32700UT_FLASH_SIZE; + m32r_map.buswidth = 2; +#endif + + /* + * For simple flash devices, use ioremap to map the flash. + */ + if (base != (unsigned long)-1) { + if (!request_mem_region(base, m32r_map.size, "flash")) + return -EBUSY; + m32r_map.map_priv_2 = base; + m32r_map.map_priv_1 = (unsigned long) + ioremap(base, m32r_map.size); + ret = -ENOMEM; + if (!m32r_map.map_priv_1) + goto out_err; + } + + /* + * Now let's probe for the actual flash. Do it here since + * specific machine settings might have been set above. + */ + printk(KERN_NOTICE "M32R flash: probing %d-bit flash bus\n", m32r_map.buswidth*8); + mymtd = do_map_probe("m5drv", &m32r_map); + ret = -ENXIO; + if (!mymtd) + goto out_err; + mymtd->module = THIS_MODULE; + + /* + * Dynamic partition selection stuff (might override the static ones) + */ +#ifdef CONFIG_MTD_REDBOOT_PARTS + if (parsed_nr_parts == 0) { + ret = parse_redboot_partitions(mymtd, &parsed_parts); + + if (ret > 0) { + part_type = "RedBoot"; + parsed_nr_parts = ret; + } + } +#endif +#ifdef CONFIG_MTD_BOOTLDR_PARTS + if (parsed_nr_parts == 0) { + ret = parse_bootldr_partitions(mymtd, &parsed_parts); + if (ret > 0) { + part_type = "Compaq bootldr"; + parsed_nr_parts = ret; + } + } +#endif + + if (parsed_nr_parts > 0) { + parts = parsed_parts; + nb_parts = parsed_nr_parts; + } + + if (nb_parts == 0) { + printk(KERN_NOTICE "M32R flash: no partition info available, registering whole flash at once\n"); + add_mtd_device(mymtd); + } else { + printk(KERN_NOTICE "Using %s partition definition\n", part_type); + add_mtd_partitions(mymtd, parts, nb_parts); + } + return 0; + + out_err: + if (m32r_map.map_priv_2 != -1) { + iounmap((void *)m32r_map.map_priv_1); + release_mem_region(m32r_map.map_priv_2, m32r_map.size); + } + return ret; +} + +static void __exit m32r_mtd_cleanup(void) +{ + if (mymtd) { + del_mtd_partitions(mymtd); + map_destroy(mymtd); + if (parsed_parts) + kfree(parsed_parts); + } + if (m32r_map.map_priv_2 != -1) { + iounmap((void *)m32r_map.map_priv_1); + release_mem_region(m32r_map.map_priv_2, m32r_map.size); + } +} + +module_init(m32r_mtd_init); +module_exit(m32r_mtd_cleanup); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("M32R Flash map driver"); +MODULE_LICENSE("GPL"); diff -Nru a/arch/m32r/mappi/defconfig.nommu b/arch/m32r/mappi/defconfig.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.nommu 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,529 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +# CONFIG_MMU is not set +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x00000000 +CONFIG_MEMORY_SIZE=0x00E00000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +# CONFIG_IDE is not set + +# +# SCSI device support +# +# CONFIG_SCSI is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +CONFIG_DEVPTS_FS_XATTR=y +CONFIG_DEVPTS_FS_SECURITY=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/mappi/defconfig.smp b/arch/m32r/mappi/defconfig.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.smp 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,646 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_CLEAN_COMPILE is not set +CONFIG_BROKEN=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y +CONFIG_STOP_MACHINE=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=10000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_NOHIGHMEM=y +CONFIG_DISCONTIGMEM=y +CONFIG_IRAM_START=0x00f00000 +CONFIG_IRAM_SIZE=0x00080000 +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +CONFIG_SMP=y +CONFIG_CHIP_M32700_TS1=y +CONFIG_NR_CPUS=2 +# CONFIG_NUMA is not set + +# +# M32R drivers +# +CONFIG_M32RPCC=y +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_CONCAT is not set +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_CMDLINE_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLKMTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set + +# +# NAND Flash Device Drivers +# +# CONFIG_MTD_NAND is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=m +CONFIG_BLK_DEV_IDE=m + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=m +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=m +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=m +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +# CONFIG_SCSI is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +# CONFIG_PACKET is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +CONFIG_ROMFS_FS=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS_FS=y +CONFIG_JFFS_FS_VERBOSE=0 +CONFIG_JFFS_PROC_FS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_NAND is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff -Nru a/arch/m32r/mappi/defconfig.up b/arch/m32r/mappi/defconfig.up --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.up 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,642 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_CLEAN_COMPILE is not set +CONFIG_BROKEN=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=10000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_NOHIGHMEM=y +CONFIG_DISCONTIGMEM=y +CONFIG_IRAM_START=0x00f00000 +CONFIG_IRAM_SIZE=0x00080000 +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +CONFIG_M32RPCC=y +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_CONCAT is not set +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_CMDLINE_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLKMTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set + +# +# NAND Flash Device Drivers +# +# CONFIG_MTD_NAND is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=m +CONFIG_BLK_DEV_IDE=m + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=m +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=m +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=m +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +# CONFIG_SCSI is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +# CONFIG_PACKET is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +CONFIG_ROMFS_FS=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS_FS=y +CONFIG_JFFS_FS_VERBOSE=0 +CONFIG_JFFS_PROC_FS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_NAND is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff -Nru a/arch/m32r/mappi/dot.gdbinit b/arch/m32r/mappi/dot.gdbinit --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,242 @@ +# .gdbinit file +# $Id$ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.8 2004/02/27 07:08:32 takata Exp $ +#----- +# target platform: mappi + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=30:360:180:90 +define clock_init + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 5 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:64MB) + set *(unsigned long *)0x00ef6020 = 0x08000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010e2b + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) + set *(unsigned long *)($sfrbase + 0x5300) = 0x0a0a8040 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01120203 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 + # swivel: 0=normal, 4=reverse +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + set *(unsigned long *)($sfrbase + 0x5400) = 0x0e0e8000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x0012220a +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d360000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d90000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc=0x08001000 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +#load_module +#set_breakpoints +#boot + diff -Nru a/arch/m32r/mappi/dot.gdbinit.nommu b/arch/m32r/mappi/dot.gdbinit.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit.nommu 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,245 @@ +# .gdbinit file +# $Id$ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.5 2004/01/23 08:23:25 takata Exp $ +#----- +# target platform: mappi + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=25:200:50:50 +define clock_init + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:64MB) + set *(unsigned long *)0x00ef6020 = 0x00000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010f05 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) + set *(unsigned long *)($sfrbase + 0x5300) = 0x07078040 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01110102 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 + # swivel: 0=normal, 4=reverse +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + set *(unsigned long *)($sfrbase + 0x5400) = 0x06078000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x00101101 +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x00000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x00002000 + # INITRD_START + #set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + #set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.bbox-httpd nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc=0x00001000 + set *(long *)0xfffffff4=0x8080 +# b load_flat_binary +# set *(unsigned char *)0x08001003=0x63 +# set *(unsigned char *)0x08001003=0x02 + si +# c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +load_modules +boot + diff -Nru a/arch/m32r/mappi/dot.gdbinit.smp b/arch/m32r/mappi/dot.gdbinit.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit.smp 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,344 @@ +# .gdbinit file +# $Id$ + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=1:4:2:1 +define clock_init_on + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +# set *(unsigned long *)0x00ef4008 = 0x0201 +end + +# clk xin:cpu:bif:bus=1:4:1:1 +define clock_init_on_1411 + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:4:2:1 +define clock_init_on_1421 + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:8:2:1 +define clock_init_on_1821 + set *(unsigned long *)0x00ef4024 = 3 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:8:4:1 +define clock_init_on_1841 + set *(unsigned long *)0x00ef4024 = 3 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:16:8:1 +define clock_init_on_11681 + set *(unsigned long *)0x00ef4024 = 4 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x7 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:1:1:1 +define clock_init_off + # CPU + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + # BIF + set *(unsigned long *)0x00ef4020 = 0 + # BUS + set *(unsigned long *)0x00ef4024 = 0 + # PLL + set *(unsigned long *)0x00ef4008 = 0x0000 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller for Mappi +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00010002 + # Ch0-ADR + set *(unsigned long *)0x00ef6020 = 0x08000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010107 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + Mappi SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller for Mappi +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) +# set *(unsigned long *)($sfrbase + 0x5300) = 0x01018040 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x01011101 + set *(unsigned long *)($sfrbase + 0x5300) = 0x04048000 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01011103 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + Mappi LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + # 20MHz +# set *(unsigned long *)($sfrbase + 0x5400) = 0x02028282 +# set *(unsigned long *)($sfrbase + 0x5404) = 0x00122202 + # 40MHz + set *(unsigned long *)($sfrbase + 0x5400) = 0x04048000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x00101103 +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + use_mon_code + while ($i < 0d32 ) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb +end + + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set $task = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$fp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 +# clock_init_on_1411 + clock_init_on_1421 +# clock_init_on_1821 +# clock_init_on_1841 +# clock_init_on_11681 +# clock_init_off + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +# load ramdisk_082a0000.mot +# load romfs_082a0000.mot +# use_mon_code +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START +# set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d160000000 +# set *(unsigned long *)($param + 0x0018) = 0d80000000 +# set *(unsigned long *)($param + 0x0018) = 0d40000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d40000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=tty1 console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +# set {char[0x200]}($param + 0x100) = "console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $pc=0x08001000 + set *(unsigned char *)0x08001003=0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +## Boot MP +define boot_mp + set_kernel_parameters + set *(unsigned long *)0x00f00000 = boot - 0x80000000 + set *(unsigned long *)0x00eff2f8 = 0x2 + x 0x00eff2f8 + + set $pc=0x08001000 + si + c +end +document boot_mp + Boot BSP +end + +## Boot UP +define boot_up + set_kernel_parameters + set $pc=0x08001000 + si + c +end +document boot_up + Boot BSP +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot_mp +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup diff -Nru a/arch/m32r/mm/Makefile b/arch/m32r/mm/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,12 @@ +# +# Makefile for the Linux M32R-specific parts of the memory manager. +# + +ifdef CONFIG_MMU +obj-y := init.o fault.o mmu.o extable.o ioremap.o cache.o page.o +else +obj-y := init.o fault-nommu.o mmu.o extable.o ioremap-nommu.o cache.o page.o +endif + +obj-$(CONFIG_DISCONTIGMEM) += discontig.o + diff -Nru a/arch/m32r/mm/cache.c b/arch/m32r/mm/cache.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/cache.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,68 @@ +/* + * linux/arch/m32r/mm/cache.c + * + * Copyright (C) 2002 Hirokazu Takata + */ + +/* $Id$ */ + +#include +#include + +#undef MCCR + +#if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) +/* Cache Control Register */ +#define MCCR ((volatile unsigned long*)0xfffffffc) +#define MCCR_CC (1UL << 7) /* Cache mode modify bit */ +#define MCCR_IIV (1UL << 6) /* I-cache invalidate */ +#define MCCR_DIV (1UL << 5) /* D-cache invalidate */ +#define MCCR_DCB (1UL << 4) /* D-cache copy back */ +#define MCCR_ICM (1UL << 1) /* I-cache mode [0:off,1:on] */ +#define MCCR_DCM (1UL << 0) /* D-cache mode [0:off,1:on] */ +#define MCCR_ICACHE_INV (MCCR_CC|MCCR_IIV) +#define MCCR_DCACHE_CB (MCCR_CC|MCCR_DCB) +#define MCCR_DCACHE_CBINV (MCCR_CC|MCCR_DIV|MCCR_DCB) +#define CHECK_MCCR(mccr) (mccr = *MCCR) +#elif defined(CONFIG_CHIP_M32102) +#define MCCR ((volatile unsigned long*)0xfffffffc) +#define MCCR_IIV (1UL << 8) /* I-cache invalidate */ +#define MCCR_ICACHE_INV MCCR_IIV +#endif /* CONFIG_CHIP_XNUX2 || CONFIG_CHIP_M32700 */ + +#ifndef MCCR +#error Unknown cache type. +#endif + + +/* Copy back and invalidate D-cache and invalidate I-cache all */ +void _flush_cache_all(void) +{ +#if defined(CONFIG_CHIP_M32102) + *MCCR = MCCR_ICACHE_INV; +#else + unsigned long mccr; + + /* Copyback and invalidate D-cache */ + /* Invalidate I-cache */ + *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; + while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ +#endif +} + +/* Copy back D-cache and invalidate I-cache all */ +void _flush_cache_copyback_all(void) +{ +#if defined(CONFIG_CHIP_M32102) + *MCCR = MCCR_ICACHE_INV; +#else + unsigned long mccr; + + /* Copyback D-cache */ + /* Invalidate I-cache */ + *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; + while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ + +#endif +} + diff -Nru a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/discontig.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,170 @@ +/* + * linux/arch/m32r/mm/discontig.c + * + * Discontig memory support + * + * Copyright (c) 2003 Hitoshi Yamamoto + */ + +#include +#include +#include +#include +#include + +#include + +extern char _end[]; + +struct pglist_data *node_data[MAX_NUMNODES]; +static bootmem_data_t node_bdata[MAX_NUMNODES] __initdata; + +pg_data_t m32r_node_data[MAX_NUMNODES]; + +/* Memory profile */ +typedef struct { + unsigned long start_pfn; + unsigned long pages; + unsigned long holes; + unsigned long free_pfn; +} mem_prof_t; +static mem_prof_t mem_prof[MAX_NUMNODES]; + +static void __init mem_prof_init(void) +{ + unsigned long start_pfn, holes, free_pfn; + const unsigned long zone_alignment = 1UL << (MAX_ORDER - 1); + unsigned long ul; + mem_prof_t *mp; + + /* Node#0 SDRAM */ + mp = &mem_prof[0]; + mp->start_pfn = PFN_UP(CONFIG_MEMORY_START); + mp->pages = PFN_DOWN(CONFIG_MEMORY_SIZE); + mp->holes = 0; + mp->free_pfn = PFN_UP(__pa(_end)); + + /* Node#1 internal SRAM */ + mp = &mem_prof[1]; + start_pfn = free_pfn = PFN_UP(CONFIG_IRAM_START); + holes = 0; + if (start_pfn & (zone_alignment - 1)) { + ul = zone_alignment; + while (start_pfn >= ul) + ul += zone_alignment; + + start_pfn = ul - zone_alignment; + holes = free_pfn - start_pfn; + } + + mp->start_pfn = start_pfn; + mp->pages = PFN_DOWN(CONFIG_IRAM_SIZE) + holes; + mp->holes = holes; + mp->free_pfn = PFN_UP(CONFIG_IRAM_START); +} + +unsigned long __init setup_memory(void) +{ + unsigned long bootmap_size; + unsigned long min_pfn; + int nid; + mem_prof_t *mp; + + max_low_pfn = 0; + min_low_pfn = -1; + + mem_prof_init(); + + for (nid = 0 ; nid < numnodes ; nid++) { + mp = &mem_prof[nid]; + NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid]; + NODE_DATA(nid)->bdata = &node_bdata[nid]; + min_pfn = mp->start_pfn; + max_pfn = mp->start_pfn + mp->pages; + bootmap_size = init_bootmem_node(NODE_DATA(nid), mp->free_pfn, + mp->start_pfn, max_pfn); + + free_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), + PFN_PHYS(mp->pages)); + + reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), + PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size); + + if (max_low_pfn < max_pfn) + max_low_pfn = max_pfn; + + if (min_low_pfn > min_pfn) + min_low_pfn = min_pfn; + } + +#ifdef CONFIG_BLK_DEV_INITRD + if (LOADER_TYPE && INITRD_START) { + if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { + reserve_bootmem_node(NODE_DATA(0), INITRD_START, + INITRD_SIZE); + initrd_start = INITRD_START ? + INITRD_START + PAGE_OFFSET : 0; + + initrd_end = initrd_start + INITRD_SIZE; + printk("initrd:start[%08lx],size[%08lx]\n", + initrd_start, INITRD_SIZE); + } else { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + INITRD_START + INITRD_SIZE, + PFN_PHYS(max_low_pfn)); + + initrd_start = 0; + } + } +#endif /* CONFIG_BLK_DEV_INITRD */ + + return max_low_pfn; +} + +#define START_PFN(nid) \ + (NODE_DATA(nid)->bdata->node_boot_start >> PAGE_SHIFT) +#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) + +unsigned long __init zone_sizes_init(void) +{ + unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; + unsigned long low, start_pfn; + unsigned long holes = 0; + int nid, i; + mem_prof_t *mp; + + pgdat_list = NULL; + for (nid = numnodes - 1 ; nid >= 0 ; nid--) { + NODE_DATA(nid)->pgdat_next = pgdat_list; + pgdat_list = NODE_DATA(nid); + } + + for (nid = 0 ; nid < numnodes ; nid++) { + mp = &mem_prof[nid]; + for (i = 0 ; i < MAX_NR_ZONES ; i++) { + zones_size[i] = 0; + zholes_size[i] = 0; + } + start_pfn = START_PFN(nid); + low = MAX_LOW_PFN(nid); + zones_size[ZONE_DMA] = low - start_pfn; + zholes_size[ZONE_DMA] = mp->holes; + holes += zholes_size[ZONE_DMA]; + + free_area_init_node(nid, NODE_DATA(nid), zones_size, + start_pfn, zholes_size); + } + + /* + * For test + * Use all area of internal RAM. + * see __alloc_pages() + */ + NODE_DATA(1)->node_zones->pages_min = 0; + NODE_DATA(1)->node_zones->pages_low = 0; + NODE_DATA(1)->node_zones->pages_high = 0; + + return holes; +} + diff -Nru a/arch/m32r/mm/extable.c b/arch/m32r/mm/extable.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/extable.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,22 @@ +/* + * linux/arch/i386/mm/extable.c + */ + +#include +#include +#include +#include + +int fixup_exception(struct pt_regs *regs) +{ + const struct exception_table_entry *fixup; + + fixup = search_exception_tables(regs->bpc); + if (fixup) { + regs->bpc = fixup->fixup; + return 1; + } + + return 0; +} + diff -Nru a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/fault-nommu.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,164 @@ +/* + * linux/arch/m32r/mm/fault.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo + * + * Some code taken from i386 version. + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id: fault-nommu.c,v 1.1 2004/03/30 06:40:59 sakugawa Exp $ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +extern void die(const char *, struct pt_regs *, long); + +#ifndef CONFIG_SMP +asmlinkage unsigned int tlb_entry_i_dat; +asmlinkage unsigned int tlb_entry_d_dat; +#define tlb_entry_i tlb_entry_i_dat +#define tlb_entry_d tlb_entry_d_dat +#else +unsigned int tlb_entry_i_dat[NR_CPUS]; +unsigned int tlb_entry_d_dat[NR_CPUS]; +#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] +#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] +#endif + +/* + * Unlock any spinlocks which will prevent us from getting the + * message out + */ +void bust_spinlocks(int yes) +{ + int loglevel_save = console_loglevel; + + if (yes) { + oops_in_progress = 1; + return; + } +#ifdef CONFIG_VT + unblank_screen(); +#endif + oops_in_progress = 0; + /* + * OK, the message is on the console. Now we call printk() + * without oops_in_progress set so that printk will give klogd + * a poke. Hold onto your hats... + */ + console_loglevel = 15; /* NMI oopser may have shut the console up */ + printk(" "); + console_loglevel = loglevel_save; +} + +void do_BUG(const char *file, int line) +{ + bust_spinlocks(1); + printk("kernel BUG at %s:%d!\n", file, line); +} + +/*======================================================================* + * do_page_fault() + *======================================================================* + * This routine handles page faults. It determines the address, + * and the problem, and then passes it off to one of the appropriate + * routines. + * + * ARGUMENT: + * regs : M32R SP reg. + * error_code : See below + * address : M32R MMU MDEVA reg. (Operand ACE) + * : M32R BPC reg. (Instruction ACE) + * + * error_code : + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * bit 2 == 0 means kernel, 1 means user-mode + *======================================================================*/ +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, + unsigned long address) +{ + +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + + bust_spinlocks(1); + + if (address < PAGE_SIZE) + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + else + printk(KERN_ALERT "Unable to handle kernel paging request"); + printk(" at virtual address %08lx\n",address); + printk(" printing bpc:\n"); + printk(KERN_ALERT "bpc = %08lx\n", regs->bpc); + + die("Oops", regs, error_code); + bust_spinlocks(0); + do_exit(SIGKILL); +} + +/*======================================================================* + * update_mmu_cache() + *======================================================================*/ +void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, + pte_t pte) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_page() : flushes one page + *======================================================================*/ +void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_range() : flushes a range of pages + *======================================================================*/ +void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_mm() : flushes the specified mm context TLB's + *======================================================================*/ +void local_flush_tlb_mm(struct mm_struct *mm) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_all() : flushes all processes TLBs + *======================================================================*/ +void local_flush_tlb_all(void) +{ + BUG(); +} + diff -Nru a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/fault.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,572 @@ +/* + * linux/arch/m32r/mm/fault.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo + * + * Some code taken from i386 version. + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* For unblank_screen() */ +#include +#include + +#include +#include +#include +#include +#include +#include + +extern void die(const char *, struct pt_regs *, long); + +#ifndef CONFIG_SMP +asmlinkage unsigned int tlb_entry_i_dat; +asmlinkage unsigned int tlb_entry_d_dat; +#define tlb_entry_i tlb_entry_i_dat +#define tlb_entry_d tlb_entry_d_dat +#else +unsigned int tlb_entry_i_dat[NR_CPUS]; +unsigned int tlb_entry_d_dat[NR_CPUS]; +#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] +#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] +#endif + +extern void init_tlb(void); + +/* + * Unlock any spinlocks which will prevent us from getting the + * message out + */ +void bust_spinlocks(int yes) +{ + int loglevel_save = console_loglevel; + + if (yes) { + oops_in_progress = 1; + return; + } +#ifdef CONFIG_VT + unblank_screen(); +#endif + oops_in_progress = 0; + /* + * OK, the message is on the console. Now we call printk() + * without oops_in_progress set so that printk will give klogd + * a poke. Hold onto your hats... + */ + console_loglevel = 15; /* NMI oopser may have shut the console up */ + printk(" "); + console_loglevel = loglevel_save; +} + +/*======================================================================* + * do_page_fault() + *======================================================================* + * This routine handles page faults. It determines the address, + * and the problem, and then passes it off to one of the appropriate + * routines. + * + * ARGUMENT: + * regs : M32R SP reg. + * error_code : See below + * address : M32R MMU MDEVA reg. (Operand ACE) + * : M32R BPC reg. (Instruction ACE) + * + * error_code : + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * bit 2 == 0 means kernel, 1 means user-mode + * bit 3 == 0 means data, 1 means instruction + *======================================================================*/ +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, + unsigned long address) +{ + struct task_struct *tsk; + struct mm_struct *mm; + struct vm_area_struct * vma; + unsigned long page, addr; + int write; + siginfo_t info; + + /* + * If BPSW IE bit enable --> set PSW IE bit + */ + if (regs->psw & M32R_PSW_BIE) + local_irq_enable(); + + tsk = current; + + info.si_code = SEGV_MAPERR; + + /* + * We fault-in kernel-space virtual memory on-demand. The + * 'reference' page table is init_mm.pgd. + * + * NOTE! We MUST NOT take any locks for this case. We may + * be in an interrupt or a critical region, and should + * only copy the information from the master page table, + * nothing more. + * + * This verifies that the fault happens in kernel space + * (error_code & 4) == 0, and that the fault was not a + * protection error (error_code & 1) == 0. + */ + if (address >= TASK_SIZE && !(error_code & 4)) + goto vmalloc_fault; + + mm = tsk->mm; + + /* + * If we're in an interrupt or have no user context or are running in an + * atomic region then we must not take the fault.. + */ + if (in_atomic() || !mm) + goto bad_area_nosemaphore; + + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the + * kernel and should generate an OOPS. Unfortunatly, in the case of an + * erroneous fault occuring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user + * space from well defined areas of code, which are listed in the + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform + * the source reference check when there is a possibilty of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. + */ + if (!down_read_trylock(&mm->mmap_sem)) { + if ((error_code & 4) == 0 && + !search_exception_tables(regs->psw)) + goto bad_area_nosemaphore; + down_read(&mm->mmap_sem); + } + + vma = find_vma(mm, address); + if (!vma) + goto bad_area; + if (vma->vm_start <= address) + goto good_area; + if (!(vma->vm_flags & VM_GROWSDOWN)) + goto bad_area; +#if 0 + if (error_code & 4) { + /* + * accessing the stack below "spu" is always a bug. + * The "+ 4" is there due to the push instruction + * doing pre-decrement on the stack and that + * doesn't show up until later.. + */ + if (address + 4 < regs->spu) + goto bad_area; + } +#endif + if (expand_stack(vma, address)) + goto bad_area; +/* + * Ok, we have a good vm_area for this memory access, so + * we can handle it.. + */ +good_area: + info.si_code = SEGV_ACCERR; + write = 0; + switch (error_code & 3) { + default: /* 3: write, present */ + /* fall through */ + case 2: /* write, not present */ + if (!(vma->vm_flags & VM_WRITE)) + goto bad_area; + write++; + break; + case 1: /* read, present */ + case 0: /* read, not present */ + if (!(vma->vm_flags & (VM_READ | VM_EXEC))) + goto bad_area; + } + +survive: + /* + * If for any reason at all we couldn't handle the fault, + * make sure we exit gracefully rather than endlessly redo + * the fault. + */ + addr = (address & PAGE_MASK) | (error_code & 8); + switch (handle_mm_fault(mm, vma, addr, write)) { + case VM_FAULT_MINOR: + tsk->min_flt++; + break; + case VM_FAULT_MAJOR: + tsk->maj_flt++; + break; + case VM_FAULT_SIGBUS: + goto do_sigbus; + case VM_FAULT_OOM: + goto out_of_memory; + default: + BUG(); + } + + up_read(&mm->mmap_sem); + return; + +/* + * Something tried to access memory that isn't in our memory map.. + * Fix it, but check if it's kernel or user first.. + */ +bad_area: + up_read(&mm->mmap_sem); + +bad_area_nosemaphore: + /* User mode accesses just cause a SIGSEGV */ + if (error_code & 4) { + tsk->thread.address = address; + tsk->thread.error_code = error_code | (address >= TASK_SIZE); + tsk->thread.trap_no = 14; + info.si_signo = SIGSEGV; + info.si_errno = 0; + /* info.si_code has been set above */ + info.si_addr = (void __user *)address; + force_sig_info(SIGSEGV, &info, tsk); + return; + } + +no_context: + /* Are we prepared to handle this kernel fault? */ + if (fixup_exception(regs)) + return; + +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + + bust_spinlocks(1); + + if (address < PAGE_SIZE) + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + else + printk(KERN_ALERT "Unable to handle kernel paging request"); + printk(" at virtual address %08lx\n",address); + printk(KERN_ALERT " printing bpc:\n"); + printk("%08lx\n", regs->bpc); + page = *(unsigned long *)MPTB; + page = ((unsigned long *) page)[address >> PGDIR_SHIFT]; + printk(KERN_ALERT "*pde = %08lx\n", page); + if (page & _PAGE_PRESENT) { + page &= PAGE_MASK; + address &= 0x003ff000; + page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT]; + printk(KERN_ALERT "*pte = %08lx\n", page); + } + die("Oops", regs, error_code); + bust_spinlocks(0); + do_exit(SIGKILL); + +/* + * We ran out of memory, or some other thing happened to us that made + * us unable to handle the page fault gracefully. + */ +out_of_memory: + up_read(&mm->mmap_sem); + if (tsk->pid == 1) { + yield(); + down_read(&mm->mmap_sem); + goto survive; + } + printk("VM: killing process %s\n", tsk->comm); + if (error_code & 4) + do_exit(SIGKILL); + goto no_context; + +do_sigbus: + up_read(&mm->mmap_sem); + + /* Kernel mode? Handle exception or die */ + if (!(error_code & 4)) + goto no_context; + + tsk->thread.address = address; + tsk->thread.error_code = error_code; + tsk->thread.trap_no = 14; + info.si_signo = SIGBUS; + info.si_errno = 0; + info.si_code = BUS_ADRERR; + info.si_addr = (void __user *)address; + force_sig_info(SIGBUS, &info, tsk); + return; + +vmalloc_fault: + { + /* + * Synchronize this task's top level page-table + * with the 'reference' page table. + * + * Do _not_ use "tsk" here. We might be inside + * an interrupt in the middle of a task switch.. + */ + int offset = pgd_index(address); + pgd_t *pgd, *pgd_k; + pmd_t *pmd, *pmd_k; + pte_t *pte_k; + + pgd = (pgd_t *)*(unsigned long *)MPTB; + pgd = offset + (pgd_t *)pgd; + pgd_k = init_mm.pgd + offset; + + if (!pgd_present(*pgd_k)) + goto no_context; + + /* + * set_pgd(pgd, *pgd_k); here would be useless on PAE + * and redundant with the set_pmd() on non-PAE. + */ + + pmd = pmd_offset(pgd, address); + pmd_k = pmd_offset(pgd_k, address); + if (!pmd_present(*pmd_k)) + goto no_context; + set_pmd(pmd, *pmd_k); + + pte_k = pte_offset_kernel(pmd_k, address); + if (!pte_present(*pte_k)) + goto no_context; + + addr = (address & PAGE_MASK) | (error_code & 8); + update_mmu_cache(NULL, addr, *pte_k); + return; + } +} + +/*======================================================================* + * update_mmu_cache() + *======================================================================*/ +#define TLB_MASK (NR_TLB_ENTRIES - 1) +#define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8)) +#define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8)) +void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, + pte_t pte) +{ + unsigned long *entry1, *entry2; + unsigned long pte_data, flags; + unsigned int *entry_dat; + int inst = vaddr & 8; + int i; + + /* Ptrace may call this routine. */ + if (vma && current->active_mm != vma->vm_mm) + return; + + local_irq_save(flags); + + vaddr = (vaddr & PAGE_MASK) | get_asid(); + +#ifdef CONFIG_CHIP_OPSP + entry1 = (unsigned long *)ITLB_BASE; + for(i = 0 ; i < NR_TLB_ENTRIES; i++) { + if(*entry1++ == vaddr) { + pte_data = pte_val(pte); + set_tlb_data(entry1, pte_data); + break; + } + entry1++; + } + entry2 = (unsigned long *)DTLB_BASE; + for(i = 0 ; i < NR_TLB_ENTRIES ; i++) { + if(*entry2++ == vaddr) { + pte_data = pte_val(pte); + set_tlb_data(entry2, pte_data); + break; + } + entry2++; + } + local_irq_restore(flags); + return; +#else + pte_data = pte_val(pte); + + /* + * Update TLB entries + * entry1: ITLB entry address + * entry2: DTLB entry address + */ + __asm__ __volatile__ ( + "seth %0, #high(%4) \n\t" + "st %2, @(%5, %0) \n\t" + "ldi %1, #1 \n\t" + "st %1, @(%6, %0) \n\t" + "add3 r4, %0, %7 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %1, @(%6, %0) \n\t" + "bnez %1, 1b \n\t" + "ld %0, @r4+ \n\t" + "ld %1, @r4 \n\t" + "st %3, @+%0 \n\t" + "st %3, @+%1 \n\t" + : "=&r" (entry1), "=&r" (entry2) + : "r" (vaddr), "r" (pte_data), "i" (MMU_REG_BASE), + "i" (MSVA_offset), "i" (MTOP_offset), "i" (MIDXI_offset) + : "r4", "memory" + ); + + if ((!inst && entry2 >= DTLB_END) || (inst && entry1 >= ITLB_END)) + goto notfound; + +found: + local_irq_restore(flags); + + return; + + /* Valid entry not found */ +notfound: + /* + * Update ITLB or DTLB entry + * entry1: TLB entry address + * entry2: TLB base address + */ + if (!inst) { + entry2 = (unsigned long *)DTLB_BASE; + entry_dat = &tlb_entry_d; + } else { + entry2 = (unsigned long *)ITLB_BASE; + entry_dat = &tlb_entry_i; + } + entry1 = entry2 + (((*entry_dat - 1) & TLB_MASK) << 1); + + for (i = 0 ; i < NR_TLB_ENTRIES ; i++) { + if (!(entry1[1] & 2)) /* Valid bit check */ + break; + + if (entry1 != entry2) + entry1 -= 2; + else + entry1 += TLB_MASK << 1; + } + + if (i >= NR_TLB_ENTRIES) { /* Empty entry not found */ + entry1 = entry2 + (*entry_dat << 1); + *entry_dat = (*entry_dat + 1) & TLB_MASK; + } + *entry1++ = vaddr; /* Set TLB tag */ + set_tlb_data(entry1, pte_data); + + goto found; +#endif +} + +/*======================================================================* + * flush_tlb_page() : flushes one page + *======================================================================*/ +void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) +{ + if (vma->vm_mm && mm_context(vma->vm_mm) != NO_CONTEXT) { + unsigned long flags; + + local_irq_save(flags); + page &= PAGE_MASK; + page |= (mm_context(vma->vm_mm) & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(page); + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_range() : flushes a range of pages + *======================================================================*/ +void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + struct mm_struct *mm; + + mm = vma->vm_mm; + if (mm_context(mm) != NO_CONTEXT) { + unsigned long flags; + int size; + + local_irq_save(flags); + size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; + if (size > (NR_TLB_ENTRIES / 4)) { /* Too many TLB to flush */ + mm_context(mm) = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + } else { + unsigned long asid; + + asid = mm_context(mm) & MMU_CONTEXT_ASID_MASK; + start &= PAGE_MASK; + end += (PAGE_SIZE - 1); + end &= PAGE_MASK; + + start |= asid; + end |= asid; + while (start < end) { + __flush_tlb_page(start); + start += PAGE_SIZE; + } + } + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_mm() : flushes the specified mm context TLB's + *======================================================================*/ +void local_flush_tlb_mm(struct mm_struct *mm) +{ + /* Invalidate all TLB of this process. */ + /* Instead of invalidating each TLB, we get new MMU context. */ + if (mm_context(mm) != NO_CONTEXT) { + unsigned long flags; + + local_irq_save(flags); + mm_context(mm) = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_all() : flushes all processes TLBs + *======================================================================*/ +void local_flush_tlb_all(void) +{ + unsigned long flags; + + local_irq_save(flags); + __flush_tlb_all(); + local_irq_restore(flags); +} + +/*======================================================================* + * init_mmu() + *======================================================================*/ +void __init init_mmu(void) +{ + tlb_entry_i = 0; + tlb_entry_d = 0; + mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; + set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK); + *(volatile unsigned long *)MPTB = (unsigned long)swapper_pg_dir; +} diff -Nru a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/init.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,250 @@ +/* + * linux/arch/m32r/mm/init.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto + * + * Some code taken from sh version. + * Copyright (C) 1999 Niibe Yutaka + * Based on linux/arch/i386/mm/init.c: + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* References to section boundaries */ +extern char _text, _etext, _edata; +extern char __init_begin, __init_end; + +pgd_t swapper_pg_dir[1024]; + +DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); + +void show_mem(void) +{ + int total = 0, reserved = 0; + int shared = 0, cached = 0; + int highmem = 0; + struct page *page; + pg_data_t *pgdat; + unsigned long i; + + printk("Mem-info:\n"); + show_free_areas(); + printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); + for_each_pgdat(pgdat) { + for (i = 0; i < pgdat->node_spanned_pages; ++i) { + page = pgdat->node_mem_map + i; + total++; + if (PageHighMem(page)) + highmem++; + if (PageReserved(page)) + reserved++; + else if (PageSwapCache(page)) + cached++; + else if (page_count(page)) + shared += page_count(page) - 1; + } + } + printk("%d pages of RAM\n", total); + printk("%d pages of HIGHMEM\n",highmem); + printk("%d reserved pages\n",reserved); + printk("%d pages shared\n",shared); + printk("%d pages swap cached\n",cached); +} + +/* + * Cache of MMU context last used. + */ +#ifndef CONFIG_SMP +unsigned long mmu_context_cache_dat; +#else +unsigned long mmu_context_cache_dat[NR_CPUS]; +#endif +static unsigned long hole_pages; + +/* + * function prototype + */ +void __init paging_init(void); +void __init mem_init(void); +void free_initmem(void); +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long, unsigned long); +#endif + +/* It'd be good if these lines were in the standard header file. */ +#define START_PFN(nid) \ + (NODE_DATA(nid)->bdata->node_boot_start >> PAGE_SHIFT) +#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) + +#ifndef CONFIG_DISCONTIGMEM +unsigned long __init zone_sizes_init(void) +{ + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; + unsigned long max_dma; + unsigned long low; + unsigned long start_pfn; + +#ifdef CONFIG_MMU + start_pfn = START_PFN(0); + max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + low = MAX_LOW_PFN(0); + + if (low < max_dma){ + zones_size[ZONE_DMA] = low - start_pfn; + zones_size[ZONE_NORMAL] = 0; + } else { + zones_size[ZONE_DMA] = low - start_pfn; + zones_size[ZONE_NORMAL] = low - max_dma; + } +#else + zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; + zones_size[ZONE_NORMAL] = __MEMORY_SIZE >> PAGE_SHIFT; + start_pfn = __MEMORY_START >> PAGE_SHIFT; +#endif /* CONFIG_MMU */ + + free_area_init_node(0, NODE_DATA(0), zones_size, start_pfn, 0); + + mem_map = contig_page_data.node_mem_map; + + return 0; +} +#else /* CONFIG_DISCONTIGMEM */ +extern unsigned long zone_sizes_init(void); +#endif /* CONFIG_DISCONTIGMEM */ + +/*======================================================================* + * paging_init() : sets up the page tables + *======================================================================*/ +void __init paging_init(void) +{ +#ifdef CONFIG_MMU + int i; + pgd_t *pg_dir; + + /* We don't need kernel mapping as hardware support that. */ + pg_dir = swapper_pg_dir; + + for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) + pgd_val(pg_dir[i]) = 0; +#endif /* CONFIG_MMU */ + hole_pages = zone_sizes_init(); +} + +int __init reservedpages_count(void) +{ + int reservedpages, nid, i; + + reservedpages = 0; + for (nid = 0 ; nid < numnodes ; nid++) + for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++) + if (PageReserved(NODE_DATA(nid)->node_mem_map + i)) + reservedpages++; + + return reservedpages; +} + +/*======================================================================* + * mem_init() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void __init mem_init(void) +{ + int codesize, reservedpages, datasize, initsize; + int nid; +#ifndef CONFIG_MMU + extern unsigned long memory_end; +#endif + + num_physpages = 0; + for (nid = 0 ; nid < numnodes ; nid++) + num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1; + + num_physpages -= hole_pages; + +#ifndef CONFIG_DISCONTIGMEM + max_mapnr = num_physpages; +#endif /* CONFIG_DISCONTIGMEM */ + +#ifdef CONFIG_MMU + high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0))); +#else + high_memory = (void *)(memory_end & PAGE_MASK); +#endif /* CONFIG_MMU */ + + /* clear the zero-page */ + memset(empty_zero_page, 0, PAGE_SIZE); + + /* this will put all low memory onto the freelists */ + for (nid = 0 ; nid < numnodes ; nid++) + totalram_pages += free_all_bootmem_node(NODE_DATA(nid)); + + reservedpages = reservedpages_count() - hole_pages; + codesize = (unsigned long) &_etext - (unsigned long)&_text; + datasize = (unsigned long) &_edata - (unsigned long)&_etext; + initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin; + + printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " + "%dk reserved, %dk data, %dk init)\n", + (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), + num_physpages << (PAGE_SHIFT-10), + codesize >> 10, + reservedpages << (PAGE_SHIFT-10), + datasize >> 10, + initsize >> 10); +} + +/*======================================================================* + * free_initmem() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void free_initmem(void) +{ + unsigned long addr; + + addr = (unsigned long)(&__init_begin); + for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); + free_page(addr); + totalram_pages++; + } + printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", \ + (int)(&__init_end - &__init_begin) >> 10); +} + +#ifdef CONFIG_BLK_DEV_INITRD +/*======================================================================* + * free_initrd_mem() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void free_initrd_mem(unsigned long start, unsigned long end) +{ + unsigned long p; + for (p = start; p < end; p += PAGE_SIZE) { + ClearPageReserved(virt_to_page(p)); + set_page_count(virt_to_page(p), 1); + free_page(p); + totalram_pages++; + } + printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); +} +#endif + diff -Nru a/arch/m32r/mm/ioremap-nommu.c b/arch/m32r/mm/ioremap-nommu.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/ioremap-nommu.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,51 @@ +/* + * linux/arch/m32r/mm/io_remap.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo + * + * Taken from mips version. + * (C) Copyright 1995 1996 Linus Torvalds + * (C) Copyright 2001 Ralf Baechle + */ + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + + +/* + * Remap an arbitrary physical address space into the kernel virtual + * address space. Needed when the kernel wants to access high addresses + * directly. + * + * NOTE! We need to allow non-page-aligned mappings too: we will obviously + * have to convert them into an offset in a page-aligned mapping, but the + * caller shouldn't need to know that small detail. + */ + +#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) + +void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +{ + return (void *)phys_addr; +} + +#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) + +void iounmap(void *addr) +{ +} + diff -Nru a/arch/m32r/mm/ioremap.c b/arch/m32r/mm/ioremap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/ioremap.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,188 @@ +/* + * linux/arch/m32r/mm/io_remap.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo + * + * Taken from mips version. + * (C) Copyright 1995 1996 Linus Torvalds + * (C) Copyright 2001 Ralf Baechle + */ + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) +{ + unsigned long end; + unsigned long pfn; + pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ + | _PAGE_WRITE | flags); + + address &= ~PMD_MASK; + end = address + size; + if (end > PMD_SIZE) + end = PMD_SIZE; + if (address >= end) + BUG(); + pfn = phys_addr >> PAGE_SHIFT; + do { + if (!pte_none(*pte)) { + printk("remap_area_pte: page already exists\n"); + BUG(); + } + set_pte(pte, pfn_pte(pfn, pgprot)); + address += PAGE_SIZE; + pfn++; + pte++; + } while (address && (address < end)); +} + +static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) +{ + unsigned long end; + + address &= ~PGDIR_MASK; + end = address + size; + if (end > PGDIR_SIZE) + end = PGDIR_SIZE; + phys_addr -= address; + if (address >= end) + BUG(); + do { + pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); + if (!pte) + return -ENOMEM; + remap_area_pte(pte, address, end - address, address + phys_addr, flags); + address = (address + PMD_SIZE) & PMD_MASK; + pmd++; + } while (address && (address < end)); + return 0; +} + +static int remap_area_pages(unsigned long address, unsigned long phys_addr, + unsigned long size, unsigned long flags) +{ + int error; + pgd_t * dir; + unsigned long end = address + size; + + phys_addr -= address; + dir = pgd_offset(&init_mm, address); + flush_cache_all(); + if (address >= end) + BUG(); + spin_lock(&init_mm.page_table_lock); + do { + pmd_t *pmd; + pmd = pmd_alloc(&init_mm, dir, address); + error = -ENOMEM; + if (!pmd) + break; + if (remap_area_pmd(pmd, address, end - address, + phys_addr + address, flags)) + break; + error = 0; + address = (address + PGDIR_SIZE) & PGDIR_MASK; + dir++; + } while (address && (address < end)); + spin_unlock(&init_mm.page_table_lock); + flush_tlb_all(); + return error; +} + +/* + * Generic mapping function (not visible outside): + */ + +/* + * Remap an arbitrary physical address space into the kernel virtual + * address space. Needed when the kernel wants to access high addresses + * directly. + * + * NOTE! We need to allow non-page-aligned mappings too: we will obviously + * have to convert them into an offset in a page-aligned mapping, but the + * caller shouldn't need to know that small detail. + */ + +#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) + +void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +{ + void * addr; + struct vm_struct * area; + unsigned long offset, last_addr; + + /* Don't allow wraparound or zero size */ + last_addr = phys_addr + size - 1; + if (!size || last_addr < phys_addr) + return NULL; + + /* + * Map objects in the low 512mb of address space using KSEG1, otherwise + * map using page tables. + */ + if (IS_LOW512(phys_addr) && IS_LOW512(phys_addr + size - 1)) + return (void *) KSEG1ADDR(phys_addr); + + /* + * Don't allow anybody to remap normal RAM that we're using.. + */ + if (phys_addr < virt_to_phys(high_memory)) { + char *t_addr, *t_end; + struct page *page; + + t_addr = __va(phys_addr); + t_end = t_addr + (size - 1); + + for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++) + if(!PageReserved(page)) + return NULL; + } + + /* + * Mappings have to be page-aligned + */ + offset = phys_addr & ~PAGE_MASK; + phys_addr &= PAGE_MASK; + size = PAGE_ALIGN(last_addr + 1) - phys_addr; + + /* + * Ok, go for it.. + */ + area = get_vm_area(size, VM_IOREMAP); + if (!area) + return NULL; + area->phys_addr = phys_addr; + addr = area->addr; + if (remap_area_pages((unsigned long)addr, phys_addr, size, flags)) { + vunmap(addr); + return NULL; + } + + return (void *) (offset + (char *)addr); +} + +#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) + +void iounmap(void *addr) +{ + if (!IS_KSEG1(addr)) + vfree((void *) (PAGE_MASK & (unsigned long) addr)); +} + diff -Nru a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/mmu.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,350 @@ +/* + * linux/arch/m32r/mm/mmu.S + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + +/* $Id: mmu.S,v 1.15 2004/03/16 02:56:27 takata Exp $ */ + +#include /* CONFIG_MMU */ +#include +#include +#include + + .text +#ifdef CONFIG_MMU + +#include +#include +#include +#include + +/* + * TLB Miss Exception handler + */ + .balign 16 +ENTRY(tme_handler) + .global tlb_entry_i_dat + .global tlb_entry_d_dat + + SWITCH_TO_KERNEL_STACK + +#if defined(CONFIG_ISA_M32R2) + st r0, @-sp + st r1, @-sp + st r2, @-sp + st r3, @-sp + + seth r3, #high(MMU_REG_BASE) + ld r1, @(MESTS_offset, r3) ; r1: status (MESTS reg.) + ld r0, @(MDEVP_offset, r3) ; r0: PFN + ASID (MDEVP reg.) + st r1, @(MESTS_offset, r3) ; clear status (MESTS reg.) + and3 r1, r1, #(MESTS_IT) + bnez r1, 1f ; instruction TLB miss? + +;; data TLB miss +;; input +;; r0: PFN + ASID (MDEVP reg.) +;; r1 - r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free + +#ifndef CONFIG_SMP + seth r2, #high(tlb_entry_d_dat) + or3 r2, r2, #low(tlb_entry_d_dat) +#else /* CONFIG_SMP */ + ldi r1, #-8192 + seth r2, #high(tlb_entry_d_dat) + or3 r2, r2, #low(tlb_entry_d_dat) + and r1, sp + ld r1, @(16, r1) ; current_thread_info->cpu + slli r1, #2 + add r2, r1 +#endif /* !CONFIG_SMP */ + seth r1, #high(DTLB_BASE) + or3 r1, r1, #low(DTLB_BASE) + bra 2f + + .balign 16 + .fillinsn +1: +;; instrucntion TLB miss +;; input +;; r0: MDEVP reg. (included ASID) +;; r1 - r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free + ldi r3, #-4096 + and3 r0, r0, #(MMU_CONTEXT_ASID_MASK) + mvfc r1, bpc + and r1, r3 + or r0, r1 ; r0: PFN + ASID +#ifndef CONFIG_SMP + seth r2, #high(tlb_entry_i_dat) + or3 r2, r2, #low(tlb_entry_i_dat) +#else /* CONFIG_SMP */ + ldi r1, #-8192 + seth r2, #high(tlb_entry_i_dat) + or3 r2, r2, #low(tlb_entry_i_dat) + and r1, sp + ld r1, @(16, r1) ; current_thread_info->cpu + slli r1, #2 + add r2, r1 +#endif /* !CONFIG_SMP */ + seth r1, #high(ITLB_BASE) + or3 r1, r1, #low(ITLB_BASE) + + .fillinsn +2: +;; select TLB entry +;; input +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +#ifdef CONFIG_ISA_DUAL_ISSUE + ld r3, @r2 || srli r1, #3 +#else + ld r3, @r2 + srli r1, #3 +#endif + add r1, r3 + ; tlb_entry_{d|i}_dat++; + addi r3, #1 + and3 r3, r3, #(NR_TLB_ENTRIES - 1) +#ifdef CONFIG_ISA_DUAL_ISSUE + st r3, @r2 || slli r1, #3 +#else + st r3, @r2 + slli r1, #3 +#endif + +;; load pte +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free + ; pgd = *(unsigned long *)MPTB; + ld24 r2, #(-MPTB - 1) + srl3 r3, r0, #22 +#ifdef CONFIG_ISA_DUAL_ISSUE + not r2, r2 || slli r3, #2 ; r3: pgd offset +#else + not r2, r2 + slli r3, #2 +#endif + ld r2, @r2 ; r2: pgd base addr (MPTB reg.) + or r3, r2 ; r3: pmd addr + + ; pmd = pmd_offset(pgd, address); + ld r3, @r3 ; r3: pmd data + ldi r2, #-4096 + beqz r3, 3f ; pmd_none(*pmd) ? + + ; pte = pte_offset(pmd, address); + and r2, r3 ; r2: pte base addr + srl3 r3, r0, #10 + and3 r3, r3, #0xffc ; r3: pte offset + or r3, r2 + seth r2, #0x8000 + or r3, r2 ; r3: pte addr + + ; pte_data = (unsigned long)pte_val(*pte); + ld r2, @r3 ; r2: pte data + or3 r2, r2, #2 ; _PAGE_PRESENT(=2) + + .fillinsn +5: +;; set tlb +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free + st r0, @r1 ; set_tlb_tag(entry++, address); + st r2, @+r1 ; set_tlb_data(entry, pte_data); + + .fillinsn +6: + ld r3, @sp+ + ld r2, @sp+ + ld r1, @sp+ + ld r0, @sp+ + rte + + .fillinsn +3: +;; error +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free +#ifdef CONFIG_ISA_DUAL_ISSUE + bra 5b || ldi r2, #2 +#else + ldi r2, #2 ; r2: pte_data = 0 | _PAGE_PRESENT(=2) + bra 5b +#endif + +#elif defined (CONFIG_ISA_M32R) + + st sp, @-sp + st r0, @-sp + st r1, @-sp + st r2, @-sp + st r3, @-sp + st r4, @-sp + + seth r3, #high(MMU_REG_BASE) + ld r0, @(MDEVA_offset,r3) ; r0: address (MDEVA reg.) + mvfc r2, bpc ; r2: bpc + ld r1, @(MESTS_offset,r3) ; r1: status (MESTS reg.) + st r1, @(MESTS_offset,r3) ; clear status (MESTS reg.) + and3 r1, r1, #(MESTS_IT) + beqz r1, 1f ; data TLB miss? + +;; instrucntion TLB miss + mv r0, r2 ; address = bpc; + ; entry = (unsigned long *)ITLB_BASE+tlb_entry_i*2; + seth r3, #shigh(tlb_entry_i_dat) + ld r4, @(low(tlb_entry_i_dat),r3) + sll3 r2, r4, #3 + seth r1, #high(ITLB_BASE) + or3 r1, r1, #low(ITLB_BASE) + add r2, r1 ; r2: entry + addi r4, #1 ; tlb_entry_i++; + and3 r4, r4, #(NR_TLB_ENTRIES-1) + st r4, @(low(tlb_entry_i_dat),r3) + bra 2f + .fillinsn +1: +;; data TLB miss + ; entry = (unsigned long *)DTLB_BASE+tlb_entry_d*2; + seth r3, #shigh(tlb_entry_d_dat) + ld r4, @(low(tlb_entry_d_dat),r3) + sll3 r2, r4, #3 + seth r1, #high(DTLB_BASE) + or3 r1, r1, #low(DTLB_BASE) + add r2, r1 ; r2: entry + addi r4, #1 ; tlb_entry_d++; + and3 r4, r4, #(NR_TLB_ENTRIES-1) + st r4, @(low(tlb_entry_d_dat),r3) + .fillinsn +2: +;; load pte +; r0: address, r2: entry +; r1,r3,r4: (free) + ; pgd = *(unsigned long *)MPTB; + ld24 r1, #(-MPTB-1) + not r1, r1 + ld r1, @r1 + srl3 r4, r0, #22 + sll3 r3, r4, #2 + add r3, r1 ; r3: pgd + ; pmd = pmd_offset(pgd, address); + ld r1, @r3 ; r1: pmd + beqz r1, 3f ; pmd_none(*pmd) ? +; + and3 r1, r1, #0xeff + ldi r4, #611 ; _KERNPG_TABLE(=611) + beq r1, r4, 4f ; !pmd_bad(*pmd) ? + .fillinsn +3: + ldi r1, #0 ; r1: pte_data = 0 + bra 5f + .fillinsn +4: + ; pte = pte_offset(pmd, address); + ld r4, @r3 ; r4: pte + ldi r3, #-4096 + and r4, r3 + srl3 r3, r0, #10 + and3 r3, r3, #0xffc + add r4, r3 + seth r3, #0x8000 + add r4, r3 ; r4: pte + ; pte_data = (unsigned long)pte_val(*pte); + ld r1, @r4 ; r1: pte_data + .fillinsn + +;; set tlb +; r0: address, r1: pte_data, r2: entry +; r3,r4: (free) +5: + ldi r3, #-4096 ; set_tlb_tag(entry++, address); + and r3, r0 + seth r4, #shigh(MASID) + ld r4, @(low(MASID),r4) ; r4: MASID + and3 r4, r4, #(MMU_CONTEXT_ASID_MASK) + or r3, r4 + st r3, @r2 + or3 r4, r1, #2 ; _PAGE_PRESENT(=2) + st r4, @(4,r2) ; set_tlb_data(entry, pte_data); + + ld r4, @sp+ + ld r3, @sp+ + ld r2, @sp+ + ld r1, @sp+ + ld r0, @sp+ + ld sp, @sp+ + rte + +#else +#error unknown isa configuration +#endif + +ENTRY(init_tlb) +;; Set MMU Register + seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher + or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower + ldi r1, #0 + st r1, @(MPSZ_offset,r0) ; Set MPSZ Reg(Page size 4KB:0 16KB:1 64KB:2) + ldi r1, #0 + st r1, @(MASID_offset,r0) ; Set ASID Zero + +;; Set TLB + seth r0, #high(ITLB_BASE) ; Set ITLB_BASE higher + or3 r0, r0, #low(ITLB_BASE) ; Set ITLB_BASE lower + seth r1, #high(DTLB_BASE) ; Set DTLB_BASE higher + or3 r1, r1, #low(DTLB_BASE) ; Set DTLB_BASE lower + ldi r2, #0 + ldi r3, #NR_TLB_ENTRIES + addi r0, #-4 + addi r1, #-4 +clear_tlb: + st r2, @+r0 ; VPA <- 0 + st r2, @+r0 ; PPA <- 0 + st r2, @+r1 ; VPA <- 0 + st r2, @+r1 ; PPA <- 0 + addi r3, #-1 + bnez r3, clear_tlb +;; + jmp r14 + +ENTRY(m32r_itlb_entrys) +ENTRY(m32r_otlb_entrys) + +#endif /* CONFIG_MMU */ + +.end + diff -Nru a/arch/m32r/mm/page.S b/arch/m32r/mm/page.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/page.S 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,82 @@ +/* + * linux/arch/m32r/mm/page.S + * + * Clear/Copy page with CPU + * + * Copyright (C) 2004 The Free Software Initiative of Japan + * + * Written by Niibe Yutaka + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + .text + .global copy_page + /* + * copy_page (to, from) + * + * PAGE_SIZE = 4096-byte + * Cache line = 16-byte + * 16 * 256 + */ + .align 4 +copy_page: + ldi r2, #255 + ld r3, @r0 /* cache line allocate */ + ld r4, @r1+ + ld r5, @r1+ + ld r6, @r1+ + ld r7, @r1+ + .fillinsn +0: + st r4, @r0 + st r5, @+r0 + st r6, @+r0 + st r7, @+r0 + ld r4, @r1+ + addi r0, #4 + ld r5, @r1+ + ld r6, @r1+ + ld r7, @r1+ + ld r3, @r0 /* cache line allocate */ + addi r2, #-1 + bnez r2, 0b + + st r4, @r0 + st r5, @+r0 + st r6, @+r0 + st r7, @+r0 + jmp r14 + + .text + .global clear_page + /* + * clear_page (to) + * + * PAGE_SIZE = 4096-byte + * Cache line = 16-byte + * 16 * 256 + */ + .align 4 +clear_page: + ldi r2, #255 + ldi r4, #0 + ld r3, @r0 /* cache line allocate */ + .fillinsn +0: + st r4, @r0 + st r4, @+r0 + st r4, @+r0 + st r4, @+r0 + addi r0, #4 + ld r3, @r0 /* cache line allocate */ + addi r2, #-1 + bnez r2, 0b + + st r4, @r0 + st r4, @+r0 + st r4, @+r0 + st r4, @+r0 + jmp r14 diff -Nru a/arch/m32r/oaks32r/defconfig.nommu b/arch/m32r/oaks32r/defconfig.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oaks32r/defconfig.nommu 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,521 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +# CONFIG_IKCONFIG is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +CONFIG_PLAT_OAKS32R=y +# CONFIG_PLAT_MAPPI2 is not set +# CONFIG_CHIP_M32700 is not set +CONFIG_CHIP_M32102=y +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_ISA_M32R=y +CONFIG_BUS_CLOCK=33333333 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x01000000 +CONFIG_MEMORY_SIZE=0x00800000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +# CONFIG_IDE is not set + +# +# SCSI device support +# +# CONFIG_SCSI is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +# CONFIG_DEVFS_FS is not set +CONFIG_DEVPTS_FS_XATTR=y +CONFIG_DEVPTS_FS_SECURITY=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/oaks32r/dot.gdbinit.nommu b/arch/m32r/oaks32r/dot.gdbinit.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oaks32r/dot.gdbinit.nommu 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,155 @@ +# .gdbinit file +# $Id: dot.gdbinit.oaks32r,v 1.2 2004/04/15 02:33:14 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.10 2004/04/15 02:10:45 takata Exp $ +#----- +# target platform: oaks32r + +# setting +set width 0d70 +set radix 0d16 + +# clk xin:cpu:bus=16:66:33 +define clock_init + set *(unsigned long *)0x00ef4008 = 1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4000 = 0x00020100 +end + +# Initialize programmable ports +define port_init + set *(unsigned long *)0x00ef1000 = 0x1 + set *(unsigned long *)0x00ef1060 = 0x01400001 + set *(unsigned long *)0x00ef1064 = 0x00015555 + set *(unsigned long *)0x00ef1068 = 0x55555050 + set *(unsigned long *)0x00ef106c = 0x05150040 +end + +# Initialize SDRAM controller +define sdram_init + set *(unsigned long *)0x00ef6008 = 0x00000182 + set *(unsigned long *)0x00ef600c = 0x00000001 + shell sleep 0.1 + set *(unsigned long *)0x00ef602c = 0x00000010 + set *(unsigned long *)0x00ef6028 = 0x00000300 + set *(unsigned long *)0x00ef6048 = 0x00000001 + set *(unsigned long *)0x00ef6020 = 0x01000041 + set *(unsigned long *)0x00ef6004 = 0x00010117 + set *(unsigned long *)0x00ef6010 = 0x00000001 + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x01000000 - 0x017fffff (8MB) +end + +# Initialize LAN controller +define lanc_init + set *(unsigned long *)0x00ef5008 = 0x03031303 + #RST DRV (P64) + set *(unsigned char *)0x00ef1046 = 0x08 + set *(unsigned char *)0x00ef1026 = 0xff + set *(unsigned char *)0x00ef1026 = 0x00 + set *(unsigned short *)0x02000630 = 0xffff +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x01002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x00000000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d66666667 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d33333333 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + +# set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.busybox.flat nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x01001000 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x00000020 + b *0x00000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +#load_modules +#set_breakpoints +#boot + diff -Nru a/arch/m32r/oprofile/Kconfig b/arch/m32r/oprofile/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/Kconfig 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,23 @@ + +menu "Profiling support" + depends on EXPERIMENTAL + +config PROFILING + bool "Profiling support (EXPERIMENTAL)" + help + Say Y here to enable the extended profiling support mechanisms used + by profilers such as OProfile. + + +config OPROFILE + tristate "OProfile system profiling (EXPERIMENTAL)" + depends on PROFILING + help + OProfile is a profiling system capable of profiling the + whole system, include the kernel, kernel modules, libraries, + and applications. + + If unsure, say N. + +endmenu + diff -Nru a/arch/m32r/oprofile/Makefile b/arch/m32r/oprofile/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/Makefile 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,9 @@ +obj-$(CONFIG_OPROFILE) += oprofile.o + +DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \ + oprof.o cpu_buffer.o buffer_sync.o \ + event_buffer.o oprofile_files.o \ + oprofilefs.o oprofile_stats.o \ + timer_int.o ) + +oprofile-y := $(DRIVER_OBJS) init.o diff -Nru a/arch/m32r/oprofile/init.c b/arch/m32r/oprofile/init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/init.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,25 @@ +/** + * @file init.c + * + * @remark Copyright 2002 OProfile authors + * @remark Read the file COPYING + * + * @author John Levon + */ + +#include +#include +#include +#include + +extern void timer_init(struct oprofile_operations ** ops); + +int __init oprofile_arch_init(struct oprofile_operations ** ops) +{ + return -ENODEV; +} + + +void oprofile_arch_exit(void) +{ +} diff -Nru a/arch/m32r/opsput/defconfig.opsput b/arch/m32r/opsput/defconfig.opsput --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/opsput/defconfig.opsput 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,598 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +CONFIG_PLAT_OPSPUT=y +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +# CONFIG_CHIP_M32700 is not set +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +CONFIG_CHIP_OPSP=y +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +# CONFIG_PREEMPT is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32R_CFC is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set +# CONFIG_DEBUG_DRIVER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +# CONFIG_IDE is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set + +# +# SCSI low-level drivers +# +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_SATA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_DEBUG is not set + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_IOVIRT is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_PAGEALLOC is not set +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/opsput/dot.gdbinit b/arch/m32r/opsput/dot.gdbinit --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/opsput/dot.gdbinit 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,180 @@ +# .gdbinit file +# $Id: dot.gdbinit,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + +# setting +set width 0d70 +set radix 0d16 +set height 0 +debug_chaos + +define tlb_init + set $tlbbase = 0xfe000000 + set *(unsigned long *)($tlbbase + 0x04) = 0x0 + set *(unsigned long *)($tlbbase + 0x0c) = 0x0 + set *(unsigned long *)($tlbbase + 0x14) = 0x0 + set *(unsigned long *)($tlbbase + 0x1c) = 0x0 + set *(unsigned long *)($tlbbase + 0x24) = 0x0 + set *(unsigned long *)($tlbbase + 0x2c) = 0x0 + set *(unsigned long *)($tlbbase + 0x34) = 0x0 + set *(unsigned long *)($tlbbase + 0x3c) = 0x0 + set *(unsigned long *)($tlbbase + 0x44) = 0x0 + set *(unsigned long *)($tlbbase + 0x4c) = 0x0 + set *(unsigned long *)($tlbbase + 0x54) = 0x0 + set *(unsigned long *)($tlbbase + 0x5c) = 0x0 + set *(unsigned long *)($tlbbase + 0x64) = 0x0 + set *(unsigned long *)($tlbbase + 0x6c) = 0x0 + set *(unsigned long *)($tlbbase + 0x74) = 0x0 + set *(unsigned long *)($tlbbase + 0x7c) = 0x0 + set *(unsigned long *)($tlbbase + 0x84) = 0x0 + set *(unsigned long *)($tlbbase + 0x8c) = 0x0 + set *(unsigned long *)($tlbbase + 0x94) = 0x0 + set *(unsigned long *)($tlbbase + 0x9c) = 0x0 + set *(unsigned long *)($tlbbase + 0xa4) = 0x0 + set *(unsigned long *)($tlbbase + 0xac) = 0x0 + set *(unsigned long *)($tlbbase + 0xb4) = 0x0 + set *(unsigned long *)($tlbbase + 0xbc) = 0x0 + set *(unsigned long *)($tlbbase + 0xc4) = 0x0 + set *(unsigned long *)($tlbbase + 0xcc) = 0x0 + set *(unsigned long *)($tlbbase + 0xd4) = 0x0 + set *(unsigned long *)($tlbbase + 0xdc) = 0x0 + set *(unsigned long *)($tlbbase + 0xe4) = 0x0 + set *(unsigned long *)($tlbbase + 0xec) = 0x0 + set *(unsigned long *)($tlbbase + 0xf4) = 0x0 + set *(unsigned long *)($tlbbase + 0xfc) = 0x0 + set $tlbbase = 0xfe000800 + set *(unsigned long *)($tlbbase + 0x04) = 0x0 + set *(unsigned long *)($tlbbase + 0x0c) = 0x0 + set *(unsigned long *)($tlbbase + 0x14) = 0x0 + set *(unsigned long *)($tlbbase + 0x1c) = 0x0 + set *(unsigned long *)($tlbbase + 0x24) = 0x0 + set *(unsigned long *)($tlbbase + 0x2c) = 0x0 + set *(unsigned long *)($tlbbase + 0x34) = 0x0 + set *(unsigned long *)($tlbbase + 0x3c) = 0x0 + set *(unsigned long *)($tlbbase + 0x44) = 0x0 + set *(unsigned long *)($tlbbase + 0x4c) = 0x0 + set *(unsigned long *)($tlbbase + 0x54) = 0x0 + set *(unsigned long *)($tlbbase + 0x5c) = 0x0 + set *(unsigned long *)($tlbbase + 0x64) = 0x0 + set *(unsigned long *)($tlbbase + 0x6c) = 0x0 + set *(unsigned long *)($tlbbase + 0x74) = 0x0 + set *(unsigned long *)($tlbbase + 0x7c) = 0x0 + set *(unsigned long *)($tlbbase + 0x84) = 0x0 + set *(unsigned long *)($tlbbase + 0x8c) = 0x0 + set *(unsigned long *)($tlbbase + 0x94) = 0x0 + set *(unsigned long *)($tlbbase + 0x9c) = 0x0 + set *(unsigned long *)($tlbbase + 0xa4) = 0x0 + set *(unsigned long *)($tlbbase + 0xac) = 0x0 + set *(unsigned long *)($tlbbase + 0xb4) = 0x0 + set *(unsigned long *)($tlbbase + 0xbc) = 0x0 + set *(unsigned long *)($tlbbase + 0xc4) = 0x0 + set *(unsigned long *)($tlbbase + 0xcc) = 0x0 + set *(unsigned long *)($tlbbase + 0xd4) = 0x0 + set *(unsigned long *)($tlbbase + 0xdc) = 0x0 + set *(unsigned long *)($tlbbase + 0xe4) = 0x0 + set *(unsigned long *)($tlbbase + 0xec) = 0x0 + set *(unsigned long *)($tlbbase + 0xf4) = 0x0 + set *(unsigned long *)($tlbbase + 0xfc) = 0x0 +end + +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x88002000 + # INITRD_START +# set *(unsigned long *)($param + 0x0010) = 0x08300000 + # INITRD_SIZE +# set *(unsigned long *)($param + 0x0014) = 0x00400000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 +# set *(unsigned long *)($param + 0x001c) = 0d25000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x\ + root=/dev/nfsroot \ + nfsroot=192.168.0.1:/project/m32r-linux/export/root.2.6 \ + nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \ + mem=16m \0" +end + +define boot + set_kernel_parameters + set $pc=0x88001000 + set $fp=0 + set $evb=0x88000000 + # I/D-Cache ON + +# IPI +# set *(long *)0x00eff2f8 = 0x2 + set $fp=0 +# set *(unsigned long *)0xa0ef4000 = 0x100 + si +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + use_mon_code + while ($i < 0d32 ) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end +# use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb +end + +define show_regs + printf " R0[%08lx] R1[%08lx] R2[%08lx] R3[%08lx]\n",$r0,$r1,$r2,$r3 + printf " R4[%08lx] R5[%08lx] R6[%08lx] R7[%08lx]\n",$r4,$r5,$r6,$r7 + printf " R8[%08lx] R9[%08lx] R10[%08lx] R11[%08lx]\n",$r8,$r9,$r10,$r11 + printf "R12[%08lx] FP[%08lx] LR[%08lx] SP[%08lx]\n",$r12,$fp,$lr,$sp + printf "PSW[%08lx] CBR[%08lx] SPI[%08lx] SPU[%08lx]\n",$psw,$cbr,$spi,$spu + printf "BPC[%08lx] PC[%08lx] ACCL[%08lx] ACCH[%08lx]\n",$bpc,$pc,$accl,$acch + printf "EVB[%08lx]\n",$evb +end + +define setup + debug_chaos + set *(unsigned long *)0xa0ef6004 = 0x0001053f + set *(unsigned long *)0xa0ef6028 = 0x00031102 +# set *(unsigned long *)0xa0ef400c = 0x2 +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc=0x0 +b *0x30000 +c +setup +tlb_init +load_modules +#set *(long *)0xa0ef4000=0x101 +#set *(long *)0xa0ef400c=0x002 + +boot +#b tme_handler +b *0x88000020 + + + + diff -Nru a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig --- a/arch/mips/configs/tb0226_defconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/mips/configs/tb0226_defconfig 2004-09-21 20:52:52 -07:00 @@ -272,7 +272,6 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig --- a/arch/mips/configs/tb0229_defconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/mips/configs/tb0229_defconfig 2004-09-21 20:52:52 -07:00 @@ -229,7 +229,6 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c --- a/arch/mips/kernel/signal.c 2004-09-21 20:52:52 -07:00 +++ b/arch/mips/kernel/signal.c 2004-09-21 20:52:52 -07:00 @@ -480,10 +480,8 @@ struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info); static inline void handle_signal(unsigned long sig, siginfo_t *info, - sigset_t *oldset, struct pt_regs *regs) + struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) { - struct k_sigaction *ka = ¤t->sighand->action[sig-1]; - switch(regs->regs[0]) { case ERESTART_RESTARTBLOCK: case ERESTARTNOHAND: @@ -535,6 +533,7 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs) { + struct k_sigaction ka; siginfo_t info; int signr; @@ -560,9 +559,9 @@ if (!oldset) oldset = ¤t->blocked; - signr = get_signal_to_deliver(&info, regs, NULL); + signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (signr > 0) { - handle_signal(signr, &info, oldset, regs); + handle_signal(signr, &info, &ka, oldset, regs); return 1; } diff -Nru a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c --- a/arch/ppc/8260_io/fcc_enet.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc/8260_io/fcc_enet.c 2004-09-21 20:52:51 -07:00 @@ -1986,9 +1986,9 @@ fccp = fcp->fccp; if (duplex) - fccp->fcc_fpsmr |= FCC_PSMR_FDE; + fccp->fcc_fpsmr |= FCC_PSMR_FDE | FCC_PSMR_LPB; else - fccp->fcc_fpsmr &= ~FCC_PSMR_FDE; + fccp->fcc_fpsmr &= ~(FCC_PSMR_FDE | FCC_PSMR_LPB); /* Enable transmit/receive */ fccp->fcc_gfmr |= FCC_GFMR_ENR | FCC_GFMR_ENT; diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig --- a/arch/ppc/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc/Kconfig 2004-09-21 20:52:52 -07:00 @@ -35,6 +35,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "Processor" diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile --- a/arch/ppc/Makefile 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc/Makefile 2004-09-21 20:52:51 -07:00 @@ -24,7 +24,7 @@ CPPFLAGS += -Iarch/$(ARCH) AFLAGS += -Iarch/$(ARCH) CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ - -ffixed-r2 -Wno-uninitialized -mmultiple + -ffixed-r2 -mmultiple CPP = $(CC) -E $(CFLAGS) CHECKFLAGS += -D__powerpc__=1 diff -Nru a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c --- a/arch/ppc/boot/common/ns16550.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc/boot/common/ns16550.c 2004-09-21 20:52:52 -07:00 @@ -5,14 +5,14 @@ #include #include #include -#include #include #include +#include "nonstdio.h" +#include "serial.h" + #define SERIAL_BAUD 9600 -extern void outb(int port, unsigned char val); -extern unsigned char inb(int port); extern unsigned long ISA_io; static struct serial_state rs_table[RS_TABLE_SIZE] = { diff -Nru a/arch/ppc/boot/include/serial.h b/arch/ppc/boot/include/serial.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ppc/boot/include/serial.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,46 @@ +/* + * A really private header file for the (dumb) serial driver in arch/ppc/boot + * + * Shamelessly taken from include/linux/serialP.h: + * + * Copyright (C) 1997 by Theodore Ts'o. + * + * Redistribution of this file is permitted under the terms of the GNU + * Public License (GPL) + */ + +#ifndef _PPC_BOOT_SERIALP_H +#define _PPC_BOOT_SERIALP_H + +/* + * This is our internal structure for each serial port's state. + * + * Many fields are paralleled by the structure used by the serial_struct + * structure. + * + * Given that this is how SERIAL_PORT_DFNS are done, and that we need + * to use a few of their fields, we need to have our own copy of it. + */ +struct serial_state { + int magic; + int baud_base; + unsigned long port; + int irq; + int flags; + int hub6; + int type; + int line; + int revision; /* Chip revision (950) */ + int xmit_fifo_size; + int custom_divisor; + int count; + u8 *iomem_base; + u16 iomem_reg_shift; + unsigned short close_delay; + unsigned short closing_wait; /* time to wait before closing */ + unsigned long icount; + int io_type; + void *info; + void *dev; +}; +#endif /* _PPC_BOOT_SERIAL_H */ diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c --- a/arch/ppc/kernel/setup.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc/kernel/setup.c 2004-09-21 20:52:52 -07:00 @@ -418,7 +418,6 @@ * are used for initrd_start and initrd_size, * otherwise they contain 0xdeadbeef. */ - cmd_line[0] = 0; if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) { strlcpy(cmd_line, (char *)r3 + KERNELBASE, sizeof(cmd_line)); diff -Nru a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c --- a/arch/ppc/lib/rheap.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc/lib/rheap.c 2004-09-21 20:52:51 -07:00 @@ -216,7 +216,7 @@ /* Grow the after block backwards */ if (before == NULL && after != NULL) { - (int8_t *) after->start -= size; + after->start = (int8_t *)after->start - size; after->size += size; return; } @@ -407,7 +407,7 @@ /* blk still in free list, with updated start and/or size */ if (bs == s || be == e) { if (bs == s) - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; } else { @@ -471,7 +471,7 @@ newblk->owner = owner; /* blk still in free list, with updated start, size */ - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; start = newblk->start; @@ -535,7 +535,7 @@ /* blk still in free list, with updated start and/or size */ if (bs == s || be == e) { if (bs == s) - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; } else { diff -Nru a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c --- a/arch/ppc/platforms/pmac_cpufreq.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc/platforms/pmac_cpufreq.c 2004-09-21 20:52:52 -07:00 @@ -498,7 +498,7 @@ * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz) * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz) * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz) - * - iBook2 500 (PMU based, 400Mhz & 500Mhz) + * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz) * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage) * - Recent MacRISC3 laptops * - iBook G4s and PowerBook G4s with 7447A CPUs @@ -533,11 +533,8 @@ machine_is_compatible("PowerBook3,5") || machine_is_compatible("MacRISC3")) { pmac_cpufreq_init_MacRISC3(cpunode); - /* Else check for iBook2 500 */ + /* Else check for iBook2 500/600 */ } else if (machine_is_compatible("PowerBook4,1")) { - /* We only know about 500Mhz model */ - if (cur_freq < 450000 || cur_freq > 550000) - goto out; hi_freq = cur_freq; low_freq = 400000; set_speed_proc = pmu_set_cpu_speed; diff -Nru a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c --- a/arch/ppc/platforms/residual.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc/platforms/residual.c 2004-09-21 20:52:51 -07:00 @@ -935,8 +935,8 @@ goto unknown; #define p pkt->L4_Pack.L4_Data.L4_PPCPack - /* Must be 32-bit memory address */ - if (!((p.PPCData[0] == 2) && (p.PPCData[1] == 32))) + /* Must be 32-bit system address */ + if (!((p.PPCData[0] == 3) && (p.PPCData[1] == 32))) goto unknown; /* It doesn't seem to work where length != 1 (what can I say? :-/ ) */ diff -Nru a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c --- a/arch/ppc/syslib/open_pic2.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc/syslib/open_pic2.c 2004-09-21 20:52:51 -07:00 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff -Nru a/arch/ppc64/Kconfig.debug b/arch/ppc64/Kconfig.debug --- a/arch/ppc64/Kconfig.debug 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/Kconfig.debug 2004-09-21 20:52:52 -07:00 @@ -44,16 +44,6 @@ for handling hard and soft interrupts. This can help avoid overflowing the process kernel stacks. -config SPINLINE - bool "Inline spinlock code at each call site" - depends on SMP && !PPC_SPLPAR && !PPC_ISERIES - help - Say Y if you want to have the code for acquiring spinlocks - and rwlocks inlined at each call site. This makes the kernel - somewhat bigger, but can be useful when profiling the kernel. - - If in doubt, say N. - config SCHEDSTATS bool "Collect scheduler statistics" depends on DEBUG_KERNEL && PROC_FS diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile --- a/arch/ppc64/Makefile 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/Makefile 2004-09-21 20:52:51 -07:00 @@ -22,12 +22,17 @@ CC := $(CC) -m64 endif +new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) + +ifeq ($(new_nm),y) +NM := $(NM) --synthetic +endif + CHECKFLAGS += -m64 -D__powerpc__=1 LDFLAGS := -m elf64ppc LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) -CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \ - -mtraceback=none +CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none ifeq ($(CONFIG_POWER4_ONLY),y) CFLAGS += $(call cc-option,-mcpu=power4) diff -Nru a/arch/ppc64/kernel/chrp_setup.c b/arch/ppc64/kernel/chrp_setup.c --- a/arch/ppc64/kernel/chrp_setup.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/chrp_setup.c 2004-09-21 20:52:51 -07:00 @@ -140,8 +140,6 @@ ROOT_DEV = Root_SDA2; } - printk("Boot arguments: %s\n", cmd_line); - fwnmi_init(); #ifndef CONFIG_PPC_ISERIES diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c --- a/arch/ppc64/kernel/eeh.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/eeh.c 2004-09-21 20:52:52 -07:00 @@ -48,9 +48,6 @@ static int ibm_slot_error_detail; static int eeh_subsystem_enabled; -#define EEH_MAX_OPTS 4096 -static char *eeh_opts; -static int eeh_opts_last; /* Buffer for reporting slot-error-detail rtas calls */ static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; @@ -62,10 +59,6 @@ static DEFINE_PER_CPU(unsigned long, false_positives); static DEFINE_PER_CPU(unsigned long, ignored_failures); -static int eeh_check_opts_config(struct device_node *dn, int class_code, - int vendor_id, int device_id, - int default_state); - /** * The pci address cache subsystem. This subsystem places * PCI device address resources into a red-black tree, sorted @@ -497,7 +490,6 @@ struct eeh_early_enable_info { unsigned int buid_hi; unsigned int buid_lo; - int force_off; }; /* Enable eeh for the given device node. */ @@ -539,18 +531,8 @@ if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY) enable = 0; - if (!eeh_check_opts_config(dn, *class_code, *vendor_id, *device_id, - enable)) { - if (enable) { - printk(KERN_WARNING "EEH: %s user requested to run " - "without EEH checking.\n", dn->full_name); - enable = 0; - } - } - - if (!enable || info->force_off) { + if (!enable) dn->eeh_mode |= EEH_MODE_NOCHECK; - } /* Ok... see if this device supports EEH. Some do, some don't, * and the only way to find out is to check each and every one. */ @@ -604,15 +586,12 @@ { struct device_node *phb, *np; struct eeh_early_enable_info info; - char *eeh_force_off = strstr(saved_command_line, "eeh-force-off"); init_pci_config_tokens(); np = of_find_node_by_path("/rtas"); - if (np == NULL) { - printk(KERN_WARNING "EEH: RTAS not found !\n"); + if (np == NULL) return; - } ibm_set_eeh_option = rtas_token("ibm,set-eeh-option"); ibm_set_slot_reset = rtas_token("ibm,set-slot-reset"); @@ -632,13 +611,6 @@ eeh_error_buf_size = RTAS_ERROR_LOG_MAX; } - info.force_off = 0; - if (eeh_force_off) { - printk(KERN_WARNING "EEH: WARNING: PCI Enhanced I/O Error " - "Handling is user disabled\n"); - info.force_off = 1; - } - /* Enable EEH for all adapters. Note that eeh requires buid's */ for (phb = of_find_node_by_name(NULL, "pci"); phb; phb = of_find_node_by_name(phb, "pci")) { @@ -653,11 +625,10 @@ traverse_pci_devices(phb, early_enable_eeh, &info); } - if (eeh_subsystem_enabled) { + if (eeh_subsystem_enabled) printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n"); - } else { - printk(KERN_WARNING "EEH: disabled PCI Enhanced I/O Error Handling\n"); - } + else + printk(KERN_WARNING "EEH: No capable adapters found\n"); } /** @@ -734,6 +705,128 @@ EXPORT_SYMBOL(eeh_remove_device); /* + * Here comes the EEH implementation of the IOMAP + * interfaces. + */ +unsigned int fastcall ioread8(void __iomem *addr) +{ + return readb(addr); +} +unsigned int fastcall ioread16(void __iomem *addr) +{ + return readw(addr); +} +unsigned int fastcall ioread32(void __iomem *addr) +{ + return readl(addr); +} +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); + +void fastcall iowrite8(u8 val, void __iomem *addr) +{ + writeb(val, addr); +} +void fastcall iowrite16(u16 val, void __iomem *addr) +{ + writew(val, addr); +} +void fastcall iowrite32(u32 val, void __iomem *addr) +{ + writel(val, addr); +} +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); + +/* + * These are the "repeat read/write" functions. Note the + * non-CPU byte order. We do things in "IO byteorder" + * here. + * + * FIXME! We could make these do EEH handling if we really + * wanted. Not clear if we do. + */ +void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insb((void *) IO_TOKEN_TO_ADDR(addr), dst, count); +} +void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insw_ns((void *) IO_TOKEN_TO_ADDR(addr), dst, count); +} +void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insl_ns((void *) IO_TOKEN_TO_ADDR(addr), dst, count); +} +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(ioread32_rep); + +void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsb((void *) IO_TOKEN_TO_ADDR(addr), src, count); +} +void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsw_ns((void *) IO_TOKEN_TO_ADDR(addr), src, count); +} +void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsl_ns((void *) IO_TOKEN_TO_ADDR(addr), src, count); +} +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(iowrite32_rep); + +void __iomem *ioport_map(unsigned long port, unsigned int len) +{ + if (!_IO_IS_VALID(port)) + return NULL; + return (void __iomem *) IO_ADDR_TO_TOKEN(port+pci_io_base); +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len) + return NULL; + if (max && len > max) + len = max; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + void __iomem *vaddr = (void __iomem *) start; + if (dev && eeh_subsystem_enabled) { + struct device_node *dn = pci_device_to_OF_node(dev); + if (dn && !(dn->eeh_mode & EEH_MODE_NOCHECK)) + return (void __iomem *) IO_ADDR_TO_TOKEN(vaddr); + } + return vaddr; + } + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); + +/* * If EEH is implemented, find the PCI device using given phys addr * and check to see if eeh failure checking is disabled. * Remap the addr (trivially) to the EEH region if EEH checking enabled. @@ -816,129 +909,3 @@ return 0; } __initcall(eeh_init_proc); - -/* - * Test if "dev" should be configured on or off. - * This processes the options literally from left to right. - * This lets the user specify stupid combinations of options, - * but at least the result should be very predictable. - */ -static int eeh_check_opts_config(struct device_node *dn, - int class_code, int vendor_id, int device_id, - int default_state) -{ - char devname[32], classname[32]; - char *strs[8], *s; - int nstrs, i; - int ret = default_state; - - /* Build list of strings to match */ - nstrs = 0; - s = (char *)get_property(dn, "ibm,loc-code", NULL); - if (s) - strs[nstrs++] = s; - sprintf(devname, "dev%04x:%04x", vendor_id, device_id); - strs[nstrs++] = devname; - sprintf(classname, "class%04x", class_code); - strs[nstrs++] = classname; - strs[nstrs++] = ""; /* yes, this matches the empty string */ - - /* - * Now see if any string matches the eeh_opts list. - * The eeh_opts list entries start with + or -. - */ - for (s = eeh_opts; s && (s < (eeh_opts + eeh_opts_last)); - s += strlen(s)+1) { - for (i = 0; i < nstrs; i++) { - if (strcasecmp(strs[i], s+1) == 0) { - ret = (strs[i][0] == '+') ? 1 : 0; - } - } - } - return ret; -} - -/* - * Handle kernel eeh-on & eeh-off cmd line options for eeh. - * - * We support: - * eeh-off=loc1,loc2,loc3... - * - * and this option can be repeated so - * eeh-off=loc1,loc2 eeh-off=loc3 - * is the same as eeh-off=loc1,loc2,loc3 - * - * loc is an IBM location code that can be found in a manual or - * via openfirmware (or the Hardware Management Console). - * - * We also support these additional "loc" values: - * - * dev#:# vendor:device id in hex (e.g. dev1022:2000) - * class# class id in hex (e.g. class0200) - * - * If no location code is specified all devices are assumed - * so eeh-off means eeh by default is off. - */ - -/* - * This is implemented as a null separated list of strings. - * Each string looks like this: "+X" or "-X" - * where X is a loc code, vendor:device, class (as shown above) - * or empty which is used to indicate all. - * - * We interpret this option string list so that it will literally - * behave left-to-right even if some combinations don't make sense. - */ -static int __init eeh_parm(char *str, int state) -{ - char *s, *cur, *curend; - - if (!eeh_opts) { - eeh_opts = alloc_bootmem(EEH_MAX_OPTS); - eeh_opts[eeh_opts_last++] = '+'; /* default */ - eeh_opts[eeh_opts_last++] = '\0'; - } - if (*str == '\0') { - eeh_opts[eeh_opts_last++] = state ? '+' : '-'; - eeh_opts[eeh_opts_last++] = '\0'; - return 1; - } - if (*str == '=') - str++; - for (s = str; s && *s != '\0'; s = curend) { - cur = s; - /* ignore empties. Don't treat as "all-on" or "all-off" */ - while (*cur == ',') - cur++; - curend = strchr(cur, ','); - if (!curend) - curend = cur + strlen(cur); - if (*cur) { - int curlen = curend-cur; - if (eeh_opts_last + curlen > EEH_MAX_OPTS-2) { - printk(KERN_WARNING "EEH: sorry...too many " - "eeh cmd line options\n"); - return 1; - } - eeh_opts[eeh_opts_last++] = state ? '+' : '-'; - strncpy(eeh_opts+eeh_opts_last, cur, curlen); - eeh_opts_last += curlen; - eeh_opts[eeh_opts_last++] = '\0'; - } - } - - return 1; -} - -static int __init eehoff_parm(char *str) -{ - return eeh_parm(str, 0); -} - -static int __init eehon_parm(char *str) -{ - return eeh_parm(str, 1); -} - -__setup("eeh-off", eehoff_parm); -__setup("eeh-on", eehon_parm); diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S --- a/arch/ppc64/kernel/head.S 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/head.S 2004-09-21 20:52:52 -07:00 @@ -548,15 +548,15 @@ .llong 0 /* Reserved */ .llong 0 /* Reserved */ .llong 0 /* Reserved */ - .llong 0xc00000000 /* KERNELBASE ESID */ - .llong 0x6a99b4b14 /* KERNELBASE VSID */ + .llong (KERNELBASE>>SID_SHIFT) + .llong 0x40bffffd5 /* KERNELBASE VSID */ /* We have to list the bolted VMALLOC segment here, too, so that it * will be restored on shared processor switch */ - .llong 0xd00000000 /* VMALLOCBASE ESID */ - .llong 0x08d12e6ab /* VMALLOCBASE VSID */ + .llong (VMALLOCBASE>>SID_SHIFT) + .llong 0xb0cffffd1 /* VMALLOCBASE VSID */ .llong 8192 /* # pages to map (32 MB) */ .llong 0 /* Offset from start of loadarea to start of map */ - .llong 0x0006a99b4b140000 /* VPN of first page to map */ + .llong 0x40bffffd50000 /* VPN of first page to map */ . = 0x6100 @@ -1064,18 +1064,9 @@ rldimi r10,r11,7,52 /* r10 = first ste of the group */ /* Calculate VSID */ - /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ - rldic r11,r11,15,36 - ori r11,r11,0xc - - /* VSID_RANDOMIZER */ - li r9,9 - sldi r9,r9,32 - oris r9,r9,58231 - ori r9,r9,39831 - - mulld r9,r11,r9 - rldic r9,r9,12,16 /* r9 = vsid << 12 */ + /* This is a kernel address, so protovsid = ESID */ + ASM_VSID_SCRAMBLE(r11, r9) + rldic r9,r11,12,16 /* r9 = vsid << 12 */ /* Search the primary group for a free entry */ 1: ld r11,0(r10) /* Test valid bit of the current ste */ diff -Nru a/arch/ppc64/kernel/iSeries_pci_reset.c b/arch/ppc64/kernel/iSeries_pci_reset.c --- a/arch/ppc64/kernel/iSeries_pci_reset.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/iSeries_pci_reset.c 2004-09-21 20:52:52 -07:00 @@ -65,7 +65,8 @@ AssertDelay = (5 * HZ) / 10; else AssertDelay = (AssertTime * HZ) / 10; - if (WaitDelay == 0) + + if (DelayTime == 0) WaitDelay = (30 * HZ) / 10; else WaitDelay = (DelayTime * HZ) / 10; diff -Nru a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c --- a/arch/ppc64/kernel/iSeries_setup.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/iSeries_setup.c 2004-09-21 20:52:52 -07:00 @@ -333,32 +333,31 @@ #endif if (itLpNaca.xPirEnvironMode == 0) piranha_simulator = 1; + + /* Associate Lp Event Queue 0 with processor 0 */ + HvCallEvent_setLpEventQueueInterruptProc(0, 0); + + mf_init(); + mf_initialized = 1; + mb(); } -void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) +void __init iSeries_parse_cmdline(void) { char *p, *q; - /* Associate Lp Event Queue 0 with processor 0 */ - HvCallEvent_setLpEventQueueInterruptProc(0, 0); - /* copy the command line parameter from the primary VSP */ HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, HvLpDma_Direction_RemoteToLocal); p = cmd_line; q = cmd_line + 255; - while( p < q ) { + while(p < q) { if (!*p || *p == '\n') break; ++p; } *p = 0; - - mf_init(); - mf_initialized = 1; - mb(); } /* diff -Nru a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c --- a/arch/ppc64/kernel/idle.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/idle.c 2004-09-21 20:52:52 -07:00 @@ -16,28 +16,18 @@ */ #include -#include #include #include -#include #include -#include -#include -#include -#include -#include #include +#include +#include -#include -#include #include -#include #include #include -#include #include #include -#include #include #include @@ -45,11 +35,11 @@ extern long poll_pending(void); extern void power4_idle(void); -int (*idle_loop)(void); +static int (*idle_loop)(void); #ifdef CONFIG_PPC_ISERIES -unsigned long maxYieldTime = 0; -unsigned long minYieldTime = 0xffffffffffffffffUL; +static unsigned long maxYieldTime = 0; +static unsigned long minYieldTime = 0xffffffffffffffffUL; static void yield_shared_processor(void) { @@ -80,7 +70,7 @@ process_iSeries_events(); } -int iSeries_idle(void) +static int iSeries_idle(void) { struct paca_struct *lpaca; long oldval; @@ -91,13 +81,10 @@ CTRL = mfspr(CTRLF); CTRL &= ~RUNLATCH; mtspr(CTRLT, CTRL); -#if 0 - init_idle(); -#endif lpaca = get_paca(); - for (;;) { + while (1) { if (lpaca->lppaca.xSharedProc) { if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr)) process_iSeries_events(); @@ -125,11 +112,13 @@ schedule(); } + return 0; } -#endif -int default_idle(void) +#else + +static int default_idle(void) { long oldval; unsigned int cpu = smp_processor_id(); @@ -142,7 +131,12 @@ while (!need_resched() && !cpu_is_offline(cpu)) { barrier(); + /* + * Go into low thread priority and possibly + * low power mode. + */ HMT_low(); + HMT_very_low(); } HMT_medium(); @@ -159,8 +153,6 @@ return 0; } -#ifdef CONFIG_PPC_PSERIES - DECLARE_PER_CPU(unsigned long, smt_snooze_delay); int dedicated_idle(void) @@ -174,8 +166,10 @@ ppaca = &paca[cpu ^ 1]; while (1) { - /* Indicate to the HV that we are idle. Now would be - * a good time to find other work to dispatch. */ + /* + * Indicate to the HV that we are idle. Now would be + * a good time to find other work to dispatch. + */ lpaca->lppaca.xIdle = 1; oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); @@ -184,41 +178,31 @@ start_snooze = __get_tb() + *smt_snooze_delay * tb_ticks_per_usec; while (!need_resched() && !cpu_is_offline(cpu)) { - /* need_resched could be 1 or 0 at this - * point. If it is 0, set it to 0, so - * an IPI/Prod is sent. If it is 1, keep - * it that way & schedule work. + /* + * Go into low thread priority and possibly + * low power mode. */ + HMT_low(); + HMT_very_low(); + if (*smt_snooze_delay == 0 || - __get_tb() < start_snooze) { - HMT_low(); /* Low thread priority */ + __get_tb() < start_snooze) continue; - } - HMT_very_low(); /* Low power mode */ + HMT_medium(); + + if (!(ppaca->lppaca.xIdle)) { + local_irq_disable(); - /* If the SMT mode is system controlled & the - * partner thread is doing work, switch into - * ST mode. - */ - if((naca->smt_state == SMT_DYNAMIC) && - (!(ppaca->lppaca.xIdle))) { - /* Indicate we are no longer polling for - * work, and then clear need_resched. If - * need_resched was 1, set it back to 1 - * and schedule work + /* + * We are about to sleep the thread + * and so wont be polling any + * more. */ clear_thread_flag(TIF_POLLING_NRFLAG); - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - if(oldval == 1) { - set_need_resched(); - break; - } - - /* DRENG: Go HMT_medium here ? */ - local_irq_disable(); - /* SMT dynamic mode. Cede will result + /* + * SMT dynamic mode. Cede will result * in this thread going dormant, if the * partner thread is still doing work. * Thread wakes up if partner goes idle, @@ -226,15 +210,21 @@ * occurs. Returning from the cede * enables external interrupts. */ - cede_processor(); + if (!need_resched()) + cede_processor(); + else + local_irq_enable(); } else { - /* Give the HV an opportunity at the + /* + * Give the HV an opportunity at the * processor, since we are not doing * any work. */ poll_pending(); } } + + clear_thread_flag(TIF_POLLING_NRFLAG); } else { set_need_resched(); } @@ -248,48 +238,49 @@ return 0; } -int shared_idle(void) +static int shared_idle(void) { struct paca_struct *lpaca = get_paca(); + unsigned int cpu = smp_processor_id(); while (1) { - if (cpu_is_offline(smp_processor_id()) && - system_state == SYSTEM_RUNNING) - cpu_die(); - - /* Indicate to the HV that we are idle. Now would be - * a good time to find other work to dispatch. */ + /* + * Indicate to the HV that we are idle. Now would be + * a good time to find other work to dispatch. + */ lpaca->lppaca.xIdle = 1; - if (!need_resched()) { - local_irq_disable(); - - /* + while (!need_resched() && !cpu_is_offline(cpu)) { + local_irq_disable(); + + /* * Yield the processor to the hypervisor. We return if * an external interrupt occurs (which are driven prior * to returning here) or if a prod occurs from another - * processor. When returning here, external interrupts + * processor. When returning here, external interrupts * are enabled. + * + * Check need_resched() again with interrupts disabled + * to avoid a race. */ - cede_processor(); + if (!need_resched()) + cede_processor(); + else + local_irq_enable(); } HMT_medium(); lpaca->lppaca.xIdle = 0; schedule(); + if (cpu_is_offline(smp_processor_id()) && + system_state == SYSTEM_RUNNING) + cpu_die(); } return 0; } -#endif - -int cpu_idle(void) -{ - idle_loop(); - return 0; -} -int native_idle(void) +static int powermac_idle(void) { while(1) { if (!need_resched()) @@ -299,6 +290,45 @@ } return 0; } +#endif + +int cpu_idle(void) +{ + idle_loop(); + return 0; +} + +int powersave_nap; + +#ifdef CONFIG_SYSCTL +/* + * Register the sysctl to set/clear powersave_nap. + */ +static ctl_table powersave_nap_ctl_table[]={ + { + .ctl_name = KERN_PPC_POWERSAVE_NAP, + .procname = "powersave-nap", + .data = &powersave_nap, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { 0, }, +}; +static ctl_table powersave_nap_sysctl_root[] = { + { 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, }, + { 0,}, +}; + +static int __init +register_powersave_nap_sysctl(void) +{ + register_sysctl_table(powersave_nap_sysctl_root, 0); + + return 0; +} +__initcall(register_powersave_nap_sysctl); +#endif int idle_setup(void) { @@ -319,8 +349,8 @@ idle_loop = default_idle; } } else if (systemcfg->platform == PLATFORM_POWERMAC) { - printk("idle = native_idle\n"); - idle_loop = native_idle; + printk("idle = powermac_idle\n"); + idle_loop = powermac_idle; } else { printk("idle_setup: unknown platform, use default_idle\n"); idle_loop = default_idle; @@ -329,4 +359,3 @@ return 1; } - diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c --- a/arch/ppc64/kernel/ioctl32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/ioctl32.c 2004-09-21 20:52:52 -07:00 @@ -22,9 +22,7 @@ #define INCLUDES #include "compat_ioctl.c" -#include #include -#include #define CODE #include "compat_ioctl.c" diff -Nru a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c --- a/arch/ppc64/kernel/iommu.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/iommu.c 2004-09-21 20:52:51 -07:00 @@ -229,7 +229,7 @@ struct scatterlist *sglist, int nelems, enum dma_data_direction direction) { - dma_addr_t dma_next, dma_addr; + dma_addr_t dma_next = 0, dma_addr; unsigned long flags; struct scatterlist *s, *outs, *segstart; int outcount; diff -Nru a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c --- a/arch/ppc64/kernel/irq.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/irq.c 2004-09-21 20:52:51 -07:00 @@ -677,6 +677,8 @@ return 0; } +EXPORT_SYMBOL(probe_irq_mask); + void __init init_IRQ(void) { static int once = 0; diff -Nru a/arch/ppc64/kernel/lparcfg.c b/arch/ppc64/kernel/lparcfg.c --- a/arch/ppc64/kernel/lparcfg.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/lparcfg.c 2004-09-21 20:52:51 -07:00 @@ -34,31 +34,37 @@ #include #include -#define MODULE_VERS "1.3" +#define MODULE_VERS "1.4" #define MODULE_NAME "lparcfg" /* #define LPARCFG_DEBUG */ /* find a better place for this function... */ -void log_plpar_hcall_return(unsigned long rc,char * tag) +void log_plpar_hcall_return(unsigned long rc, char *tag) { - if (rc ==0 ) /* success, return */ + if (rc == 0) /* success, return */ return; /* check for null tag ? */ if (rc == H_Hardware) - printk(KERN_INFO "plpar-hcall (%s) failed with hardware fault\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed with hardware fault\n", tag); else if (rc == H_Function) - printk(KERN_INFO "plpar-hcall (%s) failed; function not allowed\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed; function not allowed\n", tag); else if (rc == H_Authority) - printk(KERN_INFO "plpar-hcall (%s) failed; not authorized to this function\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed; not authorized to this function\n", + tag); else if (rc == H_Parameter) - printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",tag); + printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n", + tag); else - printk(KERN_INFO "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",tag,rc); + printk(KERN_INFO + "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n", + tag, rc); } - static struct proc_dir_entry *proc_ppc64_lparcfg; #define LPARCFG_BUFF_SIZE 4096 @@ -78,59 +84,60 @@ shared = (int)(lpaca->lppaca_ptr->xSharedProc); seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n", - e2a(xItExtVpdPanel.mfgID[2]), - e2a(xItExtVpdPanel.mfgID[3]), - e2a(xItExtVpdPanel.systemSerial[1]), - e2a(xItExtVpdPanel.systemSerial[2]), - e2a(xItExtVpdPanel.systemSerial[3]), - e2a(xItExtVpdPanel.systemSerial[4]), - e2a(xItExtVpdPanel.systemSerial[5])); + e2a(xItExtVpdPanel.mfgID[2]), + e2a(xItExtVpdPanel.mfgID[3]), + e2a(xItExtVpdPanel.systemSerial[1]), + e2a(xItExtVpdPanel.systemSerial[2]), + e2a(xItExtVpdPanel.systemSerial[3]), + e2a(xItExtVpdPanel.systemSerial[4]), + e2a(xItExtVpdPanel.systemSerial[5])); seq_printf(m, "system_type=%c%c%c%c\n", - e2a(xItExtVpdPanel.machineType[0]), - e2a(xItExtVpdPanel.machineType[1]), - e2a(xItExtVpdPanel.machineType[2]), - e2a(xItExtVpdPanel.machineType[3])); + e2a(xItExtVpdPanel.machineType[0]), + e2a(xItExtVpdPanel.machineType[1]), + e2a(xItExtVpdPanel.machineType[2]), + e2a(xItExtVpdPanel.machineType[3])); - lp_index = HvLpConfig_getLpIndex(); + lp_index = HvLpConfig_getLpIndex(); seq_printf(m, "partition_id=%d\n", (int)lp_index); seq_printf(m, "system_active_processors=%d\n", - (int)HvLpConfig_getSystemPhysicalProcessors()); + (int)HvLpConfig_getSystemPhysicalProcessors()); seq_printf(m, "system_potential_processors=%d\n", - (int)HvLpConfig_getSystemPhysicalProcessors()); + (int)HvLpConfig_getSystemPhysicalProcessors()); - processors = (int)HvLpConfig_getPhysicalProcessors(); + processors = (int)HvLpConfig_getPhysicalProcessors(); seq_printf(m, "partition_active_processors=%d\n", processors); - max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); + max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); seq_printf(m, "partition_potential_processors=%d\n", max_processors); - if(shared) { - entitled_capacity = HvLpConfig_getSharedProcUnits(); - max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits(); + if (shared) { + entitled_capacity = HvLpConfig_getSharedProcUnits(); + max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits(); } else { - entitled_capacity = processors * 100; - max_entitled_capacity = max_processors * 100; + entitled_capacity = processors * 100; + max_entitled_capacity = max_processors * 100; } seq_printf(m, "partition_entitled_capacity=%d\n", entitled_capacity); seq_printf(m, "partition_max_entitled_capacity=%d\n", - max_entitled_capacity); + max_entitled_capacity); - if(shared) { - pool_id = HvLpConfig_getSharedPoolIndex(); + if (shared) { + pool_id = HvLpConfig_getSharedPoolIndex(); seq_printf(m, "pool=%d\n", (int)pool_id); seq_printf(m, "pool_capacity=%d\n", - (int)(HvLpConfig_getNumProcsInSharedPool(pool_id)*100)); + (int)(HvLpConfig_getNumProcsInSharedPool(pool_id) * + 100)); } seq_printf(m, "shared_processor_mode=%d\n", shared); return 0; } -#endif /* CONFIG_PPC_ISERIES */ +#endif /* CONFIG_PPC_ISERIES */ #ifdef CONFIG_PPC_PSERIES /* @@ -158,11 +165,13 @@ * XXXX - Processors active on platform. */ static unsigned int h_get_ppp(unsigned long *entitled, - unsigned long *unallocated, unsigned long *aggregation, - unsigned long *resource) + unsigned long *unallocated, + unsigned long *aggregation, + unsigned long *resource) { unsigned long rc; - rc = plpar_hcall_4out(H_GET_PPP,0,0,0,0,entitled,unallocated,aggregation,resource); + rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, + aggregation, resource); log_plpar_hcall_return(rc, "H_GET_PPP"); @@ -185,7 +194,7 @@ */ static unsigned long get_purr() { - unsigned long sum_purr=0; + unsigned long sum_purr = 0; return sum_purr; } @@ -202,7 +211,7 @@ { int call_status; - char * local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); + char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); if (!local_buffer) { printk(KERN_ERR "%s %s kmalloc failure at line %d \n", __FILE__, __FUNCTION__, __LINE__); @@ -219,22 +228,23 @@ spin_unlock(&rtas_data_buf_lock); if (call_status != 0) { - printk(KERN_INFO "%s %s Error calling get-system-parameter (0x%x)\n", + printk(KERN_INFO + "%s %s Error calling get-system-parameter (0x%x)\n", __FILE__, __FUNCTION__, call_status); } else { int splpar_strlen; int idx, w_idx; - char * workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); + char *workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); if (!workbuffer) { - printk(KERN_ERR "%s %s kmalloc failure at line %d \n",__FILE__,__FUNCTION__,__LINE__); + printk(KERN_ERR "%s %s kmalloc failure at line %d \n", + __FILE__, __FUNCTION__, __LINE__); return; } - #ifdef LPARCFG_DEBUG printk(KERN_INFO "success calling get-system-parameter \n"); #endif splpar_strlen = local_buffer[0] * 16 + local_buffer[1]; - local_buffer += 2; /* step over strlen value */ + local_buffer += 2; /* step over strlen value */ memset(workbuffer, 0, SPLPAR_MAXLENGTH); w_idx = 0; @@ -253,13 +263,15 @@ w_idx = 0; } else if (local_buffer[idx] == '=') { /* code here to replace workbuffer contents - with different keyword strings */ - if (0 == strcmp(workbuffer,"MaxEntCap")) { - strcpy(workbuffer, "partition_max_entitled_capacity"); + with different keyword strings */ + if (0 == strcmp(workbuffer, "MaxEntCap")) { + strcpy(workbuffer, + "partition_max_entitled_capacity"); w_idx = strlen(workbuffer); } - if (0 == strcmp(workbuffer,"MaxPlatProcs")) { - strcpy(workbuffer, "system_potential_processors"); + if (0 == strcmp(workbuffer, "MaxPlatProcs")) { + strcpy(workbuffer, + "system_potential_processors"); w_idx = strlen(workbuffer); } } @@ -283,7 +295,7 @@ while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) { #ifdef LPARCFG_DEBUG - printk(KERN_ERR "cpus_dn %p \n",cpus_dn); + printk(KERN_ERR "cpus_dn %p \n", cpus_dn); #endif count++; } @@ -292,7 +304,8 @@ static int lparcfg_data(struct seq_file *m, void *v) { - int system_active_processors; + int partition_potential_processors; + int partition_active_processors; struct device_node *rootdn; const char *model = ""; const char *system_id = ""; @@ -305,12 +318,11 @@ model = get_property(rootdn, "model", NULL); system_id = get_property(rootdn, "system-id", NULL); lp_index_ptr = (unsigned int *) - get_property(rootdn, "ibm,partition-no", NULL); + get_property(rootdn, "ibm,partition-no", NULL); if (lp_index_ptr) lp_index = *lp_index_ptr; } - seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); seq_printf(m, "serial_number=%s\n", system_id); @@ -323,11 +335,13 @@ lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", NULL); if (lrdrp == NULL) { - system_active_processors = systemcfg->processorCount; + partition_potential_processors = systemcfg->processorCount; } else { - system_active_processors = *(lrdrp + 4); + partition_potential_processors = *(lrdrp + 4); } + partition_active_processors = lparcfg_count_active_processors(); + if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { unsigned long h_entitled, h_unallocated; unsigned long h_aggregation, h_resource; @@ -342,71 +356,69 @@ seq_printf(m, "R6=0x%lx\n", h_aggregation); seq_printf(m, "R7=0x%lx\n", h_resource); - h_pic(&pool_idle_time, &pool_procs); - purr = get_purr(); /* this call handles the ibm,get-system-parameter contents */ parse_system_parameter_string(m); - seq_printf(m, "partition_entitled_capacity=%ld\n", - h_entitled); - - seq_printf(m, "pool=%ld\n", - (h_aggregation >> 0*8) & 0xffff); + seq_printf(m, "partition_entitled_capacity=%ld\n", h_entitled); - seq_printf(m, "group=%ld\n", - (h_aggregation >> 2*8) & 0xffff); + seq_printf(m, "group=%ld\n", (h_aggregation >> 2 * 8) & 0xffff); seq_printf(m, "system_active_processors=%ld\n", - (h_resource >> 0*8) & 0xffff); + (h_resource >> 0 * 8) & 0xffff); + + /* pool related entries are apropriate for shared configs */ + if (paca[0].lppaca.xSharedProc) { - seq_printf(m, "pool_capacity=%ld\n", - (h_resource >> 2*8) & 0xffff); + h_pic(&pool_idle_time, &pool_procs); + + seq_printf(m, "pool=%ld\n", + (h_aggregation >> 0 * 8) & 0xffff); + + /* report pool_capacity in percentage */ + seq_printf(m, "pool_capacity=%ld\n", + ((h_resource >> 2 * 8) & 0xffff) * 100); + + seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); + + seq_printf(m, "pool_num_procs=%ld\n", pool_procs); + } seq_printf(m, "unallocated_capacity_weight=%ld\n", - (h_resource >> 4*8) & 0xFF); + (h_resource >> 4 * 8) & 0xFF); seq_printf(m, "capacity_weight=%ld\n", - (h_resource >> 5*8) & 0xFF); - - seq_printf(m, "capped=%ld\n", - (h_resource >> 6*8) & 0x01); + (h_resource >> 5 * 8) & 0xFF); - seq_printf(m, "unallocated_capacity=%ld\n", - h_unallocated); + seq_printf(m, "capped=%ld\n", (h_resource >> 6 * 8) & 0x01); - seq_printf(m, "pool_idle_time=%ld\n", - pool_idle_time); + seq_printf(m, "unallocated_capacity=%ld\n", h_unallocated); - seq_printf(m, "pool_num_procs=%ld\n", - pool_procs); + seq_printf(m, "purr=%ld\n", purr); - seq_printf(m, "purr=%ld\n", - purr); + } else { /* non SPLPAR case */ - } else /* non SPLPAR case */ { seq_printf(m, "system_active_processors=%d\n", - system_active_processors); + partition_potential_processors); seq_printf(m, "system_potential_processors=%d\n", - system_active_processors); + partition_potential_processors); seq_printf(m, "partition_max_entitled_capacity=%d\n", - 100*system_active_processors); + partition_potential_processors * 100); seq_printf(m, "partition_entitled_capacity=%d\n", - system_active_processors*100); + partition_active_processors * 100); } seq_printf(m, "partition_active_processors=%d\n", - (int) lparcfg_count_active_processors()); + partition_active_processors); seq_printf(m, "partition_potential_processors=%d\n", - system_active_processors); + partition_potential_processors); - seq_printf(m, "shared_processor_mode=%d\n", - paca[0].lppaca.xSharedProc); + seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.xSharedProc); return 0; } @@ -421,14 +433,15 @@ * This function should be invoked only on systems with * FW_FEATURE_SPLPAR. */ -static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t count, loff_t *off) +static ssize_t lparcfg_write(struct file *file, const char __user * buf, + size_t count, loff_t * off) { char *kbuf; char *tmp; u64 new_entitled, *new_entitled_ptr = &new_entitled; u8 new_weight, *new_weight_ptr = &new_weight; - unsigned long current_entitled; /* parameters for h_get_ppp */ + unsigned long current_entitled; /* parameters for h_get_ppp */ unsigned long dummy; unsigned long resource; u8 current_weight; @@ -453,13 +466,13 @@ if (!strcmp(kbuf, "partition_entitled_capacity")) { char *endp; - *new_entitled_ptr = (u64)simple_strtoul(tmp, &endp, 10); + *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10); if (endp == tmp) goto out; new_weight_ptr = ¤t_weight; } else if (!strcmp(kbuf, "capacity_weight")) { char *endp; - *new_weight_ptr = (u8)simple_strtoul(tmp, &endp, 10); + *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10); if (endp == tmp) goto out; new_entitled_ptr = ¤t_entitled; @@ -473,7 +486,7 @@ goto out; } - current_weight = (resource>>5*8)&0xFF; + current_weight = (resource >> 5 * 8) & 0xFF; pr_debug("%s: current_entitled = %lu, current_weight = %lu\n", __FUNCTION__, current_entitled, current_weight); @@ -498,23 +511,23 @@ retval = -EIO; } -out: + out: kfree(kbuf); return retval; } -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_PSERIES */ -static int lparcfg_open(struct inode * inode, struct file * file) +static int lparcfg_open(struct inode *inode, struct file *file) { - return single_open(file,lparcfg_data,NULL); + return single_open(file, lparcfg_data, NULL); } struct file_operations lparcfg_fops = { - owner: THIS_MODULE, - read: seq_read, - open: lparcfg_open, - release: single_release, + owner:THIS_MODULE, + read:seq_read, + open:lparcfg_open, + release:single_release, }; int __init lparcfg_init(void) @@ -533,7 +546,8 @@ ent->proc_fops = &lparcfg_fops; ent->data = kmalloc(LPARCFG_BUFF_SIZE, GFP_KERNEL); if (!ent->data) { - printk(KERN_ERR "Failed to allocate buffer for lparcfg\n"); + printk(KERN_ERR + "Failed to allocate buffer for lparcfg\n"); remove_proc_entry("lparcfg", ent->parent); return -ENOMEM; } @@ -550,7 +564,7 @@ { if (proc_ppc64_lparcfg) { if (proc_ppc64_lparcfg->data) { - kfree(proc_ppc64_lparcfg->data); + kfree(proc_ppc64_lparcfg->data); } remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent); } diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S --- a/arch/ppc64/kernel/misc.S 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/misc.S 2004-09-21 20:52:52 -07:00 @@ -860,9 +860,9 @@ .llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */ .llong .sys_ni_syscall /* 257 reserved for vserver */ .llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */ - .llong .sys_ni_syscall /* 259 reserved for new sys_mbind */ - .llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */ - .llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */ + .llong .compat_mbind + .llong .compat_get_mempolicy /* 260 */ + .llong .compat_set_mempolicy .llong .compat_sys_mq_open .llong .sys_mq_unlink .llong .compat_sys_mq_timedsend @@ -1132,9 +1132,9 @@ .llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */ .llong .sys_ni_syscall /* 257 reserved for vserver */ .llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */ - .llong .sys_ni_syscall /* 259 reserved for new sys_mbind */ - .llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */ - .llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */ + .llong .sys_mbind + .llong .sys_get_mempolicy /* 260 */ + .llong .sys_set_mempolicy .llong .sys_mq_open .llong .sys_mq_unlink .llong .sys_mq_timedsend diff -Nru a/arch/ppc64/kernel/nvram.c b/arch/ppc64/kernel/nvram.c --- a/arch/ppc64/kernel/nvram.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/nvram.c 2004-09-21 20:52:51 -07:00 @@ -340,7 +340,7 @@ struct list_head * p; struct nvram_partition * part; struct nvram_partition * new_part = NULL; - struct nvram_partition * free_part; + struct nvram_partition * free_part = NULL; int seq_init[2] = { 0, 0 }; loff_t tmp_index; long size = 0; diff -Nru a/arch/ppc64/kernel/pSeries_htab.c b/arch/ppc64/kernel/pSeries_htab.c --- a/arch/ppc64/kernel/pSeries_htab.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/pSeries_htab.c 2004-09-21 20:52:51 -07:00 @@ -220,10 +220,12 @@ if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { tlbiel(va); } else { - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + if (lock_tlbie) spin_lock(&pSeries_tlbie_lock); tlbie(va, large); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock(&pSeries_tlbie_lock); } @@ -243,6 +245,7 @@ unsigned long vsid, va, vpn, flags; long slot; HPTE *hptep; + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); vsid = get_kernel_vsid(ea); va = (vsid << 28) | (ea & 0x0fffffff); @@ -256,10 +259,10 @@ set_pp_bit(newpp, hptep); /* Ensure it is out of the tlb too */ - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_lock_irqsave(&pSeries_tlbie_lock, flags); tlbie(va, 0); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock_irqrestore(&pSeries_tlbie_lock, flags); } @@ -270,6 +273,7 @@ Hpte_dword0 dw0; unsigned long avpn = va >> 23; unsigned long flags; + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); if (large) avpn &= ~0x1UL; @@ -291,10 +295,10 @@ if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { tlbiel(va); } else { - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_lock(&pSeries_tlbie_lock); tlbie(va, large); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock(&pSeries_tlbie_lock); } local_irq_restore(flags); @@ -325,7 +329,7 @@ va = (vsid << 28) | (batch->addr[i] & 0x0fffffff); batch->vaddr[j] = va; if (large) - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; else vpn = va >> PAGE_SHIFT; hash = hpt_hash(vpn, large); @@ -364,8 +368,9 @@ asm volatile("ptesync":::"memory"); } else { - /* XXX double check that it is safe to take this late */ - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + if (lock_tlbie) spin_lock(&pSeries_tlbie_lock); asm volatile("ptesync":::"memory"); @@ -375,7 +380,7 @@ asm volatile("eieio; tlbsync; ptesync":::"memory"); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock(&pSeries_tlbie_lock); } diff -Nru a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c --- a/arch/ppc64/kernel/pSeries_lpar.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/pSeries_lpar.c 2004-09-21 20:52:52 -07:00 @@ -660,14 +660,15 @@ int i; unsigned long flags; struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags); for (i = 0; i < number; i++) flush_hash_page(context, batch->addr[i], batch->pte[i], local); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); } diff -Nru a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c --- a/arch/ppc64/kernel/pSeries_pci.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/pSeries_pci.c 2004-09-21 20:52:52 -07:00 @@ -497,7 +497,7 @@ struct pci_controller *phb; unsigned int root_size_cells = 0; unsigned int index; - unsigned int *opprop; + unsigned int *opprop = NULL; struct device_node *root = of_find_node_by_path("/"); if (naca->interrupt_controller == IC_OPEN_PIC) { diff -Nru a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c --- a/arch/ppc64/kernel/prom.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/prom.c 2004-09-21 20:52:52 -07:00 @@ -918,11 +918,7 @@ = (void *)virt_to_abs(&__secondary_hold_acknowledge); unsigned long secondary_hold = virt_to_abs(*PTRRELOC((unsigned long *)__secondary_hold)); - struct systemcfg *_systemcfg = RELOC(systemcfg); struct prom_t *_prom = PTRRELOC(&prom); -#ifdef CONFIG_SMP - struct naca_struct *_naca = RELOC(naca); -#endif prom_debug("prom_hold_cpus: start...\n"); prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); @@ -1003,18 +999,18 @@ (*acknowledge == ((unsigned long)-1)); i++ ) ; if (*acknowledge == cpuid) { - prom_printf("... done\n"); + prom_printf(" done\n"); /* We have to get every CPU out of OF, * even if we never start it. */ if (cpuid >= NR_CPUS) goto next; } else { - prom_printf("... failed: %x\n", *acknowledge); + prom_printf(" failed: %x\n", *acknowledge); } } #ifdef CONFIG_SMP else - prom_printf("%x : booting cpu %s\n", cpuid, path); + prom_printf("%x : boot cpu %s\n", cpuid, path); #endif next: #ifdef CONFIG_SMP @@ -1023,13 +1019,6 @@ cpuid++; if (cpuid >= NR_CPUS) continue; - prom_printf("%x : preparing thread ... ", - interrupt_server[i]); - if (_naca->smt_state) { - prom_printf("available\n"); - } else { - prom_printf("not available\n"); - } } #endif cpuid++; @@ -1068,57 +1057,6 @@ prom_debug("prom_hold_cpus: end...\n"); } -static void __init smt_setup(void) -{ - char *p, *q; - char my_smt_enabled = SMT_DYNAMIC; - ihandle prom_options = 0; - char option[9]; - unsigned long offset = reloc_offset(); - struct naca_struct *_naca = RELOC(naca); - char found = 0; - - if (strstr(RELOC(cmd_line), RELOC("smt-enabled="))) { - for (q = RELOC(cmd_line); (p = strstr(q, RELOC("smt-enabled="))) != 0; ) { - q = p + 12; - if (p > RELOC(cmd_line) && p[-1] != ' ') - continue; - found = 1; - if (q[0] == 'o' && q[1] == 'f' && - q[2] == 'f' && (q[3] == ' ' || q[3] == '\0')) { - my_smt_enabled = SMT_OFF; - } else if (q[0]=='o' && q[1] == 'n' && - (q[2] == ' ' || q[2] == '\0')) { - my_smt_enabled = SMT_ON; - } else { - my_smt_enabled = SMT_DYNAMIC; - } - } - } - if (!found) { - prom_options = call_prom("finddevice", 1, 1, ADDR("/options")); - if (prom_options != (ihandle) -1) { - prom_getprop(prom_options, "ibm,smt-enabled", - option, sizeof(option)); - if (option[0] != 0) { - found = 1; - if (!strcmp(option, RELOC("off"))) - my_smt_enabled = SMT_OFF; - else if (!strcmp(option, RELOC("on"))) - my_smt_enabled = SMT_ON; - else - my_smt_enabled = SMT_DYNAMIC; - } - } - } - - if (!found ) - my_smt_enabled = SMT_DYNAMIC; /* default to on */ - - _naca->smt_state = my_smt_enabled; -} - - #ifdef CONFIG_BOOTX_TEXT /* This function will enable the early boot text when doing OF booting. This @@ -1707,6 +1645,9 @@ } RELOC(cmd_line[0]) = 0; +#ifdef CONFIG_CMDLINE + strlcpy(RELOC(cmd_line), RELOC(CONFIG_CMDLINE), sizeof(cmd_line)); +#endif /* CONFIG_CMDLINE */ if ((long)_prom->chosen > 0) { prom_getprop(_prom->chosen, "bootargs", p, sizeof(cmd_line)); if (p != NULL && p[0] != 0) @@ -1726,8 +1667,6 @@ /* Initialize some system info into the Naca early... */ prom_initialize_naca(); - - smt_setup(); /* If we are on an SMP machine, then we *MUST* do the * following, regardless of whether we have an SMP diff -Nru a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c --- a/arch/ppc64/kernel/rtasd.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/rtasd.c 2004-09-21 20:52:51 -07:00 @@ -106,7 +106,7 @@ static void printk_log_rtas(char *buf, int len) { - int i,j,n; + int i,j,n = 0; int perline = 16; char buffer[64]; char * str = "RTAS event"; @@ -216,12 +216,13 @@ if (!no_more_logging && !(err_type & ERR_FLAG_BOOT)) nvram_write_error_log(buf, len, err_type); - /* rtas errors can occur during boot, and we do want to capture + /* + * rtas errors can occur during boot, and we do want to capture * those somewhere, even if nvram isn't ready (why not?), and even - * if rtasd isn't ready. Put them into the boot log, at least. */ - if ((err_type & ERR_TYPE_MASK) == ERR_TYPE_RTAS_LOG) { + * if rtasd isn't ready. Put them into the boot log, at least. + */ + if ((err_type & ERR_TYPE_MASK) == ERR_TYPE_RTAS_LOG) printk_log_rtas(buf, len); - } /* Check to see if we need to or have stopped logging */ if (fatal || no_more_logging) { @@ -233,9 +234,6 @@ /* call type specific method for error */ switch (err_type & ERR_TYPE_MASK) { case ERR_TYPE_RTAS_LOG: - /* put into syslog and error_log file */ - printk_log_rtas(buf, len); - offset = rtas_error_log_buffer_max * ((rtas_log_start+rtas_log_size) & LOG_NUMBER_MASK); diff -Nru a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c --- a/arch/ppc64/kernel/setup.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/setup.c 2004-09-21 20:52:51 -07:00 @@ -51,7 +51,6 @@ extern unsigned long klimit; /* extern void *stab; */ extern HTAB htab_data; -extern unsigned long loops_per_jiffy; int have_of = 1; @@ -68,29 +67,23 @@ unsigned long r7); extern void fw_feature_init(void); -extern void iSeries_init( void ); -extern void iSeries_init_early( void ); -extern void pSeries_init_early( void ); +extern void iSeries_init_early(void); +extern void pSeries_init_early(void); extern void pSeriesLP_init_early(void); extern void pmac_init_early(void); -extern void mm_init_ppc64( void ); +extern void mm_init_ppc64(void); extern void pseries_secondary_smp_init(unsigned long); extern int idle_setup(void); extern void vpa_init(int cpu); +extern void iSeries_parse_cmdline(void); unsigned long decr_overclock = 1; unsigned long decr_overclock_proc0 = 1; unsigned long decr_overclock_set = 0; unsigned long decr_overclock_proc0_set = 0; -int powersave_nap; - unsigned char aux_device_present; -void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7); -int parse_bootinfo(void); - #ifdef CONFIG_MAGIC_SYSRQ unsigned long SYSRQ_KEY; #endif /* CONFIG_MAGIC_SYSRQ */ @@ -157,6 +150,50 @@ } #if !defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP) + +static int smt_enabled_cmdline; + +/* Look for ibm,smt-enabled OF option */ +static void check_smt_enabled(void) +{ + struct device_node *dn; + char *smt_option; + + /* Allow the command line to overrule the OF option */ + if (smt_enabled_cmdline) + return; + + dn = of_find_node_by_path("/options"); + + if (dn) { + smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); + + if (smt_option) { + if (!strcmp(smt_option, "on")) + smt_enabled_at_boot = 1; + else if (!strcmp(smt_option, "off")) + smt_enabled_at_boot = 0; + } + } +} + +/* Look for smt-enabled= cmdline option */ +static int __init early_smt_enabled(char *p) +{ + smt_enabled_cmdline = 1; + + if (!p) + return 0; + + if (!strcmp(p, "on") || !strcmp(p, "1")) + smt_enabled_at_boot = 1; + else if (!strcmp(p, "off") || !strcmp(p, "0")) + smt_enabled_at_boot = 0; + + return 0; +} +early_param("smt-enabled", early_smt_enabled); + /** * setup_cpu_maps - initialize the following cpu maps: * cpu_possible_map @@ -179,6 +216,8 @@ struct device_node *dn = NULL; int cpu = 0; + check_smt_enabled(); + while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { u32 *intserv; int j, len = sizeof(u32), nthreads; @@ -191,9 +230,16 @@ nthreads = len / sizeof(u32); for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { + /* + * Only spin up secondary threads if SMT is enabled. + * We must leave space in the logical map for the + * threads. + */ + if (j == 0 || smt_enabled_at_boot) { + cpu_set(cpu, cpu_present_map); + set_hard_smp_processor_id(cpu, intserv[j]); + } cpu_set(cpu, cpu_possible_map); - cpu_set(cpu, cpu_present_map); - set_hard_smp_processor_id(cpu, intserv[j]); cpu++; } } @@ -249,7 +295,21 @@ systemcfg->processorCount = num_present_cpus(); } + #endif /* !defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP) */ + +#ifdef CONFIG_XMON +static int __init early_xmon(char *p) +{ + /* ensure xmon is enabled */ + xmon_init(); + debugger(0); + + return 0; +} +early_param("xmon", early_xmon); +#endif + /* * Do some initial setup of the system. The parameters are those which * were passed in from the bootloader. @@ -261,16 +321,12 @@ int ret, i; #endif -#ifdef CONFIG_XMON_DEFAULT - xmon_init(); -#endif - #ifdef CONFIG_PPC_ISERIES /* pSeries systems are identified in prom.c via OF. */ - if ( itLpNaca.xLparInstalled == 1 ) + if (itLpNaca.xLparInstalled == 1) systemcfg->platform = PLATFORM_ISERIES_LPAR; #endif - + switch (systemcfg->platform) { #ifdef CONFIG_PPC_ISERIES case PLATFORM_ISERIES_LPAR: @@ -282,22 +338,22 @@ case PLATFORM_PSERIES: fw_feature_init(); pSeries_init_early(); - parse_bootinfo(); break; case PLATFORM_PSERIES_LPAR: fw_feature_init(); pSeriesLP_init_early(); - parse_bootinfo(); break; #endif /* CONFIG_PPC_PSERIES */ #ifdef CONFIG_PPC_PMAC case PLATFORM_POWERMAC: pmac_init_early(); - parse_bootinfo(); #endif /* CONFIG_PPC_PMAC */ } +#ifdef CONFIG_XMON_DEFAULT + xmon_init(); +#endif /* If we were passed an initrd, set the ROOT_DEV properly if the values * look sensible. If not, clear initrd reference. */ @@ -334,6 +390,15 @@ } #endif /* CONFIG_PPC_PSERIES */ +#ifdef CONFIG_PPC_ISERIES + iSeries_parse_cmdline(); +#endif + + /* Save unparsed command line copy for /proc/cmdline */ + strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); + + parse_early_param(); + #ifdef CONFIG_SMP #ifndef CONFIG_PPC_ISERIES /* @@ -355,12 +420,16 @@ i); } } + + if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) + vpa_init(boot_cpuid); + #endif /* CONFIG_PPC_PSERIES */ #endif /* CONFIG_SMP */ -#if defined(CONFIG_HOTPLUG_CPU) && !defined(CONFIG_PPC_PMAC) +#if defined(CONFIG_HOTPLUG_CPU) rtas_stop_self_args.token = rtas_token("stop-self"); -#endif /* CONFIG_HOTPLUG_CPU && !CONFIG_PPC_PMAC */ +#endif /* CONFIG_HOTPLUG_CPU */ /* Finish initializing the hash table (do the dynamic * patching for the fast-path hashtable.S code) @@ -384,27 +453,6 @@ printk("-----------------------------------------------------\n"); mm_init_ppc64(); - -#if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES) - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { - vpa_init(boot_cpuid); - } -#endif - - /* Select the correct idle loop for the platform. */ - idle_setup(); - - switch (systemcfg->platform) { -#ifdef CONFIG_PPC_ISERIES - case PLATFORM_ISERIES_LPAR: - iSeries_init(); - break; -#endif - default: - /* The following relies on the device tree being */ - /* fully configured. */ - parse_cmd_line(r3, r4, r5, r6, r7); - } } void machine_restart(char *cmd) @@ -528,62 +576,27 @@ .show = show_cpuinfo, }; -/* - * Fetch the cmd_line from open firmware. - */ -void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) +#if 0 /* XXX not currently used */ +unsigned long memory_limit; + +static int __init early_parsemem(char *p) { - cmd_line[0] = 0; + if (!p) + return 0; -#ifdef CONFIG_CMDLINE - strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); -#endif /* CONFIG_CMDLINE */ + memory_limit = memparse(p, &p); -#ifdef CONFIG_PPC_PSERIES - { - struct device_node *chosen; - - chosen = of_find_node_by_name(NULL, "chosen"); - if (chosen != NULL) { - char *p; - p = get_property(chosen, "bootargs", NULL); - if (p != NULL && p[0] != 0) - strlcpy(cmd_line, p, sizeof(cmd_line)); - of_node_put(chosen); - } - } -#endif - - /* Look for mem= option on command line */ - if (strstr(cmd_line, "mem=")) { - char *p, *q; - unsigned long maxmem = 0; - extern unsigned long __max_memory; - - for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { - q = p + 4; - if (p > cmd_line && p[-1] != ' ') - continue; - maxmem = simple_strtoul(q, &q, 0); - if (*q == 'k' || *q == 'K') { - maxmem <<= 10; - ++q; - } else if (*q == 'm' || *q == 'M') { - maxmem <<= 20; - ++q; - } - } - __max_memory = maxmem; - } + return 0; } +early_param("mem", early_parsemem); +#endif #ifdef CONFIG_PPC_PSERIES static int __init set_preferred_console(void) { struct device_node *prom_stdout; char *name; - int offset; + int offset = 0; /* The user has requested a console so this is already set up. */ if (strstr(saved_command_line, "console=")) @@ -652,26 +665,6 @@ } console_initcall(set_preferred_console); - -int parse_bootinfo(void) -{ - struct bi_record *rec; - - rec = prom.bi_recs; - - if ( rec == NULL || rec->tag != BI_FIRST ) - return -1; - - for ( ; rec->tag != BI_LAST ; rec = bi_rec_next(rec) ) { - switch (rec->tag) { - case BI_CMD_LINE: - strlcpy(cmd_line, (void *)rec->data, sizeof(cmd_line)); - break; - } - } - - return 0; -} #endif int __init ppc_init(void) @@ -687,17 +680,6 @@ arch_initcall(ppc_init); -void __init ppc64_calibrate_delay(void) -{ - loops_per_jiffy = tb_ticks_per_jiffy; - - printk("Calibrating delay loop... %lu.%02lu BogoMips\n", - loops_per_jiffy/(500000/HZ), - loops_per_jiffy/(5000/HZ) % 100); -} - -extern void (*calibrate_delay)(void); - #ifdef CONFIG_IRQSTACKS static void __init irqstack_early_init(void) { @@ -753,17 +735,10 @@ extern int panic_timeout; extern void do_init_bootmem(void); - calibrate_delay = ppc64_calibrate_delay; - ppc64_boot_msg(0x12, "Setup Arch"); -#ifdef CONFIG_XMON - if (strstr(cmd_line, "xmon")) { - /* ensure xmon is enabled */ - xmon_init(); - debugger(0); - } -#endif /* CONFIG_XMON */ + *cmdline_p = cmd_line; + /* * Set cache line size based on type of cpu as a default. @@ -784,15 +759,14 @@ init_mm.end_data = (unsigned long) _edata; init_mm.brk = klimit; - /* Save unparsed command line copy for /proc/cmdline */ - strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); - *cmdline_p = cmd_line; - irqstack_early_init(); emergency_stack_init(); /* set up the bootmem stuff with available memory */ do_init_bootmem(); + + /* Select the correct idle loop for the platform. */ + idle_setup(); ppc_md.setup_arch(); diff -Nru a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c --- a/arch/ppc64/kernel/signal.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/signal.c 2004-09-21 20:52:51 -07:00 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -178,7 +177,7 @@ elf_vrreg_t __user *v_regs; #endif unsigned long err = 0; - unsigned long save_r13; + unsigned long save_r13 = 0; elf_greg_t *gregs = (elf_greg_t *)regs; int i; @@ -371,7 +370,8 @@ printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n", regs, uc, &uc->uc_mcontext); #endif - do_exit(SIGSEGV); + force_sig(SIGSEGV, current); + return 0; } static void setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, @@ -446,7 +446,7 @@ printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", regs, frame, newsp); #endif - do_exit(SIGSEGV); + force_sigsegv(signr, current); } diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c --- a/arch/ppc64/kernel/signal32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/signal32.c 2004-09-21 20:52:52 -07:00 @@ -189,7 +189,7 @@ elf_greg_t64 *gregs = (elf_greg_t64 *)regs; int i; long err = 0; - unsigned int save_r2; + unsigned int save_r2 = 0; #ifdef CONFIG_ALTIVEC unsigned long msr; #endif diff -Nru a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c --- a/arch/ppc64/kernel/smp.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/smp.c 2004-09-21 20:52:52 -07:00 @@ -74,6 +74,8 @@ extern long register_vpa(unsigned long flags, unsigned long proc, unsigned long vpa); +int smt_enabled_at_boot = 1; + /* Low level assembly function used to backup CPU 0 state */ extern void __save_cpu_setup(void); @@ -377,7 +379,7 @@ /* At boot time the cpus are already spinning in hold * loops, so nothing to do. */ - if (system_state == SYSTEM_BOOTING) + if (system_state < SYSTEM_RUNNING) return 1; pcpu = find_physical_cpu_to_start(get_hard_smp_processor_id(lcpu)); @@ -815,7 +817,7 @@ int c; /* At boot, don't bother with non-present cpus -JSCHOPP */ - if (system_state == SYSTEM_BOOTING && !cpu_present(cpu)) + if (system_state < SYSTEM_RUNNING && !cpu_present(cpu)) return -ENOENT; paca[cpu].default_decr = tb_ticks_per_jiffy / decr_overclock; @@ -847,7 +849,7 @@ * use this value that I found through experimentation. * -- Cort */ - if (system_state == SYSTEM_BOOTING) + if (system_state < SYSTEM_RUNNING) for (c = 5000; c && !cpu_callin_map[cpu]; c--) udelay(100); #ifdef CONFIG_HOTPLUG_CPU @@ -942,4 +944,12 @@ smp_threads_ready = 1; set_cpus_allowed(current, old_mask); + + /* + * We know at boot the maximum number of cpus we can add to + * a partition and set cpu_possible_map accordingly. cpu_present_map + * needs to match for the hotplug code to allow us to hot add + * any offline cpus. + */ + cpu_present_map = cpu_possible_map; } diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c --- a/arch/ppc64/kernel/sys_ppc32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/sys_ppc32.c 2004-09-21 20:52:52 -07:00 @@ -72,7 +72,6 @@ #include #include #include -#include #include #include "pci.h" @@ -700,7 +699,7 @@ (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) @@ -709,7 +708,7 @@ (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } #define IOBASE_BRIDGE_NUMBER 0 @@ -1095,7 +1094,7 @@ u32 __unused[4]; }; -extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) +asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) { struct __sysctl_args32 tmp; int error; @@ -1114,19 +1113,20 @@ glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; - if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || + if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } lock_kernel(); - error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), - oldlenp, (void __user *)A(tmp.newval), tmp.newlen); + error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, + compat_ptr(tmp.oldval), oldlenp, + compat_ptr(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { if (get_user(oldlen, oldlenp) || - put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) + put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); diff -Nru a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c --- a/arch/ppc64/kernel/sysfs.c 2004-09-21 20:52:51 -07:00 +++ b/arch/ppc64/kernel/sysfs.c 2004-09-21 20:52:51 -07:00 @@ -97,6 +97,13 @@ /* PMC stuff */ +#ifdef CONFIG_PPC_ISERIES +void ppc64_enable_pmcs(void) +{ + /* XXX Implement for iseries */ +} +#else + /* * Enabling PMCs will slow partition context switch times so we only do * it the first time we write to the PMCs. @@ -104,12 +111,6 @@ static DEFINE_PER_CPU(char, pmcs_enabled); -#ifdef CONFIG_PPC_ISERIES -void ppc64_enable_pmcs(void) -{ - /* XXX Implement for iseries */ -} -#else void ppc64_enable_pmcs(void) { unsigned long hid0; diff -Nru a/arch/ppc64/kernel/vmlinux.lds.S b/arch/ppc64/kernel/vmlinux.lds.S --- a/arch/ppc64/kernel/vmlinux.lds.S 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/kernel/vmlinux.lds.S 2004-09-21 20:52:52 -07:00 @@ -117,8 +117,11 @@ .data : { *(.data .data.rel* .toc1) - *(.opd) *(.branch_lt) + } + + .opd : { + *(.opd) } .got : { diff -Nru a/arch/ppc64/lib/locks.c b/arch/ppc64/lib/locks.c --- a/arch/ppc64/lib/locks.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/lib/locks.c 2004-09-21 20:52:52 -07:00 @@ -20,8 +20,6 @@ #include #include -#ifndef CONFIG_SPINLINE - /* waiting for a spinlock... */ #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) @@ -95,5 +93,3 @@ } EXPORT_SYMBOL(spin_unlock_wait); - -#endif /* CONFIG_SPINLINE */ diff -Nru a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c --- a/arch/ppc64/mm/hash_utils.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/hash_utils.c 2004-09-21 20:52:52 -07:00 @@ -100,7 +100,7 @@ int ret; if (large) - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; else vpn = va >> PAGE_SHIFT; @@ -253,24 +253,24 @@ int local = 0; cpumask_t tmp; - /* Check for invalid addresses. */ - if (!IS_VALID_EA(ea)) - return 1; - switch (REGION_ID(ea)) { case USER_REGION_ID: user_region = 1; mm = current->mm; - if (mm == NULL) + if ((ea > USER_END) || (! mm)) return 1; vsid = get_vsid(mm->context.id, ea); break; case IO_REGION_ID: + if (ea > IMALLOC_END) + return 1; mm = &ioremap_mm; vsid = get_kernel_vsid(ea); break; case VMALLOC_REGION_ID: + if (ea > VMALLOC_END) + return 1; mm = &init_mm; vsid = get_kernel_vsid(ea); break; @@ -332,7 +332,7 @@ va = (vsid << 28) | (ea & 0x0fffffff); if (large) - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; else vpn = va >> PAGE_SHIFT; hash = hpt_hash(vpn, large); diff -Nru a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c --- a/arch/ppc64/mm/hugetlbpage.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/hugetlbpage.c 2004-09-21 20:52:52 -07:00 @@ -853,7 +853,7 @@ vsid = get_vsid(context.id, ea); va = (vsid << 28) | (ea & 0x0fffffff); - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; hash = hpt_hash(vpn, 1); if (hugepte_val(pte) & _HUGEPAGE_SECONDARY) hash = ~hash; diff -Nru a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c --- a/arch/ppc64/mm/init.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/init.c 2004-09-21 20:52:52 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -62,8 +63,6 @@ #include #include - -struct mmu_context_queue_t mmu_context_queue; int mem_init_done; unsigned long ioremap_bot = IMALLOC_BASE; static unsigned long phbs_io_bot = PHBS_IO_BASE; @@ -477,25 +476,69 @@ } #endif +static spinlock_t mmu_context_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_IDR(mmu_context_idr); + +int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +{ + int index; + int err; + +again: + if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL)) + return -ENOMEM; + + spin_lock(&mmu_context_lock); + err = idr_get_new(&mmu_context_idr, NULL, &index); + spin_unlock(&mmu_context_lock); + + if (err == -EAGAIN) + goto again; + else if (err) + return err; + + if (index > MAX_CONTEXT) { + idr_remove(&mmu_context_idr, index); + return -ENOMEM; + } + + mm->context.id = index; + + return 0; +} + +void destroy_context(struct mm_struct *mm) +{ + spin_lock(&mmu_context_lock); + idr_remove(&mmu_context_idr, mm->context.id); + spin_unlock(&mmu_context_lock); + + mm->context.id = NO_CONTEXT; +} + +static int __init mmu_context_init(void) +{ + int index; + + /* Reserve the first (invalid) context*/ + idr_pre_get(&mmu_context_idr, GFP_KERNEL); + idr_get_new(&mmu_context_idr, NULL, &index); + BUG_ON(0 != index); + + return 0; +} +arch_initcall(mmu_context_init); + /* * Do very early mm setup. */ void __init mm_init_ppc64(void) { +#ifndef CONFIG_PPC_ISERIES unsigned long i; +#endif ppc64_boot_msg(0x100, "MM Init"); - - /* Reserve all contexts < FIRST_USER_CONTEXT for kernel use. - * The range of contexts [FIRST_USER_CONTEXT, NUM_USER_CONTEXT) - * are stored on a stack/queue for easy allocation and deallocation. - */ - mmu_context_queue.lock = SPIN_LOCK_UNLOCKED; - mmu_context_queue.head = 0; - mmu_context_queue.tail = NUM_USER_CONTEXT-1; - mmu_context_queue.size = NUM_USER_CONTEXT; - for (i = 0; i < NUM_USER_CONTEXT; i++) - mmu_context_queue.elements[i] = i + FIRST_USER_CONTEXT; /* This is the story of the IO hole... please, keep seated, * unfortunately, we are out of oxygen masks at the moment. diff -Nru a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c --- a/arch/ppc64/mm/numa.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/numa.c 2004-09-21 20:52:52 -07:00 @@ -18,6 +18,8 @@ #include #include +static int numa_enabled = 1; + static int numa_debug; #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); } @@ -189,10 +191,7 @@ long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT; unsigned long i; - if (strstr(saved_command_line, "numa=debug")) - numa_debug = 1; - - if (strstr(saved_command_line, "numa=off")) { + if (numa_enabled == 0) { printk(KERN_WARNING "NUMA disabled by user\n"); return -1; } @@ -587,3 +586,18 @@ start_pfn, zholes_size); } } + +static int __init early_numa(char *p) +{ + if (!p) + return 0; + + if (strstr(p, "off")) + numa_enabled = 0; + + if (strstr(p, "debug")) + numa_debug = 1; + + return 0; +} +early_param("numa", early_numa); diff -Nru a/arch/ppc64/mm/slb_low.S b/arch/ppc64/mm/slb_low.S --- a/arch/ppc64/mm/slb_low.S 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/slb_low.S 2004-09-21 20:52:52 -07:00 @@ -68,19 +68,19 @@ srdi r3,r3,28 /* get esid */ cmpldi cr7,r9,0xc /* cmp KERNELBASE for later use */ - /* r9 = region, r3 = esid, cr7 = <>KERNELBASE */ - - rldicr. r11,r3,32,16 - bne- 8f /* invalid ea bits set */ - addi r11,r9,-1 - cmpldi r11,0xb - blt- 8f /* invalid region */ + rldimi r10,r3,28,0 /* r10= ESID<<28 | entry */ + oris r10,r10,SLB_ESID_V@h /* r10 |= SLB_ESID_V */ - /* r9 = region, r3 = esid, r10 = entry, cr7 = <>KERNELBASE */ + /* r3 = esid, r10 = esid_data, cr7 = <>KERNELBASE */ blt cr7,0f /* user or kernel? */ - /* kernel address */ + /* kernel address: proto-VSID = ESID */ + /* WARNING - MAGIC: we don't use the VSID 0xfffffffff, but + * this code will generate the protoVSID 0xfffffffff for the + * top segment. That's ok, the scramble below will translate + * it to VSID 0, which is reserved as a bad VSID - one which + * will never have any pages in it. */ li r11,SLB_VSID_KERNEL BEGIN_FTR_SECTION bne cr7,9f @@ -88,8 +88,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) b 9f -0: /* user address */ +0: /* user address: proto-VSID = context<<15 | ESID */ li r11,SLB_VSID_USER + + srdi. r9,r3,13 + bne- 8f /* invalid ea bits set */ + #ifdef CONFIG_HUGETLB_PAGE BEGIN_FTR_SECTION /* check against the hugepage ranges */ @@ -111,33 +115,18 @@ #endif /* CONFIG_HUGETLB_PAGE */ 6: ld r9,PACACONTEXTID(r13) + rldimi r3,r9,USER_ESID_BITS,0 -9: /* r9 = "context", r3 = esid, r11 = flags, r10 = entry */ - - rldimi r9,r3,15,0 /* r9= VSID ordinal */ - -7: rldimi r10,r3,28,0 /* r10= ESID<<28 | entry */ - oris r10,r10,SLB_ESID_V@h /* r10 |= SLB_ESID_V */ - - /* r9 = ordinal, r3 = esid, r11 = flags, r10 = esid_data */ - - li r3,VSID_RANDOMIZER@higher - sldi r3,r3,32 - oris r3,r3,VSID_RANDOMIZER@h - ori r3,r3,VSID_RANDOMIZER@l - - mulld r9,r3,r9 /* r9 = ordinal * VSID_RANDOMIZER */ - clrldi r9,r9,28 /* r9 &= VSID_MASK */ - sldi r9,r9,SLB_VSID_SHIFT /* r9 <<= SLB_VSID_SHIFT */ - or r9,r9,r11 /* r9 |= flags */ +9: /* r3 = protovsid, r11 = flags, r10 = esid_data, cr7 = <>KERNELBASE */ + ASM_VSID_SCRAMBLE(r3,r9) - /* r9 = vsid_data, r10 = esid_data, cr7 = <>KERNELBASE */ + rldimi r11,r3,SLB_VSID_SHIFT,16 /* combine VSID and flags */ /* * No need for an isync before or after this slbmte. The exception * we enter with and the rfid we exit with are context synchronizing. */ - slbmte r9,r10 + slbmte r11,r10 bgelr cr7 /* we're done for kernel addresses */ @@ -160,6 +149,6 @@ blr 8: /* invalid EA */ - li r9,0 /* 0 VSID ordinal -> BAD_VSID */ + li r3,0 /* BAD_VSID */ li r11,SLB_VSID_USER /* flags don't much matter */ - b 7b + b 9b diff -Nru a/arch/ppc64/mm/stab.c b/arch/ppc64/mm/stab.c --- a/arch/ppc64/mm/stab.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/mm/stab.c 2004-09-21 20:52:52 -07:00 @@ -115,15 +115,11 @@ unsigned char stab_entry; unsigned long offset; - /* Check for invalid effective addresses. */ - if (!IS_VALID_EA(ea)) - return 1; - /* Kernel or user address? */ if (ea >= KERNELBASE) { vsid = get_kernel_vsid(ea); } else { - if (! mm) + if ((ea >= TASK_SIZE_USER64) || (! mm)) return 1; vsid = get_vsid(mm->context.id, ea); diff -Nru a/arch/ppc64/oprofile/op_model_rs64.c b/arch/ppc64/oprofile/op_model_rs64.c --- a/arch/ppc64/oprofile/op_model_rs64.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/oprofile/op_model_rs64.c 2004-09-21 20:52:52 -07:00 @@ -21,8 +21,8 @@ static void ctrl_write(unsigned int i, unsigned int val) { - unsigned int tmp; - unsigned long shift, mask; + unsigned int tmp = 0; + unsigned long shift = 0, mask = 0; dbg("ctrl_write %d %x\n", i, val); diff -Nru a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c --- a/arch/ppc64/xmon/xmon.c 2004-09-21 20:52:52 -07:00 +++ b/arch/ppc64/xmon/xmon.c 2004-09-21 20:52:52 -07:00 @@ -2059,7 +2059,7 @@ { int nr, dotted; unsigned long first_adr; - unsigned long inst, last_inst; + unsigned long inst, last_inst = 0; unsigned char val[4]; dotted = 0; diff -Nru a/arch/sparc64/defconfig b/arch/sparc64/defconfig --- a/arch/sparc64/defconfig 2004-09-21 20:52:51 -07:00 +++ b/arch/sparc64/defconfig 2004-09-21 20:52:51 -07:00 @@ -1,10 +1,11 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.9-rc1 -# Thu Sep 2 23:38:33 2004 +# Linux kernel version: 2.6.9-rc2 +# Thu Sep 16 14:44:26 2004 # CONFIG_64BIT=y CONFIG_MMU=y +CONFIG_TIME_INTERPOLATION=y # # Code maturity level options @@ -15,6 +16,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -1077,6 +1079,7 @@ # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PARKBD is not set CONFIG_SERIO_PCIPS2=m +CONFIG_SERIO_RAW=m # # Input Device Drivers diff -Nru a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c --- a/arch/sparc64/kernel/auxio.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/kernel/auxio.c 2004-09-21 20:52:52 -07:00 @@ -17,7 +17,7 @@ #include /* This cannot be static, as it is referenced in entry.S */ -unsigned long auxio_register = 0UL; +void __iomem *auxio_register = 0UL; enum auxio_type { AUXIO_TYPE_NODEV, @@ -30,7 +30,7 @@ static void __auxio_sbus_set(u8 bits_on, u8 bits_off) { - if(auxio_register) { + if (auxio_register) { unsigned char regval; unsigned long flags; unsigned char newval; @@ -49,7 +49,7 @@ static void __auxio_ebus_set(u8 bits_on, u8 bits_off) { - if(auxio_register) { + if (auxio_register) { unsigned char regval; unsigned long flags; unsigned char newval; @@ -126,7 +126,8 @@ if (sdev) { auxio_devtype = AUXIO_TYPE_SBUS; auxio_register = sbus_ioremap(&sdev->resource[0], 0, - sdev->reg_addrs[0].reg_size, "auxiliaryIO"); + sdev->reg_addrs[0].reg_size, + "auxiliaryIO"); } #ifdef CONFIG_PCI else { @@ -142,7 +143,7 @@ ebus_done: if (edev) { auxio_devtype = AUXIO_TYPE_EBUS; - auxio_register = (unsigned long) + auxio_register = ioremap(edev->resource[0].start, sizeof(u32)); } } diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c --- a/arch/sparc64/kernel/pci_schizo.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/kernel/pci_schizo.c 2004-09-21 20:52:52 -07:00 @@ -1171,7 +1171,7 @@ prom_halt(); } bucket = __bucket(irq); - tmp = readl(bucket->imap); + tmp = upa_readl(bucket->imap); upa_writel(tmp, (pbm->pbm_regs + schizo_imap_offset(SCHIZO_UE_INO) + 4)); @@ -1309,7 +1309,7 @@ prom_halt(); } bucket = __bucket(irq); - tmp = readl(bucket->imap); + tmp = upa_readl(bucket->imap); upa_writel(tmp, (pbm->pbm_regs + schizo_imap_offset(SCHIZO_UE_INO) + 4)); pbm = pbm_for_ino(p, SCHIZO_CE_INO); diff -Nru a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c --- a/arch/sparc64/kernel/power.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/kernel/power.c 2004-09-21 20:52:52 -07:00 @@ -27,7 +27,7 @@ int scons_pwroff = 1; #ifdef CONFIG_PCI -static unsigned long power_reg = 0UL; +static void __iomem *power_reg; static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); static int button_pressed; @@ -52,7 +52,7 @@ { if (!serial_console || scons_pwroff) { #ifdef CONFIG_PCI - if (power_reg != 0UL) { + if (power_reg) { /* Both register bits seem to have the * same effect, so until I figure out * what the difference is... @@ -130,8 +130,8 @@ return; found: - power_reg = (unsigned long)ioremap(edev->resource[0].start, 0x4); - printk("power: Control reg at %016lx ... ", power_reg); + power_reg = ioremap(edev->resource[0].start, 0x4); + printk("power: Control reg at %p ... ", power_reg); poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(edev)) { if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c --- a/arch/sparc64/kernel/signal32.c 2004-09-21 20:52:51 -07:00 +++ b/arch/sparc64/kernel/signal32.c 2004-09-21 20:52:51 -07:00 @@ -122,7 +122,6 @@ int _status; /* exit code */ compat_clock_t _utime; compat_clock_t _stime; - struct compat_rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ @@ -188,8 +187,6 @@ err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); err |= __put_user(from->si_status, &to->si_status); - err |= put_compat_rusage(&from->si_rusage, - &to->si_rusage); default: err |= __put_user(from->si_pid, &to->si_pid); err |= __put_user(from->si_uid, &to->si_uid); diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c --- a/arch/sparc64/kernel/sys_sparc32.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/kernel/sys_sparc32.c 2004-09-21 20:52:52 -07:00 @@ -1737,21 +1737,30 @@ } asmlinkage long compat_sys_waitid(u32 which, u32 pid, - struct siginfo32 __user *uinfo, u32 options) + struct siginfo32 __user *uinfo, u32 options, + struct compat_rusage __user *uru) { siginfo_t info; + struct rusage ru; long ret; mm_segment_t old_fs = get_fs(); memset(&info, 0, sizeof(info)); set_fs (KERNEL_DS); - ret = sys_waitid((int)which, (compat_pid_t) pid, - (siginfo_t __user *) &info, (int) options); + ret = sys_waitid(which, pid, (siginfo_t __user *) &info, + options, uru ? &ru : NULL); set_fs (old_fs); if (ret < 0 || info.si_signo == 0) return ret; + + if (uru) { + ret = put_compat_rusage(&ru, uru); + if (ret) + return ret; + } + BUG_ON(info.si_code & __SI_MASK); info.si_code |= __SI_CHLD; return copy_siginfo_to_user32(uinfo, &info); diff -Nru a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c --- a/arch/sparc64/kernel/traps.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/kernel/traps.c 2004-09-21 20:52:52 -07:00 @@ -1843,6 +1843,37 @@ EXPORT_SYMBOL(dump_stack); +static inline int is_kernel_stack(struct task_struct *task, + struct reg_window *rw) +{ + unsigned long rw_addr = (unsigned long) rw; + unsigned long thread_base, thread_end; + + if (rw_addr < PAGE_OFFSET) { + if (task != &init_task) + return 0; + } + + thread_base = (unsigned long) task->thread_info; + thread_end = thread_base + sizeof(union thread_union); + if (rw_addr >= thread_base && + rw_addr < thread_end && + !(rw_addr & 0x7UL)) + return 1; + + return 0; +} + +static inline struct reg_window *kernel_stack_up(struct reg_window *rw) +{ + unsigned long fp = rw->ins[6]; + + if (!fp) + return NULL; + + return (struct reg_window *) (fp + STACK_BIAS); +} + void die_if_kernel(char *str, struct pt_regs *regs) { static int die_counter; @@ -1868,17 +1899,14 @@ /* Stop the back trace when we hit userland or we * find some badly aligned kernel stack. */ - while (rw && - count++ < 30 && - (((unsigned long) rw) >= PAGE_OFFSET) && - (char *) rw < ((char *) current) - + sizeof (union thread_union) && - !(((unsigned long) rw) & 0x7)) { + while (rw && + count++ < 30&& + is_kernel_stack(current, rw)) { printk("Caller[%016lx]", rw->ins[7]); print_symbol(": %s", rw->ins[7]); printk("\n"); - rw = (struct reg_window *) - (rw->ins[6] + STACK_BIAS); + + rw = kernel_stack_up(rw); } instruction_dump ((unsigned int *) regs->tpc); } else { diff -Nru a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile --- a/arch/sparc64/lib/Makefile 2004-09-21 20:52:51 -07:00 +++ b/arch/sparc64/lib/Makefile 2004-09-21 20:52:51 -07:00 @@ -12,7 +12,7 @@ U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ copy_in_user.o user_fixup.o memmove.o \ - mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o + mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o iomap.o lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff -Nru a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c --- a/arch/sparc64/lib/PeeCeeI.c 2004-09-21 20:52:52 -07:00 +++ b/arch/sparc64/lib/PeeCeeI.c 2004-09-21 20:52:52 -07:00 @@ -7,7 +7,7 @@ #include #include -void outsb(unsigned long addr, const void *src, unsigned long count) +void outsb(void __iomem *addr, const void *src, unsigned long count) { const u8 *p = src; @@ -15,7 +15,7 @@ outb(*p++, addr); } -void outsw(unsigned long addr, const void *src, unsigned long count) +void outsw(void __iomem *addr, const void *src, unsigned long count) { if(count) { u16 *ps = (u16 *)src; @@ -44,7 +44,7 @@ } } -void outsl(unsigned long addr, const void *src, unsigned long count) +void outsl(void __iomem *addr, const void *src, unsigned long count) { if(count) { if((((u64)src) & 0x3) == 0) { @@ -119,7 +119,7 @@ } } -void insb(unsigned long addr, void *dst, unsigned long count) +void insb(void __iomem *addr, void *dst, unsigned long count) { if(count) { u32 *pi; @@ -144,7 +144,7 @@ } } -void insw(unsigned long addr, void *dst, unsigned long count) +void insw(void __iomem *addr, void *dst, unsigned long count) { if(count) { u16 *ps = dst; @@ -169,7 +169,7 @@ } } -void insl(unsigned long addr, void *dst, unsigned long count) +void insl(void __iomem *addr, void *dst, unsigned long count) { if(count) { if((((unsigned long)dst) & 0x3) == 0) { diff -Nru a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/sparc64/lib/iomap.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,48 @@ +/* + * Implement the sparc64 iomap interfaces + */ +#include +#include +#include + +/* Create a virtual mapping cookie for an IO port range */ +void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + return (void __iomem *) (unsigned long) port; +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + if (maxlen && len > maxlen) + len = maxlen; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + if (flags & IORESOURCE_CACHEABLE) + return ioremap(start, len); + return ioremap_nocache(start, len); + } + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ + /* nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/arch/um/Kconfig b/arch/um/Kconfig --- a/arch/um/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/um/Kconfig 2004-09-21 20:52:52 -07:00 @@ -132,8 +132,9 @@ config HOST_2G_2G bool "2G/2G host address space split" -config UML_SMP +config SMP bool "Symmetric multi-processing support" + default n help This option enables UML SMP support. UML implements virtual SMP by allowing as many processes to run simultaneously on the host as @@ -144,10 +145,6 @@ on the host scheduler. CONFIG_SMP will be set to whatever this option is set to. It is safe to leave this unchanged. - -config SMP - bool - default UML_SMP config NR_CPUS int "Maximum number of CPUs (2-32)" diff -Nru a/arch/um/Kconfig_char b/arch/um/Kconfig_char --- a/arch/um/Kconfig_char 2004-09-21 20:52:51 -07:00 +++ b/arch/um/Kconfig_char 2004-09-21 20:52:51 -07:00 @@ -158,11 +158,6 @@ When not in use, each legacy PTY occupies 12 bytes on 32-bit architectures and 24 bytes on 64-bit architectures. -#config UNIX98_PTY_COUNT -# int "Maximum number of Unix98 PTYs in use (0-2048)" -# depends on UNIX98_PTYS -# default "256" - config WATCHDOG bool "Watchdog Timer Support" diff -Nru a/arch/um/Makefile b/arch/um/Makefile --- a/arch/um/Makefile 2004-09-21 20:52:52 -07:00 +++ b/arch/um/Makefile 2004-09-21 20:52:52 -07:00 @@ -48,8 +48,6 @@ include $(ARCH_DIR)/Makefile-$(SUBARCH) include $(ARCH_DIR)/Makefile-os-$(OS) -EXTRAVERSION := $(EXTRAVERSION)-1um - ARCH_INCLUDE = -I$(ARCH_DIR)/include # -Derrno=kernel_errno - This turns all kernel references to errno into diff -Nru a/arch/um/defconfig b/arch/um/defconfig --- a/arch/um/defconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/um/defconfig 2004-09-21 20:52:52 -07:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.8.1-mm3 -# Fri Aug 20 13:03:03 2004 +# Linux kernel version: 2.6.9-rc2-mm1 +# Thu Sep 16 23:44:48 2004 # CONFIG_USERMODE=y CONFIG_MMU=y @@ -20,7 +20,6 @@ CONFIG_HPPFS=y CONFIG_MCONSOLE=y # CONFIG_HOST_2G_2G is not set -# CONFIG_UML_SMP is not set # CONFIG_SMP is not set CONFIG_NEST_LEVEL=0 CONFIG_KERNEL_HALF_GIGS=1 @@ -38,6 +37,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set @@ -47,6 +47,7 @@ # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set +CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y @@ -54,12 +55,13 @@ # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y -# CONFIG_CPUSETS is not set CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -144,6 +146,7 @@ # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set # CONFIG_IPV6 is not set # CONFIG_NETFILTER is not set @@ -253,6 +256,11 @@ CONFIG_QUOTACTL=y CONFIG_AUTOFS_FS=y CONFIG_AUTOFS4_FS=y + +# +# Caches +# +# CONFIG_CACHEFS is not set # # CD-ROM/DVD Filesystems diff -Nru a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c --- a/arch/um/drivers/chan_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/chan_kern.c 2004-09-21 20:52:52 -07:00 @@ -106,6 +106,8 @@ return(n); } +/* XXX Trivial wrapper around os_write_file */ + int generic_write(int fd, const char *buf, int n, void *unused) { return(os_write_file(fd, buf, n)); diff -Nru a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c --- a/arch/um/drivers/cow_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/cow_user.c 2004-09-21 20:52:52 -07:00 @@ -27,8 +27,8 @@ #define PATH_LEN_V2 MAXPATHLEN struct cow_header_v2 { - unsigned long magic; - unsigned long version; + __u32 magic; + __u32 version; char backing_file[PATH_LEN_V2]; time_t mtime; __u64 size; diff -Nru a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c --- a/arch/um/drivers/fd.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/fd.c 2004-09-21 20:52:52 -07:00 @@ -7,6 +7,7 @@ #include #include #include +#include #include "user.h" #include "user_util.h" #include "chan_user.h" @@ -45,10 +46,16 @@ int fd_open(int input, int output, int primary, void *d, char **dev_out) { struct fd_chan *data = d; + int err; if(data->raw && isatty(data->fd)){ - tcgetattr(data->fd, &data->tt); - raw(data->fd, 0); + CATCH_EINTR(err = tcgetattr(data->fd, &data->tt)); + if(err) + return(err); + + err = raw(data->fd); + if(err) + return(err); } sprintf(data->str, "%d", data->fd); *dev_out = data->str; @@ -58,9 +65,13 @@ void fd_close(int fd, void *d) { struct fd_chan *data = d; + int err; if(data->raw && isatty(fd)){ - tcsetattr(fd, TCSAFLUSH, &data->tt); + CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &data->tt)); + if(err) + printk("Failed to restore terminal state - " + "errno = %d\n", -err); data->raw = 0; } } diff -Nru a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c --- a/arch/um/drivers/hostaudio_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/hostaudio_kern.c 2004-09-21 20:52:52 -07:00 @@ -35,7 +35,7 @@ " The default is \"" HOSTAUDIO_DEV_DSP "\".\n\n" #define MIXER_HELP \ -" This is used to specify the host mixer device to the hostaudio driver.\n" \ +" This is used to specify the host mixer device to the hostaudio driver.\n"\ " The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n" #ifndef MODULE @@ -72,7 +72,7 @@ { struct hostaudio_state *state = file->private_data; void *kbuf; - int ret; + int err; #ifdef DEBUG printk("hostaudio: read called, count = %d\n", count); @@ -82,16 +82,16 @@ if(kbuf == NULL) return(-ENOMEM); - ret = os_read_file(state->fd, kbuf, count); - if(ret < 0) + err = os_read_file(state->fd, kbuf, count); + if(err < 0) goto out; - if(copy_to_user(buffer, kbuf, ret)) - ret = -EFAULT; + if(copy_to_user(buffer, kbuf, err)) + err = -EFAULT; out: kfree(kbuf); - return(ret); + return(err); } static ssize_t hostaudio_write(struct file *file, const char *buffer, @@ -99,7 +99,7 @@ { struct hostaudio_state *state = file->private_data; void *kbuf; - int ret; + int err; #ifdef DEBUG printk("hostaudio: write called, count = %d\n", count); @@ -109,17 +109,18 @@ if(kbuf == NULL) return(-ENOMEM); - ret = -EFAULT; + err = -EFAULT; if(copy_from_user(kbuf, buffer, count)) goto out; - ret = os_write_file(state->fd, kbuf, count); - if(ret < 0) + err = os_write_file(state->fd, kbuf, count); + if(err < 0) goto out; + *ppos += err; out: kfree(kbuf); - return(ret); + return(err); } static unsigned int hostaudio_poll(struct file *file, @@ -139,7 +140,7 @@ { struct hostaudio_state *state = file->private_data; unsigned long data = 0; - int ret; + int err; #ifdef DEBUG printk("hostaudio: ioctl called, cmd = %u\n", cmd); @@ -158,7 +159,7 @@ break; } - ret = os_ioctl_generic(state->fd, cmd, (unsigned long) &data); + err = os_ioctl_generic(state->fd, cmd, (unsigned long) &data); switch(cmd){ case SNDCTL_DSP_SPEED: @@ -174,7 +175,7 @@ break; } - return(ret); + return(err); } static int hostaudio_open(struct inode *inode, struct file *file) @@ -188,22 +189,19 @@ #endif state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL); - if(state == NULL) return(-ENOMEM); + if(state == NULL) + return(-ENOMEM); if(file->f_mode & FMODE_READ) r = 1; if(file->f_mode & FMODE_WRITE) w = 1; ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); - if(ret < 0){ - printk("hostaudio_open failed to open '%s', err = %d\n", - dsp, -ret); kfree(state); return(ret); } state->fd = ret; - file->private_data = state; return(0); } @@ -216,11 +214,7 @@ printk("hostaudio: release called\n"); #endif - if(state->fd >= 0){ os_close_file(state->fd); - state->fd = -1; - } - kfree(state); return(0); @@ -265,8 +259,6 @@ return(ret); } - state->fd = ret; - file->private_data = state; return(0); } @@ -279,10 +271,7 @@ printk("hostmixer: release called\n"); #endif - if(state->fd >= 0){ os_close_file(state->fd); - state->fd = -1; - } kfree(state); return(0); diff -Nru a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c --- a/arch/um/drivers/mconsole_kern.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/drivers/mconsole_kern.c 2004-09-21 20:52:51 -07:00 @@ -51,27 +51,26 @@ LIST_HEAD(mc_requests); -void mc_work_proc(void *unused) +static void mc_work_proc(void *unused) { struct mconsole_entry *req; unsigned long flags; - int done; - do { + while(!list_empty(&mc_requests)){ local_save_flags(flags); req = list_entry(mc_requests.next, struct mconsole_entry, list); list_del(&req->list); - done = list_empty(&mc_requests); local_irq_restore(flags); req->request.cmd->handler(&req->request); kfree(req); - } while(!done); + } } DECLARE_WORK(mconsole_work, mc_work_proc, NULL); -irqreturn_t mconsole_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t mconsole_interrupt(int irq, void *dev_id, + struct pt_regs *regs) { int fd; struct mconsole_entry *new; @@ -91,7 +90,8 @@ } } } - if(!list_empty(&mc_requests)) schedule_work(&mconsole_work); + if(!list_empty(&mc_requests)) + schedule_work(&mconsole_work); reactivate_fd(fd, MCONSOLE_IRQ); return(IRQ_HANDLED); } @@ -374,8 +374,8 @@ ptr += strlen("sysrq"); while(isspace(*ptr)) ptr++; - handle_sysrq(*ptr, ¤t->thread.regs, NULL); mconsole_reply(req, "", 0, 0); + handle_sysrq(*ptr, ¤t->thread.regs, NULL); } #else void mconsole_sysrq(struct mc_request *req) diff -Nru a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c --- a/arch/um/drivers/net_kern.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/drivers/net_kern.c 2004-09-21 20:52:51 -07:00 @@ -19,6 +19,8 @@ #include "linux/inetdevice.h" #include "linux/ctype.h" #include "linux/bootmem.h" +#include "linux/ethtool.h" +#include "asm/uaccess.h" #include "user_util.h" #include "kern_util.h" #include "net_kern.h" @@ -127,6 +129,13 @@ spin_lock(&opened_lock); list_add(&lp->list, &opened); spin_unlock(&opened_lock); + + /* clear buffer - it can happen that the host side of the interface + * is full when we get here. In this case, new data is never queued, + * SIGIOs never arrive, and the net never works. + */ + while((err = uml_net_rx(dev)) > 0) ; + out: spin_unlock(&lp->lock); return(err); @@ -240,7 +249,30 @@ static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - return(-EINVAL); + static const struct ethtool_drvinfo info = { + .cmd = ETHTOOL_GDRVINFO, + .driver = "uml virtual ethernet", + .version = "42", + }; + void *useraddr; + u32 ethcmd; + + switch (cmd) { + case SIOCETHTOOL: + useraddr = ifr->ifr_data; + if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) + return -EFAULT; + switch (ethcmd) { + case ETHTOOL_GDRVINFO: + if (copy_to_user(useraddr, &info, sizeof(info))) + return -EFAULT; + return 0; + default: + return -EOPNOTSUPP; + } + default: + return -EINVAL; + } } void uml_net_user_timer_expire(unsigned long _conn) diff -Nru a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c --- a/arch/um/drivers/port_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/port_user.c 2004-09-21 20:52:52 -07:00 @@ -76,12 +76,17 @@ int port_open(int input, int output, int primary, void *d, char **dev_out) { struct port_chan *data = d; - int fd; + int fd, err; fd = port_wait(data->kernel_data); if((fd >= 0) && data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } *dev_out = data->dev; return(fd); diff -Nru a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c --- a/arch/um/drivers/pty.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/pty.c 2004-09-21 20:52:52 -07:00 @@ -38,7 +38,7 @@ { struct pty_chan *data = d; char *dev; - int fd; + int fd, err; fd = get_pty(); if(fd < 0){ @@ -46,8 +46,13 @@ return(-errno); } if(data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } dev = ptsname(fd); @@ -89,13 +94,19 @@ int pty_open(int input, int output, int primary, void *d, char **dev_out) { struct pty_chan *data = d; - int fd; + int fd, err; char dev[sizeof("/dev/ptyxx\0")] = "/dev/ptyxx"; fd = getmaster(dev); - if(fd < 0) return(-errno); + if(fd < 0) + return(-errno); + + if(data->raw){ + err = raw(fd); + if(err) + return(err); + } - if(data->raw) raw(fd, 0); if(data->announce) (*data->announce)(dev, data->dev); sprintf(data->dev_name, "%s", dev); diff -Nru a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c --- a/arch/um/drivers/stdio_console.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/drivers/stdio_console.c 2004-09-21 20:52:51 -07:00 @@ -191,7 +191,7 @@ late_initcall(stdio_init); -static void console_write(struct console *console, const char *string, +static void uml_console_write(struct console *console, const char *string, unsigned len) { struct line *line = &vts[console->index]; @@ -203,22 +203,22 @@ up(&line->sem); } -static struct tty_driver *um_console_device(struct console *c, int *index) +static struct tty_driver *uml_console_device(struct console *c, int *index) { *index = c->index; return console_driver; } -static int console_setup(struct console *co, char *options) +static int uml_console_setup(struct console *co, char *options) { return(0); } static struct console stdiocons = { name: "tty", - write: console_write, - device: um_console_device, - setup: console_setup, + write: uml_console_write, + device: uml_console_device, + setup: uml_console_setup, flags: CON_PRINTBUFFER, index: -1, }; diff -Nru a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c --- a/arch/um/drivers/tty.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/drivers/tty.c 2004-09-21 20:52:51 -07:00 @@ -41,13 +41,18 @@ int tty_open(int input, int output, int primary, void *d, char **dev_out) { struct tty_chan *data = d; - int fd; + int fd, err; fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0); if(fd < 0) return(fd); if(data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } *dev_out = data->dev; diff -Nru a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c --- a/arch/um/drivers/ubd_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/drivers/ubd_kern.c 2004-09-21 20:52:52 -07:00 @@ -1064,7 +1064,6 @@ { struct hd_geometry *loc = (struct hd_geometry *) arg; struct ubd *dev = inode->i_bdev->bd_disk->private_data; - int err; struct hd_driveid ubd_id = { .cyls = 0, .heads = 128, @@ -1081,32 +1080,6 @@ g.cylinders = dev->size / (128 * 32 * 512); g.start = get_start_sect(inode->i_bdev); return(copy_to_user(loc, &g, sizeof(g)) ? -EFAULT : 0); - - case HDIO_SET_UNMASKINTR: - if(!capable(CAP_SYS_ADMIN)) return(-EACCES); - if((arg > 1) || (inode->i_bdev->bd_contains != inode->i_bdev)) - return(-EINVAL); - return(0); - - case HDIO_GET_UNMASKINTR: - if(!arg) return(-EINVAL); - err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long)); - if(err) - return(err); - return(0); - - case HDIO_GET_MULTCOUNT: - if(!arg) return(-EINVAL); - err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long)); - if(err) - return(err); - return(0); - - case HDIO_SET_MULTCOUNT: - if(!capable(CAP_SYS_ADMIN)) return(-EACCES); - if(inode->i_bdev->bd_contains != inode->i_bdev) - return(-EINVAL); - return(0); case HDIO_GET_IDENTITY: ubd_id.cyls = dev->size / (128 * 32 * 512); diff -Nru a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c --- a/arch/um/drivers/xterm.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/drivers/xterm.c 2004-09-21 20:52:51 -07:00 @@ -83,6 +83,7 @@ " are 'xterm=gnome-terminal,-t,-x'.\n\n" ); +/* XXX This badly needs some cleaning up in the error paths */ int xterm_open(int input, int output, int primary, void *d, char **dev_out) { struct xterm_chan *data = d; @@ -141,8 +142,19 @@ goto out; } - tcgetattr(new, &data->tt); - if(data->raw) raw(new, 0); + CATCH_EINTR(err = tcgetattr(new, &data->tt)); + if(err){ + new = err; + goto out; + } + + if(data->raw){ + err = raw(new); + if(err){ + new = err; + goto out; + } + } data->pid = pid; *dev_out = NULL; diff -Nru a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h --- a/arch/um/include/irq_user.h 2004-09-21 20:52:52 -07:00 +++ b/arch/um/include/irq_user.h 2004-09-21 20:52:52 -07:00 @@ -14,6 +14,7 @@ extern void free_irq_by_fd(int fd); extern void reactivate_fd(int fd, int irqnum); extern void deactivate_fd(int fd, int irqnum); +extern int deactivate_all_fds(void); extern void forward_interrupts(int pid); extern void init_irq_signals(int on_sigstack); extern void forward_ipi(int fd, int pid); diff -Nru a/arch/um/include/os.h b/arch/um/include/os.h --- a/arch/um/include/os.h 2004-09-21 20:52:51 -07:00 +++ b/arch/um/include/os.h 2004-09-21 20:52:51 -07:00 @@ -140,6 +140,7 @@ extern int os_file_modtime(char *file, unsigned long *modtime); extern int os_pipe(int *fd, int stream, int close_on_exec); extern int os_set_fd_async(int fd, int owner); +extern int os_clear_fd_async(int fd); extern int os_set_fd_block(int fd, int blocking); extern int os_accept_connection(int fd); extern int os_create_unix_socket(char *file, int len, int close_on_exec); @@ -165,6 +166,7 @@ int r, int w, int x); extern int os_unmap_memory(void *addr, int len); extern void os_flush_stdout(void); +extern unsigned long long os_usecs(void); #endif diff -Nru a/arch/um/include/time_user.h b/arch/um/include/time_user.h --- a/arch/um/include/time_user.h 2004-09-21 20:52:51 -07:00 +++ b/arch/um/include/time_user.h 2004-09-21 20:52:51 -07:00 @@ -11,6 +11,7 @@ extern void set_interval(int timer_type); extern void idle_sleep(int secs); extern void enable_timer(void); +extern void disable_timer(void); extern unsigned long time_lock(void); extern void time_unlock(unsigned long); diff -Nru a/arch/um/include/user_util.h b/arch/um/include/user_util.h --- a/arch/um/include/user_util.h 2004-09-21 20:52:51 -07:00 +++ b/arch/um/include/user_util.h 2004-09-21 20:52:51 -07:00 @@ -8,6 +8,8 @@ #include "sysdep/ptrace.h" +#define CATCH_EINTR(expr) while (((expr) < 0) && (errno == EINTR)) + extern int mode_tt; extern int grantpt(int __fd); @@ -72,7 +74,6 @@ extern void tracer_panic(char *msg, ...); extern char *get_umid(int only_if_set); extern void do_longjmp(void *p, int val); -extern void suspend_new_thread(int fd); extern int detach(int pid, int sig); extern int attach(int pid); extern void kill_child_dead(int pid); @@ -88,11 +89,9 @@ extern void forward_pending_sigio(int target); extern int can_do_skas(void); extern void arch_init_thread(void); +extern int setjmp_wrapper(void (*proc)(void *, void *), ...); +extern int raw(int fd); -extern int __raw(int fd, int complain, int now); -#define raw(fd, complain) __raw((fd), (complain), 1) - -#define CATCH_EINTR(expr) while ( ((expr) < 0) && errno == EINTR) #endif /* diff -Nru a/arch/um/kernel/helper.c b/arch/um/kernel/helper.c --- a/arch/um/kernel/helper.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/helper.c 2004-09-21 20:52:52 -07:00 @@ -132,7 +132,7 @@ return(-errno); } if(stack_out == NULL){ - pid = waitpid(pid, &status, 0); + CATCH_EINTR(pid = waitpid(pid, &status, 0)); if(pid < 0){ printk("run_helper_thread - wait failed, errno = %d\n", errno); @@ -151,7 +151,7 @@ { int ret; - ret = waitpid(pid, NULL, WNOHANG); + CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); if(ret < 0){ printk("helper_wait : waitpid failed, errno = %d\n", errno); return(-errno); diff -Nru a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c --- a/arch/um/kernel/irq.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/irq.c 2004-09-21 20:52:52 -07:00 @@ -147,7 +147,7 @@ struct irqaction * action) { int status = 1; /* Force the "do bottom halves" bit */ - int ret; + int ret, retval = 0; if (!(action->flags & SA_INTERRUPT)) local_irq_enable(); @@ -156,6 +156,7 @@ ret = action->handler(irq, action->dev_id, regs); if (ret == IRQ_HANDLED) status |= action->flags; + retval |= ret; action = action->next; } while (action); if (status & SA_SAMPLE_RANDOM) @@ -163,7 +164,7 @@ local_irq_disable(); - return status; + return retval; } /* diff -Nru a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c --- a/arch/um/kernel/irq_user.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/irq_user.c 2004-09-21 20:52:51 -07:00 @@ -364,6 +364,20 @@ irq_unlock(flags); } +int deactivate_all_fds(void) +{ + struct irq_fd *irq; + int err; + + for(irq=active_fds;irq != NULL;irq = irq->next){ + err = os_clear_fd_async(irq->fd); + if(err) + return(err); + } + + return(0); +} + void forward_ipi(int fd, int pid) { int err; diff -Nru a/arch/um/kernel/main.c b/arch/um/kernel/main.c --- a/arch/um/kernel/main.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/main.c 2004-09-21 20:52:52 -07:00 @@ -147,7 +147,21 @@ /* Reboot */ if(ret){ + int err; + printf("\n"); + + /* Let any pending signals fire, then disable them. This + * ensures that they won't be delivered after the exec, when + * they are definitely not expected. + */ + unblock_signals(); + disable_timer(); + err = deactivate_all_fds(); + if(err) + printf("deactivate_all_fds failed, errno = %d\n", + -err); + execvp(new_argv[0], new_argv); perror("Failed to exec kernel"); ret = 1; diff -Nru a/arch/um/kernel/mem_user.c b/arch/um/kernel/mem_user.c --- a/arch/um/kernel/mem_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/mem_user.c 2004-09-21 20:52:52 -07:00 @@ -143,7 +143,7 @@ struct iomem_region *new; struct uml_stat buf; char *file, *driver; - int fd, err; + int fd, err, size; driver = str; file = strchr(str,','); @@ -171,10 +171,12 @@ goto out_close; } + size = (buf.ust_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1); + *new = ((struct iomem_region) { .next = iomem_regions, .driver = driver, .fd = fd, - .size = buf.ust_size, + .size = size, .phys = 0, .virt = 0 }); iomem_regions = new; diff -Nru a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c --- a/arch/um/kernel/physmem.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/physmem.c 2004-09-21 20:52:52 -07:00 @@ -4,7 +4,7 @@ */ #include "linux/mm.h" -#include "linux/ghash.h" +#include "linux/rbtree.h" #include "linux/slab.h" #include "linux/vmalloc.h" #include "linux/bootmem.h" @@ -19,36 +19,8 @@ #include "kern.h" #include "init.h" -#if 0 -static pgd_t physmem_pgd[PTRS_PER_PGD]; - -static struct phys_desc *lookup_mapping(void *addr) -{ - pgd = &physmem_pgd[pgd_index(addr)]; - if(pgd_none(pgd)) - return(NULL); - - pmd = pmd_offset(pgd, addr); - if(pmd_none(pmd)) - return(NULL); - - pte = pte_offset_kernel(pmd, addr); - return((struct phys_desc *) pte_val(pte)); -} - -static struct add_mapping(void *addr, struct phys_desc *new) -{ -} -#endif - -#define PHYS_HASHSIZE (8192) - -struct phys_desc; - -DEF_HASH_STRUCTS(virtmem, PHYS_HASHSIZE, struct phys_desc); - struct phys_desc { - struct virtmem_ptrs virt_ptrs; + struct rb_node rb; int fd; __u64 offset; void *virt; @@ -56,21 +28,48 @@ struct list_head list; }; -struct virtmem_table virtmem_hash; +static struct rb_root phys_mappings = RB_ROOT; -static int virt_cmp(void *virt1, void *virt2) +static struct rb_node **find_rb(void *virt) { - return(virt1 != virt2); + struct rb_node **n = &phys_mappings.rb_node; + struct phys_desc *d; + + while(*n != NULL){ + d = rb_entry(n, struct phys_desc, rb); + if(d->virt == virt) + return(n); + + if(d->virt > virt) + n = &(*n)->rb_left; + else + n = &(*n)->rb_right; + } + + return(n); } -static int virt_hash(void *virt) +static struct phys_desc *find_phys_mapping(void *virt) { - unsigned long addr = ((unsigned long) virt) >> PAGE_SHIFT; - return(addr % PHYS_HASHSIZE); + struct rb_node **n = find_rb(virt); + + if(*n == NULL) + return(NULL); + + return(rb_entry(n, struct phys_desc, rb)); } -DEF_HASH(static, virtmem, struct phys_desc, virt_ptrs, void *, virt, virt_cmp, - virt_hash); +static void insert_phys_mapping(struct phys_desc *desc) +{ + struct rb_node **n = find_rb(desc->virt); + + if(*n != NULL) + panic("Physical remapping for %p already present", + desc->virt); + + rb_link_node(&desc->rb, (*n)->rb_parent, n); + rb_insert_color(&desc->rb, &phys_mappings); +} LIST_HEAD(descriptor_mappings); @@ -127,7 +126,8 @@ return(-ENOMEM); phys = __pa(virt); - if(find_virtmem_hash(&virtmem_hash, virt) != NULL) + desc = find_phys_mapping(virt); + if(desc != NULL) panic("Address 0x%p is already substituted\n", virt); err = -ENOMEM; @@ -136,13 +136,12 @@ goto out; *desc = ((struct phys_desc) - { .virt_ptrs = { NULL, NULL }, - .fd = fd, + { .fd = fd, .offset = offset, .virt = virt, .phys = __pa(virt), .list = LIST_HEAD_INIT(desc->list) }); - insert_virtmem_hash(&virtmem_hash, desc); + insert_phys_mapping(desc); list_add(&desc->list, &fd_maps->pages); @@ -151,7 +150,7 @@ if(!err) goto out; - remove_virtmem_hash(&virtmem_hash, desc); + rb_erase(&desc->rb, &phys_mappings); kfree(desc); out: return(err); @@ -164,7 +163,7 @@ void *virt = desc->virt; int err; - remove_virtmem_hash(&virtmem_hash, desc); + rb_erase(&desc->rb, &phys_mappings); list_del(&desc->list); kfree(desc); @@ -179,7 +178,7 @@ struct phys_desc *desc; virt = (void *) ((unsigned long) virt & PAGE_MASK); - desc = find_virtmem_hash(&virtmem_hash, virt); + desc = find_phys_mapping(virt); if(desc == NULL) return(0); @@ -234,7 +233,9 @@ int is_remapped(void *virt) { - return(find_virtmem_hash(&virtmem_hash, virt) != NULL); + struct phys_desc *desc = find_phys_mapping(virt); + + return(desc != NULL); } /* Changed during early boot */ @@ -367,8 +368,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out) { - struct phys_desc *desc = find_virtmem_hash(&virtmem_hash, - __va(phys & PAGE_MASK)); + struct phys_desc *desc = find_phys_mapping(__va(phys & PAGE_MASK)); int fd = -1; if(desc != NULL){ diff -Nru a/arch/um/kernel/process.c b/arch/um/kernel/process.c --- a/arch/um/kernel/process.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/process.c 2004-09-21 20:52:52 -07:00 @@ -46,7 +46,7 @@ int flags = 0, pages; if(sig_stack != NULL){ - pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; + pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER); set_sigstack(sig_stack, pages * page_size()); flags = SA_ONSTACK; } @@ -57,11 +57,7 @@ { int flags = altstack ? SA_ONSTACK : 0; - /* NODEFER is set here because SEGV isn't turned back on when the - * handler is ready to receive signals. This causes any segfault - * during a copy_user to kill the process because the fault is blocked. - */ - set_handler(SIGSEGV, (__sighandler_t) sig_handler, flags | SA_NODEFER, + set_handler(SIGSEGV, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); set_handler(SIGTRAP, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); @@ -74,7 +70,7 @@ set_handler(SIGWINCH, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); set_handler(SIGUSR2, (__sighandler_t) sig_handler, - SA_NOMASK | flags, -1); + flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); signal(SIGHUP, SIG_IGN); init_irq_signals(altstack); @@ -139,16 +135,6 @@ return(arg.pid); } -void suspend_new_thread(int fd) -{ - char c; - - os_stop_process(os_getpid()); - - if(os_read_file(fd, &c, sizeof(c)) != sizeof(c)) - panic("read failed in suspend_new_thread"); -} - static int ptrace_child(void *arg) { int pid = os_getpid(); @@ -297,7 +283,7 @@ int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { - jmp_buf buf; + sigjmp_buf buf; int n; *jmp_ptr = &buf; diff -Nru a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c --- a/arch/um/kernel/process_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/process_kern.c 2004-09-21 20:52:52 -07:00 @@ -166,8 +166,6 @@ struct pt_regs *regs) { p->thread = (struct thread_struct) INIT_THREAD; - p->thread.kernel_stack = - (unsigned long) p->thread_info + 2 * PAGE_SIZE; return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, clone_flags, sp, stack_top, p, regs)); } @@ -327,8 +325,7 @@ unsigned long stack; stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER); - stack += 2 * PAGE_SIZE; - return(stack != current->thread.kernel_stack); + return(stack != (unsigned long) current_thread); } extern void remove_umid_dir(void); diff -Nru a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c --- a/arch/um/kernel/sigio_kern.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/sigio_kern.c 2004-09-21 20:52:51 -07:00 @@ -16,7 +16,7 @@ /* Protected by sigio_lock() called from write_sigio_workaround */ static int sigio_irq_fd = -1; -irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) +static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) { read_sigio_fd(sigio_irq_fd); reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); @@ -25,10 +25,14 @@ int write_sigio_irq(int fd) { - if(um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, + int err; + + err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, SA_INTERRUPT | SA_SAMPLE_RANDOM, "write sigio", - NULL)){ - printk("write_sigio_irq : um_request_irq failed\n"); + NULL); + if(err){ + printk("write_sigio_irq : um_request_irq failed, err = %d\n", + err); return(-1); } sigio_irq_fd = fd; diff -Nru a/arch/um/kernel/sigio_user.c b/arch/um/kernel/sigio_user.c --- a/arch/um/kernel/sigio_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/sigio_user.c 2004-09-21 20:52:52 -07:00 @@ -68,7 +68,8 @@ return; } - err = __raw(master, 1, 0); //Not now, but complain so we now where we failed. + /* Not now, but complain so we now where we failed. */ + err = raw(master); if (err < 0) panic("check_sigio : __raw failed, errno = %d\n", -err); diff -Nru a/arch/um/kernel/signal_user.c b/arch/um/kernel/signal_user.c --- a/arch/um/kernel/signal_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/signal_user.c 2004-09-21 20:52:52 -07:00 @@ -80,6 +80,12 @@ change_signals(SIG_UNBLOCK); } +/* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled + * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to + * be able to profile all of UML, not just the non-critical sections. If + * profiling is not thread-safe, then that is not my problem. We can disable + * profiling when SMP is enabled in that case. + */ #define SIGIO_BIT 0 #define SIGVTALRM_BIT 1 @@ -114,6 +120,11 @@ sigaddset(&mask, SIGVTALRM); sigaddset(&mask, SIGALRM); } + + /* This is safe - sigprocmask is guaranteed to copy locally the + * value of new_set, do his work and then, at the end, write to + * old_set. + */ if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0) panic("Failed to enable signals"); ret = enable_mask(&mask); diff -Nru a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c --- a/arch/um/kernel/skas/process.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/skas/process.c 2004-09-21 20:52:52 -07:00 @@ -209,7 +209,7 @@ void (*handler)(int)) { unsigned long flags; - jmp_buf switch_buf, fork_buf; + sigjmp_buf switch_buf, fork_buf; *switch_buf_ptr = &switch_buf; *fork_buf_ptr = &fork_buf; @@ -233,7 +233,7 @@ void thread_wait(void *sw, void *fb) { - jmp_buf buf, **switch_buf = sw, *fork_buf; + sigjmp_buf buf, **switch_buf = sw, *fork_buf; *switch_buf = &buf; fork_buf = fb; @@ -295,23 +295,23 @@ void switch_threads(void *me, void *next) { - jmp_buf my_buf, **me_ptr = me, *next_buf = next; + sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; *me_ptr = &my_buf; if(sigsetjmp(my_buf, 1) == 0) siglongjmp(*next_buf, 1); } -static jmp_buf initial_jmpbuf; +static sigjmp_buf initial_jmpbuf; /* XXX Make these percpu */ static void (*cb_proc)(void *arg); static void *cb_arg; -static jmp_buf *cb_back; +static sigjmp_buf *cb_back; int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) { - jmp_buf **switch_buf = switch_buf_ptr; + sigjmp_buf **switch_buf = switch_buf_ptr; int n; *fork_buf_ptr = &initial_jmpbuf; @@ -347,7 +347,7 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) { - jmp_buf here; + sigjmp_buf here; cb_proc = proc; cb_arg = arg; @@ -373,28 +373,6 @@ { block_signals(); siglongjmp(initial_jmpbuf, 4); -} - -int new_mm(int from) -{ - struct proc_mm_op copy; - int n, fd = os_open_file("/proc/mm", - of_cloexec(of_write(OPENFLAGS())), 0); - - if(fd < 0) - return(fd); - - if(from != -1){ - copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS, - .u = - { .copy_segments = from } } ); - n = os_write_file(fd, ©, sizeof(copy)); - if(n != sizeof(copy)) - printk("new_mm : /proc/mm copy_segments failed, " - "err = %d\n", -n); - } - - return(fd); } void switch_mm_skas(int mm_fd) diff -Nru a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c --- a/arch/um/kernel/skas/process_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/skas/process_kern.c 2004-09-21 20:52:52 -07:00 @@ -22,6 +22,7 @@ #include "frame.h" #include "kern.h" #include "mode.h" +#include "proc_mm.h" static atomic_t using_sysemu; int sysemu_supported; @@ -191,12 +192,33 @@ handler = new_thread_handler; } - new_thread((void *) p->thread.kernel_stack, - &p->thread.mode.skas.switch_buf, + new_thread(p->thread_info, &p->thread.mode.skas.switch_buf, &p->thread.mode.skas.fork_buf, handler); return(0); } +int new_mm(int from) +{ + struct proc_mm_op copy; + int n, fd; + + fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); + if(fd < 0) + return(fd); + + if(from != -1){ + copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS, + .u = + { .copy_segments = from } } ); + n = os_write_file(fd, ©, sizeof(copy)); + if(n != sizeof(copy)) + printk("new_mm : /proc/mm copy_segments failed, " + "err = %d\n", -n); + } + + return(fd); +} + void init_idle_skas(void) { cpu_tasks[current_thread->cpu].pid = os_getpid(); @@ -225,13 +247,13 @@ { start_userspace(0); capture_signal_stack(); - uml_idle_timer(); init_new_thread_signals(1); + uml_idle_timer(); init_task.thread.request.u.thread.proc = start_kernel_proc; init_task.thread.request.u.thread.arg = NULL; - return(start_idle_thread((void *) init_task.thread.kernel_stack, + return(start_idle_thread(init_task.thread_info, &init_task.thread.mode.skas.switch_buf, &init_task.thread.mode.skas.fork_buf)); } diff -Nru a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c --- a/arch/um/kernel/skas/tlb.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/skas/tlb.c 2004-09-21 20:52:52 -07:00 @@ -77,7 +77,7 @@ int updated = 0, err; mm = &init_mm; - for(addr = start_vm; addr < end_vm;){ + for(addr = start; addr < end;){ pgd = pgd_offset(mm, addr); pmd = pmd_offset(pgd, addr); if(pmd_present(*pmd)){ diff -Nru a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c --- a/arch/um/kernel/skas/trap_user.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/skas/trap_user.c 2004-09-21 20:52:51 -07:00 @@ -19,8 +19,10 @@ struct skas_regs *r; struct signal_info *info; int save_errno = errno; + int save_user; r = &TASK_REGS(get_current())->skas; + save_user = r->is_user; r->is_user = 0; r->fault_addr = SC_FAULT_ADDR(sc); r->fault_type = SC_FAULT_TYPE(sc); @@ -33,6 +35,7 @@ (*info->handler)(sig, (union uml_pt_regs *) r); errno = save_errno; + r->is_user = save_user; } void user_signal(int sig, union uml_pt_regs *regs) diff -Nru a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c --- a/arch/um/kernel/skas/uaccess.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/skas/uaccess.c 2004-09-21 20:52:52 -07:00 @@ -12,6 +12,7 @@ #include "asm/pgtable.h" #include "asm/uaccess.h" #include "kern_util.h" +#include "user_util.h" extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr, pte_t *pte_out); @@ -51,37 +52,67 @@ return(n); } -static int buffer_op(unsigned long addr, int len, int is_write, - int (*op)(unsigned long addr, int len, void *arg), - void *arg) +static void do_buffer_op(void *jmpbuf, void *arg_ptr) { + va_list args = *((va_list *) arg_ptr); + unsigned long addr = va_arg(args, unsigned long); + int len = va_arg(args, int); + int is_write = va_arg(args, int); + int (*op)(unsigned long, int, void *) = va_arg(args, void *); + void *arg = va_arg(args, void *); + int *res = va_arg(args, int *); int size = min(PAGE_ALIGN(addr) - addr, (unsigned long) len); int remain = len, n; + current->thread.fault_catcher = jmpbuf; n = do_op(addr, size, is_write, op, arg); - if(n != 0) - return(n < 0 ? remain : 0); + if(n != 0){ + *res = (n < 0 ? remain : 0); + goto out; + } addr += size; remain -= size; - if(remain == 0) - return(0); + if(remain == 0){ + *res = 0; + goto out; + } while(addr < ((addr + remain) & PAGE_MASK)){ n = do_op(addr, PAGE_SIZE, is_write, op, arg); - if(n != 0) - return(n < 0 ? remain : 0); + if(n != 0){ + *res = (n < 0 ? remain : 0); + goto out; + } addr += PAGE_SIZE; remain -= PAGE_SIZE; } - if(remain == 0) - return(0); + if(remain == 0){ + *res = 0; + goto out; + } n = do_op(addr, remain, is_write, op, arg); if(n != 0) - return(n < 0 ? remain : 0); - return(0); + *res = (n < 0 ? remain : 0); + else *res = 0; + out: + current->thread.fault_catcher = NULL; +} + +static int buffer_op(unsigned long addr, int len, int is_write, + int (*op)(unsigned long addr, int len, void *arg), + void *arg) +{ + int faulted, res; + + faulted = setjmp_wrapper(do_buffer_op, addr, len, is_write, op, arg, + &res); + if(!faulted) + return(res); + + return(addr + len - (unsigned long) current->thread.fault_addr); } static int copy_chunk_from_user(unsigned long from, int len, void *arg) diff -Nru a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c --- a/arch/um/kernel/smp.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/smp.c 2004-09-21 20:52:51 -07:00 @@ -29,9 +29,11 @@ #include "os.h" /* CPU online map, set by smp_boot_cpus */ -unsigned long cpu_online_map = CPU_MASK_NONE; +cpumask_t cpu_online_map = CPU_MASK_NONE; +cpumask_t cpu_possible_map = CPU_MASK_NONE; EXPORT_SYMBOL(cpu_online_map); +EXPORT_SYMBOL(cpu_possible_map); /* Per CPU bogomips and other parameters * The only piece used here is the ipi pipe, which is set before SMP is @@ -125,6 +127,10 @@ struct task_struct *idle; unsigned long waittime; int err, cpu, me = smp_processor_id(); + int i; + + for (i = 0; i < ncpus; ++i) + cpu_set(i, cpu_possible_map); cpu_clear(me, cpu_online_map); cpu_set(me, cpu_online_map); diff -Nru a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c --- a/arch/um/kernel/syscall_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/syscall_kern.c 2004-09-21 20:52:52 -07:00 @@ -44,17 +44,6 @@ return(ret); } -long sys_clone(unsigned long clone_flags, unsigned long newsp, - int *parent_tid, int *child_tid) -{ - long ret; - - current->thread.forking = 1; - ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); - current->thread.forking = 0; - return(ret); -} - long sys_vfork(void) { long ret; diff -Nru a/arch/um/kernel/time.c b/arch/um/kernel/time.c --- a/arch/um/kernel/time.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/time.c 2004-09-21 20:52:51 -07:00 @@ -10,7 +10,6 @@ #include #include #include -#include #include "user_util.h" #include "kern_util.h" #include "user.h" @@ -54,6 +53,15 @@ errno); } +void disable_timer(void) +{ + struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); + if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) || + (setitimer(ITIMER_REAL, &disable, NULL) < 0)) + printk("disnable_timer - setitimer failed, errno = %d\n", + errno); +} + void switch_timers(int to_real) { struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); @@ -86,49 +94,12 @@ set_interval(ITIMER_REAL); } -static unsigned long long get_host_hz(void) -{ - char mhzline[16], *end; - unsigned long long mhz; - int ret, mult, rest, len; - - ret = cpu_feature("cpu MHz", mhzline, - sizeof(mhzline) / sizeof(mhzline[0])); - if(!ret) - panic ("Could not get host MHZ"); - - mhz = strtoul(mhzline, &end, 10); - - /* This business is to parse a floating point number without using - * floating types. - */ - - rest = 0; - mult = 0; - if(*end == '.'){ - end++; - len = strlen(end); - if(len < 6) - mult = 6 - len; - else if(len > 6) - end[6] = '\0'; - rest = strtoul(end, NULL, 10); - while(mult-- > 0) - rest *= 10; - } - - return(1000000 * mhz + rest); -} - -unsigned long long host_hz = 0; - extern int do_posix_clock_monotonic_gettime(struct timespec *tp); void time_init(void) { struct timespec now; - host_hz = get_host_hz(); if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) panic("Couldn't set SIGVTALRM handler"); set_interval(ITIMER_VIRTUAL); diff -Nru a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c --- a/arch/um/kernel/time_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/time_kern.c 2004-09-21 20:52:52 -07:00 @@ -20,6 +20,7 @@ #include "user_util.h" #include "time_user.h" #include "mode.h" +#include "os.h" u64 jiffies_64; @@ -42,12 +43,10 @@ int timer_irq_inited = 0; static int first_tick; -static unsigned long long prev_tsc; -#ifdef CONFIG_UML_REAL_TIME_CLOCK +static unsigned long long prev_usecs; static long long delta; /* Deviation per interval */ -#endif -extern unsigned long long host_hz; +#define MILLION 1000000 void timer_irq(union uml_pt_regs *regs) { @@ -61,22 +60,25 @@ } if(first_tick){ -#ifdef CONFIG_UML_REAL_TIME_CLOCK - unsigned long long tsc; +#if defined(CONFIG_UML_REAL_TIME_CLOCK) /* We've had 1 tick */ - tsc = time_stamp(); + unsigned long long usecs = os_usecs(); + + delta += usecs - prev_usecs; + prev_usecs = usecs; - delta += tsc - prev_tsc; - prev_tsc = tsc; + /* Protect against the host clock being set backwards */ + if(delta < 0) + delta = 0; - ticks += (delta * HZ) / host_hz; - delta -= (ticks * host_hz) / HZ; + ticks += (delta * HZ) / MILLION; + delta -= (ticks * MILLION) / HZ; #else ticks = 1; #endif } else { - prev_tsc = time_stamp(); + prev_usecs = os_usecs(); first_tick = 1; } @@ -151,7 +153,7 @@ { int i, n; - n = (loops_per_jiffy * HZ * usecs) / 1000000; + n = (loops_per_jiffy * HZ * usecs) / MILLION; for(i=0;ithread.kernel_stack, - stack, 0, exec_tramp); + new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp); if(new_pid < 0){ printk(KERN_ERR "flush_thread : new thread failed, errno = %d\n", @@ -54,7 +54,9 @@ current->thread.request.u.exec.pid = new_pid; unprotect_stack((unsigned long) current_thread); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); + change_sig(SIGUSR1, 0); enable_timer(); free_page(stack); protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1); diff -Nru a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c --- a/arch/um/kernel/tt/process_kern.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/tt/process_kern.c 2004-09-21 20:52:52 -07:00 @@ -28,7 +28,7 @@ void *switch_to_tt(void *prev, void *next, void *last) { - struct task_struct *from, *to; + struct task_struct *from, *to, *prev_sched; unsigned long flags; int err, vtalrm, alrm, prof, cpu; char c; @@ -72,6 +72,18 @@ if(err != sizeof(c)) panic("read of switch_pipe failed, errno = %d", -err); + /* If the process that we have just scheduled away from has exited, + * then it needs to be killed here. The reason is that, even though + * it will kill itself when it next runs, that may be too late. Its + * stack will be freed, possibly before then, and if that happens, + * we have a use-after-free situation. So, it gets killed here + * in case it has not already killed itself. + */ + prev_sched = current->thread.prev_sched; + if((prev_sched->state == TASK_ZOMBIE) || + (prev_sched->state == TASK_DEAD)) + os_kill_process(prev_sched->thread.mode.tt.extern_pid, 1); + /* This works around a nasty race with 'jail'. If we are switching * between two threads of a threaded app and the incoming process * runs before the outgoing process reaches the read, and it makes @@ -116,6 +128,17 @@ os_close_file(current->thread.mode.tt.switch_pipe[1]); } +void suspend_new_thread(int fd) +{ + int err; + char c; + + os_stop_process(os_getpid()); + err = os_read_file(fd, &c, sizeof(c)); + if(err != sizeof(c)) + panic("read failed in suspend_new_thread, err = %d", -err); +} + void schedule_tail(task_t *prev); static void new_thread_handler(int sig) @@ -150,6 +173,12 @@ local_irq_enable(); if(!run_kernel_thread(fn, arg, ¤t->thread.exec_buf)) do_exit(0); + + /* XXX No set_user_mode here because a newly execed process will + * immediately segfault on its non-existent IP, coming straight back + * to the signal handler, which will call set_user_mode on its way + * out. This should probably change since it's confusing. + */ } static int new_thread_proc(void *stack) @@ -172,6 +201,7 @@ local_irq_disable(); init_new_thread_stack(stack, new_thread_handler); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); return(0); } @@ -215,6 +245,7 @@ init_new_thread_stack(stack, finish_fork_handler); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); return(0); } @@ -248,8 +279,7 @@ clone_flags &= CLONE_VM; p->thread.temp_stack = stack; - new_pid = start_fork_tramp((void *) p->thread.kernel_stack, stack, - clone_flags, tramp); + new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp); if(new_pid < 0){ printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", -new_pid); @@ -267,19 +297,30 @@ current->thread.request.op = OP_FORK; current->thread.request.u.fork.pid = new_pid; os_usr1_process(os_getpid()); - return(0); + + /* Enable the signal and then disable it to ensure that it is handled + * here, and nowhere else. + */ + change_sig(SIGUSR1, 1); + + change_sig(SIGUSR1, 0); + err = 0; + out: + return(err); } void reboot_tt(void) { current->thread.request.op = OP_REBOOT; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); } void halt_tt(void) { current->thread.request.op = OP_HALT; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); } void kill_off_processes_tt(void) @@ -306,6 +347,9 @@ current->thread.request.u.cb.proc = proc; current->thread.request.u.cb.arg = arg; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); + + change_sig(SIGUSR1, 0); } } @@ -412,7 +456,7 @@ protect_memory(start, end - start, 1, w, 1, 1); start = (unsigned long) UML_ROUND_DOWN(&__bss_start); - end = (unsigned long) UML_ROUND_UP(&_end); + end = (unsigned long) UML_ROUND_UP(brk_start); protect_memory(start, end - start, 1, w, 1, 1); mprotect_kernel_vm(w); @@ -501,9 +545,9 @@ void *sp; int pages; - pages = (1 << CONFIG_KERNEL_STACK_ORDER) - 2; - sp = (void *) init_task.thread.kernel_stack + pages * PAGE_SIZE - - sizeof(unsigned long); + pages = (1 << CONFIG_KERNEL_STACK_ORDER); + sp = (void *) ((unsigned long) init_task.thread_info) + + pages * PAGE_SIZE - sizeof(unsigned long); return(tracer(start_kernel_proc, sp)); } diff -Nru a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c --- a/arch/um/kernel/tt/tracer.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/tt/tracer.c 2004-09-21 20:52:51 -07:00 @@ -330,7 +330,8 @@ continue; } tracing = 0; - if(do_syscall(task, pid)) sig = SIGUSR2; + if(do_syscall(task, pid)) + sig = SIGUSR2; else clear_singlestep(task); break; case SIGPROF: diff -Nru a/arch/um/kernel/tt/trap_user.c b/arch/um/kernel/tt/trap_user.c --- a/arch/um/kernel/tt/trap_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/tt/trap_user.c 2004-09-21 20:52:52 -07:00 @@ -23,6 +23,13 @@ unprotect_kernel_mem(); + /* This is done because to allow SIGSEGV to be delivered inside a SEGV + * handler. This can happen in copy_user, and if SEGV is disabled, + * the process will die. + */ + if(sig == SIGSEGV) + change_sig(SIGSEGV, 1); + r = &TASK_REGS(get_current())->tt; save_regs = *r; is_user = user_context(SC_SP(sc)); @@ -30,7 +37,6 @@ if(sig != SIGUSR2) r->syscall = -1; - change_sig(SIGUSR1, 1); info = &sig_info[sig]; if(!info->is_irq) unblock_signals(); @@ -39,7 +45,6 @@ if(is_user){ interrupt_end(); block_signals(); - change_sig(SIGUSR1, 0); set_user_mode(NULL); } *r = save_regs; diff -Nru a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c --- a/arch/um/kernel/tt/uaccess_user.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/tt/uaccess_user.c 2004-09-21 20:52:51 -07:00 @@ -72,7 +72,7 @@ struct tt_regs save = TASK_REGS(get_current())->tt; int ret; unsigned long *faddrp = (unsigned long *)fault_addr; - jmp_buf jbuf; + sigjmp_buf jbuf; *fault_catcher = &jbuf; if(sigsetjmp(jbuf, 1) == 0) diff -Nru a/arch/um/kernel/uaccess_user.c b/arch/um/kernel/uaccess_user.c --- a/arch/um/kernel/uaccess_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/uaccess_user.c 2004-09-21 20:52:52 -07:00 @@ -18,7 +18,7 @@ { unsigned long *faddrp = (unsigned long *) fault_addr, ret; - jmp_buf jbuf; + sigjmp_buf jbuf; *fault_catcher = &jbuf; if(sigsetjmp(jbuf, 1) == 0){ (*op)(to, from, n); diff -Nru a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c --- a/arch/um/kernel/um_arch.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/um_arch.c 2004-09-21 20:52:52 -07:00 @@ -27,7 +27,6 @@ #include "user_util.h" #include "kern_util.h" #include "kern.h" -#include "mprot.h" #include "mem_user.h" #include "mem.h" #include "umid.h" @@ -306,7 +305,7 @@ int linux_main(int argc, char **argv) { - unsigned long avail; + unsigned long avail, diff; unsigned long virtmem_size, max_physmem; unsigned int i, add; @@ -324,6 +323,16 @@ brk_start = (unsigned long) sbrk(0); CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); + /* Increase physical memory size for exec-shield users + so they actually get what they asked for. This should + add zero for non-exec shield users */ + + diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); + if(diff > 1024 * 1024){ + printf("Adding %ld bytes to physical memory to account for " + "exec-shield gap\n", diff); + physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); + } uml_physmem = uml_start; @@ -379,9 +388,6 @@ virtmem_size); uml_postsetup(); - - init_task.thread.kernel_stack = (unsigned long) &init_thread_info + - 2 * PAGE_SIZE; task_protections((unsigned long) &init_thread_info); os_flush_stdout(); diff -Nru a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c --- a/arch/um/kernel/umid.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/kernel/umid.c 2004-09-21 20:52:52 -07:00 @@ -43,7 +43,7 @@ } if(strlen(name) > UMID_LEN - 1) - (*printer)("Unique machine name is being truncated to %s " + (*printer)("Unique machine name is being truncated to %d " "characters\n", UMID_LEN); strlcpy(umid, name, sizeof(umid)); @@ -199,17 +199,20 @@ static int __init set_uml_dir(char *name, int *add) { if((strlen(name) > 0) && (name[strlen(name) - 1] != '/')){ - uml_dir = malloc(strlen(name) + 1); + uml_dir = malloc(strlen(name) + 2); if(uml_dir == NULL){ printf("Failed to malloc uml_dir - error = %d\n", errno); uml_dir = name; + /* Return 0 here because do_initcalls doesn't look at + * the return value. + */ return(0); } sprintf(uml_dir, "%s/", name); } else uml_dir = name; - return 0; + return(0); } static int __init make_uml_dir(void) diff -Nru a/arch/um/kernel/user_util.c b/arch/um/kernel/user_util.c --- a/arch/um/kernel/user_util.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/kernel/user_util.c 2004-09-21 20:52:51 -07:00 @@ -7,7 +7,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -88,11 +89,11 @@ errno); } else if(WIFEXITED(status)) - printk("process exited with status %d\n", - WEXITSTATUS(status)); + printk("process %d exited with status %d\n", + pid, WEXITSTATUS(status)); else if(WIFSIGNALED(status)) - printk("process exited with signal %d\n", - WTERMSIG(status)); + printk("process %d exited with signal %d\n", + pid, WTERMSIG(status)); else if((WSTOPSIG(status) == SIGVTALRM) || (WSTOPSIG(status) == SIGALRM) || (WSTOPSIG(status) == SIGIO) || @@ -108,8 +109,8 @@ ptrace(cont_type, pid, 0, WSTOPSIG(status)); continue; } - else printk("process stopped with signal %d\n", - WSTOPSIG(status)); + else printk("process %d stopped with signal %d\n", + pid, WSTOPSIG(status)); panic("wait_for_stop failed to wait for %d to stop " "with %d\n", pid, sig); } @@ -117,35 +118,26 @@ } } -int __raw(int fd, int complain, int now) +int raw(int fd) { struct termios tt; int err; - int when; CATCH_EINTR(err = tcgetattr(fd, &tt)); - if (err < 0) { - if (complain) printk("tcgetattr failed, errno = %d\n", errno); return(-errno); } cfmakeraw(&tt); - if (now) - when = TCSANOW; - else - when = TCSADRAIN; - - CATCH_EINTR(err = tcsetattr(fd, when, &tt)); - + CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt)); if (err < 0) { - if (complain) printk("tcsetattr failed, errno = %d\n", errno); return(-errno); } - /*XXX: tcsetattr could have applied only some changes + + /* XXX tcsetattr could have applied only some changes * (and cfmakeraw() is a set of changes) */ return(0); } @@ -167,6 +159,21 @@ uname(&host); sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename, host.release, host.version, host.machine); +} + +int setjmp_wrapper(void (*proc)(void *, void *), ...) +{ + va_list args; + sigjmp_buf buf; + int n; + + n = sigsetjmp(buf, 1); + if(n == 0){ + va_start(args, proc); + (*proc)(&buf, &args); + } + va_end(args); + return(n); } /* diff -Nru a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile --- a/arch/um/os-Linux/Makefile 2004-09-21 20:52:52 -07:00 +++ b/arch/um/os-Linux/Makefile 2004-09-21 20:52:52 -07:00 @@ -3,9 +3,9 @@ # Licensed under the GPL # -obj-y = file.o process.o tty.o user_syms.o drivers/ +obj-y = file.o process.o time.o tty.o user_syms.o drivers/ -USER_OBJS := $(foreach file,file.o process.o tty.o,$(obj)/$(file)) +USER_OBJS := $(foreach file,file.o process.o time.o tty.o,$(obj)/$(file)) $(USER_OBJS) : %.o: %.c $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< diff -Nru a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c --- a/arch/um/os-Linux/file.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/os-Linux/file.c 2004-09-21 20:52:52 -07:00 @@ -187,7 +187,8 @@ if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) || (fcntl(master, F_SETOWN, os_getpid()) < 0)){ - printk("fcntl F_SETFL or F_SETOWN failed, errno = %d\n", errno); + printk("fcntl F_SETFL or F_SETOWN failed, errno = %d\n", + errno); return(-errno); } @@ -492,6 +493,16 @@ return(-errno); } + return(0); +} + +int os_clear_fd_async(int fd) +{ + int flags = fcntl(fd, F_GETFL); + + flags &= ~(O_ASYNC | O_NONBLOCK); + if(fcntl(fd, F_SETFL, flags) < 0) + return(-errno); return(0); } diff -Nru a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c --- a/arch/um/os-Linux/process.c 2004-09-21 20:52:51 -07:00 +++ b/arch/um/os-Linux/process.c 2004-09-21 20:52:51 -07:00 @@ -42,9 +42,9 @@ } os_close_file(fd); pc = ARBITRARY_ADDR; - if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d %*d " + if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d " "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %lu", &pc) != 1){ + "%*d %*d %*d %*d %*d %lu", &pc) != 1){ printk("os_process_pc - couldn't find pc in '%s'\n", buf); } return(pc); @@ -96,11 +96,7 @@ void os_usr1_process(int pid) { -#ifdef __NR_tkill - syscall(__NR_tkill, pid, SIGUSR1); -#else kill(pid, SIGUSR1); -#endif } int os_getpid(void) diff -Nru a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/um/os-Linux/time.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,21 @@ +#include +#include + +unsigned long long os_usecs(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return((unsigned long long) tv.tv_sec * 1000000 + tv.tv_usec); +} + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Nru a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c --- a/arch/um/os-Linux/user_syms.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/os-Linux/user_syms.c 2004-09-21 20:52:52 -07:00 @@ -14,11 +14,13 @@ extern size_t strlen(const char *); extern void *memcpy(void *, const void *, size_t); +extern void *memmove(void *, const void *, size_t); extern void *memset(void *, int, size_t); extern int printf(const char *, ...); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(memcpy); +EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(memset); EXPORT_SYMBOL(printf); diff -Nru a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile --- a/arch/um/sys-i386/Makefile 2004-09-21 20:52:51 -07:00 +++ b/arch/um/sys-i386/Makefile 2004-09-21 20:52:51 -07:00 @@ -1,5 +1,5 @@ obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \ - ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o + ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_MODULES) += module.o diff -Nru a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c --- a/arch/um/sys-i386/bugs.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/sys-i386/bugs.c 2004-09-21 20:52:52 -07:00 @@ -183,15 +183,16 @@ int arch_handle_signal(int sig, union uml_pt_regs *regs) { - unsigned long ip; + unsigned char tmp[2]; /* This is testing for a cmov (0x0f 0x4x) instruction causing a * SIGILL in init. */ if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) return(0); - ip = UPT_IP(regs); - if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) + if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) + panic("SIGILL in init, could not read instructions!\n"); + if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) return(0); if(host_has_cmov == 0) diff -Nru a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c --- a/arch/um/sys-i386/ldt.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/sys-i386/ldt.c 2004-09-21 20:52:52 -07:00 @@ -13,6 +13,8 @@ #ifdef CONFIG_MODE_TT extern int modify_ldt(int func, void *ptr, unsigned long bytecount); +/* XXX this needs copy_to_user and copy_from_user */ + int sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount) { if(verify_area(VERIFY_READ, ptr, bytecount)) return(-EFAULT); diff -Nru a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c --- a/arch/um/sys-i386/ptrace_user.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/sys-i386/ptrace_user.c 2004-09-21 20:52:52 -07:00 @@ -42,7 +42,8 @@ if(ptrace(PTRACE_POKEUSER, pid, &dummy->u_debugreg[i], regs[i]) < 0) printk("write_debugregs - ptrace failed on " - "register %d, errno = %d\n", errno); + "register %d, value = 0x%x, errno = %d\n", i, + regs[i], errno); } } diff -Nru a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c --- a/arch/um/sys-i386/syscalls.c 2004-09-21 20:52:52 -07:00 +++ b/arch/um/sys-i386/syscalls.c 2004-09-21 20:52:52 -07:00 @@ -3,6 +3,7 @@ * Licensed under the GPL */ +#include "linux/sched.h" #include "asm/mman.h" #include "asm/uaccess.h" #include "asm/unistd.h" @@ -54,6 +55,27 @@ return -EFAULT; /* sys_select() does the appropriate kernel locking */ return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* The i386 version skips reading from %esi, the fourth argument. So we must do + * this, too. + */ +int sys_clone(unsigned long clone_flags, unsigned long newsp, int *parent_tid, + int unused, int *child_tid) +{ + long ret; + + /* XXX: normal arch do here this pass, and also pass the regs to + * do_fork, instead of NULL. Currently the arch-independent code + * ignores these values, while the UML code (actually it's + * copy_thread) does the right thing. But this should change, + probably. */ + /*if (!newsp) + newsp = UPT_SP(current->thread.regs);*/ + current->thread.forking = 1; + ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); + current->thread.forking = 0; + return(ret); } /* diff -Nru a/arch/um/sys-i386/time.c b/arch/um/sys-i386/time.c --- a/arch/um/sys-i386/time.c 2004-09-21 20:52:52 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,24 +0,0 @@ -/* - * sys-i386/time.c - * Created 25.9.2002 Sapan Bhatia - * - */ - -unsigned long long time_stamp(void) -{ - unsigned long low, high; - - asm("rdtsc" : "=a" (low), "=d" (high)); - return((((unsigned long long) high) << 32) + low); -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig --- a/arch/x86_64/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/Kconfig 2004-09-21 20:52:52 -07:00 @@ -78,6 +78,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" @@ -315,8 +319,13 @@ are doing. config X86_MCE - bool + bool "Machine check support" if EMBEDDED default y + help + Include a machine check error handler to report hardware errors. + This version will require the mcelog utility to decode some + machine check error logs. See + ftp://ftp.x86-64.org/pub/linux/tools/mcelog endmenu diff -Nru a/arch/x86_64/boot/video.S b/arch/x86_64/boot/video.S --- a/arch/x86_64/boot/video.S 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/boot/video.S 2004-09-21 20:52:52 -07:00 @@ -66,6 +66,7 @@ #define VIDEO_80x30 0x0f05 #define VIDEO_80x34 0x0f06 #define VIDEO_80x60 0x0f07 +#define VIDEO_GFX_HACK 0x0f08 #define VIDEO_LAST_SPECIAL 0x0f09 /* Video modes given by resolution */ @@ -97,7 +98,6 @@ #define PARAM_LFB_PAGES 0x32 #define PARAM_VESA_ATTRIB 0x34 - /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ #ifdef CONFIG_VIDEO_RETAIN #define DO_STORE call store_screen @@ -133,6 +133,7 @@ #ifdef CONFIG_VIDEO_RETAIN call restore_screen # Restore screen contents #endif /* CONFIG_VIDEO_RETAIN */ + call store_edid #endif /* CONFIG_VIDEO_SELECT */ call mode_params # Store mode parameters popw %ds # Restore original DS @@ -231,6 +232,41 @@ xorl %eax, %eax movw 18(%di), %ax movl %eax, %fs:(PARAM_LFB_SIZE) + +# switching the DAC to 8-bit is for <= 8 bpp only + movw %fs:(PARAM_LFB_DEPTH), %ax + cmpw $8, %ax + jg dac_done + +# get DAC switching capability + xorl %eax, %eax + movb 10(%di), %al + testb $1, %al + jz dac_set + +# attempt to switch DAC to 8-bit + movw $0x4f08, %ax + movw $0x0800, %bx + int $0x10 + cmpw $0x004f, %ax + jne dac_set + movb %bh, dac_size # store actual DAC size + +dac_set: +# set color size to DAC size + movb dac_size, %al + movb %al, %fs:(PARAM_LFB_COLORS+0) + movb %al, %fs:(PARAM_LFB_COLORS+2) + movb %al, %fs:(PARAM_LFB_COLORS+4) + movb %al, %fs:(PARAM_LFB_COLORS+6) + +# set color offsets to 0 + movb $0, %fs:(PARAM_LFB_COLORS+1) + movb $0, %fs:(PARAM_LFB_COLORS+3) + movb $0, %fs:(PARAM_LFB_COLORS+5) + movb $0, %fs:(PARAM_LFB_COLORS+7) + +dac_done: # get protected mode interface informations movw $0x4f0a, %ax xorw %bx, %bx @@ -440,7 +476,7 @@ # Setting of user mode (AX=mode ID) => CF=success mode_set: - movw %ax, %fs:(0x01fa) + movw %ax, %fs:(0x01fa) # Store mode for use in acpi_wakeup.S movw %ax, %bx cmpb $0xff, %ah jz setalias @@ -744,7 +780,15 @@ movw $0x503c, force_size jmp setvde +# Special hack for ThinkPad graphics set_gfx: +#ifdef CONFIG_VIDEO_GFX_HACK + movw $VIDEO_GFX_BIOS_AX, %ax + movw $VIDEO_GFX_BIOS_BX, %bx + int $0x10 + movw $VIDEO_GFX_DUMMY_RESOLUTION, force_size + stc +#endif ret #ifdef CONFIG_VIDEO_RETAIN @@ -969,6 +1013,10 @@ .word 0x5022 # 80x34 .word VIDEO_80x60 .word 0x503c # 80x60 +#ifdef CONFIG_VIDEO_GFX_HACK + .word VIDEO_GFX_HACK + .word VIDEO_GFX_DUMMY_RESOLUTION +#endif vga_modes_end: # Detect VESA modes. @@ -1875,6 +1923,39 @@ popw %ax ret +store_edid: + pushw %es # just save all registers + pushw %ax + pushw %bx + pushw %cx + pushw %dx + pushw %di + + pushw %fs + popw %es + + movl $0x13131313, %eax # memset block with 0x13 + movw $32, %cx + movw $0x440, %di + cld + rep + stosl + + movw $0x4f15, %ax # do VBE/DDC + movw $0x01, %bx + movw $0x00, %cx + movw $0x01, %dx + movw $0x440, %di + int $0x10 + + popw %di # restore all registers + popw %dx + popw %cx + popw %bx + popw %ax + popw %es + ret + # VIDEO_SELECT-only variables mt_end: .word 0 # End of video mode table if built edit_buf: .space 6 # Line editor buffer @@ -1883,6 +1964,7 @@ do_restore: .byte 0 # Screen contents altered during mode change svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes graphic_mode: .byte 0 # Graphic mode with a linear frame buffer +dac_size: .byte 6 # DAC bit depth # Status messages keymsg: .ascii "Press to see video modes available, " diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig --- a/arch/x86_64/defconfig 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/defconfig 2004-09-21 20:52:52 -07:00 @@ -1,5 +1,7 @@ # # Automatically generated make config: don't edit +# Linux kernel version: 2.6.9-rc1-bk19 +# Sun Sep 12 23:13:23 2004 # CONFIG_X86_64=y CONFIG_64BIT=y @@ -21,6 +23,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -28,13 +31,13 @@ CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=18 -CONFIG_HOTPLUG=y +# CONFIG_HOTPLUG is not set CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y -CONFIG_KALLSYMS_EXTRA_PASS=y +# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -42,6 +45,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -104,8 +109,8 @@ CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_ASUS is not set -# CONFIG_ACPI_TOSHIBA is not set -# CONFIG_ACPI_DEBUG is not set +CONFIG_ACPI_TOSHIBA=y +CONFIG_ACPI_DEBUG=y CONFIG_ACPI_BUS=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y @@ -115,23 +120,7 @@ # # CPU Frequency scaling # -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_PROC_INTF=y -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -# CONFIG_CPU_FREQ_24_API is not set -CONFIG_CPU_FREQ_TABLE=y - -# -# CPUFreq processor drivers -# -CONFIG_X86_POWERNOW_K8=y -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -CONFIG_X86_ACPI_CPUFREQ=y -CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y +# CONFIG_CPU_FREQ is not set # # Bus options (PCI etc.) @@ -145,21 +134,6 @@ # CONFIG_PCI_NAMES is not set # -# PCMCIA/CardBus support -# -# CONFIG_PCMCIA is not set - -# -# PCI Hotplug Support -# -CONFIG_HOTPLUG_PCI=y -# CONFIG_HOTPLUG_PCI_FAKE is not set -# CONFIG_HOTPLUG_PCI_ACPI is not set -# CONFIG_HOTPLUG_PCI_CPCI is not set -# CONFIG_HOTPLUG_PCI_PCIE is not set -# CONFIG_HOTPLUG_PCI_SHPC is not set - -# # Executable file formats / Emulations # CONFIG_BINFMT_ELF=y @@ -179,7 +153,6 @@ # CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y -# CONFIG_FW_LOADER is not set # CONFIG_DEBUG_DRIVER is not set # @@ -208,6 +181,7 @@ # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_UB is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y @@ -270,7 +244,7 @@ # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set -CONFIG_BLK_DEV_VIA82CXXX=y +# CONFIG_BLK_DEV_VIA82CXXX is not set # CONFIG_IDE_ARM is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set @@ -316,13 +290,13 @@ # CONFIG_SCSI_AIC7XXX_OLD is not set CONFIG_SCSI_AIC79XX=y CONFIG_AIC79XX_CMDS_PER_DEVICE=32 -CONFIG_AIC79XX_RESET_DELAY_MS=2000 -# CONFIG_AIC79XX_BUILD_FIRMWARE is not set +CONFIG_AIC79XX_RESET_DELAY_MS=4000 # CONFIG_AIC79XX_ENABLE_RD_STRM is not set # CONFIG_AIC79XX_DEBUG_ENABLE is not set CONFIG_AIC79XX_DEBUG_MASK=0 -CONFIG_AIC79XX_REG_PRETTY_PRINT=y -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set CONFIG_SCSI_ATA_PIIX=y @@ -367,7 +341,6 @@ # CONFIG_FUSION=y CONFIG_FUSION_MAX_SGE=40 -# CONFIG_FUSION_ISENSE is not set # CONFIG_FUSION_CTL is not set # @@ -405,11 +378,13 @@ # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set CONFIG_IPV6=y # CONFIG_IPV6_PRIVACY is not set # CONFIG_INET6_AH is not set # CONFIG_INET6_ESP is not set # CONFIG_INET6_IPCOMP is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_IPV6_TUNNEL is not set # CONFIG_NETFILTER is not set @@ -475,7 +450,8 @@ # CONFIG_HP100 is not set CONFIG_NET_PCI=y # CONFIG_PCNET32 is not set -# CONFIG_AMD8111_ETH is not set +CONFIG_AMD8111_ETH=y +# CONFIG_AMD8111E_NAPI is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_B44 is not set CONFIG_FORCEDETH=y @@ -485,8 +461,12 @@ # CONFIG_FEALNX is not set # CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set +CONFIG_8139CP=m +CONFIG_8139TOO=m +# CONFIG_8139TOO_PIO is not set +# CONFIG_8139TOO_TUNE_TWISTER is not set +# CONFIG_8139TOO_8129 is not set +# CONFIG_8139_OLD_RX_RESET is not set # CONFIG_SIS900 is not set # CONFIG_EPIC100 is not set # CONFIG_SUNDANCE is not set @@ -615,7 +595,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -683,7 +662,6 @@ # Console display driver support # CONFIG_VGA_CONSOLE=y -# CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y # @@ -734,6 +712,8 @@ CONFIG_USB_DEVICEFS=y # CONFIG_USB_BANDWIDTH is not set # CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_OTG is not set # # USB Host Controller Drivers @@ -751,8 +731,18 @@ # CONFIG_USB_BLUETOOTH_TTY is not set # CONFIG_USB_MIDI is not set # CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_STORAGE is not set +CONFIG_USB_PRINTER=y +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_RW_DETECT is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_DPCM is not set +# CONFIG_USB_STORAGE_HP8200e is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set # # USB Human Interface Devices (HID) @@ -896,7 +886,6 @@ # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set # CONFIG_CRAMFS is not set # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set @@ -920,6 +909,7 @@ CONFIG_EXPORTFS=y CONFIG_SUNRPC=y # CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set @@ -947,14 +937,15 @@ # Kernel hacking # CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_SLAB is not set CONFIG_MAGIC_SYSRQ=y +# CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_SPINLOCK is not set -CONFIG_INIT_DEBUG=y +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_INFO is not set # CONFIG_FRAME_POINTER is not set -CONFIG_IOMMU_DEBUG=y -# CONFIG_IOMMU_LEAK is not set +# CONFIG_INIT_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_IOMMU_DEBUG is not set # # Security options diff -Nru a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c --- a/arch/x86_64/ia32/ia32_signal.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/ia32/ia32_signal.c 2004-09-21 20:52:52 -07:00 @@ -74,8 +74,6 @@ err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); err |= __put_user(from->si_status, &to->si_status); - err |= put_compat_rusage(&from->si_rusage, - &to->si_rusage); default: case __SI_KILL >> 16: err |= __put_user(from->si_uid, &to->si_uid); diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c --- a/arch/x86_64/ia32/sys_ia32.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/ia32/sys_ia32.c 2004-09-21 20:52:51 -07:00 @@ -1152,19 +1152,26 @@ } asmlinkage long sys32_waitid(int which, compat_pid_t pid, - siginfo_t32 __user *uinfo, int options) + siginfo_t32 __user *uinfo, int options, + struct compat_rusage __user *uru) { siginfo_t info; + struct rusage ru; long ret; mm_segment_t old_fs = get_fs(); info.si_signo = 0; set_fs (KERNEL_DS); - ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options); + ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options, + uru ? &ru : NULL); set_fs (old_fs); if (ret < 0 || info.si_signo == 0) return ret; + + if (uru && (ret = put_compat_rusage(&ru, uru))) + return ret; + BUG_ON(info.si_code & __SI_MASK); info.si_code |= __SI_CHLD; return ia32_copy_siginfo_to_user(uinfo, &info); diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c --- a/arch/x86_64/kernel/apic.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/apic.c 2004-09-21 20:52:51 -07:00 @@ -33,6 +33,8 @@ #include #include +int apic_verbosity; + int disable_apic_timer __initdata; /* Using APIC to generate smp_local_timer_interrupt? */ @@ -123,7 +125,7 @@ * PIC mode, enable APIC mode in the IMCR, i.e. * connect BSP's local APIC to INT and NMI lines. */ - printk(KERN_INFO "leaving PIC mode, enabling APIC mode.\n"); + apic_printk(APIC_VERBOSE, "leaving PIC mode, enabling APIC mode.\n"); outb(0x70, 0x22); outb(0x01, 0x23); } @@ -138,7 +140,7 @@ * interrupts, including IPIs, won't work beyond * this point! The only exception are INIT IPIs. */ - printk(KERN_INFO "disabling APIC mode, entering PIC mode.\n"); + apic_printk(APIC_QUIET, "disabling APIC mode, entering PIC mode.\n"); outb(0x70, 0x22); outb(0x00, 0x23); } @@ -172,10 +174,10 @@ * The version register is read-only in a real APIC. */ reg0 = apic_read(APIC_LVR); - Dprintk("Getting VERSION: %x\n", reg0); + apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg0); apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); reg1 = apic_read(APIC_LVR); - Dprintk("Getting VERSION: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg1); /* * The two version reads above should print the same @@ -199,10 +201,10 @@ * The ID register is read/write in a real APIC. */ reg0 = apic_read(APIC_ID); - Dprintk("Getting ID: %x\n", reg0); + apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); reg1 = apic_read(APIC_ID); - Dprintk("Getting ID: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); apic_write(APIC_ID, reg0); if (reg1 != (reg0 ^ APIC_ID_MASK)) return 0; @@ -213,9 +215,9 @@ * compatibility mode, but most boxes are anymore. */ reg0 = apic_read(APIC_LVT0); - Dprintk("Getting LVT0: %x\n", reg0); + apic_printk(APIC_DEBUG,"Getting LVT0: %x\n", reg0); reg1 = apic_read(APIC_LVT1); - Dprintk("Getting LVT1: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting LVT1: %x\n", reg1); return 1; } @@ -227,7 +229,7 @@ */ apic_wait_icr_idle(); - Dprintk("Synchronizing Arb IDs.\n"); + apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT); } @@ -388,10 +390,10 @@ value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; if (!smp_processor_id() && (pic_mode || !value)) { value = APIC_DM_EXTINT; - Dprintk(KERN_INFO "enabled ExtINT on CPU#%d\n", smp_processor_id()); + apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); } else { value = APIC_DM_EXTINT | APIC_LVT_MASKED; - Dprintk(KERN_INFO "masked ExtINT on CPU#%d\n", smp_processor_id()); + apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); } apic_write_around(APIC_LVT0, value); @@ -407,12 +409,11 @@ apic_write_around(APIC_LVT1, value); if (APIC_INTEGRATED(ver) && !esr_disable) { /* !82489DX */ + unsigned oldvalue; maxlvt = get_maxlvt(); if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ apic_write(APIC_ESR, 0); - value = apic_read(APIC_ESR); - Dprintk("ESR value before enabling vector: %08x\n", value); - + oldvalue = apic_read(APIC_ESR); value = ERROR_APIC_VECTOR; // enables sending errors apic_write_around(APIC_LVTERR, value); /* @@ -421,7 +422,10 @@ if (maxlvt > 3) apic_write(APIC_ESR, 0); value = apic_read(APIC_ESR); - Dprintk("ESR value after enabling vector: %08x\n", value); + if (value != oldvalue) + apic_printk(APIC_VERBOSE, + "ESR value after enabling vector: %08x, after %08x\n", + oldvalue, value); } else { if (esr_disable) /* @@ -430,9 +434,9 @@ * ESR disabled - we can't do anything useful with the * errors anyway - mbligh */ - printk("Leaving ESR disabled.\n"); + apic_printk(APIC_DEBUG, "Leaving ESR disabled.\n"); else - printk("No ESR for 82489DX.\n"); + apic_printk(APIC_DEBUG, "No ESR for 82489DX.\n"); } nmi_watchdog_default(); @@ -564,6 +568,21 @@ #endif /* CONFIG_PM */ +static int __init apic_set_verbosity(char *str) +{ + if (strcmp("debug", str) == 0) + apic_verbosity = APIC_DEBUG; + else if (strcmp("verbose", str) == 0) + apic_verbosity = APIC_VERBOSE; + else + printk(KERN_WARNING "APIC Verbosity level %s not recognised" + " use apic=verbose or apic=debug", str); + + return 0; +} + +__setup("apic=", apic_set_verbosity); + /* * Detect and enable local APICs on non-SMP boards. * Original code written by Keir Fraser. @@ -599,7 +618,7 @@ apic_phys = mp_lapic_addr; set_fixmap_nocache(FIX_APIC_BASE, apic_phys); - Dprintk("mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); + apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); /* * Fetch the APIC ID of the BSP in case we have a @@ -621,7 +640,7 @@ ioapic_phys = __pa(ioapic_phys); } set_fixmap_nocache(idx, ioapic_phys); - Dprintk("mapped IOAPIC to %016lx (%016lx)\n", + apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n", __fix_to_virt(idx), ioapic_phys); idx++; } @@ -961,7 +980,7 @@ 6: Received illegal vector 7: Illegal register address */ - printk (KERN_INFO "APIC error on CPU%d: %02x(%02x)\n", + printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", smp_processor_id(), v , v1); irq_exit(); } diff -Nru a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c --- a/arch/x86_64/kernel/i8259.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/i8259.c 2004-09-21 20:52:51 -07:00 @@ -329,7 +329,7 @@ * lets ACK and report it. [once per IRQ] */ if (!(spurious_irq_mask & irqmask)) { - printk("spurious 8259A interrupt: IRQ%d.\n", irq); + printk(KERN_DEBUG "spurious 8259A interrupt: IRQ%d.\n", irq); spurious_irq_mask |= irqmask; } atomic_inc(&irq_err_count); diff -Nru a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c --- a/arch/x86_64/kernel/init_task.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/init_task.c 2004-09-21 20:52:52 -07:00 @@ -44,8 +44,7 @@ * section. Since TSS's are completely CPU-local, we want them * on exact cacheline boundaries, to eliminate cacheline ping-pong. */ -struct tss_struct init_tss[NR_CPUS] __cacheline_aligned; - +DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c --- a/arch/x86_64/kernel/io_apic.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/io_apic.c 2004-09-21 20:52:52 -07:00 @@ -30,12 +30,15 @@ #include #include #include +#include #include #include #include #include +#define __apicdebuginit __init + int sis_apic_bug; /* not actually supported, dummy for compile */ #undef APIC_LOCKUP_DEBUG @@ -292,13 +295,13 @@ pirq_entries[i] = -1; pirqs_enabled = 1; - printk(KERN_INFO "PIRQ redirection, working around broken MP-BIOS.\n"); + apic_printk(APIC_VERBOSE, "PIRQ redirection, working around broken MP-BIOS.\n"); max = MAX_PIRQS; if (ints[0] < MAX_PIRQS) max = ints[0]; for (i = 0; i < max; i++) { - printk(KERN_DEBUG "... PIRQ%d -> IRQ %d\n", i, ints[i+1]); + apic_printk(APIC_VERBOSE, "... PIRQ%d -> IRQ %d\n", i, ints[i+1]); /* * PIRQs are mapped upside down, usually. */ @@ -357,10 +360,10 @@ { int apic, i, best_guess = -1; - Dprintk("querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", + apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", bus, slot, pin); if (mp_bus_id_to_pci_bus[bus] == -1) { - printk(KERN_WARNING "PCI BIOS passed nonexistent PCI bus %d!\n", bus); + apic_printk(APIC_VERBOSE, "PCI BIOS passed nonexistent PCI bus %d!\n", bus); return -1; } for (i = 0; i < mp_irq_entries; i++) { @@ -402,7 +405,7 @@ unsigned int port = 0x4d0 + (irq >> 3); return (inb(port) >> (irq & 7)) & 1; } - printk(KERN_INFO "Broken MPtable reports ISA irq %d\n", irq); + apic_printk(APIC_VERBOSE, "Broken MPtable reports ISA irq %d\n", irq); return 0; } @@ -625,10 +628,10 @@ if ((pin >= 16) && (pin <= 23)) { if (pirq_entries[pin-16] != -1) { if (!pirq_entries[pin-16]) { - printk(KERN_DEBUG "disabling PIRQ%d\n", pin-16); + apic_printk(APIC_VERBOSE, "disabling PIRQ%d\n", pin-16); } else { irq = pirq_entries[pin-16]; - printk(KERN_DEBUG "using PIRQ%d -> IRQ %d\n", + apic_printk(APIC_VERBOSE, "using PIRQ%d -> IRQ %d\n", pin-16, irq); } } @@ -719,7 +722,7 @@ int apic, pin, idx, irq, first_notcon = 1, vector; unsigned long flags; - printk(KERN_DEBUG "init IO_APIC IRQs\n"); + apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); for (apic = 0; apic < nr_ioapics; apic++) { for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { @@ -737,10 +740,10 @@ idx = find_irq_entry(apic,pin,mp_INT); if (idx == -1) { if (first_notcon) { - printk(KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mpc_apicid, pin); + apic_printk(APIC_VERBOSE, KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mpc_apicid, pin); first_notcon = 0; } else - printk(", %d-%d", mp_ioapics[apic].mpc_apicid, pin); + apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); continue; } @@ -775,7 +778,7 @@ } if (!first_notcon) - printk(" not connected.\n"); + apic_printk(APIC_VERBOSE," not connected.\n"); } /* @@ -825,13 +828,9 @@ void __init UNEXPECTED_IO_APIC(void) { -#if 0 - printk(KERN_WARNING " WARNING: unexpected IO-APIC, please mail\n"); - printk(KERN_WARNING " to linux-smp@vger.kernel.org\n"); -#endif } -void __init print_IO_APIC(void) +void __apicdebuginit print_IO_APIC(void) { int apic, i; union IO_APIC_reg_00 reg_00; @@ -839,7 +838,10 @@ union IO_APIC_reg_02 reg_02; unsigned long flags; - printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); + if (apic_verbosity == APIC_QUIET) + return; + + printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); for (i = 0; i < nr_ioapics; i++) printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]); @@ -955,11 +957,14 @@ return; } -static void print_APIC_bitfield (int base) +static __apicdebuginit void print_APIC_bitfield (int base) { unsigned int v; int i, j; + if (apic_verbosity == APIC_QUIET) + return; + printk(KERN_DEBUG "0123456789abcdef0123456789abcdef\n" KERN_DEBUG); for (i = 0; i < 8; i++) { v = apic_read(base + i*0x10); @@ -973,10 +978,13 @@ } } -void /*__init*/ print_local_APIC(void * dummy) +void __apicdebuginit print_local_APIC(void * dummy) { unsigned int v, ver, maxlvt; + if (apic_verbosity == APIC_QUIET) + return; + printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", smp_processor_id(), hard_smp_processor_id()); v = apic_read(APIC_ID); @@ -1058,12 +1066,15 @@ on_each_cpu(print_local_APIC, NULL, 1, 1); } -void /*__init*/ print_PIC(void) +void __apicdebuginit print_PIC(void) { extern spinlock_t i8259A_lock; unsigned int v; unsigned long flags; + if (apic_verbosity == APIC_QUIET) + return; + printk(KERN_DEBUG "\nprinting PIC contents\n"); spin_lock_irqsave(&i8259A_lock, flags); @@ -1160,9 +1171,9 @@ old_id = mp_ioapics[apic].mpc_apicid; if (mp_ioapics[apic].mpc_apicid >= 0xf) { - printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", + apic_printk(APIC_QUIET,KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", apic, mp_ioapics[apic].mpc_apicid); - printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", + apic_printk(APIC_QUIET,KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", reg_00.bits.ID); mp_ioapics[apic].mpc_apicid = reg_00.bits.ID; } @@ -1205,7 +1216,7 @@ * Read the right value from the MPC table and * write it into the ID register. */ - printk(KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", + apic_printk(APIC_VERBOSE,KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", mp_ioapics[apic].mpc_apicid); reg_00.bits.ID = mp_ioapics[apic].mpc_apicid; @@ -1220,9 +1231,9 @@ reg_00.raw = io_apic_read(apic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) - panic("could not set ID!\n"); + printk("could not set ID!\n"); else - printk(" ok.\n"); + apic_printk(APIC_VERBOSE," ok.\n"); } } @@ -1671,7 +1682,7 @@ pin1 = find_isa_irq_pin(0, mp_INT); pin2 = find_isa_irq_pin(0, mp_ExtINT); - printk(KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); + apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); if (pin1 != -1) { /* @@ -1689,12 +1700,12 @@ return; } clear_IO_APIC_pin(0, pin1); - printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); + apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); } - printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); + apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); if (pin2 != -1) { - printk("\n..... (found pin %d) ...", pin2); + apic_printk(APIC_VERBOSE,"\n..... (found pin %d) ...", pin2); /* * legacy devices should be connected to IO APIC #0 */ @@ -1720,7 +1731,7 @@ nmi_watchdog = 0; } - printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); + apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); disable_8259A_irq(0); irq_desc[0].handler = &lapic_irq_type; @@ -1728,13 +1739,13 @@ enable_8259A_irq(0); if (timer_irq_works()) { - printk(" works.\n"); + apic_printk(APIC_QUIET, " works.\n"); return; } apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); - printk(" failed.\n"); + apic_printk(APIC_VERBOSE," failed.\n"); - printk(KERN_INFO "...trying to set up timer as ExtINT IRQ..."); + apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); init_8259A(0); make_8259A_irq(0); @@ -1743,10 +1754,10 @@ unlock_ExtINT_logic(); if (timer_irq_works()) { - printk(" works.\n"); + apic_printk(APIC_VERBOSE," works.\n"); return; } - printk(" failed :(.\n"); + apic_printk(APIC_VERBOSE," failed :(.\n"); panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); } @@ -1768,7 +1779,7 @@ else io_apic_irqs = ~PIC_IRQS; - printk("ENABLING IO-APIC IRQs\n"); + apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); /* * Set up the IO-APIC IRQ routing table. @@ -1783,6 +1794,98 @@ print_IO_APIC(); } +struct sysfs_ioapic_data { + struct sys_device dev; + struct IO_APIC_route_entry entry[0]; +}; +static struct sysfs_ioapic_data * mp_ioapic_data[MAX_IO_APICS]; + +static int ioapic_suspend(struct sys_device *dev, u32 state) +{ + struct IO_APIC_route_entry *entry; + struct sysfs_ioapic_data *data; + unsigned long flags; + int i; + + data = container_of(dev, struct sysfs_ioapic_data, dev); + entry = data->entry; + spin_lock_irqsave(&ioapic_lock, flags); + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { + *(((int *)entry) + 1) = io_apic_read(dev->id, 0x11 + 2 * i); + *(((int *)entry) + 0) = io_apic_read(dev->id, 0x10 + 2 * i); + } + spin_unlock_irqrestore(&ioapic_lock, flags); + + return 0; +} + +static int ioapic_resume(struct sys_device *dev) +{ + struct IO_APIC_route_entry *entry; + struct sysfs_ioapic_data *data; + unsigned long flags; + union IO_APIC_reg_00 reg_00; + int i; + + data = container_of(dev, struct sysfs_ioapic_data, dev); + entry = data->entry; + + spin_lock_irqsave(&ioapic_lock, flags); + reg_00.raw = io_apic_read(dev->id, 0); + if (reg_00.bits.ID != mp_ioapics[dev->id].mpc_apicid) { + reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; + io_apic_write(dev->id, 0, reg_00.raw); + } + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { + io_apic_write(dev->id, 0x11+2*i, *(((int *)entry)+1)); + io_apic_write(dev->id, 0x10+2*i, *(((int *)entry)+0)); + } + spin_unlock_irqrestore(&ioapic_lock, flags); + + return 0; +} + +static struct sysdev_class ioapic_sysdev_class = { + set_kset_name("ioapic"), + .suspend = ioapic_suspend, + .resume = ioapic_resume, +}; + +static int __init ioapic_init_sysfs(void) +{ + struct sys_device * dev; + int i, size, error = 0; + + error = sysdev_class_register(&ioapic_sysdev_class); + if (error) + return error; + + for (i = 0; i < nr_ioapics; i++ ) { + size = sizeof(struct sys_device) + nr_ioapic_registers[i] + * sizeof(struct IO_APIC_route_entry); + mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); + if (!mp_ioapic_data[i]) { + printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); + continue; + } + memset(mp_ioapic_data[i], 0, size); + dev = &mp_ioapic_data[i]->dev; + dev->id = i; + dev->cls = &ioapic_sysdev_class; + error = sysdev_register(dev); + if (error) { + kfree(mp_ioapic_data[i]); + mp_ioapic_data[i] = NULL; + printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); + continue; + } + } + + return 0; +} + +device_initcall(ioapic_init_sysfs); + /* -------------------------------------------------------------------------- ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ @@ -1815,7 +1918,7 @@ spin_unlock_irqrestore(&ioapic_lock, flags); if (apic_id >= IO_APIC_MAX_ID) { - printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " + apic_printk(APIC_QUIET, KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " "%d\n", ioapic, apic_id, reg_00.bits.ID); apic_id = reg_00.bits.ID; } @@ -1834,7 +1937,7 @@ if (i == IO_APIC_MAX_ID) panic("Max apic_id exceeded!\n"); - printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " + apic_printk(APIC_VERBOSE, KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " "trying %d\n", ioapic, apic_id, i); apic_id = i; @@ -1855,7 +1958,7 @@ panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic); } - printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); + apic_printk(APIC_VERBOSE,KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); return apic_id; } @@ -1893,7 +1996,7 @@ unsigned long flags; if (!IO_APIC_IRQ(irq)) { - printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", + apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", ioapic); return -EINVAL; } @@ -1921,7 +2024,7 @@ entry.vector = assign_irq_vector(irq); - printk(KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " + apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " "IRQ %d Mode:%i Active:%i)\n", ioapic, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, edge_level, active_high_low); diff -Nru a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c --- a/arch/x86_64/kernel/ioport.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/ioport.c 2004-09-21 20:52:51 -07:00 @@ -28,12 +28,12 @@ clear_bit(i, bitmap); } - /* * this changes the io permissions bitmap in the current task. */ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) { + unsigned int i, max_long, bytes, bytes_updated; struct thread_struct * t = ¤t->thread; struct tss_struct * tss; unsigned long *bitmap; @@ -59,16 +59,34 @@ /* * do it in the per-thread copy and in the TSS ... + * + * Disable preemption via get_cpu() - we must not switch away + * because the ->io_bitmap_max value must match the bitmap + * contents: */ + tss = &per_cpu(init_tss, get_cpu()); + set_bitmap(t->io_bitmap_ptr, from, num, !turn_on); - tss = init_tss + get_cpu(); - if (tss->io_bitmap_base == IO_BITMAP_OFFSET) { /* already active? */ - set_bitmap(tss->io_bitmap, from, num, !turn_on); - } else { - memcpy(tss->io_bitmap, t->io_bitmap_ptr, IO_BITMAP_BYTES); - tss->io_bitmap_base = IO_BITMAP_OFFSET; /* Activate it in the TSS */ - } + + /* + * Search for a (possibly new) maximum. This is simple and stupid, + * to keep it obviously correct: + */ + max_long = 0; + for (i = 0; i < IO_BITMAP_LONGS; i++) + if (t->io_bitmap_ptr[i] != ~0UL) + max_long = i; + + bytes = (max_long + 1) * sizeof(long); + bytes_updated = max(bytes, t->io_bitmap_max); + + t->io_bitmap_max = bytes; + + /* Update the TSS: */ + memcpy(tss->io_bitmap, t->io_bitmap_ptr, bytes_updated); + put_cpu(); + return 0; } diff -Nru a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c --- a/arch/x86_64/kernel/mce.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/mce.c 2004-09-21 20:52:51 -07:00 @@ -470,7 +470,7 @@ /* Why are there no generic functions for this? */ #define ACCESSOR(name, var, start) \ static ssize_t show_ ## name(struct sys_device *s, char *buf) { \ - return sprintf(buf, "%lu\n", (unsigned long)var); \ + return sprintf(buf, "%lx\n", (unsigned long)var); \ } \ static ssize_t set_ ## name(struct sys_device *s,const char *buf,size_t siz) { \ char *end; \ diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c --- a/arch/x86_64/kernel/process.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/process.c 2004-09-21 20:52:52 -07:00 @@ -130,11 +130,20 @@ { /* endless idle loop with no priority at all */ while (1) { - void (*idle)(void) = pm_idle; - if (!idle) - idle = default_idle; - while (!need_resched()) + while (!need_resched()) { + void (*idle)(void); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; + if (!idle) + idle = default_idle; idle(); + rcu_read_unlock(); + } schedule(); } } @@ -250,11 +259,17 @@ void exit_thread(void) { struct task_struct *me = current; + struct thread_struct *t = &me->thread; if (me->thread.io_bitmap_ptr) { - struct tss_struct *tss = init_tss + get_cpu(); - kfree(me->thread.io_bitmap_ptr); - me->thread.io_bitmap_ptr = NULL; - tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + struct tss_struct *tss = &per_cpu(init_tss, get_cpu()); + + kfree(t->io_bitmap_ptr); + t->io_bitmap_ptr = NULL; + /* + * Careful, clear this in the TSS too: + */ + memset(tss->io_bitmap, 0xff, t->io_bitmap_max); + t->io_bitmap_max = 0; put_cpu(); } } @@ -362,8 +377,10 @@ if (unlikely(me->thread.io_bitmap_ptr != NULL)) { p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); - if (!p->thread.io_bitmap_ptr) + if (!p->thread.io_bitmap_ptr) { + p->thread.io_bitmap_max = 0; return -ENOMEM; + } memcpy(p->thread.io_bitmap_ptr, me->thread.io_bitmap_ptr, IO_BITMAP_BYTES); } @@ -382,8 +399,10 @@ } err = 0; out: - if (err && p->thread.io_bitmap_ptr) + if (err && p->thread.io_bitmap_ptr) { kfree(p->thread.io_bitmap_ptr); + p->thread.io_bitmap_max = 0; + } return err; } @@ -404,7 +423,7 @@ struct thread_struct *prev = &prev_p->thread, *next = &next_p->thread; int cpu = smp_processor_id(); - struct tss_struct *tss = init_tss + cpu; + struct tss_struct *tss = &per_cpu(init_tss, cpu); unlazy_fpu(prev_p); @@ -490,22 +509,18 @@ * Handle the IO bitmap */ if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) { - if (next->io_bitmap_ptr) { + if (next->io_bitmap_ptr) /* - * 2 cachelines copy ... not good, but not that - * bad either. Anyone got something better? - * This only affects processes which use ioperm(). - */ - memcpy(tss->io_bitmap, next->io_bitmap_ptr, IO_BITMAP_BYTES); - tss->io_bitmap_base = IO_BITMAP_OFFSET; - } else { + * Copy the relevant range of the IO bitmap. + * Normally this is 128 bytes or less: + */ + memcpy(tss->io_bitmap, next->io_bitmap_ptr, + max(prev->io_bitmap_max, next->io_bitmap_max)); + else { /* - * a bitmap offset pointing outside of the TSS limit - * causes a nicely controllable SIGSEGV if a process - * tries to use a port IO instruction. The first - * sys_ioperm() call sets up the bitmap properly. + * Clear any possible leftover bits: */ - tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); } } diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c --- a/arch/x86_64/kernel/setup.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/setup.c 2004-09-21 20:52:51 -07:00 @@ -745,7 +745,7 @@ } if (index_lsb != index_msb ) index_msb++; - initial_apic_id = ebx >> 24 & 0xff; + initial_apic_id = hard_smp_processor_id(); phys_proc_id[cpu] = initial_apic_id >> index_msb; printk(KERN_INFO "CPU: Physical Processor ID: %d\n", diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c --- a/arch/x86_64/kernel/setup64.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/setup64.c 2004-09-21 20:52:51 -07:00 @@ -237,10 +237,11 @@ #else int cpu = smp_processor_id(); #endif - struct tss_struct * t = &init_tss[cpu]; + struct tss_struct *t = &per_cpu(init_tss, cpu); unsigned long v; char *estacks = NULL; struct task_struct *me; + int i; /* CPU 0 is initialised in head64.c */ if (cpu != 0) { @@ -304,12 +305,13 @@ t->ist[v] = (unsigned long)estacks; } - t->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap); /* - * This is required because the CPU will access up to + * <= is required because the CPU will access up to * 8 bits beyond the end of the IO permission bitmap. */ - t->io_bitmap[IO_BITMAP_LONGS] = ~0UL; + for (i = 0; i <= IO_BITMAP_LONGS; i++) + t->io_bitmap[i] = ~0UL; atomic_inc(&init_mm.mm_count); me->active_mm = &init_mm; diff -Nru a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c --- a/arch/x86_64/kernel/smp.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/smp.c 2004-09-21 20:52:52 -07:00 @@ -396,6 +396,7 @@ * * You must not call this function with disabled interrupts or from a * hardware interrupt handler or from a bottom half handler. + * Actually there are a few legal cases, like panic. */ { struct call_data_struct data; @@ -403,9 +404,6 @@ if (!cpus) return 0; - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); data.func = func; data.info = info; diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c --- a/arch/x86_64/kernel/smpboot.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/smpboot.c 2004-09-21 20:52:52 -07:00 @@ -575,7 +575,7 @@ start_rip = setup_trampoline(); init_rsp = idle->thread.rsp; - init_tss[cpu].rsp0 = init_rsp; + per_cpu(init_tss,cpu).rsp0 = init_rsp; initial_code = start_secondary; clear_ti_thread_flag(idle->thread_info, TIF_FORK); diff -Nru a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c --- a/arch/x86_64/kernel/suspend.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/kernel/suspend.c 2004-09-21 20:52:52 -07:00 @@ -129,7 +129,7 @@ void fix_processor_context(void) { int cpu = smp_processor_id(); - struct tss_struct * t = init_tss + cpu; + struct tss_struct *t = &per_cpu(init_tss, cpu); set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ diff -Nru a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c --- a/arch/x86_64/kernel/traps.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/kernel/traps.c 2004-09-21 20:52:51 -07:00 @@ -110,9 +110,10 @@ { int k; for (k = 0; k < N_EXCEPTION_STACKS; k++) { - unsigned long end = init_tss[cpu].ist[k] + EXCEPTION_STKSZ; + struct tss_struct *tss = &per_cpu(init_tss, cpu); + unsigned long end = tss->ist[k] + EXCEPTION_STKSZ; - if (stack >= init_tss[cpu].ist[k] && stack <= end) + if (stack >= tss->ist[k] && stack <= end) return (unsigned long *)end; } return NULL; @@ -463,7 +464,7 @@ DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr2()) +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) DO_ERROR(18, SIGSEGV, "reserved", reserved) #define DO_ERROR_STACK(trapnr, signr, str, name) \ diff -Nru a/arch/x86_64/lib/csum-wrappers.c b/arch/x86_64/lib/csum-wrappers.c --- a/arch/x86_64/lib/csum-wrappers.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/lib/csum-wrappers.c 2004-09-21 20:52:51 -07:00 @@ -22,6 +22,7 @@ csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int isum, int *errp) { + might_sleep(); *errp = 0; if (likely(access_ok(VERIFY_READ,src, len))) { /* Why 6, not 7? To handle odd addresses aligned we @@ -69,6 +70,7 @@ csum_partial_copy_to_user(const char *src, char __user *dst, int len, unsigned int isum, int *errp) { + might_sleep(); if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { *errp = -EFAULT; return 0; diff -Nru a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c --- a/arch/x86_64/lib/usercopy.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/lib/usercopy.c 2004-09-21 20:52:51 -07:00 @@ -14,6 +14,7 @@ #define __do_strncpy_from_user(dst,src,count,res) \ do { \ long __d0, __d1, __d2; \ + might_sleep(); \ __asm__ __volatile__( \ " testq %1,%1\n" \ " jz 2f\n" \ @@ -63,6 +64,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size) { long __d0; + might_sleep(); /* no memory constraint because it doesn't change any memory gcc knows about */ asm volatile( diff -Nru a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c --- a/arch/x86_64/mm/fault.c 2004-09-21 20:52:51 -07:00 +++ b/arch/x86_64/mm/fault.c 2004-09-21 20:52:51 -07:00 @@ -315,7 +315,27 @@ goto bad_area_nosemaphore; again: - down_read(&mm->mmap_sem); + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the + * kernel and should generate an OOPS. Unfortunatly, in the case of an + * erroneous fault occuring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user + * space from well defined areas of code, which are listed in the + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform + * the source reference check when there is a possibilty of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. + */ + if (!down_read_trylock(&mm->mmap_sem)) { + if ((error_code & 4) == 0 && + !search_exception_tables(regs->rip)) + goto bad_area_nosemaphore; + down_read(&mm->mmap_sem); + } vma = find_vma(mm, address); if (!vma) diff -Nru a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c --- a/arch/x86_64/mm/k8topology.c 2004-09-21 20:52:52 -07:00 +++ b/arch/x86_64/mm/k8topology.c 2004-09-21 20:52:52 -07:00 @@ -100,8 +100,8 @@ limit <<= 24; limit |= (1<<24)-1; - if (limit > end_pfn_map << PAGE_SHIFT) - limit = end_pfn_map << PAGE_SHIFT; + if (limit > end_pfn << PAGE_SHIFT) + limit = end_pfn << PAGE_SHIFT; if (limit <= base) continue; diff -Nru a/crypto/api.c b/crypto/api.c --- a/crypto/api.c 2004-09-21 20:52:52 -07:00 +++ b/crypto/api.c 2004-09-21 20:52:52 -07:00 @@ -155,8 +155,12 @@ void crypto_free_tfm(struct crypto_tfm *tfm) { + struct crypto_alg *alg = tfm->__crt_alg; + int size = sizeof(*tfm) + alg->cra_ctxsize; + crypto_exit_ops(tfm); - crypto_alg_put(tfm->__crt_alg); + crypto_alg_put(alg); + memset(tfm, 0, size); kfree(tfm); } diff -Nru a/drivers/Makefile b/drivers/Makefile --- a/drivers/Makefile 2004-09-21 20:52:52 -07:00 +++ b/drivers/Makefile 2004-09-21 20:52:52 -07:00 @@ -16,6 +16,9 @@ # char/ comes before serial/ etc so that the VT console is the boot-time # default. obj-y += char/ +# we also need input/serio early so serio bus is initialized by the time +# serial drivers start registering their serio ports +obj-$(CONFIG_SERIO) += input/serio/ obj-y += serial/ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ net/ media/ @@ -40,7 +43,6 @@ obj-$(CONFIG_USB_GADGET) += usb/gadget/ obj-$(CONFIG_INPUT) += input/ obj-$(CONFIG_GAMEPORT) += input/gameport/ -obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_I2C) += i2c/ obj-$(CONFIG_W1) += w1/ diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c --- a/drivers/acpi/processor.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/acpi/processor.c 2004-09-21 20:52:52 -07:00 @@ -2419,6 +2419,11 @@ /* Unregister the idle handler when processor #0 is removed. */ if (pr->id == 0) { pm_idle = pm_idle_save; + /* + * We are about to unload the current idle thread pm callback + * (pm_idle), Wait for all processors to update cached/local + * copies of pm_idle before proceeding. + */ synchronize_kernel(); } diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c --- a/drivers/acpi/thermal.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/acpi/thermal.c 2004-09-21 20:52:52 -07:00 @@ -659,7 +659,7 @@ struct acpi_thermal *tz = (struct acpi_thermal *) data; unsigned long sleep_time = 0; int i = 0; - struct acpi_thermal_state state = tz->state; + struct acpi_thermal_state state; ACPI_FUNCTION_TRACE("acpi_thermal_check"); @@ -667,6 +667,8 @@ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); return_VOID; } + + state = tz->state; result = acpi_thermal_get_temperature(tz); if (result) diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c --- a/drivers/atm/firestream.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/firestream.c 2004-09-21 20:52:51 -07:00 @@ -1667,7 +1667,7 @@ dev->hw_base = pci_resource_start(pci_dev, 0); - dev->base = (ulong) ioremap(dev->hw_base, 0x1000); + dev->base = ioremap(dev->hw_base, 0x1000); reset_chip (dev); @@ -1704,8 +1704,7 @@ } /* Try again after 10ms. */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout ((HZ+99)/100); + msleep(10); } if (!to) { diff -Nru a/drivers/atm/firestream.h b/drivers/atm/firestream.h --- a/drivers/atm/firestream.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/atm/firestream.h 2004-09-21 20:52:52 -07:00 @@ -477,7 +477,7 @@ struct timer_list timer; unsigned long hw_base; /* mem base address */ - unsigned long base; /* Mapping of base address */ + void __iomem *base; /* Mapping of base address */ int channo; unsigned long channel_mask; diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c --- a/drivers/atm/he.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/he.c 2004-09-21 20:52:51 -07:00 @@ -1007,6 +1007,7 @@ { struct he_dev *he_dev; struct pci_dev *pci_dev; + unsigned long membase; u16 command; u32 gen_cntl_0, host_cntl, lb_swap; @@ -1019,8 +1020,8 @@ he_dev = HE_DEV(dev); pci_dev = he_dev->pci_dev; - he_dev->membase = pci_dev->resource[0].start; - HPRINTK("membase = 0x%lx irq = %d.\n", he_dev->membase, pci_dev->irq); + membase = pci_resource_start(pci_dev, 0); + HPRINTK("membase = 0x%lx irq = %d.\n", membase, pci_dev->irq); /* * pci bus controller initialization @@ -1080,7 +1081,7 @@ hprintk("can't set latency timer to %d\n", timer); } - if (!(he_dev->membase = (unsigned long) ioremap(he_dev->membase, HE_REGMAP_SIZE))) { + if (!(he_dev->membase = ioremap(membase, HE_REGMAP_SIZE))) { hprintk("can't set up page mapping\n"); return -EINVAL; } @@ -1962,7 +1963,7 @@ struct he_tpd *tpd; int slot, updated = 0; #ifdef USE_TPD_POOL - struct list_head *p; + struct he_tpd *__tpd; #endif /* 2.1.6 transmit buffer return queue */ @@ -1977,8 +1978,7 @@ TBRQ_MULTIPLE(he_dev->tbrq_head) ? " MULTIPLE" : ""); #ifdef USE_TPD_POOL tpd = NULL; - list_for_each(p, &he_dev->outstanding_tpds) { - struct he_tpd *__tpd = list_entry(p, struct he_tpd, entry); + list_for_each_entry(__tpd, &he_dev->outstanding_tpds, entry) { if (TPD_ADDR(__tpd->status) == TBRQ_TPD(he_dev->tbrq_head)) { tpd = __tpd; list_del(&__tpd->entry); @@ -2595,9 +2595,8 @@ while (((tx_inuse = atomic_read(&vcc->sk->sk_wmem_alloc)) > 0) && (retry < MAX_RETRY)) { - set_current_state(TASK_UNINTERRUPTIBLE); - (void) schedule_timeout(sleep); - if (sleep < HZ) + msleep(sleep); + if (sleep < 250) sleep = sleep * 2; ++retry; diff -Nru a/drivers/atm/he.h b/drivers/atm/he.h --- a/drivers/atm/he.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/atm/he.h 2004-09-21 20:52:52 -07:00 @@ -265,7 +265,7 @@ struct he_dev { unsigned int number; unsigned int irq; - unsigned long membase; + void __iomem *membase; char prod_id[30]; char mac_addr[6]; diff -Nru a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c --- a/drivers/atm/idt77252.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/atm/idt77252.c 2004-09-21 20:52:52 -07:00 @@ -2516,7 +2516,7 @@ struct vc_map *vc = vcc->dev_data; unsigned long flags; unsigned long addr; - int timeout; + unsigned long timeout; down(&card->mutex); @@ -2566,9 +2566,9 @@ } spin_unlock_irqrestore(&vc->lock, flags); - timeout = 5 * HZ; + timeout = 5 * 1000; while (atomic_read(&vc->scq->used) > 0) { - timeout = schedule_timeout(timeout); + timeout = msleep_interruptible(timeout); if (!timeout) break; } @@ -3164,7 +3164,7 @@ for (i = 0; i < 4; i++) { if (card->fbq[i]) - iounmap((void *) card->fbq[i]); + iounmap(card->fbq[i]); } if (card->membase) @@ -3722,7 +3722,7 @@ card->tst_timer.function = tst_timer; /* Do the I/O remapping... */ - card->membase = (unsigned long) ioremap(membase, 1024); + card->membase = ioremap(membase, 1024); if (!card->membase) { printk("%s: can't ioremap() membase\n", card->name); err = -EIO; @@ -3756,8 +3756,7 @@ card->sramsize = probe_sram(card); for (i = 0; i < 4; i++) { - card->fbq[i] = (unsigned long) - ioremap(srambase | 0x200000 | (i << 18), 4); + card->fbq[i] = ioremap(srambase | 0x200000 | (i << 18), 4); if (!card->fbq[i]) { printk("%s: can't ioremap() FBQ%d\n", card->name, i); err = -EIO; diff -Nru a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h --- a/drivers/atm/idt77252.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/atm/idt77252.h 2004-09-21 20:52:52 -07:00 @@ -355,9 +355,9 @@ struct pci_dev *pcidev; /* PCI handle (desriptor) */ struct atm_dev *atmdev; /* ATM device desriptor */ - unsigned long membase; /* SAR's memory base address */ + void __iomem *membase; /* SAR's memory base address */ unsigned long srambase; /* SAR's sram base address */ - unsigned long fbq[4]; /* FBQ fill addresses */ + void __iomem *fbq[4]; /* FBQ fill addresses */ struct semaphore mutex; spinlock_t cmd_lock; /* for r/w utility/sram */ diff -Nru a/drivers/atm/lanai.c b/drivers/atm/lanai.c --- a/drivers/atm/lanai.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/lanai.c 2004-09-21 20:52:51 -07:00 @@ -191,7 +191,7 @@ #define LANAI_EEPROM_SIZE (128) typedef int vci_t; -typedef unsigned long bus_addr_t; +typedef void __iomem *bus_addr_t; /* DMA buffer in host memory for TX, RX, or service list. */ struct lanai_buffer { @@ -471,7 +471,7 @@ static inline bus_addr_t reg_addr(const struct lanai_dev *lanai, enum lanai_register reg) { - return lanai->base + (bus_addr_t) reg; + return lanai->base + reg; } static inline u32 reg_read(const struct lanai_dev *lanai, @@ -651,7 +651,7 @@ { u32 val; APRINTK(lvcc->vbase != 0, "cardvcc_read: unbound vcc!\n"); - val= readl(lvcc->vbase + (bus_addr_t) offset); + val= readl(lvcc->vbase + offset); RWDEBUG("VR vci=%04d 0x%02X = 0x%08X\n", lvcc->vci, (int) offset, val); return val; @@ -666,7 +666,7 @@ (unsigned int) val, lvcc->vci, (unsigned int) offset); RWDEBUG("VW vci=%04d 0x%02X > 0x%08X\n", lvcc->vci, (unsigned int) offset, (unsigned int) val); - writel(val, lvcc->vbase + (bus_addr_t) offset); + writel(val, lvcc->vbase + offset); } /* -------------------- COMPUTE SIZE OF AN AAL5 PDU: */ @@ -813,7 +813,7 @@ DPRINTK("read, write = %d, %d\n", read, write); break; } - schedule_timeout(HZ / 25); + msleep(4); } /* 15.2.2 - clear out all tx registers */ cardvcc_write(lvcc, 0, vcc_txreadptr); @@ -2177,7 +2177,7 @@ /* 3.2: PCI initialization */ if ((result = lanai_pci_start(lanai)) != 0) goto error; - raw_base = (bus_addr_t) lanai->pci->resource[0].start; + raw_base = lanai->pci->resource[0].start; lanai->base = (bus_addr_t) ioremap(raw_base, LANAI_MAPPING_SIZE); if (lanai->base == 0) { printk(KERN_ERR DEV_LABEL ": couldn't remap I/O space\n"); diff -Nru a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c --- a/drivers/atm/nicstar.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/nicstar.c 2004-09-21 20:52:51 -07:00 @@ -467,6 +467,7 @@ u32 u32d[4]; u32 ns_cfg_rctsize; int bcount; + unsigned long membase; error = 0; @@ -494,8 +495,8 @@ card->index = i; card->atmdev = NULL; card->pcidev = pcidev; - card->membase = pci_resource_start(pcidev, 1); - card->membase = (unsigned long) ioremap(card->membase, NS_IOREMAP_SIZE); + membase = pci_resource_start(pcidev, 1); + card->membase = ioremap(membase, NS_IOREMAP_SIZE); if (card->membase == 0) { printk("nicstar%d: can't ioremap() membase.\n",i); diff -Nru a/drivers/atm/nicstar.h b/drivers/atm/nicstar.h --- a/drivers/atm/nicstar.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/nicstar.h 2004-09-21 20:52:51 -07:00 @@ -763,7 +763,7 @@ { int index; /* Card ID to the device driver */ int sram_size; /* In k x 32bit words. 32 or 128 */ - unsigned long membase; /* Card's memory base address */ + void __iomem *membase; /* Card's memory base address */ unsigned long max_pcr; int rct_size; /* Number of entries */ int vpibits; diff -Nru a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c --- a/drivers/atm/nicstarmac.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/atm/nicstarmac.c 2004-09-21 20:52:52 -07:00 @@ -162,7 +162,7 @@ */ static u_int8_t -read_eprom_byte(u_int32_t base, u_int8_t offset) +read_eprom_byte(virt_addr_t base, u_int8_t offset) { u_int32_t val = 0; int i,j=0; diff -Nru a/drivers/atm/nicstarmac.h b/drivers/atm/nicstarmac.h --- a/drivers/atm/nicstarmac.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/atm/nicstarmac.h 2004-09-21 20:52:51 -07:00 @@ -7,7 +7,7 @@ ******************************************************************************/ -typedef unsigned int virt_addr_t; +typedef void __iomem *virt_addr_t; u_int32_t nicstar_read_eprom_status( virt_addr_t base ); void nicstar_init_eprom( virt_addr_t base ); diff -Nru a/drivers/block/amiflop.c b/drivers/block/amiflop.c --- a/drivers/block/amiflop.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/block/amiflop.c 2004-09-21 20:52:51 -07:00 @@ -386,16 +386,6 @@ fd_select(drive); udelay (1); fd_deselect(drive); - -#ifdef MODULE -/* - this is the last interrupt for any drive access, happens after - release (from floppy_off). So we have to wait until now to decrease - the use count. -*/ - if (decusecount) - MOD_DEC_USE_COUNT; -#endif } static void floppy_off (unsigned int nr) @@ -1590,10 +1580,6 @@ local_irq_save(flags); fd_ref[drive]++; fd_device[drive] = system; -#ifdef MODULE - if (unit[drive].motor == 0) - MOD_INC_USE_COUNT; -#endif local_irq_restore(flags); unit[drive].dtype=&data_types[system]; @@ -1839,6 +1825,7 @@ return amiga_floppy_init(); } +#if 0 /* not safe to unload */ void cleanup_module(void) { int i; @@ -1859,4 +1846,5 @@ release_mem_region(CUSTOM_PHYSADDR+0x20, 8); unregister_blkdev(FLOPPY_MAJOR, "fd"); } +#endif #endif diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c --- a/drivers/block/ll_rw_blk.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/block/ll_rw_blk.c 2004-09-21 20:52:51 -07:00 @@ -352,7 +352,7 @@ printk("%s: set to minimum %d\n", __FUNCTION__, max_sectors); } - q->max_sectors = max_sectors; + q->max_sectors = q->max_hw_sectors = max_sectors; } EXPORT_SYMBOL(blk_queue_max_sectors); @@ -454,7 +454,8 @@ void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b) { /* zero is "infinity" */ - t->max_sectors = min_not_zero(t->max_sectors,b->max_sectors); + t->max_sectors = t->max_hw_sectors = + min_not_zero(t->max_sectors,b->max_sectors); t->max_phys_segments = min(t->max_phys_segments,b->max_phys_segments); t->max_hw_segments = min(t->max_hw_segments,b->max_hw_segments); @@ -2583,11 +2584,11 @@ break; } - if (unlikely(bio_sectors(bio) > q->max_sectors)) { + if (unlikely(bio_sectors(bio) > q->max_hw_sectors)) { printk("bio too big device %s (%u > %u)\n", bdevname(bio->bi_bdev, b), bio_sectors(bio), - q->max_sectors); + q->max_hw_sectors); goto end_io; } @@ -3206,13 +3207,61 @@ unsigned long ra_kb; ssize_t ret = queue_var_store(&ra_kb, page, count); + spin_lock_irq(q->queue_lock); if (ra_kb > (q->max_sectors >> 1)) ra_kb = (q->max_sectors >> 1); q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10); + spin_unlock_irq(q->queue_lock); + + return ret; +} + +static ssize_t queue_max_sectors_show(struct request_queue *q, char *page) +{ + int max_sectors_kb = q->max_sectors >> 1; + + return queue_var_show(max_sectors_kb, (page)); +} + +static ssize_t +queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) +{ + unsigned long max_sectors_kb, + max_hw_sectors_kb = q->max_hw_sectors >> 1, + page_kb = 1 << (PAGE_CACHE_SHIFT - 10); + ssize_t ret = queue_var_store(&max_sectors_kb, page, count); + int ra_kb; + + if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb) + return -EINVAL; + /* + * Take the queue lock to update the readahead and max_sectors + * values synchronously: + */ + spin_lock_irq(q->queue_lock); + /* + * Trim readahead window as well, if necessary: + */ + ra_kb = q->backing_dev_info.ra_pages << (PAGE_CACHE_SHIFT - 10); + if (ra_kb > max_sectors_kb) + q->backing_dev_info.ra_pages = + max_sectors_kb >> (PAGE_CACHE_SHIFT - 10); + + q->max_sectors = max_sectors_kb << 1; + spin_unlock_irq(q->queue_lock); + return ret; } +static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page) +{ + int max_hw_sectors_kb = q->max_hw_sectors >> 1; + + return queue_var_show(max_hw_sectors_kb, (page)); +} + + static struct queue_sysfs_entry queue_requests_entry = { .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, .show = queue_requests_show, @@ -3225,9 +3274,22 @@ .store = queue_ra_store, }; +static struct queue_sysfs_entry queue_max_sectors_entry = { + .attr = {.name = "max_sectors_kb", .mode = S_IRUGO | S_IWUSR }, + .show = queue_max_sectors_show, + .store = queue_max_sectors_store, +}; + +static struct queue_sysfs_entry queue_max_hw_sectors_entry = { + .attr = {.name = "max_hw_sectors_kb", .mode = S_IRUGO }, + .show = queue_max_hw_sectors_show, +}; + static struct attribute *default_attrs[] = { &queue_requests_entry.attr, &queue_ra_entry.attr, + &queue_max_hw_sectors_entry.attr, + &queue_max_sectors_entry.attr, NULL, }; diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c --- a/drivers/bluetooth/hci_usb.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/bluetooth/hci_usb.c 2004-09-21 20:52:52 -07:00 @@ -96,7 +96,7 @@ { USB_DEVICE(0x0a5c, 0x2033), .driver_info = HCI_IGNORE }, /* Broadcom BCM2035 */ - { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET }, + { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_BROKEN_ISOC }, /* ISSC Bluetooth Adapter v3.1 */ { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, diff -Nru a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c --- a/drivers/cdrom/cdrom.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/cdrom/cdrom.c 2004-09-21 20:52:51 -07:00 @@ -1933,7 +1933,8 @@ int lba, int nframes) { struct packet_command cgc; - int nr, ret; + int ret = 0; + int nr; cdi->last_sense = 0; @@ -1955,8 +1956,8 @@ return -ENOMEM; if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) { - kfree(cgc.buffer); - return -EFAULT; + ret = -EFAULT; + goto out; } cgc.data_direction = CGC_DATA_READ; @@ -1967,13 +1968,17 @@ ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); if (ret) break; - __copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr); + if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { + ret = -EFAULT; + break; + } ubuf += CD_FRAMESIZE_RAW * nr; nframes -= nr; lba += nr; } +out: kfree(cgc.buffer); - return 0; + return ret; } static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig --- a/drivers/char/Kconfig 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/Kconfig 2004-09-21 20:52:51 -07:00 @@ -59,7 +59,7 @@ config HW_CONSOLE bool - depends on VT && !S390 && !UM + depends on VT && !S390 && !USERMODE default y config SERIAL_NONSTANDARD @@ -980,6 +980,14 @@ The hangcheck-timer module detects when the system has gone out to lunch past a certain margin. It can reboot the system or merely print a warning. + +config MMTIMER + tristate "MMTIMER Memory mapped RTC for SGI Altix" + depends on IA64_GENERIC || IA64_SGI_SN2 + default y + help + The mmtimer device allows direct userspace access to the + Altix system timer. endmenu diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile --- a/drivers/char/Makefile 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/Makefile 2004-09-21 20:52:52 -07:00 @@ -45,6 +45,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o hvsi.o obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_SGI_SNSC) += snsc.o +obj-$(CONFIG_MMTIMER) += mmtimer.o obj-$(CONFIG_VIOCONS) += viocons.o obj-$(CONFIG_VIOTAPE) += viotape.o obj-$(CONFIG_HVCS) += hvcs.o diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h --- a/drivers/char/drm/drm_drv.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/drm_drv.h 2004-09-21 20:52:52 -07:00 @@ -52,10 +52,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef __HAVE_COUNTERS -#define __HAVE_COUNTERS 0 -#endif - #ifndef DRIVER_IOCTLS #define DRIVER_IOCTLS #endif @@ -195,41 +191,6 @@ return i; } - dev->counters = 6 + __HAVE_COUNTERS; - dev->types[0] = _DRM_STAT_LOCK; - dev->types[1] = _DRM_STAT_OPENS; - dev->types[2] = _DRM_STAT_CLOSES; - dev->types[3] = _DRM_STAT_IOCTLS; - dev->types[4] = _DRM_STAT_LOCKS; - dev->types[5] = _DRM_STAT_UNLOCKS; -#ifdef __HAVE_COUNTER6 - dev->types[6] = __HAVE_COUNTER6; -#endif -#ifdef __HAVE_COUNTER7 - dev->types[7] = __HAVE_COUNTER7; -#endif -#ifdef __HAVE_COUNTER8 - dev->types[8] = __HAVE_COUNTER8; -#endif -#ifdef __HAVE_COUNTER9 - dev->types[9] = __HAVE_COUNTER9; -#endif -#ifdef __HAVE_COUNTER10 - dev->types[10] = __HAVE_COUNTER10; -#endif -#ifdef __HAVE_COUNTER11 - dev->types[11] = __HAVE_COUNTER11; -#endif -#ifdef __HAVE_COUNTER12 - dev->types[12] = __HAVE_COUNTER12; -#endif -#ifdef __HAVE_COUNTER13 - dev->types[13] = __HAVE_COUNTER13; -#endif -#ifdef __HAVE_COUNTER14 - dev->types[14] = __HAVE_COUNTER14; -#endif - for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) atomic_set( &dev->counts[i], 0 ); @@ -480,6 +441,9 @@ if (DRM(numdevs) >= MAX_DEVICES) return -ENODEV; + if ((retcode=pci_enable_device(pdev))) + return retcode; + dev = &(DRM(device)[DRM(numdevs)]); memset( (void *)dev, 0, sizeof(*dev) ); @@ -507,7 +471,16 @@ /* dev_priv_size can be changed by a driver in driver_register_fns */ dev->dev_priv_size = sizeof(u32); - + + /* the DRM has 6 basic counters - drivers add theirs in register_fns */ + dev->counters = 6; + dev->types[0] = _DRM_STAT_LOCK; + dev->types[1] = _DRM_STAT_OPENS; + dev->types[2] = _DRM_STAT_CLOSES; + dev->types[3] = _DRM_STAT_IOCTLS; + dev->types[4] = _DRM_STAT_LOCKS; + dev->types[5] = _DRM_STAT_UNLOCKS; + DRM(init_fn_table)(dev); DRM(driver_register_fns)(dev); @@ -785,7 +758,7 @@ add_wait_queue( &dev->lock.lock_queue, &entry ); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ retcode = -EINTR; @@ -805,7 +778,7 @@ break; } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue( &dev->lock.lock_queue, &entry ); if( !retcode ) { if (dev->fn_tbl.release) @@ -985,7 +958,7 @@ add_wait_queue( &dev->lock.lock_queue, &entry ); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ ret = -EINTR; @@ -1006,7 +979,7 @@ break; } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue( &dev->lock.lock_queue, &entry ); sigemptyset( &dev->sigmask ); diff -Nru a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h --- a/drivers/char/drm/drm_os_linux.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/drm_os_linux.h 2004-09-21 20:52:52 -07:00 @@ -134,7 +134,7 @@ add_wait_queue(&(queue), &entry); \ \ for (;;) { \ - current->state = TASK_INTERRUPTIBLE; \ + __set_current_state(TASK_INTERRUPTIBLE); \ if (condition) \ break; \ if (time_after_eq(jiffies, end)) { \ @@ -147,7 +147,7 @@ break; \ } \ } \ - current->state = TASK_RUNNING; \ + __set_current_state(TASK_RUNNING); \ remove_wait_queue(&(queue), &entry); \ } while (0) diff -Nru a/drivers/char/drm/drm_scatter.h b/drivers/char/drm/drm_scatter.h --- a/drivers/char/drm/drm_scatter.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/drm_scatter.h 2004-09-21 20:52:52 -07:00 @@ -73,7 +73,7 @@ DRM_DEBUG( "%s\n", __FUNCTION__ ); - if (drm_core_check_feature(dev, DRIVER_SG)) + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; if ( dev->sg ) @@ -209,7 +209,7 @@ drm_scatter_gather_t request; drm_sg_mem_t *entry; - if (drm_core_check_feature(dev, DRIVER_SG)) + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; if ( copy_from_user( &request, diff -Nru a/drivers/char/drm/i810.h b/drivers/char/drm/i810.h --- a/drivers/char/drm/i810.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i810.h 2004-09-21 20:52:51 -07:00 @@ -74,10 +74,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I810_FLIP)] = { i810_flip_bufs, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - #endif diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c --- a/drivers/char/drm/i810_dma.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i810_dma.c 2004-09-21 20:52:51 -07:00 @@ -1412,5 +1412,11 @@ dev->fn_tbl.release = i810_driver_release; dev->fn_tbl.dma_quiescent = i810_driver_dma_quiescent; dev->fn_tbl.reclaim_buffers = i810_reclaim_buffers; + + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/i830.h b/drivers/char/drm/i830.h --- a/drivers/char/drm/i830.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i830.h 2004-09-21 20:52:51 -07:00 @@ -73,12 +73,6 @@ [DRM_IOCTL_NR(DRM_IOCTL_I830_GETPARAM)] = { i830_getparam, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I830_SETPARAM)] = { i830_setparam, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - /* Driver will work either way: IRQ's save cpu time when waiting for * the card, but are subject to subtle interactions between bios, * hardware and the driver. diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c --- a/drivers/char/drm/i830_dma.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i830_dma.c 2004-09-21 20:52:51 -07:00 @@ -1615,5 +1615,10 @@ dev->fn_tbl.irq_uninstall = i830_driver_irq_uninstall; dev->fn_tbl.irq_handler = i830_driver_irq_handler; #endif + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/i830_irq.c b/drivers/char/drm/i830_irq.c --- a/drivers/char/drm/i830_irq.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/i830_irq.c 2004-09-21 20:52:52 -07:00 @@ -92,7 +92,7 @@ add_wait_queue(&dev_priv->irq_queue, &entry); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(&dev_priv->irq_received) >= irq_nr) break; if((signed)(end - jiffies) <= 0) { @@ -112,7 +112,7 @@ } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue(&dev_priv->irq_queue, &entry); return ret; } diff -Nru a/drivers/char/drm/i915.h b/drivers/char/drm/i915.h --- a/drivers/char/drm/i915.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i915.h 2004-09-21 20:52:51 -07:00 @@ -45,12 +45,6 @@ [DRM_IOCTL_NR(DRM_IOCTL_I915_INIT_HEAP)] = { i915_mem_init_heap, 1, 1 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I915_CMDBUFFER)] = { i915_cmdbuffer, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - /* We use our own dma mechanisms, not the drm template code. However, * the shared IRQ code is useful to us: */ diff -Nru a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c --- a/drivers/char/drm/i915_dma.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/char/drm/i915_dma.c 2004-09-21 20:52:51 -07:00 @@ -746,4 +746,10 @@ dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall; dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall; dev->fn_tbl.irq_handler = i915_driver_irq_handler; + + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/mga.h b/drivers/char/drm/mga.h --- a/drivers/char/drm/mga.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/mga.h 2004-09-21 20:52:52 -07:00 @@ -60,9 +60,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam, 1, 0 }, -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY - #endif diff -Nru a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c --- a/drivers/char/drm/mga_dma.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/mga_dma.c 2004-09-21 20:52:52 -07:00 @@ -819,4 +819,9 @@ dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall; dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall; dev->fn_tbl.irq_handler = mga_driver_irq_handler; + + dev->counters += 3; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; } diff -Nru a/drivers/char/drm/sis.h b/drivers/char/drm/sis.h --- a/drivers/char/drm/sis.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/drm/sis.h 2004-09-21 20:52:52 -07:00 @@ -58,6 +58,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_SIS_AGP_FREE)] = { sis_ioctl_agp_free, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_SIS_FB_INIT)] = { sis_fb_init, 1, 1 } -#define __HAVE_COUNTERS 5 - #endif diff -Nru a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c --- a/drivers/char/hvc_console.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/hvc_console.c 2004-09-21 20:52:52 -07:00 @@ -265,6 +265,11 @@ */ tty_wait_until_sent(tty, HVC_CLOSE_WAIT); + /* + * Since the line disc doesn't block writes during tty close + * operations we'll set driver_data to NULL and then make sure + * to check tty->driver_data for NULL in hvc_write(). + */ tty->driver_data = NULL; if (irq != NO_IRQ) @@ -418,6 +423,10 @@ struct hvc_struct *hp = tty->driver_data; int written; + /* This write was probably executed during a tty close. */ + if (!hp) + return -EPIPE; + if (from_user) written = __hvc_write_user(hp, buf, count); else @@ -801,7 +810,7 @@ void hvc_console_print(struct console *co, const char *b, unsigned count) { char c[16] __ALIGNED__; - unsigned i, n = 0; + unsigned i = 0, n = 0; int r, donecr = 0; /* Console access attempt outside of acceptable console range. */ diff -Nru a/drivers/char/hvcs.c b/drivers/char/hvcs.c --- a/drivers/char/hvcs.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/hvcs.c 2004-09-21 20:52:52 -07:00 @@ -119,8 +119,16 @@ * Rearranged hvcs_close(). Cleaned up some printks and did some housekeeping * on the changelog. Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from * arch/ppc64/hvcserver.h. + * + * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to + * prevent possible lockup with realtime scheduling as similarily pointed out by + * akpm in hvc_console. Changed resulted in the removal of hvcs_final_close() + * to reorder cleanup operations and prevent discarding of pending data during + * an hvcs_close(). Removed spinlock protection of hvcs_struct data members in + * hvcs_write_room() and hvcs_chars_in_buffer() because they aren't needed. */ -#define HVCS_DRIVER_VERSION "1.3.2" + +#define HVCS_DRIVER_VERSION "1.3.3" MODULE_AUTHOR("Ryan S. Arnold "); MODULE_DESCRIPTION("IBM hvcs (Hypervisor Virtual Console Server) Driver"); @@ -128,6 +136,12 @@ MODULE_VERSION(HVCS_DRIVER_VERSION); /* + * Wait this long per iteration while trying to push buffered data to the + * hypervisor before allowing the tty to complete a close operation. + */ +#define HVCS_CLOSE_WAIT (HZ/100) /* 1/10 of a second */ + +/* * Since the Linux TTY code does not currently (2-04-2004) support dynamic * addition of tty derived devices and we shouldn't allocate thousands of * tty_device pointers when the number of vty-server & vty partner connections @@ -317,7 +331,6 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, unsigned int irq, struct vio_dev *dev); -static void hvcs_final_close(struct hvcs_struct *hvcsd); static void destroy_hvcs_struct(struct kobject *kobj); static int hvcs_open(struct tty_struct *tty, struct file *filp); @@ -427,7 +440,7 @@ struct tty_struct *tty; char buf[HVCS_BUFF_LEN] __ALIGNED__; unsigned long flags; - int got; + int got = 0; int i; spin_lock_irqsave(&hvcsd->lock, flags); @@ -574,28 +587,6 @@ kfree(hvcsd); } -/* - * This function must be called with hvcsd->lock held. Do not free the irq in - * this function since it is called with the spinlock held. - */ -static void hvcs_final_close(struct hvcs_struct *hvcsd) -{ - vio_disable_interrupts(hvcsd->vdev); - - hvcsd->todo_mask = 0; - - /* These two may be redundant if the operation was a close. */ - if (hvcsd->tty) { - hvcsd->tty->driver_data = NULL; - hvcsd->tty = NULL; - } - - hvcsd->open_count = 0; - - memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); - hvcsd->chars_in_buffer = 0; -} - static struct kobj_type hvcs_kobj_type = { .release = destroy_hvcs_struct, }; @@ -692,8 +683,6 @@ return 0; } - - static int __devexit hvcs_remove(struct vio_dev *dev) { struct hvcs_struct *hvcsd = dev->dev.driver_data; @@ -945,7 +934,7 @@ */ struct hvcs_struct *hvcs_get_by_index(int index) { - struct hvcs_struct *hvcsd; + struct hvcs_struct *hvcsd = NULL; unsigned long flags; spin_lock(&hvcs_structs_lock); @@ -1099,12 +1088,7 @@ kobjp = &hvcsd->kobj; if (--hvcsd->open_count == 0) { - /* - * This line is important because it tells hvcs_open that this - * device needs to be re-configured the next time hvcs_open is - * called. - */ - hvcsd->tty->driver_data = NULL; + vio_disable_interrupts(hvcsd->vdev); /* * NULL this early so that the kernel_thread doesn't try to @@ -1113,26 +1097,18 @@ */ hvcsd->tty = NULL; + irq = hvcsd->vdev->irq; + spin_unlock_irqrestore(&hvcsd->lock, flags); + + tty_wait_until_sent(tty, HVCS_CLOSE_WAIT); + /* - * Block the close until all the buffered data has been - * delivered. + * This line is important because it tells hvcs_open that this + * device needs to be re-configured the next time hvcs_open is + * called. */ - while(hvcsd->chars_in_buffer) { - spin_unlock_irqrestore(&hvcsd->lock, flags); - - /* - * Give the kernel thread the hvcs_struct so that it can - * try to deliver the remaining data but block the close - * operation by spinning in this function so that other - * tty operations have to wait. - */ - yield(); - spin_lock_irqsave(&hvcsd->lock, flags); - } + tty->driver_data = NULL; - hvcs_final_close(hvcsd); - irq = hvcsd->vdev->irq; - spin_unlock_irqrestore(&hvcsd->lock, flags); free_irq(irq, hvcsd); kobject_put(kobjp); return; @@ -1162,12 +1138,25 @@ * Don't kobject put inside the spinlock because the destruction * callback may use the spinlock and it may get called before the * spinlock has been released. Get a pointer to the kobject and - * kobject_put on that instead. + * kobject_put on that after releasing the spinlock. */ kobjp = &hvcsd->kobj; - /* Calling this will drop any buffered data on the floor. */ - hvcs_final_close(hvcsd); + vio_disable_interrupts(hvcsd->vdev); + + hvcsd->todo_mask = 0; + + /* I don't think the tty needs the hvcs_struct pointer after a hangup */ + hvcsd->tty->driver_data = NULL; + hvcsd->tty = NULL; + + hvcsd->open_count = 0; + + /* This will drop any buffered data on the floor which is OK in a hangup + * scenario. */ + memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); + hvcsd->chars_in_buffer = 0; + irq = hvcsd->vdev->irq; spin_unlock_irqrestore(&hvcsd->lock, flags); @@ -1323,28 +1312,18 @@ static int hvcs_write_room(struct tty_struct *tty) { struct hvcs_struct *hvcsd = tty->driver_data; - unsigned long flags; - int retval; if (!hvcsd || hvcsd->open_count <= 0) return 0; - spin_lock_irqsave(&hvcsd->lock, flags); - retval = HVCS_BUFF_LEN - hvcsd->chars_in_buffer; - spin_unlock_irqrestore(&hvcsd->lock, flags); - return retval; + return HVCS_BUFF_LEN - hvcsd->chars_in_buffer; } static int hvcs_chars_in_buffer(struct tty_struct *tty) { struct hvcs_struct *hvcsd = tty->driver_data; - unsigned long flags; - int retval; - spin_lock_irqsave(&hvcsd->lock, flags); - retval = hvcsd->chars_in_buffer; - spin_unlock_irqrestore(&hvcsd->lock, flags); - return retval; + return hvcsd->chars_in_buffer; } static struct tty_operations hvcs_ops = { @@ -1433,7 +1412,7 @@ " as a tty driver failed.\n"); hvcs_free_index_list(); put_tty_driver(hvcs_tty_driver); - return rc; + return -EIO; } hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); diff -Nru a/drivers/char/hvsi.c b/drivers/char/hvsi.c --- a/drivers/char/hvsi.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/hvsi.c 2004-09-21 20:52:52 -07:00 @@ -1004,7 +1004,7 @@ { struct hvsi_struct *hp = tty->driver_data; const char *source = buf; - char *kbuf; + char *kbuf = NULL; unsigned long flags; int total = 0; int origcount = count; diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c --- a/drivers/char/keyboard.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/char/keyboard.c 2004-09-21 20:52:52 -07:00 @@ -123,7 +123,7 @@ */ static struct input_handler kbd_handler; -static unsigned long key_down[256/BITS_PER_LONG]; /* keyboard key bitmap */ +static unsigned long key_down[NBITS(KEY_MAX)]; /* keyboard key bitmap */ static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ static int dead_key_next; static int npadch = -1; /* -1 or number assembled on pad */ @@ -142,7 +142,7 @@ /* Simple translation table for the SysRq keys */ #ifdef CONFIG_MAGIC_SYSRQ -unsigned char kbd_sysrq_xlate[128] = +unsigned char kbd_sysrq_xlate[KEY_MAX] = "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ @@ -941,6 +941,9 @@ #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) +#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ + ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) + static unsigned short x86_keycodes[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -1007,6 +1010,8 @@ #else +#define HW_RAW(dev) 0 + #warning "Cannot generate rawmode keyboard for your architecture yet." static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char up_flag) @@ -1019,7 +1024,15 @@ } #endif -void kbd_keycode(unsigned int keycode, int down, struct pt_regs *regs) +void kbd_rawcode(unsigned char data) +{ + struct vc_data *vc = vc_cons[fg_console].d; + kbd = kbd_table + fg_console; + if (kbd->kbdmode == VC_RAW) + put_queue(vc, data); +} + +void kbd_keycode(unsigned int keycode, int down, int hw_raw, struct pt_regs *regs) { struct vc_data *vc = vc_cons[fg_console].d; unsigned short keysym, *key_map; @@ -1053,7 +1066,7 @@ return; #endif /* CONFIG_MAC_EMUMOUSEBTN */ - if ((raw_mode = (kbd->kbdmode == VC_RAW))) + if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) if (emulate_raw(vc, keycode, !down << 7)) if (keycode < BTN_MISC) printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode); @@ -1119,6 +1132,9 @@ return; } + if (keycode > NR_KEYS) + return; + keysym = key_map[keycode]; type = KTYP(keysym); @@ -1148,11 +1164,12 @@ } static void kbd_event(struct input_handle *handle, unsigned int event_type, - unsigned int keycode, int down) + unsigned int event_code, int value) { - if (event_type != EV_KEY) - return; - kbd_keycode(keycode, down, handle->dev->regs); + if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) + kbd_rawcode(value); + if (event_type == EV_KEY) + kbd_keycode(event_code, value, HW_RAW(handle->dev), handle->dev->regs); tasklet_schedule(&keyboard_tasklet); do_poke_blanked_console = 1; schedule_console_callback(); diff -Nru a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/mmtimer.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,198 @@ +/* + * Intel Multimedia Timer device implementation for SGI SN platforms. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved. + * + * This driver implements a subset of the interface required by the + * IA-PC Multimedia Timers Draft Specification (rev. 0.97) from Intel. + * + * 11/01/01 - jbarnes - initial revision + * 9/10/04 - Christoph Lameter - remove interrupt support for kernel inclusion + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Jesse Barnes "); +MODULE_DESCRIPTION("Multimedia timer support"); +MODULE_LICENSE("GPL"); + +#define RTC_BITS 55 /* 55 bits for this implementation */ + +static int mmtimer_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); +static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); + +/* + * Period in femtoseconds (10^-15 s) + */ +static unsigned long mmtimer_femtoperiod = 0; + +static struct file_operations mmtimer_fops = { + .owner = THIS_MODULE, + .mmap = mmtimer_mmap, + .ioctl = mmtimer_ioctl, +}; + +/** + * mmtimer_ioctl - ioctl interface for /dev/mmtimer + * @inode: inode of the device + * @file: file structure for the device + * @cmd: command to execute + * @arg: optional argument to command + * + * Executes the command specified by @cmd. Returns 0 for success, <0 for failure. + * Valid commands are + * + * %MMTIMER_GETOFFSET - Should return the offset (relative to the start + * of the page where the registers are mapped) for the counter in question. + * + * %MMTIMER_GETRES - Returns the resolution of the clock in femto (10^-15) + * seconds + * + * %MMTIMER_GETFREQ - Copies the frequency of the clock in Hz to the address + * specified by @arg + * + * %MMTIMER_GETBITS - Returns the number of bits in the clock's counter + * + * %MMTIMER_MMAPAVAIL - Returns 1 if the registers can be mmap'd into userspace + * + * %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it + * in the address specified by @arg. + */ +static int +mmtimer_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + int ret = 0; + + switch (cmd) { + case MMTIMER_GETOFFSET: /* offset of the counter */ + /* + * SN RTC registers are on their own 64k page + */ + if(PAGE_SIZE <= (1 << 16)) + ret = (((long)RTC_COUNTER_ADDR) & (PAGE_SIZE-1)) / 8; + else + ret = -ENOSYS; + break; + + case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */ + if(copy_to_user((unsigned long *)arg, &mmtimer_femtoperiod, sizeof(unsigned long))) + return -EFAULT; + break; + + case MMTIMER_GETFREQ: /* frequency in Hz */ + if(copy_to_user((unsigned long *)arg, &sn_rtc_cycles_per_second, sizeof(unsigned long))) + return -EFAULT; + ret = 0; + break; + + case MMTIMER_GETBITS: /* number of bits in the clock */ + ret = RTC_BITS; + break; + + case MMTIMER_MMAPAVAIL: /* can we mmap the clock into userspace? */ + ret = (PAGE_SIZE <= (1 << 16)) ? 1 : 0; + break; + + case MMTIMER_GETCOUNTER: + if(copy_to_user((unsigned long *)arg, RTC_COUNTER_ADDR, sizeof(unsigned long))) + return -EFAULT; + break; + default: + ret = -ENOSYS; + break; + } + + return ret; +} + +/** + * mmtimer_mmap - maps the clock's registers into userspace + * @file: file structure for the device + * @vma: VMA to map the registers into + * + * Calls remap_page_range() to map the clock's registers into + * the calling process' address space. + */ +static int +mmtimer_mmap(struct file *file, struct vm_area_struct *vma) +{ + unsigned long mmtimer_addr; + + if (vma->vm_end - vma->vm_start != PAGE_SIZE) + return -EINVAL; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + if (PAGE_SIZE > (1 << 16)) + return -ENOSYS; + + vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED ); + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + mmtimer_addr = __pa(RTC_COUNTER_ADDR); + mmtimer_addr &= ~(PAGE_SIZE - 1); + mmtimer_addr &= 0xfffffffffffffffUL; + + if (remap_page_range(vma, vma->vm_start, mmtimer_addr, PAGE_SIZE, vma->vm_page_prot)) { + printk(KERN_ERR "remap_page_range failed in mmtimer.c\n"); + return -EAGAIN; + } + + return 0; +} + +static struct miscdevice mmtimer_miscdev = { + SGI_MMTIMER, + MMTIMER_NAME, + &mmtimer_fops +}; + +/** + * mmtimer_init - device initialization routine + * + * Does initial setup for the mmtimer device. + */ +static int __init +mmtimer_init(void) +{ + /* + * Sanity check the cycles/sec variable + */ + if (sn_rtc_cycles_per_second < 100000) { + printk(KERN_ERR "%s: unable to determine clock frequency\n", MMTIMER_NAME); + return -1; + } + + mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 2) / + sn_rtc_cycles_per_second; + + strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); + if (misc_register(&mmtimer_miscdev)) { + printk(KERN_ERR "%s: failed to register device\n", MMTIMER_NAME); + return -1; + } + + printk(KERN_INFO "%s: v%s, %ld MHz\n", MMTIMER_DESC, MMTIMER_VERSION, sn_rtc_cycles_per_second/(unsigned long)1E6); + + return 0; +} + +module_init(mmtimer_init); + diff -Nru a/drivers/fc4/soc.h b/drivers/fc4/soc.h --- a/drivers/fc4/soc.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/fc4/soc.h 2004-09-21 20:52:51 -07:00 @@ -81,29 +81,29 @@ * That's why here are the following inline functions... */ -typedef unsigned long xram_p; +typedef void __iomem *xram_p; /* Get 32bit number from XRAM */ -static inline u32 xram_get_32 (xram_p x) +static inline u32 xram_get_32(xram_p x) { return ((sbus_readw(x + 0x00UL) << 16) | (sbus_readw(x + 0x02UL))); } /* Like the above, but when we don't care about the high 16 bits */ -static inline u32 xram_get_32low (xram_p x) +static inline u32 xram_get_32low(xram_p x) { return (u32) sbus_readw(x + 0x02UL); } -static inline u16 xram_get_16 (xram_p x) +static inline u16 xram_get_16(xram_p x) { return sbus_readw(x); } -static inline u8 xram_get_8 (xram_p x) +static inline u8 xram_get_8(xram_p x) { - if (x & (xram_p)0x1) { + if ((unsigned long)x & 0x1UL) { x = x - 1; return (u8) sbus_readw(x); } else { @@ -111,7 +111,7 @@ } } -static inline void xram_copy_from (void *p, xram_p x, int len) +static inline void xram_copy_from(void *p, xram_p x, int len) { for (len >>= 2; len > 0; len--, x += sizeof(u32)) { u32 val, *p32 = p; @@ -123,7 +123,7 @@ } } -static inline void xram_copy_to (xram_p x, void *p, int len) +static inline void xram_copy_to(xram_p x, void *p, int len) { for (len >>= 2; len > 0; len--, x += sizeof(u32)) { u32 tmp, *p32 = p; @@ -135,7 +135,7 @@ } } -static inline void xram_bzero (xram_p x, int len) +static inline void xram_bzero(xram_p x, int len) { for (len >>= 1; len > 0; len--, x += sizeof(u16)) sbus_writew(0, x); @@ -274,7 +274,7 @@ soc_cq req[2]; /* Request CQs */ soc_cq rsp[2]; /* Response CQs */ int soc_no; - unsigned long regs; + void __iomem *regs; xram_p xram; fc_wwn wwn; u32 imask; /* Our copy of regs->imask */ diff -Nru a/drivers/fc4/socal.c b/drivers/fc4/socal.c --- a/drivers/fc4/socal.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/fc4/socal.c 2004-09-21 20:52:51 -07:00 @@ -60,7 +60,7 @@ #define for_each_socal(s) for (s = socals; s; s = s->next) struct socal *socals = NULL; -static void socal_copy_from_xram(void *d, unsigned long xram, long size) +static void socal_copy_from_xram(void *d, void __iomem *xram, long size) { u32 *dp = (u32 *) d; while (size) { @@ -70,7 +70,7 @@ } } -static void socal_copy_to_xram(unsigned long xram, void *s, long size) +static void socal_copy_to_xram(void __iomem *xram, void *s, long size) { u32 *sp = (u32 *) s; while (size) { diff -Nru a/drivers/fc4/socal.h b/drivers/fc4/socal.h --- a/drivers/fc4/socal.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/fc4/socal.h 2004-09-21 20:52:52 -07:00 @@ -295,9 +295,9 @@ socal_cq req[4]; /* Request CQs */ socal_cq rsp[4]; /* Response CQs */ int socal_no; - unsigned long regs; - unsigned long xram; - unsigned long eeprom; + void __iomem *regs; + void __iomem *xram; + void __iomem *eeprom; fc_wwn wwn; u32 imask; /* Our copy of regs->imask */ u32 cfg; /* Our copy of regs->cfg */ diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig --- a/drivers/ide/Kconfig 2004-09-21 20:52:51 -07:00 +++ b/drivers/ide/Kconfig 2004-09-21 20:52:51 -07:00 @@ -457,11 +457,6 @@ Generally say N here. -config BLK_DEV_ADMA - bool - depends on PCI && BLK_DEV_IDEPCI - default BLK_DEV_IDEDMA_PCI - config BLK_DEV_AEC62XX tristate "AEC62XX chipset support" help diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c --- a/drivers/ide/pci/sis5513.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/ide/pci/sis5513.c 2004-09-21 20:52:52 -07:00 @@ -954,31 +954,25 @@ return; } -#define DECLARE_SIS_DEV(name_str) \ - { \ - .name = name_str, \ - .init_chipset = init_chipset_sis5513, \ - .init_hwif = init_hwif_sis5513, \ - .channels = 2, \ - .autodma = NOAUTODMA, \ - .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, \ - .bootable = ON_BOARD, \ - } - -static ide_pci_device_t sis5513_chipsets[] __devinitdata = { - /* 0 */ DECLARE_SIS_DEV("SIS5513"), - /* 1 */ DECLARE_SIS_DEV("SIS5518") +static ide_pci_device_t sis5513_chipset __devinitdata = { + .name = "SIS5513", + .init_chipset = init_chipset_sis5513, + .init_hwif = init_hwif_sis5513, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, + .bootable = ON_BOARD, }; static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sis5513_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &sis5513_chipset); return 0; } static struct pci_device_id sis5513_pci_tbl[] = { { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5513, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5518, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5518, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, sis5513_pci_tbl); diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c --- a/drivers/ieee1394/eth1394.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/ieee1394/eth1394.c 2004-09-21 20:52:52 -07:00 @@ -132,7 +132,7 @@ }; /* Our ieee1394 highlevel driver */ -#define ETH1394_DRIVER_NAME "ip1394" +#define ETH1394_DRIVER_NAME "eth1394" static const char driver_name[] = ETH1394_DRIVER_NAME; static kmem_cache_t *packet_task_cache; diff -Nru a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c --- a/drivers/input/gameport/emu10k1-gp.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/gameport/emu10k1-gp.c 2004-09-21 20:52:52 -07:00 @@ -50,8 +50,11 @@ }; static struct pci_device_id emu_tbl[] = { + { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ + { 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */ + { 0x1102, 0x7005, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy LS gameport */ { 0, } }; diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c --- a/drivers/input/joydev.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/joydev.c 2004-09-21 20:52:52 -07:00 @@ -232,8 +232,10 @@ && list->head == list->tail && (file->f_flags & O_NONBLOCK)) return -EAGAIN; - retval = wait_event_interruptible(list->joydev->wait, list->joydev->exist - && (list->startup < joydev->nabs + joydev->nkey || list->head != list->tail)); + retval = wait_event_interruptible(list->joydev->wait, + !list->joydev->exist || + list->startup < joydev->nabs + joydev->nkey || + list->head != list->tail); if (retval) return retval; diff -Nru a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig --- a/drivers/input/joystick/Kconfig 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/Kconfig 2004-09-21 20:52:51 -07:00 @@ -247,7 +247,7 @@ To compile this driver as a module, choose M here: the module will be called amijoy. -config INPUT_JOYDUMP +config JOYSTICK_JOYDUMP tristate "Gameport data dumper" depends on INPUT && INPUT_JOYSTICK help diff -Nru a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c --- a/drivers/input/joystick/gamecon.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/joystick/gamecon.c 2004-09-21 20:52:52 -07:00 @@ -1,7 +1,8 @@ /* - * $Id: gamecon.c,v 1.22 2002/07/01 15:42:25 vojtech Exp $ + * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux * - * Copyright (c) 1999-2001 Vojtech Pavlik + * Copyright (c) 1999-2004 Vojtech Pavlik + * Copyright (c) 2004 Peter Nelson * * Based on the work of: * Andree Borrmann John Dahlstrom @@ -9,10 +10,6 @@ */ /* - * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux - */ - -/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -72,8 +69,9 @@ #define GC_MULTI2 5 #define GC_N64 6 #define GC_PSX 7 +#define GC_DDR 8 -#define GC_MAX 7 +#define GC_MAX 8 #define GC_REFRESH_TIME HZ/100 @@ -91,7 +89,8 @@ static int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 }; static char *gc_names[] = { NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick", - "Multisystem 2-button joystick", "N64 controller", "PSX controller" }; + "Multisystem 2-button joystick", "N64 controller", "PSX controller" + "PSX DDR controller" }; /* * N64 support. */ @@ -237,7 +236,7 @@ #define GC_PSX_RUMBLE 7 /* Rumble in Red mode */ #define GC_PSX_CLOCK 0x04 /* Pin 4 */ -#define GC_PSX_COMMAND 0x01 /* Pin 1 */ +#define GC_PSX_COMMAND 0x01 /* Pin 2 */ #define GC_PSX_POWER 0xf8 /* Pins 5-9 */ #define GC_PSX_SELECT 0x02 /* Pin 3 */ @@ -253,25 +252,29 @@ static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR }; +static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 }; /* * gc_psx_command() writes 8bit command and reads 8bit data from * the psx pad. */ -static int gc_psx_command(struct gc *gc, int b) +static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_PSX_LENGTH]) { - int i, cmd, data = 0; + int i, j, cmd, read; + for (i = 0; i < 5; i++) + data[i] = 0; for (i = 0; i < 8; i++, b >>= 1) { cmd = (b & 1) ? GC_PSX_COMMAND : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); udelay(gc_psx_delay); - data |= ((parport_read_status(gc->pd->port) ^ 0x80) & gc->pads[GC_PSX]) ? (1 << i) : 0; + read = parport_read_status(gc->pd->port) ^ 0x80; + for (j = 0; j < 5; j++) + data[j] |= (read & gc_status_bit[j] & gc->pads[GC_PSX]) ? (1 << i) : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); udelay(gc_psx_delay); } - return data; } /* @@ -279,30 +282,39 @@ * device identifier code. */ -static int gc_psx_read_packet(struct gc *gc, unsigned char *data) +static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_LENGTH], unsigned char id[5]) { - int i, id; + int i, j, max_len = 0; unsigned long flags; + unsigned char data2[5]; parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ - udelay(gc_psx_delay * 2); + udelay(gc_psx_delay); parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER); /* Deselect, begin command */ - udelay(gc_psx_delay * 2); + udelay(gc_psx_delay); local_irq_save(flags); - gc_psx_command(gc, 0x01); /* Access pad */ - id = gc_psx_command(gc, 0x42); /* Get device id */ - if (gc_psx_command(gc, 0) == 0x5a) { /* Okay? */ - for (i = 0; i < GC_PSX_LEN(id) * 2; i++) - data[i] = gc_psx_command(gc, 0); - } else id = 0; + gc_psx_command(gc, 0x01, data2); /* Access pad */ + gc_psx_command(gc, 0x42, id); /* Get device ids */ + gc_psx_command(gc, 0, data2); /* Dump status */ + + for (i =0; i < 5; i++) /* Find the longest pad */ + if((gc_status_bit[i] & gc->pads[GC_PSX]) && (GC_PSX_LEN(id[i]) > max_len)) + max_len = GC_PSX_LEN(id[i]); + + for (i = 0; i < max_len * 2; i++) { /* Read in all the data */ + gc_psx_command(gc, 0, data2); + for (j = 0; j < 5; j++) + data[j][i] = data2[j]; + } local_irq_restore(flags); parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); - return GC_PSX_ID(id); + for(i = 0; i < 5; i++) /* Set id's to the real value */ + id[i] = GC_PSX_ID(id[i]); } /* @@ -316,6 +328,7 @@ struct gc *gc = (void *) private; struct input_dev *dev = gc->dev; unsigned char data[GC_MAX_LENGTH]; + unsigned char data_psx[5][GC_PSX_LENGTH]; int i, j, s; /* @@ -412,53 +425,72 @@ * PSX controllers */ - if (gc->pads[GC_PSX]) { + if (gc->pads[GC_PSX] || gc->pads[GC_DDR]) { - for (i = 0; i < 5; i++) - if (gc->pads[GC_PSX] & gc_status_bit[i]) - break; + gc_psx_read_packet(gc, data_psx, data); - switch (gc_psx_read_packet(gc, data)) { + for (i = 0; i < 5; i++) { + switch (data[i]) { - case GC_PSX_RUMBLE: + case GC_PSX_RUMBLE: - input_report_key(dev + i, BTN_THUMBL, ~data[0] & 0x04); - input_report_key(dev + i, BTN_THUMBR, ~data[0] & 0x02); - input_sync(dev + i); + input_report_key(dev + i, BTN_THUMBL, ~data_psx[i][0] & 0x04); + input_report_key(dev + i, BTN_THUMBR, ~data_psx[i][0] & 0x02); - case GC_PSX_NEGCON: - case GC_PSX_ANALOG: + case GC_PSX_NEGCON: + case GC_PSX_ANALOG: - for (j = 0; j < 4; j++) - input_report_abs(dev + i, gc_psx_abs[j], data[j + 2]); + if(gc->pads[GC_DDR] & gc_status_bit[i]) { + for(j = 0; j < 4; j++) + input_report_key(dev + i, gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); + } else { + for (j = 0; j < 4; j++) + input_report_abs(dev + i, gc_psx_abs[j+2], data_psx[i][j + 2]); - input_report_abs(dev + i, ABS_HAT0X, !(data[0] & 0x20) - !(data[0] & 0x80)); - input_report_abs(dev + i, ABS_HAT0Y, !(data[0] & 0x40) - !(data[0] & 0x10)); + input_report_abs(dev + i, ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); + input_report_abs(dev + i, ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); + } - for (j = 0; j < 8; j++) - input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + for (j = 0; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); - input_report_key(dev + i, BTN_START, ~data[0] & 0x08); - input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01); + input_report_key(dev + i, BTN_START, ~data_psx[i][0] & 0x08); + input_report_key(dev + i, BTN_SELECT, ~data_psx[i][0] & 0x01); - input_sync(dev + i); + input_sync(dev + i); - break; + break; - case GC_PSX_NORMAL: + case GC_PSX_NORMAL: + if(gc->pads[GC_DDR] & gc_status_bit[i]) { + for(j = 0; j < 4; j++) + input_report_key(dev + i, gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); + } else { + input_report_abs(dev + i, ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); + input_report_abs(dev + i, ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); - input_report_abs(dev + i, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); - input_report_abs(dev + i, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); + /* for some reason if the extra axes are left unset they drift */ + /* for (j = 0; j < 4; j++) + input_report_abs(dev + i, gc_psx_abs[j+2], 128); + * This needs to be debugged properly, + * maybe fuzz processing needs to be done in input_sync() + * --vojtech + */ + } - for (j = 0; j < 8; j++) - input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + for (j = 0; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); - input_report_key(dev + i, BTN_START, ~data[0] & 0x08); - input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01); + input_report_key(dev + i, BTN_START, ~data_psx[i][0] & 0x08); + input_report_key(dev + i, BTN_SELECT, ~data_psx[i][0] & 0x01); - input_sync(dev + i); + input_sync(dev + i); - break; + break; + + case 0: /* not a pad, ignore */ + break; + } } } @@ -490,8 +522,7 @@ { struct gc *gc; struct parport *pp; - int i, j, psx; - unsigned char data[32]; + int i, j; if (config[0] < 0) return NULL; @@ -588,43 +619,22 @@ break; case GC_PSX: + case GC_DDR: + if(config[i + 1] == GC_DDR) { + for (j = 0; j < 4; j++) + set_bit(gc_psx_ddr_btn[j], gc->dev[i].keybit); + } else { + for (j = 0; j < 6; j++) { + set_bit(gc_psx_abs[j], gc->dev[i].absbit); + gc->dev[i].absmin[gc_psx_abs[j]] = 4; + gc->dev[i].absmax[gc_psx_abs[j]] = 252; + gc->dev[i].absflat[gc_psx_abs[j]] = 2; + } + } - psx = gc_psx_read_packet(gc, data); + for (j = 0; j < 12; j++) + set_bit(gc_psx_btn[j], gc->dev[i].keybit); - switch(psx) { - case GC_PSX_NEGCON: - case GC_PSX_NORMAL: - case GC_PSX_ANALOG: - case GC_PSX_RUMBLE: - - for (j = 0; j < 6; j++) { - psx = gc_psx_abs[j]; - set_bit(psx, gc->dev[i].absbit); - if (j < 4) { - gc->dev[i].absmin[psx] = 4; - gc->dev[i].absmax[psx] = 252; - gc->dev[i].absflat[psx] = 2; - } else { - gc->dev[i].absmin[psx] = -1; - gc->dev[i].absmax[psx] = 1; - } - } - - for (j = 0; j < 12; j++) - set_bit(gc_psx_btn[j], gc->dev[i].keybit); - - break; - - case 0: - gc->pads[GC_PSX] &= ~gc_status_bit[i]; - printk(KERN_ERR "gamecon.c: No PSX controller found.\n"); - break; - - default: - gc->pads[GC_PSX] &= ~gc_status_bit[i]; - printk(KERN_WARNING "gamecon.c: Unsupported PSX controller %#x," - " please report to .\n", psx); - } break; } diff -Nru a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c --- a/drivers/input/joystick/iforce/iforce-main.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/iforce/iforce-main.c 2004-09-21 20:52:51 -07:00 @@ -524,7 +524,7 @@ usb_register(&iforce_usb_driver); #endif #ifdef CONFIG_JOYSTICK_IFORCE_232 - serio_register_device(&iforce_serio_dev); + serio_register_driver(&iforce_serio_drv); #endif return 0; } @@ -535,7 +535,7 @@ usb_deregister(&iforce_usb_driver); #endif #ifdef CONFIG_JOYSTICK_IFORCE_232 - serio_unregister_device(&iforce_serio_dev); + serio_unregister_driver(&iforce_serio_drv); #endif } diff -Nru a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c --- a/drivers/input/joystick/iforce/iforce-serio.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/iforce/iforce-serio.c 2004-09-21 20:52:51 -07:00 @@ -124,7 +124,7 @@ return IRQ_HANDLED; } -static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev) +static void iforce_serio_connect(struct serio *serio, struct serio_driver *drv) { struct iforce *iforce; if (serio->type != (SERIO_RS232 | SERIO_IFORCE)) @@ -137,7 +137,7 @@ iforce->serio = serio; serio->private = iforce; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(iforce); return; } @@ -158,9 +158,13 @@ kfree(iforce); } -struct serio_dev iforce_serio_dev = { - .write_wakeup = iforce_serio_write_wakeup, - .interrupt = iforce_serio_irq, - .connect = iforce_serio_connect, - .disconnect = iforce_serio_disconnect, +struct serio_driver iforce_serio_drv = { + .driver = { + .name = "iforce", + }, + .description = "RS232 I-Force joysticks and wheels driver", + .write_wakeup = iforce_serio_write_wakeup, + .interrupt = iforce_serio_irq, + .connect = iforce_serio_connect, + .disconnect = iforce_serio_disconnect, }; diff -Nru a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h --- a/drivers/input/joystick/iforce/iforce.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/joystick/iforce/iforce.h 2004-09-21 20:52:52 -07:00 @@ -187,5 +187,5 @@ int iforce_upload_condition(struct iforce*, struct ff_effect*, int is_update); /* Public variables */ -extern struct serio_dev iforce_serio_dev; +extern struct serio_driver iforce_serio_drv; extern struct usb_driver iforce_usb_driver; diff -Nru a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c --- a/drivers/input/joystick/magellan.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/magellan.c 2004-09-21 20:52:51 -07:00 @@ -35,8 +35,10 @@ #include #include +#define DRIVER_DESC "Magellan and SpaceMouse 6dof controller driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Magellan and SpaceMouse 6dof controller driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -146,7 +148,7 @@ * it as an input device. */ -static void magellan_connect(struct serio *serio, struct serio_dev *dev) +static void magellan_connect(struct serio *serio, struct serio_driver *drv) { struct magellan *magellan; int i, t; @@ -184,7 +186,7 @@ serio->private = magellan; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(magellan); return; } @@ -199,10 +201,14 @@ * The serio device structure. */ -static struct serio_dev magellan_dev = { - .interrupt = magellan_interrupt, - .connect = magellan_connect, - .disconnect = magellan_disconnect, +static struct serio_driver magellan_drv = { + .driver = { + .name = "magellan", + }, + .description = DRIVER_DESC, + .interrupt = magellan_interrupt, + .connect = magellan_connect, + .disconnect = magellan_disconnect, }; /* @@ -211,13 +217,13 @@ int __init magellan_init(void) { - serio_register_device(&magellan_dev); + serio_register_driver(&magellan_drv); return 0; } void __exit magellan_exit(void) { - serio_unregister_device(&magellan_dev); + serio_unregister_driver(&magellan_drv); } module_init(magellan_init); diff -Nru a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c --- a/drivers/input/joystick/spaceball.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/spaceball.c 2004-09-21 20:52:51 -07:00 @@ -39,8 +39,10 @@ #include #include +#define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("SpaceTec SpaceBall 2003/3003/4000 FLX driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -201,7 +203,7 @@ * it as an input device. */ -static void spaceball_connect(struct serio *serio, struct serio_dev *dev) +static void spaceball_connect(struct serio *serio, struct serio_driver *drv) { struct spaceball *spaceball; int i, t, id; @@ -254,7 +256,7 @@ serio->private = spaceball; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(spaceball); return; } @@ -269,10 +271,14 @@ * The serio device structure. */ -static struct serio_dev spaceball_dev = { - .interrupt = spaceball_interrupt, - .connect = spaceball_connect, - .disconnect = spaceball_disconnect, +static struct serio_driver spaceball_drv = { + .driver = { + .name = "spaceball", + }, + .description = DRIVER_DESC, + .interrupt = spaceball_interrupt, + .connect = spaceball_connect, + .disconnect = spaceball_disconnect, }; /* @@ -281,13 +287,13 @@ int __init spaceball_init(void) { - serio_register_device(&spaceball_dev); + serio_register_driver(&spaceball_drv); return 0; } void __exit spaceball_exit(void) { - serio_unregister_device(&spaceball_dev); + serio_unregister_driver(&spaceball_drv); } module_init(spaceball_init); diff -Nru a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c --- a/drivers/input/joystick/spaceorb.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/spaceorb.c 2004-09-21 20:52:51 -07:00 @@ -38,8 +38,10 @@ #include #include +#define DRIVER_DESC "SpaceTec SpaceOrb 360 and Avenger 6dof controller driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("SpaceTec SpaceOrb 360 and Avenger 6dof controller driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -162,7 +164,7 @@ * it as an input device. */ -static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) +static void spaceorb_connect(struct serio *serio, struct serio_driver *drv) { struct spaceorb *spaceorb; int i, t; @@ -201,7 +203,7 @@ serio->private = spaceorb; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(spaceorb); return; } @@ -213,10 +215,14 @@ * The serio device structure. */ -static struct serio_dev spaceorb_dev = { - .interrupt = spaceorb_interrupt, - .connect = spaceorb_connect, - .disconnect = spaceorb_disconnect, +static struct serio_driver spaceorb_drv = { + .driver = { + .name = "spaceorb", + }, + .description = DRIVER_DESC, + .interrupt = spaceorb_interrupt, + .connect = spaceorb_connect, + .disconnect = spaceorb_disconnect, }; /* @@ -225,13 +231,13 @@ int __init spaceorb_init(void) { - serio_register_device(&spaceorb_dev); + serio_register_driver(&spaceorb_drv); return 0; } void __exit spaceorb_exit(void) { - serio_unregister_device(&spaceorb_dev); + serio_unregister_driver(&spaceorb_drv); } module_init(spaceorb_init); diff -Nru a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c --- a/drivers/input/joystick/stinger.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/stinger.c 2004-09-21 20:52:51 -07:00 @@ -36,8 +36,10 @@ #include #include +#define DRIVER_DESC "Gravis Stinger gamepad driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Gravis Stinger gamepad driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -134,7 +136,7 @@ * it as an input device. */ -static void stinger_connect(struct serio *serio, struct serio_dev *dev) +static void stinger_connect(struct serio *serio, struct serio_driver *drv) { struct stinger *stinger; int i; @@ -172,7 +174,7 @@ stinger->dev.private = stinger; serio->private = stinger; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(stinger); return; } @@ -187,10 +189,14 @@ * The serio device structure. */ -static struct serio_dev stinger_dev = { - .interrupt = stinger_interrupt, - .connect = stinger_connect, - .disconnect = stinger_disconnect, +static struct serio_driver stinger_drv = { + .driver = { + .name = "stinger", + }, + .description = DRIVER_DESC, + .interrupt = stinger_interrupt, + .connect = stinger_connect, + .disconnect = stinger_disconnect, }; /* @@ -199,13 +205,13 @@ int __init stinger_init(void) { - serio_register_device(&stinger_dev); + serio_register_driver(&stinger_drv); return 0; } void __exit stinger_exit(void) { - serio_unregister_device(&stinger_dev); + serio_unregister_driver(&stinger_drv); } module_init(stinger_init); diff -Nru a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c --- a/drivers/input/joystick/tmdc.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/tmdc.c 2004-09-21 20:52:51 -07:00 @@ -322,7 +322,7 @@ tmdc->dev[j].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < models[m].abs && i < TMDC_ABS; i++) { - if (tmdc->abs[i] < 0) continue; + if (tmdc->abs[j][i] < 0) continue; set_bit(tmdc->abs[j][i], tmdc->dev[j].absbit); tmdc->dev[j].absmin[tmdc->abs[j][i]] = 8; tmdc->dev[j].absmax[tmdc->abs[j][i]] = 248; diff -Nru a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c --- a/drivers/input/joystick/twidjoy.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/joystick/twidjoy.c 2004-09-21 20:52:51 -07:00 @@ -187,7 +187,7 @@ * it as an input device. */ -static void twidjoy_connect(struct serio *serio, struct serio_dev *dev) +static void twidjoy_connect(struct serio *serio, struct serio_driver *drv) { struct twidjoy_button_spec *bp; struct twidjoy *twidjoy; @@ -232,7 +232,7 @@ twidjoy->dev.private = twidjoy; serio->private = twidjoy; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(twidjoy); return; } @@ -246,10 +246,14 @@ * The serio device structure. */ -static struct serio_dev twidjoy_dev = { - .interrupt = twidjoy_interrupt, - .connect = twidjoy_connect, - .disconnect = twidjoy_disconnect, +static struct serio_driver twidjoy_drv = { + .driver = { + .name = "twidjoy", + }, + .description = DRIVER_DESC, + .interrupt = twidjoy_interrupt, + .connect = twidjoy_connect, + .disconnect = twidjoy_disconnect, }; /* @@ -258,13 +262,13 @@ int __init twidjoy_init(void) { - serio_register_device(&twidjoy_dev); + serio_register_driver(&twidjoy_drv); return 0; } void __exit twidjoy_exit(void) { - serio_unregister_device(&twidjoy_dev); + serio_unregister_driver(&twidjoy_drv); } module_init(twidjoy_init); diff -Nru a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c --- a/drivers/input/joystick/warrior.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/joystick/warrior.c 2004-09-21 20:52:52 -07:00 @@ -35,8 +35,10 @@ #include #include +#define DRIVER_DESC "Logitech WingMan Warrior joystick driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Logitech WingMan Warrior joystick driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -139,7 +141,7 @@ * it as an input device. */ -static void warrior_connect(struct serio *serio, struct serio_dev *dev) +static void warrior_connect(struct serio *serio, struct serio_driver *drv) { struct warrior *warrior; int i; @@ -185,7 +187,7 @@ serio->private = warrior; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(warrior); return; } @@ -199,10 +201,14 @@ * The serio device structure. */ -static struct serio_dev warrior_dev = { - .interrupt = warrior_interrupt, - .connect = warrior_connect, - .disconnect = warrior_disconnect, +static struct serio_driver warrior_drv = { + .driver = { + .name = "warrior", + }, + .description = DRIVER_DESC, + .interrupt = warrior_interrupt, + .connect = warrior_connect, + .disconnect = warrior_disconnect, }; /* @@ -211,13 +217,13 @@ int __init warrior_init(void) { - serio_register_device(&warrior_dev); + serio_register_driver(&warrior_drv); return 0; } void __exit warrior_exit(void) { - serio_unregister_device(&warrior_dev); + serio_unregister_driver(&warrior_drv); } module_init(warrior_init); diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c --- a/drivers/input/keyboard/atkbd.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/keyboard/atkbd.c 2004-09-21 20:52:52 -07:00 @@ -27,8 +27,10 @@ #include #include +#define DRIVER_DESC "AT and PS/2 keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static int atkbd_set = 2; @@ -47,6 +49,10 @@ module_param_named(softrepeat, atkbd_softrepeat, bool, 0); MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); +static int atkbd_softraw = 1; +module_param_named(softraw, atkbd_softraw, bool, 0); +MODULE_PARM_DESC(softraw, "Use software generated rawmode"); + static int atkbd_scroll; module_param_named(scroll, atkbd_scroll, bool, 0); MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); @@ -164,36 +170,64 @@ { ATKBD_SCR_CLICK, 0x60 }, }; +#define ATKBD_FLAG_ACK 0 /* Waiting for ACK/NAK */ +#define ATKBD_FLAG_CMD 1 /* Waiting for command to finish */ +#define ATKBD_FLAG_CMD1 2 /* First byte of command response */ +#define ATKBD_FLAG_ENABLED 3 /* Waining for init to finish */ + /* * The atkbd control structure */ struct atkbd { - unsigned char keycode[512]; - struct input_dev dev; - struct serio *serio; + /* Written only during init */ char name[64]; char phys[32]; - unsigned short id; + struct serio *serio; + struct input_dev dev; + unsigned char set; - unsigned int translated:1; - unsigned int extra:1; - unsigned int write:1; + unsigned short id; + unsigned char keycode[512]; + unsigned char translated; + unsigned char extra; + unsigned char write; + + /* Protected by FLAG_ACK */ + unsigned char nak; + /* Protected by FLAG_CMD */ unsigned char cmdbuf[4]; unsigned char cmdcnt; - volatile signed char ack; - unsigned char emul; - unsigned int resend:1; - unsigned int release:1; - unsigned int bat_xl:1; - unsigned int enabled:1; + /* Accessed only from interrupt */ + unsigned char emul; + unsigned char resend; + unsigned char release; + unsigned char bat_xl; unsigned int last; unsigned long time; + + /* Ensures that only one command is executing at a time */ + struct semaphore cmd_sem; + + /* Used to signal completion from interrupt handler */ + wait_queue_head_t wait; + + /* Flags */ + unsigned long flags; }; +/* Work structure to schedule execution of a command */ +struct atkbd_work { + struct work_struct work; + struct atkbd *atkbd; + int command; + unsigned char param[0]; +}; + + static void atkbd_report_key(struct input_dev *dev, struct pt_regs *regs, int code, int value) { input_regs(dev, regs); @@ -224,7 +258,7 @@ #if !defined(__i386__) && !defined (__x86_64__) if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { - printk("atkbd.c: frame/parity error: %02x\n", flags); + printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); serio_write(serio, ATKBD_CMD_RESEND); atkbd->resend = 1; goto out; @@ -234,24 +268,46 @@ atkbd->resend = 0; #endif - if (!atkbd->ack) + if (test_bit(ATKBD_FLAG_ACK, &atkbd->flags)) { switch (code) { case ATKBD_RET_ACK: - atkbd->ack = 1; - goto out; + atkbd->nak = 0; + if (atkbd->cmdcnt) { + set_bit(ATKBD_FLAG_CMD, &atkbd->flags); + set_bit(ATKBD_FLAG_CMD1, &atkbd->flags); + } + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + break; case ATKBD_RET_NAK: - atkbd->ack = -1; - goto out; + atkbd->nak = 1; + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + break; } + goto out; + } + + if (test_bit(ATKBD_FLAG_CMD, &atkbd->flags)) { + + if (atkbd->cmdcnt) + atkbd->cmdbuf[--atkbd->cmdcnt] = code; - if (atkbd->cmdcnt) { - atkbd->cmdbuf[--atkbd->cmdcnt] = code; + if (test_and_clear_bit(ATKBD_FLAG_CMD1, &atkbd->flags) && atkbd->cmdcnt) + wake_up_interruptible(&atkbd->wait); + + if (!atkbd->cmdcnt) { + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + } goto out; } - if (!atkbd->enabled) + if (!test_bit(ATKBD_FLAG_ENABLED, &atkbd->flags)) goto out; + input_event(&atkbd->dev, EV_MSC, MSC_RAW, code); + if (atkbd->translated) { if (atkbd->emul || @@ -270,6 +326,7 @@ switch (code) { case ATKBD_RET_BAT: + clear_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); serio_rescan(atkbd->serio); goto out; case ATKBD_RET_EMUL0: @@ -300,6 +357,9 @@ code |= (atkbd->set != 3) ? 0x80 : 0x100; } + if (atkbd->keycode[code] != ATKBD_KEY_NULL) + input_event(&atkbd->dev, EV_MSC, MSC_SCAN, code); + switch (atkbd->keycode[code]) { case ATKBD_KEY_NULL: break; @@ -372,83 +432,147 @@ * acknowledge. It doesn't handle resends according to the keyboard * protocol specs, because if these are needed, the keyboard needs * replacement anyway, and they only make a mess in the protocol. + * + * atkbd_sendbyte() can only be called from a process context */ static int atkbd_sendbyte(struct atkbd *atkbd, unsigned char byte) { - int timeout = 20000; /* 200 msec */ - atkbd->ack = 0; - #ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Sent: %02x\n", byte); #endif - if (serio_write(atkbd->serio, byte)) - return -1; + atkbd->nak = 1; + set_bit(ATKBD_FLAG_ACK, &atkbd->flags); - while (!atkbd->ack && timeout--) udelay(10); + if (serio_write(atkbd->serio, byte) == 0) + wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_ACK, &atkbd->flags), + msecs_to_jiffies(200)); - return -(atkbd->ack <= 0); + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + return -atkbd->nak; } /* * atkbd_command() sends a command, and its parameters to the keyboard, * then waits for the response and puts it in the param array. + * + * atkbd_command() can only be called from a process context */ static int atkbd_command(struct atkbd *atkbd, unsigned char *param, int command) { - int timeout = 500000; /* 500 msec */ + int timeout; int send = (command >> 12) & 0xf; int receive = (command >> 8) & 0xf; + int rc = -1; int i; - atkbd->cmdcnt = receive; + timeout = msecs_to_jiffies(command == ATKBD_CMD_RESET_BAT ? 4000 : 500); - if (command == ATKBD_CMD_RESET_BAT) - timeout = 2000000; /* 2 sec */ + down(&atkbd->cmd_sem); + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); if (receive && param) for (i = 0; i < receive; i++) atkbd->cmdbuf[(receive - 1) - i] = param[i]; + atkbd->cmdcnt = receive; + if (command & 0xff) if (atkbd_sendbyte(atkbd, command & 0xff)) - return (atkbd->cmdcnt = 0) - 1; + goto out; for (i = 0; i < send; i++) if (atkbd_sendbyte(atkbd, param[i])) - return (atkbd->cmdcnt = 0) - 1; - - while (atkbd->cmdcnt && timeout--) { + goto out; - if (atkbd->cmdcnt == 1 && - command == ATKBD_CMD_RESET_BAT && timeout > 100000) - timeout = 100000; + timeout = wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_CMD1, &atkbd->flags), timeout); - if (atkbd->cmdcnt == 1 && command == ATKBD_CMD_GETID && - atkbd->cmdbuf[1] != 0xab && atkbd->cmdbuf[1] != 0xac) { + if (atkbd->cmdcnt && timeout > 0) { + if (command == ATKBD_CMD_RESET_BAT && jiffies_to_msecs(timeout) > 100) + timeout = msecs_to_jiffies(100); + + if (command == ATKBD_CMD_GETID && + atkbd->cmdbuf[receive - 1] != 0xab && atkbd->cmdbuf[receive - 1] != 0xac) { + /* + * Device behind the port is not a keyboard + * so we don't need to wait for the 2nd byte + * of ID response. + */ + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); atkbd->cmdcnt = 0; - break; } - udelay(1); + wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_CMD, &atkbd->flags), timeout); } if (param) for (i = 0; i < receive; i++) param[i] = atkbd->cmdbuf[(receive - 1) - i]; - if (command == ATKBD_CMD_RESET_BAT && atkbd->cmdcnt == 1) - atkbd->cmdcnt = 0; + if (atkbd->cmdcnt && (command != ATKBD_CMD_RESET_BAT || atkbd->cmdcnt != 1)) + goto out; + + rc = 0; + +out: + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); + clear_bit(ATKBD_FLAG_CMD1, &atkbd->flags); + up(&atkbd->cmd_sem); + + return rc; +} + +/* + * atkbd_execute_scheduled_command() sends a command, previously scheduled by + * atkbd_schedule_command(), to the keyboard. + */ + +static void atkbd_execute_scheduled_command(void *data) +{ + struct atkbd_work *atkbd_work = data; + + atkbd_command(atkbd_work->atkbd, atkbd_work->param, atkbd_work->command); + + kfree(atkbd_work); +} + +/* + * atkbd_schedule_command() allows to schedule delayed execution of a keyboard + * command and can be used to issue a command from an interrupt or softirq + * context. + */ + +static int atkbd_schedule_command(struct atkbd *atkbd, unsigned char *param, int command) +{ + struct atkbd_work *atkbd_work; + int send = (command >> 12) & 0xf; + int receive = (command >> 8) & 0xf; + + if (!test_bit(ATKBD_FLAG_ENABLED, &atkbd->flags)) + return -1; - if (atkbd->cmdcnt) { - atkbd->cmdcnt = 0; + if (!(atkbd_work = kmalloc(sizeof(struct atkbd_work) + max(send, receive), GFP_ATOMIC))) + return -1; + + memset(atkbd_work, 0, sizeof(struct atkbd_work)); + atkbd_work->atkbd = atkbd; + atkbd_work->command = command; + memcpy(atkbd_work->param, param, send); + INIT_WORK(&atkbd_work->work, atkbd_execute_scheduled_command, atkbd_work); + + if (!schedule_work(&atkbd_work->work)) { + kfree(atkbd_work); return -1; } return 0; } + /* * Event callback from the input module. Events that change the state of * the hardware are processed here. @@ -475,7 +599,7 @@ param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | (test_bit(LED_NUML, dev->led) ? 2 : 0) | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); - atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_SETLEDS); if (atkbd->extra) { param[0] = 0; @@ -484,7 +608,7 @@ | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); - atkbd_command(atkbd, param, ATKBD_CMD_EX_SETLEDS); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_EX_SETLEDS); } return 0; @@ -500,7 +624,7 @@ dev->rep[REP_PERIOD] = period[i]; dev->rep[REP_DELAY] = delay[j]; param[0] = i | (j << 5); - atkbd_command(atkbd, param, ATKBD_CMD_SETREP); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_SETREP); return 0; } @@ -672,6 +796,11 @@ static void atkbd_disconnect(struct serio *serio) { struct atkbd *atkbd = serio->private; + + clear_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + synchronize_kernel(); + flush_scheduled_work(); + input_unregister_device(&atkbd->dev); serio_close(serio); kfree(atkbd); @@ -684,7 +813,7 @@ * to the input module. */ -static void atkbd_connect(struct serio *serio, struct serio_dev *dev) +static void atkbd_connect(struct serio *serio, struct serio_driver *drv) { struct atkbd *atkbd; int i; @@ -693,6 +822,9 @@ return; memset(atkbd, 0, sizeof(struct atkbd)); + init_MUTEX(&atkbd->cmd_sem); + init_waitqueue_head(&atkbd->wait); + switch (serio->type & SERIO_TYPE) { case SERIO_8042_XL: @@ -709,17 +841,22 @@ return; } + if (!atkbd->write) + atkbd_softrepeat = 1; + if (atkbd_softrepeat) + atkbd_softraw = 1; + if (atkbd->write) { - atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); + atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP) | BIT(EV_MSC); atkbd->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); - } else atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); + } else atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); + atkbd->dev.mscbit[0] = atkbd_softraw ? BIT(MSC_SCAN) : BIT(MSC_RAW) | BIT(MSC_SCAN); if (!atkbd_softrepeat) { atkbd->dev.rep[REP_DELAY] = 250; atkbd->dev.rep[REP_PERIOD] = 33; - } + } else atkbd_softraw = 1; - atkbd->ack = 1; atkbd->serio = serio; init_input_dev(&atkbd->dev); @@ -732,7 +869,7 @@ serio->private = atkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(atkbd); return; } @@ -754,8 +891,6 @@ atkbd->id = 0xab00; } - atkbd->enabled = 1; - if (atkbd->extra) { atkbd->dev.ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC); sprintf(atkbd->name, "AT Set 2 Extra keyboard"); @@ -797,6 +932,8 @@ input_register_device(&atkbd->dev); + set_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + printk(KERN_INFO "input: %s on %s\n", atkbd->name, serio->phys); } @@ -808,10 +945,10 @@ static int atkbd_reconnect(struct serio *serio) { struct atkbd *atkbd = serio->private; - struct serio_dev *dev = serio->dev; + struct serio_driver *drv = serio->drv; unsigned char param[1]; - if (!dev) { + if (!drv) { printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } @@ -832,26 +969,32 @@ return -1; } + set_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + return 0; } -static struct serio_dev atkbd_dev = { - .interrupt = atkbd_interrupt, - .connect = atkbd_connect, - .reconnect = atkbd_reconnect, - .disconnect = atkbd_disconnect, - .cleanup = atkbd_cleanup, +static struct serio_driver atkbd_drv = { + .driver = { + .name = "atkbd", + }, + .description = DRIVER_DESC, + .interrupt = atkbd_interrupt, + .connect = atkbd_connect, + .reconnect = atkbd_reconnect, + .disconnect = atkbd_disconnect, + .cleanup = atkbd_cleanup, }; int __init atkbd_init(void) { - serio_register_device(&atkbd_dev); + serio_register_driver(&atkbd_drv); return 0; } void __exit atkbd_exit(void) { - serio_unregister_device(&atkbd_dev); + serio_unregister_driver(&atkbd_drv); } module_init(atkbd_init); diff -Nru a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c --- a/drivers/input/keyboard/lkkbd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/keyboard/lkkbd.c 2004-09-21 20:52:51 -07:00 @@ -76,8 +76,10 @@ #include #include +#define DRIVER_DESC "LK keyboard driver" + MODULE_AUTHOR ("Jan-Benedict Glaw "); -MODULE_DESCRIPTION ("LK keyboard driver"); +MODULE_DESCRIPTION (DRIVER_DESC); MODULE_LICENSE ("GPL"); /* @@ -622,7 +624,7 @@ * lkkbd_connect() probes for a LK keyboard and fills the necessary structures. */ static void -lkkbd_connect (struct serio *serio, struct serio_dev *dev) +lkkbd_connect (struct serio *serio, struct serio_driver *drv) { struct lkkbd *lk; int i; @@ -665,7 +667,7 @@ serio->private = lk; - if (serio_open (serio, dev)) { + if (serio_open (serio, drv)) { kfree (lk); return; } @@ -703,10 +705,14 @@ kfree (lk); } -static struct serio_dev lkkbd_dev = { - .connect = lkkbd_connect, - .disconnect = lkkbd_disconnect, - .interrupt = lkkbd_interrupt, +static struct serio_driver lkkbd_drv = { + .driver = { + .name = "lkkbd", + }, + .description = DRIVER_DESC, + .connect = lkkbd_connect, + .disconnect = lkkbd_disconnect, + .interrupt = lkkbd_interrupt, }; /* @@ -715,14 +721,14 @@ int __init lkkbd_init (void) { - serio_register_device (&lkkbd_dev); + serio_register_driver(&lkkbd_drv); return 0; } void __exit lkkbd_exit (void) { - serio_unregister_device (&lkkbd_dev); + serio_unregister_driver(&lkkbd_drv); } module_init (lkkbd_init); diff -Nru a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c --- a/drivers/input/keyboard/newtonkbd.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/keyboard/newtonkbd.c 2004-09-21 20:52:52 -07:00 @@ -32,8 +32,10 @@ #include #include +#define DRIVER_DESC "Newton keyboard driver" + MODULE_AUTHOR("Justin Cormack "); -MODULE_DESCRIPTION("Newton keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); #define NKBD_KEY 0x7f @@ -82,7 +84,7 @@ } -void nkbd_connect(struct serio *serio, struct serio_dev *dev) +void nkbd_connect(struct serio *serio, struct serio_driver *drv) { struct nkbd *nkbd; int i; @@ -106,7 +108,7 @@ nkbd->dev.private = nkbd; serio->private = nkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(nkbd); return; } @@ -138,21 +140,25 @@ kfree(nkbd); } -struct serio_dev nkbd_dev = { - .interrupt = nkbd_interrupt, - .connect = nkbd_connect, - .disconnect = nkbd_disconnect +struct serio_driver nkbd_drv = { + .driver = { + .name = "newtonkbd", + }, + .description = DRIVER_DESC, + .interrupt = nkbd_interrupt, + .connect = nkbd_connect, + .disconnect = nkbd_disconnect, }; int __init nkbd_init(void) { - serio_register_device(&nkbd_dev); + serio_register_driver(&nkbd_drv); return 0; } void __exit nkbd_exit(void) { - serio_unregister_device(&nkbd_dev); + serio_unregister_driver(&nkbd_drv); } module_init(nkbd_init); diff -Nru a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c --- a/drivers/input/keyboard/sunkbd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/keyboard/sunkbd.c 2004-09-21 20:52:51 -07:00 @@ -37,8 +37,10 @@ #include #include +#define DRIVER_DESC "Sun keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Sun keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static unsigned char sunkbd_keycode[128] = { @@ -221,7 +223,7 @@ * sunkbd_connect() probes for a Sun keyboard and fills the necessary structures. */ -static void sunkbd_connect(struct serio *serio, struct serio_dev *dev) +static void sunkbd_connect(struct serio *serio, struct serio_driver *drv) { struct sunkbd *sunkbd; int i; @@ -257,7 +259,7 @@ serio->private = sunkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(sunkbd); return; } @@ -301,10 +303,14 @@ kfree(sunkbd); } -static struct serio_dev sunkbd_dev = { - .interrupt = sunkbd_interrupt, - .connect = sunkbd_connect, - .disconnect = sunkbd_disconnect +static struct serio_driver sunkbd_drv = { + .driver = { + .name = "sunkbd", + }, + .description = DRIVER_DESC, + .interrupt = sunkbd_interrupt, + .connect = sunkbd_connect, + .disconnect = sunkbd_disconnect, }; /* @@ -313,13 +319,13 @@ int __init sunkbd_init(void) { - serio_register_device(&sunkbd_dev); + serio_register_driver(&sunkbd_drv); return 0; } void __exit sunkbd_exit(void) { - serio_unregister_device(&sunkbd_dev); + serio_unregister_driver(&sunkbd_drv); } module_init(sunkbd_init); diff -Nru a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c --- a/drivers/input/keyboard/xtkbd.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/keyboard/xtkbd.c 2004-09-21 20:52:52 -07:00 @@ -34,8 +34,10 @@ #include #include +#define DRIVER_DESC "XT keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("XT keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); #define XTKBD_EMUL0 0xe0 @@ -86,7 +88,7 @@ return IRQ_HANDLED; } -void xtkbd_connect(struct serio *serio, struct serio_dev *dev) +void xtkbd_connect(struct serio *serio, struct serio_driver *drv) { struct xtkbd *xtkbd; int i; @@ -111,7 +113,7 @@ serio->private = xtkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(xtkbd); return; } @@ -143,21 +145,25 @@ kfree(xtkbd); } -struct serio_dev xtkbd_dev = { - .interrupt = xtkbd_interrupt, - .connect = xtkbd_connect, - .disconnect = xtkbd_disconnect +struct serio_driver xtkbd_drv = { + .driver = { + .name = "xtkbd", + }, + .description = DRIVER_DESC, + .interrupt = xtkbd_interrupt, + .connect = xtkbd_connect, + .disconnect = xtkbd_disconnect, }; int __init xtkbd_init(void) { - serio_register_device(&xtkbd_dev); + serio_register_driver(&xtkbd_drv); return 0; } void __exit xtkbd_exit(void) { - serio_unregister_device(&xtkbd_dev); + serio_unregister_driver(&xtkbd_drv); } module_init(xtkbd_init); diff -Nru a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig --- a/drivers/input/misc/Kconfig 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/misc/Kconfig 2004-09-21 20:52:51 -07:00 @@ -14,7 +14,7 @@ config INPUT_PCSPKR tristate "PC Speaker support" - depends on (ALPHA || X86 || X86_64 || MIPS) && INPUT && INPUT_MISC + depends on (ALPHA || X86 || X86_64 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES) && INPUT && INPUT_MISC help Say Y here if you want the standard PC Speaker to be used for bells and whistles. diff -Nru a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c --- a/drivers/input/misc/uinput.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/misc/uinput.c 2004-09-21 20:52:52 -07:00 @@ -279,6 +279,9 @@ { struct uinput_device *udev = file->private_data; + if (!test_bit(UIST_CREATED, &(udev->state))) + return 0; + poll_wait(file, &udev->waitq, wait); if (udev->head != udev->tail) diff -Nru a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig --- a/drivers/input/mouse/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mouse/Kconfig 2004-09-21 20:52:52 -07:00 @@ -30,8 +30,6 @@ and a new verion of GPM at: http://www.geocities.com/dt_or/gpm/gpm.html to take advantage of the advanced features of the touchpad. - If you do not want install specialized drivers but want tapping - working please use option psmouse.proto=imps. If unsure, say Y. diff -Nru a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c --- a/drivers/input/mouse/logips2pp.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mouse/logips2pp.c 2004-09-21 20:52:52 -07:00 @@ -277,7 +277,7 @@ protocol = PSMOUSE_PS2TPP; } - } else if (get_model_info(model) != NULL) { + } else if (model_info != NULL) { param[0] = param[1] = param[2] = 0; ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c --- a/drivers/input/mouse/psmouse-base.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/mouse/psmouse-base.c 2004-09-21 20:52:51 -07:00 @@ -22,8 +22,10 @@ #include "synaptics.h" #include "logips2pp.h" +#define DRIVER_DESC "PS/2 mouse driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("PS/2 mouse driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static char *psmouse_proto; @@ -142,37 +144,67 @@ printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", flags & SERIO_TIMEOUT ? " timeout" : "", flags & SERIO_PARITY ? " bad parity" : ""); - if (psmouse->acking) { - psmouse->ack = -1; - psmouse->acking = 0; - } - psmouse->pktcnt = 0; + psmouse->nak = 1; + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); goto out; } - if (psmouse->acking) { + if (test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags)) { switch (data) { case PSMOUSE_RET_ACK: - psmouse->ack = 1; + psmouse->nak = 0; break; + case PSMOUSE_RET_NAK: - psmouse->ack = -1; + psmouse->nak = 1; break; + + /* + * Workaround for mice which don't ACK the Get ID command. + * These are valid mouse IDs that we recognize. + */ + case 0x00: + case 0x03: + case 0x04: + if (test_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags)) { + psmouse->nak = 0; + break; + } + /* Fall through */ default: - psmouse->ack = 1; /* Workaround for mice which don't ACK the Get ID command */ - if (psmouse->cmdcnt) - psmouse->cmdbuf[--psmouse->cmdcnt] = data; - break; + goto out; } - psmouse->acking = 0; - goto out; + + if (!psmouse->nak && psmouse->cmdcnt) { + set_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + set_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags); + } + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); + + if (data == PSMOUSE_RET_ACK || data == PSMOUSE_RET_NAK) + goto out; } - if (psmouse->cmdcnt) { - psmouse->cmdbuf[--psmouse->cmdcnt] = data; + if (test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags)) { + if (psmouse->cmdcnt) + psmouse->cmdbuf[--psmouse->cmdcnt] = data; + + if (test_and_clear_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags) && psmouse->cmdcnt) + wake_up_interruptible(&psmouse->wait); + + if (!psmouse->cmdcnt) { + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); + } goto out; } + if (psmouse->state == PSMOUSE_INITIALIZING) + goto out; + if (psmouse->state == PSMOUSE_ACTIVATED && psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n", @@ -238,78 +270,96 @@ * psmouse_sendbyte() sends a byte to the mouse, and waits for acknowledge. * It doesn't handle retransmission, though it could - because when there would * be need for retransmissions, the mouse has to be replaced anyway. + * + * psmouse_sendbyte() can only be called from a process context */ static int psmouse_sendbyte(struct psmouse *psmouse, unsigned char byte) { - int timeout = 10000; /* 100 msec */ - psmouse->ack = 0; - psmouse->acking = 1; - - if (serio_write(psmouse->serio, byte)) { - psmouse->acking = 0; - return -1; - } + psmouse->nak = 1; + set_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); - while (!psmouse->ack && timeout--) udelay(10); + if (serio_write(psmouse->serio, byte) == 0) + wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags), + msecs_to_jiffies(200)); - return -(psmouse->ack <= 0); + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + return -psmouse->nak; } /* * psmouse_command() sends a command and its parameters to the mouse, * then waits for the response and puts it in the param array. + * + * psmouse_command() can only be called from a process context */ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) { - int timeout = 500000; /* 500 msec */ + int timeout; int send = (command >> 12) & 0xf; int receive = (command >> 8) & 0xf; + int rc = -1; int i; - psmouse->cmdcnt = receive; + timeout = msecs_to_jiffies(command == PSMOUSE_CMD_RESET_BAT ? 4000 : 500); - if (command == PSMOUSE_CMD_RESET_BAT) - timeout = 4000000; /* 4 sec */ + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + if (command == PSMOUSE_CMD_GETID) + set_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags); + + if (receive && param) + for (i = 0; i < receive; i++) + psmouse->cmdbuf[(receive - 1) - i] = param[i]; - /* initialize cmdbuf with preset values from param */ - if (receive) - for (i = 0; i < receive; i++) - psmouse->cmdbuf[(receive - 1) - i] = param[i]; + psmouse->cmdcnt = receive; if (command & 0xff) if (psmouse_sendbyte(psmouse, command & 0xff)) - return (psmouse->cmdcnt = 0) - 1; + goto out; for (i = 0; i < send; i++) if (psmouse_sendbyte(psmouse, param[i])) - return (psmouse->cmdcnt = 0) - 1; - - while (psmouse->cmdcnt && timeout--) { + goto out; - if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT && - timeout > 100000) /* do not run in a endless loop */ - timeout = 100000; /* 1 sec */ + timeout = wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags), timeout); - if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID && - psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) { + if (psmouse->cmdcnt && timeout > 0) { + if (command == PSMOUSE_CMD_RESET_BAT && jiffies_to_msecs(timeout) > 100) + timeout = msecs_to_jiffies(100); + + if (command == PSMOUSE_CMD_GETID && + psmouse->cmdbuf[receive - 1] != 0xab && psmouse->cmdbuf[receive - 1] != 0xac) { + /* + * Device behind the port is not a keyboard + * so we don't need to wait for the 2nd byte + * of ID response. + */ + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); psmouse->cmdcnt = 0; - break; } - udelay(1); + wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags), timeout); } - for (i = 0; i < receive; i++) - param[i] = psmouse->cmdbuf[(receive - 1) - i]; + if (param) + for (i = 0; i < receive; i++) + param[i] = psmouse->cmdbuf[(receive - 1) - i]; - if (psmouse->cmdcnt) - return (psmouse->cmdcnt = 0) - 1; + if (psmouse->cmdcnt && (command != PSMOUSE_CMD_RESET_BAT || psmouse->cmdcnt != 1)) + goto out; - return 0; -} + rc = 0; +out: + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags); + return rc; +} /* * psmouse_sliced_command() sends an extended PS/2 command to the mouse @@ -394,6 +444,8 @@ { unsigned char param[2]; + intellimouse_detect(psmouse); + param[0] = 200; psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE); param[0] = 200; @@ -598,6 +650,21 @@ } /* + * psmouse_set_state() sets new psmouse state and resets all flags and + * counters while holding serio lock so fighting with interrupt handler + * is not a concern. + */ + +static void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) +{ + serio_pause_rx(psmouse->serio); + psmouse->state = new_state; + psmouse->pktcnt = psmouse->cmdcnt = psmouse->out_of_sync = 0; + psmouse->flags = 0; + serio_continue_rx(psmouse->serio); +} + +/* * psmouse_activate() enables the mouse so that we get motion reports from it. */ @@ -606,9 +673,24 @@ if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE)) printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->serio->phys); - psmouse->state = PSMOUSE_ACTIVATED; + psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); } + +/* + * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion + * reports from it unless we explicitely request it. + */ + +static void psmouse_deactivate(struct psmouse *psmouse) +{ + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_DISABLE)) + printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n", psmouse->serio->phys); + + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); +} + + /* * psmouse_cleanup() resets the mouse into power-on state. */ @@ -626,22 +708,21 @@ static void psmouse_disconnect(struct serio *serio) { - struct psmouse *psmouse = serio->private; + struct psmouse *psmouse, *parent; - psmouse->state = PSMOUSE_CMD_MODE; + psmouse = serio->private; + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); - if (psmouse->ptport) { - if (psmouse->ptport->deactivate) - psmouse->ptport->deactivate(psmouse); - __serio_unregister_port(&psmouse->ptport->serio); /* we have serio_sem */ - kfree(psmouse->ptport); - psmouse->ptport = NULL; + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + if (parent->pt_deactivate) + parent->pt_deactivate(parent); } if (psmouse->disconnect) psmouse->disconnect(psmouse); - psmouse->state = PSMOUSE_IGNORE; + psmouse_set_state(psmouse, PSMOUSE_IGNORE); input_unregister_device(&psmouse->dev); serio_close(serio); @@ -652,39 +733,49 @@ * psmouse_connect() is a callback from the serio module when * an unhandled serio port is found. */ -static void psmouse_connect(struct serio *serio, struct serio_dev *dev) +static void psmouse_connect(struct serio *serio, struct serio_driver *drv) { - struct psmouse *psmouse; + struct psmouse *psmouse, *parent = NULL; if ((serio->type & SERIO_TYPE) != SERIO_8042 && (serio->type & SERIO_TYPE) != SERIO_PS_PSTHRU) return; + /* + * If this is a pass-through port deactivate parent so the device + * connected to this port can be successfully identified + */ + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + psmouse_deactivate(parent); + } + if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL))) - return; + goto out; memset(psmouse, 0, sizeof(struct psmouse)); + init_waitqueue_head(&psmouse->wait); init_input_dev(&psmouse->dev); psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); - psmouse->state = PSMOUSE_CMD_MODE; psmouse->serio = serio; psmouse->dev.private = psmouse; + psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); serio->private = psmouse; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(psmouse); serio->private = NULL; - return; + goto out; } if (psmouse_probe(psmouse) < 0) { serio_close(serio); kfree(psmouse); serio->private = NULL; - return; + goto out; } psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); @@ -711,63 +802,88 @@ printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys); + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_initialize(psmouse); - if (psmouse->ptport) { - printk(KERN_INFO "serio: %s port at %s\n", psmouse->ptport->serio.name, psmouse->phys); - __serio_register_port(&psmouse->ptport->serio); /* we have serio_sem */ - if (psmouse->ptport->activate) - psmouse->ptport->activate(psmouse); + if (parent && parent->pt_activate) + parent->pt_activate(parent); + + if (serio->child) { + /* + * Nothing to be done here, serio core will detect that + * the driver set serio->child and will register it for us. + */ + printk(KERN_INFO "serio: %s port at %s\n", serio->child->name, psmouse->phys); } psmouse_activate(psmouse); + +out: + /* If this is a pass-through port the parent awaits to be activated */ + if (parent) + psmouse_activate(parent); } static int psmouse_reconnect(struct serio *serio) { struct psmouse *psmouse = serio->private; - struct serio_dev *dev = serio->dev; + struct psmouse *parent = NULL; + struct serio_driver *drv = serio->drv; + int rc = -1; - if (!dev || !psmouse) { + if (!drv || !psmouse) { printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } - psmouse->state = PSMOUSE_CMD_MODE; - psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = psmouse->out_of_sync = 0; + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + psmouse_deactivate(parent); + } + + psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); + if (psmouse->reconnect) { if (psmouse->reconnect(psmouse)) - return -1; + goto out; } else if (psmouse_probe(psmouse) < 0 || psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) - return -1; + goto out; /* ok, the device type (and capabilities) match the old one, * we can continue using it, complete intialization */ + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_initialize(psmouse); - if (psmouse->ptport) { - if (psmouse_reconnect(&psmouse->ptport->serio)) { - __serio_unregister_port(&psmouse->ptport->serio); - __serio_register_port(&psmouse->ptport->serio); - if (psmouse->ptport->activate) - psmouse->ptport->activate(psmouse); - } - } + if (parent && parent->pt_activate) + parent->pt_activate(parent); psmouse_activate(psmouse); - return 0; + rc = 0; + +out: + /* If this is a pass-through port the parent waits to be activated */ + if (parent) + psmouse_activate(parent); + + return rc; } -static struct serio_dev psmouse_dev = { - .interrupt = psmouse_interrupt, - .connect = psmouse_connect, - .reconnect = psmouse_reconnect, - .disconnect = psmouse_disconnect, - .cleanup = psmouse_cleanup, +static struct serio_driver psmouse_drv = { + .driver = { + .name = "psmouse", + }, + .description = DRIVER_DESC, + .interrupt = psmouse_interrupt, + .connect = psmouse_connect, + .reconnect = psmouse_reconnect, + .disconnect = psmouse_disconnect, + .cleanup = psmouse_cleanup, }; static inline void psmouse_parse_proto(void) @@ -787,13 +903,13 @@ int __init psmouse_init(void) { psmouse_parse_proto(); - serio_register_device(&psmouse_dev); + serio_register_driver(&psmouse_drv); return 0; } void __exit psmouse_exit(void) { - serio_unregister_device(&psmouse_dev); + serio_unregister_driver(&psmouse_drv); } module_init(psmouse_init); diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h --- a/drivers/input/mouse/psmouse.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mouse/psmouse.h 2004-09-21 20:52:52 -07:00 @@ -9,6 +9,7 @@ #define PSMOUSE_CMD_GETID 0x02f2 #define PSMOUSE_CMD_SETRATE 0x10f3 #define PSMOUSE_CMD_ENABLE 0x00f4 +#define PSMOUSE_CMD_DISABLE 0x00f5 #define PSMOUSE_CMD_RESET_DIS 0x00f6 #define PSMOUSE_CMD_RESET_BAT 0x02ff @@ -17,10 +18,17 @@ #define PSMOUSE_RET_ACK 0xfa #define PSMOUSE_RET_NAK 0xfe -/* psmouse states */ -#define PSMOUSE_CMD_MODE 0 -#define PSMOUSE_ACTIVATED 1 -#define PSMOUSE_IGNORE 2 +#define PSMOUSE_FLAG_ACK 0 /* Waiting for ACK/NAK */ +#define PSMOUSE_FLAG_CMD 1 /* Waiting for command to finish */ +#define PSMOUSE_FLAG_CMD1 2 /* Waiting for the first byte of command response */ +#define PSMOUSE_FLAG_WAITID 3 /* Command execiting is GET ID */ + +enum psmouse_state { + PSMOUSE_IGNORE, + PSMOUSE_INITIALIZING, + PSMOUSE_CMD_MODE, + PSMOUSE_ACTIVATED, +}; /* psmouse protocol handler return codes */ typedef enum { @@ -29,20 +37,10 @@ PSMOUSE_FULL_PACKET } psmouse_ret_t; -struct psmouse; - -struct psmouse_ptport { - struct serio serio; - - void (*activate)(struct psmouse *parent); - void (*deactivate)(struct psmouse *parent); -}; - struct psmouse { void *private; struct input_dev dev; struct serio *serio; - struct psmouse_ptport *ptport; char *vendor; char *name; unsigned char cmdbuf[8]; @@ -53,16 +51,22 @@ unsigned char model; unsigned long last; unsigned long out_of_sync; - unsigned char state; - char acking; - volatile char ack; + enum psmouse_state state; + unsigned char nak; char error; char devname[64]; char phys[32]; + unsigned long flags; + + /* Used to signal completion from interrupt handler */ + wait_queue_head_t wait; - psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); + psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); int (*reconnect)(struct psmouse *psmouse); void (*disconnect)(struct psmouse *psmouse); + + void (*pt_activate)(struct psmouse *psmouse); + void (*pt_deactivate)(struct psmouse *psmouse); }; #define PSMOUSE_PS2 1 diff -Nru a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c --- a/drivers/input/mouse/sermouse.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mouse/sermouse.c 2004-09-21 20:52:52 -07:00 @@ -37,8 +37,10 @@ #include #include +#define DRIVER_DESC "Serial mouse driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Serial mouse driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static char *sermouse_protocols[] = { "None", "Mouse Systems Mouse", "Sun Mouse", "Microsoft Mouse", @@ -237,7 +239,7 @@ * an unhandled serio port is found. */ -static void sermouse_connect(struct serio *serio, struct serio_dev *dev) +static void sermouse_connect(struct serio *serio, struct serio_driver *drv) { struct sermouse *sermouse; unsigned char c; @@ -279,7 +281,7 @@ sermouse->dev.id.product = c; sermouse->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(sermouse); return; } @@ -289,21 +291,25 @@ printk(KERN_INFO "input: %s on %s\n", sermouse_protocols[sermouse->type], serio->phys); } -static struct serio_dev sermouse_dev = { - .interrupt = sermouse_interrupt, - .connect = sermouse_connect, - .disconnect = sermouse_disconnect +static struct serio_driver sermouse_drv = { + .driver = { + .name = "sermouse", + }, + .description = DRIVER_DESC, + .interrupt = sermouse_interrupt, + .connect = sermouse_connect, + .disconnect = sermouse_disconnect, }; int __init sermouse_init(void) { - serio_register_device(&sermouse_dev); + serio_register_driver(&sermouse_drv); return 0; } void __exit sermouse_exit(void) { - serio_unregister_device(&sermouse_dev); + serio_unregister_driver(&sermouse_drv); } module_init(sermouse_init); diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/mouse/synaptics.c 2004-09-21 20:52:51 -07:00 @@ -212,9 +212,9 @@ /***************************************************************************** * Synaptics pass-through PS/2 port support ****************************************************************************/ -static int synaptics_pt_write(struct serio *port, unsigned char c) +static int synaptics_pt_write(struct serio *serio, unsigned char c) { - struct psmouse *parent = port->driver; + struct psmouse *parent = serio->parent->private; char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ if (psmouse_sliced_command(parent, c)) @@ -233,22 +233,19 @@ { struct psmouse *child = ptport->private; - if (child) { - if (child->state == PSMOUSE_ACTIVATED) { - serio_interrupt(ptport, packet[1], 0, NULL); - serio_interrupt(ptport, packet[4], 0, NULL); - serio_interrupt(ptport, packet[5], 0, NULL); - if (child->type >= PSMOUSE_GENPS) - serio_interrupt(ptport, packet[2], 0, NULL); - } else if (child->state != PSMOUSE_IGNORE) { - serio_interrupt(ptport, packet[1], 0, NULL); - } - } + if (child && child->state == PSMOUSE_ACTIVATED) { + serio_interrupt(ptport, packet[1], 0, NULL); + serio_interrupt(ptport, packet[4], 0, NULL); + serio_interrupt(ptport, packet[5], 0, NULL); + if (child->type >= PSMOUSE_GENPS) + serio_interrupt(ptport, packet[2], 0, NULL); + } else + serio_interrupt(ptport, packet[1], 0, NULL); } static void synaptics_pt_activate(struct psmouse *psmouse) { - struct psmouse *child = psmouse->ptport->serio.private; + struct psmouse *child = psmouse->serio->child->private; /* adjust the touchpad to child's choice of protocol */ if (child && child->type >= PSMOUSE_GENPS) { @@ -259,23 +256,25 @@ static void synaptics_pt_create(struct psmouse *psmouse) { - struct psmouse_ptport *port; + struct serio *serio; - psmouse->ptport = port = kmalloc(sizeof(struct psmouse_ptport), GFP_KERNEL); - if (!port) { + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!serio) { printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); return; } - memset(port, 0, sizeof(struct psmouse_ptport)); + memset(serio, 0, sizeof(struct serio)); + + serio->type = SERIO_PS_PSTHRU; + strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); + strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); + serio->write = synaptics_pt_write; + serio->parent = psmouse->serio; - port->serio.type = SERIO_PS_PSTHRU; - port->serio.name = "Synaptics pass-through"; - port->serio.phys = "synaptics-pt/serio0"; - port->serio.write = synaptics_pt_write; - port->serio.driver = psmouse; + psmouse->pt_activate = synaptics_pt_activate; - port->activate = synaptics_pt_activate; + psmouse->serio->child = serio; } /***************************************************************************** @@ -470,9 +469,10 @@ if (unlikely(priv->pkt_type == SYN_NEWABS)) priv->pkt_type = synaptics_detect_pkt_type(psmouse); - if (psmouse->ptport && psmouse->ptport->serio.dev && synaptics_is_pt_packet(psmouse->packet)) - synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet); - else + if (SYN_CAP_PASS_THROUGH(priv->capabilities) && synaptics_is_pt_packet(psmouse->packet)) { + if (psmouse->serio->child) + synaptics_pass_pt_packet(psmouse->serio->child, psmouse->packet); + } else synaptics_process_packet(psmouse); return PSMOUSE_FULL_PACKET; diff -Nru a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c --- a/drivers/input/mouse/vsxxxaa.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mouse/vsxxxaa.c 2004-09-21 20:52:52 -07:00 @@ -82,8 +82,10 @@ #include #include +#define DRIVER_DESC "Serial DEC VSXXX-AA/GA mouse / DEC tablet driver" + MODULE_AUTHOR ("Jan-Benedict Glaw "); -MODULE_DESCRIPTION ("Serial DEC VSXXX-AA/GA mouse / DEC tablet driver"); +MODULE_DESCRIPTION (DRIVER_DESC); MODULE_LICENSE ("GPL"); #undef VSXXXAA_DEBUG @@ -482,7 +484,7 @@ } static void -vsxxxaa_connect (struct serio *serio, struct serio_dev *dev) +vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) { struct vsxxxaa *mouse; @@ -524,7 +526,7 @@ mouse->dev.id.bustype = BUS_RS232; mouse->serio = serio; - if (serio_open (serio, dev)) { + if (serio_open (serio, drv)) { kfree (mouse); return; } @@ -540,23 +542,27 @@ printk (KERN_INFO "input: %s on %s\n", mouse->name, mouse->phys); } -static struct serio_dev vsxxxaa_dev = { - .connect = vsxxxaa_connect, - .interrupt = vsxxxaa_interrupt, - .disconnect = vsxxxaa_disconnect, +static struct serio_driver vsxxxaa_drv = { + .driver = { + .name = "vsxxxaa", + }, + .description = DRIVER_DESC, + .connect = vsxxxaa_connect, + .interrupt = vsxxxaa_interrupt, + .disconnect = vsxxxaa_disconnect, }; int __init vsxxxaa_init (void) { - serio_register_device (&vsxxxaa_dev); + serio_register_driver(&vsxxxaa_drv); return 0; } void __exit vsxxxaa_exit (void) { - serio_unregister_device (&vsxxxaa_dev); + serio_unregister_driver(&vsxxxaa_drv); } module_init (vsxxxaa_init); diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c --- a/drivers/input/mousedev.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/mousedev.c 2004-09-21 20:52:52 -07:00 @@ -48,8 +48,15 @@ module_param(yres, uint, 0); MODULE_PARM_DESC(yres, "Vertical screen resolution"); -struct mousedev_motion { +static unsigned tap_time = 200; +module_param(tap_time, uint, 0); +MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)"); + +struct mousedev_hw_data { int dx, dy, dz; + int x, y; + int abs_event; + unsigned long buttons; }; struct mousedev { @@ -61,22 +68,38 @@ struct list_head list; struct input_handle handle; - struct mousedev_motion packet; - unsigned long buttons; + struct mousedev_hw_data packet; unsigned int pkt_count; int old_x[4], old_y[4]; - unsigned int touch; + unsigned long touch; }; +enum mousedev_emul { + MOUSEDEV_EMUL_PS2, + MOUSEDEV_EMUL_IMPS, + MOUSEDEV_EMUL_EXPS +}; + +struct mousedev_motion { + int dx, dy, dz; + unsigned long buttons; +}; + +#define PACKET_QUEUE_LEN 16 struct mousedev_list { struct fasync_struct *fasync; struct mousedev *mousedev; struct list_head node; - int dx, dy, dz; - unsigned long buttons; + + struct mousedev_motion packets[PACKET_QUEUE_LEN]; + unsigned int head, tail; + spinlock_t packet_lock; + int pos_x, pos_y; + signed char ps2[6]; unsigned char ready, buffer, bufsiz; - unsigned char mode, imexseq, impsseq; + unsigned char imexseq, impsseq; + enum mousedev_emul mode; }; #define MOUSEDEV_SEQ_LEN 6 @@ -119,15 +142,19 @@ case ABS_X: size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; if (size == 0) size = xres; - mousedev->packet.dx = (value * xres - mousedev->old_x[0]) / size; - mousedev->old_x[0] = mousedev->packet.dx * size; + if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; + if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; + mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; + mousedev->packet.abs_event = 1; break; case ABS_Y: size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; if (size == 0) size = yres; - mousedev->packet.dy = (value * yres - mousedev->old_y[0]) / size; - mousedev->old_y[0] = mousedev->packet.dy * size; + if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; + if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; + mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; + mousedev->packet.abs_event = 1; break; } } @@ -165,30 +192,82 @@ } if (value) { - set_bit(index, &mousedev->buttons); - set_bit(index, &mousedev_mix.buttons); + set_bit(index, &mousedev->packet.buttons); + set_bit(index, &mousedev_mix.packet.buttons); } else { - clear_bit(index, &mousedev->buttons); - clear_bit(index, &mousedev_mix.buttons); + clear_bit(index, &mousedev->packet.buttons); + clear_bit(index, &mousedev_mix.packet.buttons); } } -static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_motion *packet) +static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet) { struct mousedev_list *list; + struct mousedev_motion *p; + unsigned long flags; list_for_each_entry(list, &mousedev->list, node) { - list->dx += packet->dx; - list->dy += packet->dy; - list->dz += packet->dz; - list->buttons = mousedev->buttons; + spin_lock_irqsave(&list->packet_lock, flags); + + p = &list->packets[list->head]; + if (list->ready && p->buttons != packet->buttons) { + unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; + if (new_head != list->tail) { + p = &list->packets[list->head = new_head]; + memset(p, 0, sizeof(struct mousedev_motion)); + } + } + + if (packet->abs_event) { + p->dx += packet->x - list->pos_x; + p->dy += packet->y - list->pos_y; + list->pos_x = packet->x; + list->pos_y = packet->y; + } + + list->pos_x += packet->dx; + list->pos_x = list->pos_x < 0 ? 0 : (list->pos_x >= xres ? xres : list->pos_x); + list->pos_y += packet->dy; + list->pos_y = list->pos_y < 0 ? 0 : (list->pos_y >= yres ? yres : list->pos_y); + + p->dx += packet->dx; + p->dy += packet->dy; + p->dz += packet->dz; + p->buttons = mousedev->packet.buttons; + list->ready = 1; + + spin_unlock_irqrestore(&list->packet_lock, flags); kill_fasync(&list->fasync, SIGIO, POLL_IN); } wake_up_interruptible(&mousedev->wait); } +static void mousedev_touchpad_touch(struct mousedev *mousedev, int value) +{ + if (!value) { + if (mousedev->touch && + time_before(jiffies, mousedev->touch + msecs_to_jiffies(tap_time))) { + /* + * Toggle left button to emulate tap. + * We rely on the fact that mousedev_mix always has 0 + * motion packet so we won't mess current position. + */ + set_bit(0, &mousedev->packet.buttons); + set_bit(0, &mousedev_mix.packet.buttons); + mousedev_notify_readers(mousedev, &mousedev_mix.packet); + mousedev_notify_readers(&mousedev_mix, &mousedev_mix.packet); + clear_bit(0, &mousedev->packet.buttons); + clear_bit(0, &mousedev_mix.packet.buttons); + } + mousedev->touch = mousedev->pkt_count = 0; + } + else + if (!mousedev->touch) + mousedev->touch = jiffies; +} + static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { struct mousedev *mousedev = handle->private; @@ -212,12 +291,8 @@ case EV_KEY: if (value != 2) { - if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { - /* Handle touchpad data */ - mousedev->touch = value; - if (!mousedev->touch) - mousedev->pkt_count = 0; - } + if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) + mousedev_touchpad_touch(mousedev, value); else mousedev_key_event(mousedev, code, value); } @@ -237,7 +312,8 @@ mousedev_notify_readers(mousedev, &mousedev->packet); mousedev_notify_readers(&mousedev_mix, &mousedev->packet); - memset(&mousedev->packet, 0, sizeof(struct mousedev_motion)); + mousedev->packet.dx = mousedev->packet.dy = mousedev->packet.dz = 0; + mousedev->packet.abs_event = 0; } break; } @@ -322,6 +398,9 @@ return -ENOMEM; memset(list, 0, sizeof(struct mousedev_list)); + spin_lock_init(&list->packet_lock); + list->pos_x = xres / 2; + list->pos_y = yres / 2; list->mousedev = mousedev_table[i]; list_add_tail(&list->node, &mousedev_table[i]->list); file->private_data = list; @@ -341,32 +420,56 @@ return 0; } -static void mousedev_packet(struct mousedev_list *list, unsigned char off) +static inline int mousedev_limit_delta(int delta, int limit) { - list->ps2[off] = 0x08 | ((list->dx < 0) << 4) | ((list->dy < 0) << 5) | (list->buttons & 0x07); - list->ps2[off + 1] = (list->dx > 127 ? 127 : (list->dx < -127 ? -127 : list->dx)); - list->ps2[off + 2] = (list->dy > 127 ? 127 : (list->dy < -127 ? -127 : list->dy)); - list->dx -= list->ps2[off + 1]; - list->dy -= list->ps2[off + 2]; - list->bufsiz = off + 3; - - if (list->mode == 2) { - list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz)); - list->dz -= list->ps2[off + 3]; - list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1); - list->bufsiz++; - } else { - list->ps2[off] |= ((list->buttons & 0x10) >> 3) | ((list->buttons & 0x08) >> 1); + return delta > limit ? limit : (delta < -limit ? -limit : delta); +} + +static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) +{ + struct mousedev_motion *p; + unsigned long flags; + + spin_lock_irqsave(&list->packet_lock, flags); + p = &list->packets[list->tail]; + + ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); + ps2_data[1] = mousedev_limit_delta(p->dx, 127); + ps2_data[2] = mousedev_limit_delta(p->dy, 127); + p->dx -= ps2_data[1]; + p->dy -= ps2_data[2]; + + switch (list->mode) { + case MOUSEDEV_EMUL_EXPS: + ps2_data[3] = mousedev_limit_delta(p->dz, 127); + p->dz -= ps2_data[3]; + ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); + list->bufsiz = 4; + break; + + case MOUSEDEV_EMUL_IMPS: + ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); + ps2_data[3] = mousedev_limit_delta(p->dz, 127); + p->dz -= ps2_data[3]; + list->bufsiz = 4; + break; + + case MOUSEDEV_EMUL_PS2: + default: + ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); + p->dz = 0; + list->bufsiz = 3; + break; } - if (list->mode == 1) { - list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); - list->dz -= list->ps2[off + 3]; - list->bufsiz++; + if (!p->dx && !p->dy && !p->dz) { + if (list->tail != list->head) + list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; + if (list->tail == list->head) + list->ready = 0; } - if (!list->dx && !list->dy && (!list->mode || !list->dz)) list->ready = 0; - list->buffer = list->bufsiz; + spin_unlock_irqrestore(&list->packet_lock, flags); } @@ -384,31 +487,31 @@ if (c == mousedev_imex_seq[list->imexseq]) { if (++list->imexseq == MOUSEDEV_SEQ_LEN) { list->imexseq = 0; - list->mode = 2; + list->mode = MOUSEDEV_EMUL_EXPS; } } else list->imexseq = 0; if (c == mousedev_imps_seq[list->impsseq]) { if (++list->impsseq == MOUSEDEV_SEQ_LEN) { list->impsseq = 0; - list->mode = 1; + list->mode = MOUSEDEV_EMUL_IMPS; } } else list->impsseq = 0; list->ps2[0] = 0xfa; - list->bufsiz = 1; switch (c) { case 0xeb: /* Poll */ - mousedev_packet(list, 1); + mousedev_packet(list, &list->ps2[1]); + list->bufsiz++; /* account for leading ACK */ break; case 0xf2: /* Get ID */ switch (list->mode) { - case 0: list->ps2[1] = 0; break; - case 1: list->ps2[1] = 3; break; - case 2: list->ps2[1] = 4; break; + case MOUSEDEV_EMUL_PS2: list->ps2[1] = 0; break; + case MOUSEDEV_EMUL_IMPS: list->ps2[1] = 3; break; + case MOUSEDEV_EMUL_EXPS: list->ps2[1] = 4; break; } list->bufsiz = 2; break; @@ -419,13 +522,15 @@ break; case 0xff: /* Reset */ - list->impsseq = 0; - list->imexseq = 0; - list->mode = 0; - list->ps2[1] = 0xaa; - list->ps2[2] = 0x00; + list->impsseq = list->imexseq = 0; + list->mode = MOUSEDEV_EMUL_PS2; + list->ps2[1] = 0xaa; list->ps2[2] = 0x00; list->bufsiz = 3; break; + + default: + list->bufsiz = 1; + break; } list->buffer = list->bufsiz; @@ -446,13 +551,19 @@ if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK)) return -EAGAIN; - retval = wait_event_interruptible(list->mousedev->wait, list->ready || list->buffer); + retval = wait_event_interruptible(list->mousedev->wait, + !list->mousedev->exist || list->ready || list->buffer); if (retval) return retval; - if (!list->buffer && list->ready) - mousedev_packet(list, 0); + if (!list->mousedev->exist) + return -ENODEV; + + if (!list->buffer && list->ready) { + mousedev_packet(list, list->ps2); + list->buffer = list->bufsiz; + } if (count > list->buffer) count = list->buffer; diff -Nru a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig --- a/drivers/input/serio/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/Kconfig 2004-09-21 20:52:52 -07:00 @@ -20,7 +20,7 @@ tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 default y select SERIO - depends on !PARISC && (!ARM || ARCH_SHARK || ARCH_EBSA285) + depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) ---help--- i8042 is the chip over which the standard AT keyboard and PS/2 mouse are connected to the computer. If you use these devices, @@ -130,3 +130,19 @@ To compile this driver as a module, choose M here: the module will be called maceps2. + +config SERIO_RAW + tristate "Raw access to serio ports" + depends on SERIO + help + Say Y here if you want to have raw access to serio ports, such as + AUX ports on i8042 keyboard controller. Each serio port that is + bound to this driver will be accessible via a char device with + major 10 and dynamically allocated minor. The driver will try + allocating minor 1 (that historically corresponds to /dev/psaux) + first. To bind this driver to a serio port use sysfs interface: + + echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver + + To compile this driver as a module, choose M here: the + module will be called serio_raw. diff -Nru a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile --- a/drivers/input/serio/Makefile 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/Makefile 2004-09-21 20:52:51 -07:00 @@ -17,3 +17,4 @@ obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o +obj-$(CONFIG_SERIO_RAW) += serio_raw.o diff -Nru a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c --- a/drivers/input/serio/ambakmi.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/ambakmi.c 2004-09-21 20:52:52 -07:00 @@ -29,7 +29,7 @@ #define KMI_BASE (kmi->base) struct amba_kmi_port { - struct serio io; + struct serio *io; struct clk *clk; unsigned char *base; unsigned int irq; @@ -44,7 +44,7 @@ int handled = IRQ_NONE; while (status & KMIIR_RXINTR) { - serio_interrupt(&kmi->io, readb(KMIDATA), 0, regs); + serio_interrupt(kmi->io, readb(KMIDATA), 0, regs); status = readb(KMIIR); handled = IRQ_HANDLED; } @@ -54,7 +54,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; unsigned int timeleft = 10000; /* timeout in 100ms */ while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--) @@ -68,7 +68,7 @@ static int amba_kmi_open(struct serio *io) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; unsigned int divisor; int ret; @@ -105,7 +105,7 @@ static void amba_kmi_close(struct serio *io) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; writeb(0, KMICR); @@ -117,6 +117,7 @@ static int amba_kmi_probe(struct amba_device *dev, void *id) { struct amba_kmi_port *kmi; + struct serio *io; int ret; ret = amba_request_regions(dev, NULL); @@ -124,21 +125,25 @@ return ret; kmi = kmalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); - if (!kmi) { + io = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!kmi || !io) { ret = -ENOMEM; goto out; } memset(kmi, 0, sizeof(struct amba_kmi_port)); + memset(io, 0, sizeof(struct serio)); - kmi->io.type = SERIO_8042; - kmi->io.write = amba_kmi_write; - kmi->io.open = amba_kmi_open; - kmi->io.close = amba_kmi_close; - kmi->io.name = dev->dev.bus_id; - kmi->io.phys = dev->dev.bus_id; - kmi->io.driver = kmi; + io->type = SERIO_8042; + io->write = amba_kmi_write; + io->open = amba_kmi_open; + io->close = amba_kmi_close; + strlcpy(io->name, dev->dev.bus_id, sizeof(io->name)); + strlcpy(io->phys, dev->dev.bus_id, sizeof(io->phys)); + io->port_data = kmi; + io->dev.parent = &dev->dev; + kmi->io = io; kmi->base = ioremap(dev->res.start, KMI_SIZE); if (!kmi->base) { ret = -ENOMEM; @@ -154,13 +159,14 @@ kmi->irq = dev->irq[0]; amba_set_drvdata(dev, kmi); - serio_register_port(&kmi->io); + serio_register_port(kmi->io); return 0; unmap: iounmap(kmi->base); out: kfree(kmi); + kfree(io); amba_release_regions(dev); return ret; } @@ -171,7 +177,7 @@ amba_set_drvdata(dev, NULL); - serio_unregister_port(&kmi->io); + serio_unregister_port(kmi->io); clk_put(kmi->clk); iounmap(kmi->base); kfree(kmi); @@ -184,7 +190,7 @@ struct amba_kmi_port *kmi = amba_get_drvdata(dev); /* kick the serio layer to rescan this port */ - serio_rescan(&kmi->io); + serio_reconnect(kmi->io); return 0; } @@ -214,7 +220,7 @@ static void __exit amba_kmi_exit(void) { - return amba_driver_unregister(&ambakmi_driver); + amba_driver_unregister(&ambakmi_driver); } module_init(amba_kmi_init); diff -Nru a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c --- a/drivers/input/serio/ct82c710.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/ct82c710.c 2004-09-21 20:52:51 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -43,9 +44,6 @@ MODULE_DESCRIPTION("82C710 C&T mouse port chip driver"); MODULE_LICENSE("GPL"); -static char ct82c710_name[] = "C&T 82c710 mouse port"; -static char ct82c710_phys[16]; - /* * ct82c710 interface */ @@ -61,10 +59,22 @@ #define CT82C710_IRQ 12 -static int ct82c710_data; -static int ct82c710_status; +#define CT82C710_DATA ct82c710_iores.start +#define CT82C710_STATUS (ct82c710_iores.start + 1) -static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs); +static struct serio *ct82c710_port; +static struct platform_device *ct82c710_device; +static struct resource ct82c710_iores; + +/* + * Interrupt handler for the 82C710 mouse port. A character + * is waiting in the 82C710. + */ + +static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs) +{ + return serio_interrupt(ct82c710_port, inb(CT82C710_DATA), 0, regs); +} /* * Wait for device to send output char and flush any input char. @@ -74,10 +84,10 @@ { int timeout = 60000; - while ((inb(ct82c710_status) & (CT82C710_RX_FULL | CT82C710_TX_IDLE | CT82C710_DEV_IDLE)) + while ((inb(CT82C710_STATUS) & (CT82C710_RX_FULL | CT82C710_TX_IDLE | CT82C710_DEV_IDLE)) != (CT82C710_DEV_IDLE | CT82C710_TX_IDLE) && timeout) { - if (inb_p(ct82c710_status) & CT82C710_RX_FULL) inb_p(ct82c710_data); + if (inb_p(CT82C710_STATUS) & CT82C710_RX_FULL) inb_p(CT82C710_DATA); udelay(1); timeout--; @@ -91,7 +101,7 @@ if (ct82c170_wait()) printk(KERN_WARNING "ct82c710.c: Device busy in close()\n"); - outb_p(inb_p(ct82c710_status) & ~(CT82C710_ENABLE | CT82C710_INTS_ON), ct82c710_status); + outb_p(inb_p(CT82C710_STATUS) & ~(CT82C710_ENABLE | CT82C710_INTS_ON), CT82C710_STATUS); if (ct82c170_wait()) printk(KERN_WARNING "ct82c710.c: Device busy in close()\n"); @@ -106,21 +116,21 @@ if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) return -1; - status = inb_p(ct82c710_status); + status = inb_p(CT82C710_STATUS); status |= (CT82C710_ENABLE | CT82C710_RESET); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); status &= ~(CT82C710_RESET); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); status |= CT82C710_INTS_ON; - outb_p(status, ct82c710_status); /* Enable interrupts */ + outb_p(status, CT82C710_STATUS); /* Enable interrupts */ while (ct82c170_wait()) { printk(KERN_ERR "ct82c710: Device busy in open()\n"); status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); free_irq(CT82C710_IRQ, NULL); return -1; } @@ -135,30 +145,10 @@ static int ct82c710_write(struct serio *port, unsigned char c) { if (ct82c170_wait()) return -1; - outb_p(c, ct82c710_data); + outb_p(c, CT82C710_DATA); return 0; } -static struct serio ct82c710_port = -{ - .type = SERIO_8042, - .name = ct82c710_name, - .phys = ct82c710_phys, - .write = ct82c710_write, - .open = ct82c710_open, - .close = ct82c710_close, -}; - -/* - * Interrupt handler for the 82C710 mouse port. A character - * is waiting in the 82C710. - */ - -static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs) -{ - return serio_interrupt(&ct82c710_port, inb(ct82c710_data), 0, regs); -} - /* * See if we can find a 82C710 device. Read mouse address. */ @@ -175,36 +165,60 @@ return -1; /* No: no 82C710 here */ outb_p(0x0d, 0x390); /* Write index */ - ct82c710_data = inb_p(0x391) << 2; /* Get mouse I/O address */ - ct82c710_status = ct82c710_data + 1; + ct82c710_iores.start = inb_p(0x391) << 2; /* Get mouse I/O address */ + ct82c710_iores.end = ct82c710_iores.start + 1; + ct82c710_iores.flags = IORESOURCE_IO; outb_p(0x0f, 0x390); outb_p(0x0f, 0x391); /* Close config mode */ return 0; } +static struct serio * __init ct82c710_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->open = ct82c710_open; + serio->close = ct82c710_close; + serio->write = ct82c710_write; + serio->dev.parent = &ct82c710_device->dev; + strlcpy(serio->name, "C&T 82c710 mouse port", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "isa%04lx/serio0", CT82C710_DATA); + } + + return serio; +} + int __init ct82c710_init(void) { if (ct82c710_probe()) return -ENODEV; - if (request_region(ct82c710_data, 2, "ct82c710")) - return -EBUSY; - - sprintf(ct82c710_phys, "isa%04x/serio0", ct82c710_data); + ct82c710_device = platform_device_register_simple("ct82c710", -1, &ct82c710_iores, 1); + if (IS_ERR(ct82c710_device)) + return PTR_ERR(ct82c710_device); + + if (!(ct82c710_port = ct82c710_allocate_port())) { + platform_device_unregister(ct82c710_device); + return -ENOMEM; + } - serio_register_port(&ct82c710_port); + serio_register_port(ct82c710_port); - printk(KERN_INFO "serio: C&T 82c710 mouse port at %#x irq %d\n", - ct82c710_data, CT82C710_IRQ); + printk(KERN_INFO "serio: C&T 82c710 mouse port at %#lx irq %d\n", + CT82C710_DATA, CT82C710_IRQ); return 0; } void __exit ct82c710_exit(void) { - serio_unregister_port(&ct82c710_port); - release_region(ct82c710_data, 2); + serio_unregister_port(ct82c710_port); + platform_device_unregister(ct82c710_device); } module_init(ct82c710_init); diff -Nru a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c --- a/drivers/input/serio/gscps2.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/gscps2.c 2004-09-21 20:52:52 -07:00 @@ -91,7 +91,7 @@ struct gscps2port { struct list_head node; struct parisc_device *padev; - struct serio port; + struct serio *port; spinlock_t lock; char *addr; u8 act, append; /* position in buffer[] */ @@ -100,7 +100,6 @@ u8 str; } buffer[BUFFER_SIZE+1]; int id; - char name[32]; }; /* @@ -272,7 +271,7 @@ rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) | ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 ); - serio_interrupt(&ps2port->port, data, rxflags, regs); + serio_interrupt(ps2port->port, data, rxflags, regs); } /* while() */ @@ -288,7 +287,7 @@ static int gscps2_write(struct serio *port, unsigned char data) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; if (!gscps2_writeb_output(ps2port, data)) { printk(KERN_DEBUG PFX "sending byte %#x failed.\n", data); @@ -304,7 +303,7 @@ static int gscps2_open(struct serio *port) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; gscps2_reset(ps2port); @@ -319,7 +318,7 @@ static void gscps2_close(struct serio *port) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; gscps2_enable(ps2port, DISABLE); } @@ -343,7 +342,8 @@ static int __init gscps2_probe(struct parisc_device *dev) { - struct gscps2port *ps2port; + struct gscps2port *ps2port; + struct serio *serio; unsigned long hpa = dev->hpa; int ret; @@ -355,34 +355,45 @@ hpa += GSC_DINO_OFFSET; ps2port = kmalloc(sizeof(struct gscps2port), GFP_KERNEL); - if (!ps2port) - return -ENOMEM; + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2port || !serio) { + ret = -ENOMEM; + goto fail_nomem; + } dev_set_drvdata(&dev->dev, ps2port); memset(ps2port, 0, sizeof(struct gscps2port)); + memset(serio, 0, sizeof(struct serio)); + ps2port->port = serio; ps2port->padev = dev; ps2port->addr = ioremap(hpa, GSC_STATUS + 4); spin_lock_init(&ps2port->lock); gscps2_reset(ps2port); - ps2port->id = readb(ps2port->addr+GSC_ID) & 0x0f; - snprintf(ps2port->name, sizeof(ps2port->name)-1, "%s %s", - gscps2_serio_port.name, - (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse" ); - - memcpy(&ps2port->port, &gscps2_serio_port, sizeof(gscps2_serio_port)); - ps2port->port.driver = ps2port; - ps2port->port.name = ps2port->name; - ps2port->port.phys = dev->dev.bus_id; + ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f; + + snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", + (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->idbus = BUS_GSC; + serio->idvendor = PCI_VENDOR_ID_HP; + serio->idproduct = 0x0001; + serio->idversion = 0x0010; + serio->type = SERIO_8042; + serio->write = gscps2_write; + serio->open = gscps2_open; + serio->close = gscps2_close; + serio->port_data = ps2port; + serio->dev.parent = &dev->dev; list_add_tail(&ps2port->node, &ps2port_list); ret = -EBUSY; - if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->name, ps2port)) + if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port)) goto fail_miserably; - if ( (ps2port->id != GSC_ID_KEYBOARD) && (ps2port->id != GSC_ID_MOUSE) ) { + if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) { printk(KERN_WARNING PFX "Unsupported PS/2 port at 0x%08lx (id=%d) ignored\n", hpa, ps2port->id); ret = -ENODEV; @@ -395,12 +406,12 @@ #endif printk(KERN_INFO "serio: %s port at 0x%p irq %d @ %s\n", - ps2port->name, + ps2port->port->name, ps2port->addr, ps2port->padev->irq, - ps2port->port.phys); + ps2port->port->phys); - serio_register_port(&ps2port->port); + serio_register_port(ps2port->port); return 0; @@ -411,7 +422,10 @@ list_del(&ps2port->node); iounmap(ps2port->addr); release_mem_region(dev->hpa, GSC_STATUS + 4); + +fail_nomem: kfree(ps2port); + kfree(serio); return ret; } @@ -424,7 +438,7 @@ { struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); - serio_unregister_port(&ps2port->port); + serio_unregister_port(ps2port->port); free_irq(dev->irq, ps2port); gscps2_flush(ps2port); list_del(&ps2port->node); diff -Nru a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h --- a/drivers/input/serio/i8042-io.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/i8042-io.h 2004-09-21 20:52:51 -07:00 @@ -65,6 +65,31 @@ return; } +#if defined(__i386__) + +#include + +static struct dmi_system_id __initdata i8042_dmi_table[] = { + { + .ident = "Compaq Proliant 8500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), + DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), + DMI_MATCH(DMI_PRODUCT_VERSION, "8500"), + }, + }, + { + .ident = "Compaq Proliant DL760", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), + DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), + DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), + }, + }, + { } +}; +#endif + static inline int i8042_platform_init(void) { /* @@ -79,6 +104,12 @@ #if !defined(__i386__) && !defined(__x86_64__) i8042_reset = 1; #endif + +#if defined(__i386__) + if (dmi_check_system(i8042_dmi_table)) + i8042_noloop = 1; +#endif + return 0; } diff -Nru a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h --- a/drivers/input/serio/i8042-sparcio.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/i8042-sparcio.h 2004-09-21 20:52:52 -07:00 @@ -18,7 +18,7 @@ #define I8042_AUX_PHYS_DESC "sparcps2/serio1" #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" -static unsigned long kbd_iobase; +static void __iomem *kbd_iobase; #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) #define I8042_DATA_REG (kbd_iobase + 0x60UL) @@ -64,7 +64,7 @@ if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) { /* Hardcoded values for MrCoffee. */ i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; - kbd_iobase = (unsigned long) ioremap(0x71300060, 8); + kbd_iobase = ioremap(0x71300060, 8); if (!kbd_iobase) return -1; } else { @@ -85,7 +85,7 @@ if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) || !strcmp(child->prom_name, OBP_PS2KBD_NAME2)) { i8042_kbd_irq = child->irqs[0]; - kbd_iobase = (unsigned long) + kbd_iobase = ioremap(child->resource[0].start, 8); } if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) || @@ -109,7 +109,7 @@ static inline void i8042_platform_exit(void) { #ifdef CONFIG_PCI - iounmap((void *)kbd_iobase); + iounmap(kbd_iobase); #endif } diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c --- a/drivers/input/serio/i8042.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/i8042.c 2004-09-21 20:52:51 -07:00 @@ -1,7 +1,7 @@ /* * i8042 keyboard and mouse controller driver for Linux * - * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 1999-2004 Vojtech Pavlik */ /* @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -52,6 +53,10 @@ module_param_named(dumbkbd, i8042_dumbkbd, bool, 0); MODULE_PARM_DESC(dumbkbd, "Pretend that controller can only read data from keyboard"); +static unsigned int i8042_noloop; +module_param_named(noloop, i8042_noloop, bool, 0); +MODULE_PARM_DESC(dumbkbd, "Disable the AUX Loopback command while probing for the AUX port"); + __obsolete_setup("i8042_noaux"); __obsolete_setup("i8042_nomux"); __obsolete_setup("i8042_unlock"); @@ -70,19 +75,35 @@ unsigned char irqen; unsigned char exists; signed char mux; - unsigned char *name; - unsigned char *phys; + char name[8]; +}; + +static struct i8042_values i8042_kbd_values = { + .disable = I8042_CTR_KBDDIS, + .irqen = I8042_CTR_KBDINT, + .mux = -1, + .name = "KBD", +}; + +static struct i8042_values i8042_aux_values = { + .disable = I8042_CTR_AUXDIS, + .irqen = I8042_CTR_AUXINT, + .mux = -1, + .name = "AUX", }; -static struct serio i8042_kbd_port; -static struct serio i8042_aux_port; +static struct i8042_values i8042_mux_values[I8042_NUM_MUX_PORTS]; + +static struct serio *i8042_kbd_port; +static struct serio *i8042_aux_port; +static struct serio *i8042_mux_port[I8042_NUM_MUX_PORTS]; static unsigned char i8042_initial_ctr; static unsigned char i8042_ctr; static unsigned char i8042_mux_open; static unsigned char i8042_mux_present; -static unsigned char i8042_sysdev_initialized; static struct pm_dev *i8042_pm_dev; -struct timer_list i8042_timer; +static struct timer_list i8042_timer; +static struct platform_device *i8042_platform_device; /* * Shared IRQ's require a device pointer, but this driver doesn't support @@ -95,6 +116,7 @@ /* * The i8042_wait_read() and i8042_wait_write functions wait for the i8042 to * be ready for reading values from it / writing values to it. + * Called always with i8042_lock held. */ static int i8042_wait_read(void) @@ -131,6 +153,7 @@ spin_lock_irqsave(&i8042_lock, flags); while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE)) { + udelay(50); data = i8042_read_data(); dbg("%02x <- i8042 (flush, %s)", data, i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd"); @@ -154,6 +177,9 @@ unsigned long flags; int retval = 0, i = 0; + if (i8042_noloop && command == I8042_CMD_AUX_LOOP) + return -1; + spin_lock_irqsave(&i8042_lock, flags); retval = i8042_wait_write(); @@ -214,7 +240,7 @@ static int i8042_aux_write(struct serio *port, unsigned char c) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; int retval; /* @@ -242,7 +268,7 @@ static int i8042_activate_port(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; i8042_flush(); @@ -270,7 +296,7 @@ static int i8042_open(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; if (values->mux != -1) if (i8042_mux_open++) @@ -309,7 +335,7 @@ static void i8042_close(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; if (values->mux != -1) if (--i8042_mux_open) @@ -328,52 +354,6 @@ } /* - * Structures for registering the devices in the serio.c module. - */ - -static struct i8042_values i8042_kbd_values = { - .irqen = I8042_CTR_KBDINT, - .disable = I8042_CTR_KBDDIS, - .name = "KBD", - .mux = -1, -}; - -static struct serio i8042_kbd_port = -{ - .type = SERIO_8042_XL, - .write = i8042_kbd_write, - .open = i8042_open, - .close = i8042_close, - .driver = &i8042_kbd_values, - .name = "i8042 Kbd Port", - .phys = I8042_KBD_PHYS_DESC, -}; - -static struct i8042_values i8042_aux_values = { - .irqen = I8042_CTR_AUXINT, - .disable = I8042_CTR_AUXDIS, - .name = "AUX", - .mux = -1, -}; - -static struct serio i8042_aux_port = -{ - .type = SERIO_8042, - .write = i8042_aux_write, - .open = i8042_open, - .close = i8042_close, - .driver = &i8042_aux_values, - .name = "i8042 Aux Port", - .phys = I8042_AUX_PHYS_DESC, -}; - -static struct i8042_values i8042_mux_values[4]; -static struct serio i8042_mux_port[4]; -static char i8042_mux_names[4][32]; -static char i8042_mux_short[4][16]; -static char i8042_mux_phys[4][32]; - -/* * i8042_interrupt() is the most important function in this driver - * it handles the interrupts from the i8042, and sends incoming bytes * to the upper layers. @@ -384,6 +364,7 @@ unsigned long flags; unsigned char str, data = 0; unsigned int dfl; + unsigned int aux_idx; int ret; mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); @@ -400,44 +381,67 @@ goto out; } - dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | - ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); - - if (i8042_mux_values[0].exists && (str & I8042_STR_AUXDATA)) { + if (i8042_mux_present && (str & I8042_STR_AUXDATA)) { + static unsigned long last_transmit; + static unsigned char last_str; + dfl = 0; if (str & I8042_STR_MUXERR) { + dbg("MUX error, status is %02x, data is %02x", str, data); switch (data) { + default: +/* + * When MUXERR condition is signalled the data register can only contain + * 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately + * it is not always the case. Some KBC just get confused which port the + * data came from and signal error leaving the data intact. They _do not_ + * revert to legacy mode (actually I've never seen KBC reverting to legacy + * mode yet, when we see one we'll add proper handling). + * Anyway, we will assume that the data came from the same serio last byte + * was transmitted (if transmission happened not too long ago). + */ + if (time_before(jiffies, last_transmit + HZ/10)) { + str = last_str; + break; + } + /* fall through - report timeout */ case 0xfd: - case 0xfe: dfl = SERIO_TIMEOUT; break; - case 0xff: dfl = SERIO_PARITY; break; + case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break; + case 0xff: dfl = SERIO_PARITY; data = 0xfe; break; } - data = 0xfe; - } else dfl = 0; + } + + aux_idx = (str >> 6) & 3; dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)", - data, (str >> 6), irq, + data, aux_idx, irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); - serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl, regs); + if (likely(i8042_mux_values[aux_idx].exists)) + serio_interrupt(i8042_mux_port[aux_idx], data, dfl, regs); + last_str = str; + last_transmit = jiffies; goto irq_ret; } + dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | + ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); + dbg("%02x <- i8042 (interrupt, %s, %d%s%s)", data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); - if (i8042_aux_values.exists && (str & I8042_STR_AUXDATA)) { - serio_interrupt(&i8042_aux_port, data, dfl, regs); - goto irq_ret; - } - - if (!i8042_kbd_values.exists) - goto irq_ret; - serio_interrupt(&i8042_kbd_port, data, dfl, regs); + if (str & I8042_STR_AUXDATA) { + if (likely(i8042_aux_values.exists)) + serio_interrupt(i8042_aux_port, data, dfl, regs); + } else { + if (likely(i8042_kbd_values.exists)) + serio_interrupt(i8042_kbd_port, data, dfl, regs); + } irq_ret: ret = 1; @@ -474,17 +478,8 @@ if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa9) return -1; param = 0xa4; - if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) { - -/* - * Do another loop test with the 0x5a value. Doing anything else upsets - * Profusion/ServerWorks OSB4 chipsets. - */ - - param = 0x5a; - i8042_command(¶m, I8042_CMD_AUX_LOOP); + if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) return -1; - } if (mux_version) *mux_version = ~param; @@ -639,8 +634,10 @@ * registers it, and reports to the user. */ -static int __init i8042_port_register(struct i8042_values *values, struct serio *port) +static int __init i8042_port_register(struct serio *port) { + struct i8042_values *values = port->port_data; + values->exists = 1; i8042_ctr &= ~values->disable; @@ -677,6 +674,7 @@ static int i8042_controller_init(void) { + unsigned long flags; /* * Test the i8042. We need to know if it thinks it's working correctly @@ -723,12 +721,14 @@ * Handle keylock. */ + spin_lock_irqsave(&i8042_lock, flags); if (~i8042_read_status() & I8042_STR_KEYLOCK) { if (i8042_unlock) i8042_ctr |= I8042_CTR_IGNKEYLOCK; else printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); } + spin_unlock_irqrestore(&i8042_lock, flags); /* * If the chip is configured into nontranslated mode by the BIOS, don't @@ -745,10 +745,8 @@ * BIOSes. */ - if (i8042_direct) { + if (i8042_direct) i8042_ctr &= ~I8042_CTR_XLATE; - i8042_kbd_port.type = SERIO_8042; - } /* * Write CTR back. @@ -802,14 +800,14 @@ */ if (i8042_kbd_values.exists) - serio_cleanup(&i8042_kbd_port); + serio_cleanup(i8042_kbd_port); if (i8042_aux_values.exists) - serio_cleanup(&i8042_aux_port); + serio_cleanup(i8042_aux_port); - for (i = 0; i < 4; i++) + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) if (i8042_mux_values[i].exists) - serio_cleanup(i8042_mux_port + i); + serio_cleanup(i8042_mux_port[i]); i8042_controller_reset(); } @@ -851,15 +849,15 @@ * Reconnect anything that was connected to the ports. */ - if (i8042_kbd_values.exists && i8042_activate_port(&i8042_kbd_port) == 0) - serio_reconnect(&i8042_kbd_port); + if (i8042_kbd_values.exists && i8042_activate_port(i8042_kbd_port) == 0) + serio_reconnect(i8042_kbd_port); - if (i8042_aux_values.exists && i8042_activate_port(&i8042_aux_port) == 0) - serio_reconnect(&i8042_aux_port); + if (i8042_aux_values.exists && i8042_activate_port(i8042_aux_port) == 0) + serio_reconnect(i8042_aux_port); - for (i = 0; i < 4; i++) - if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port + i) == 0) - serio_reconnect(i8042_mux_port + i); + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) + if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port[i]) == 0) + serio_reconnect(i8042_mux_port[i]); /* * Restart timer (for polling "stuck" data) */ @@ -882,7 +880,7 @@ return NOTIFY_DONE; } -static struct notifier_block i8042_notifier= +static struct notifier_block i8042_notifier = { i8042_notify_sys, NULL, @@ -892,25 +890,27 @@ /* * Suspend/resume handlers for the new PM scheme (driver model) */ -static int i8042_suspend(struct sys_device *dev, u32 state) +static int i8042_suspend(struct device *dev, u32 state, u32 level) { - return i8042_controller_suspend(); + return level == SUSPEND_DISABLE ? i8042_controller_suspend() : 0; } -static int i8042_resume(struct sys_device *dev) +static int i8042_resume(struct device *dev, u32 level) { - return i8042_controller_resume(); + return level == RESUME_ENABLE ? i8042_controller_resume() : 0; } -static struct sysdev_class kbc_sysclass = { - set_kset_name("i8042"), - .suspend = i8042_suspend, - .resume = i8042_resume, -}; +static void i8042_shutdown(struct device *dev) +{ + i8042_controller_cleanup(); +} -static struct sys_device device_i8042 = { - .id = 0, - .cls = &kbc_sysclass, +static struct device_driver i8042_driver = { + .name = "i8042", + .bus = &platform_bus_type, + .suspend = i8042_suspend, + .resume = i8042_resume, + .shutdown = i8042_shutdown, }; /* @@ -929,23 +929,75 @@ return 0; } -static void __init i8042_init_mux_values(struct i8042_values *values, struct serio *port, int index) +static struct serio * __init i8042_allocate_kbd_port(void) { - memcpy(port, &i8042_aux_port, sizeof(struct serio)); - memcpy(values, &i8042_aux_values, sizeof(struct i8042_values)); - sprintf(i8042_mux_names[index], "i8042 Aux-%d Port", index); - sprintf(i8042_mux_phys[index], I8042_MUX_PHYS_DESC, index + 1); - sprintf(i8042_mux_short[index], "AUX%d", index); - port->name = i8042_mux_names[index]; - port->phys = i8042_mux_phys[index]; - port->driver = values; - values->name = i8042_mux_short[index]; - values->mux = index; + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = i8042_direct ? SERIO_8042 : SERIO_8042_XL, + serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write, + serio->open = i8042_open, + serio->close = i8042_close, + serio->port_data = &i8042_kbd_values, + serio->dev.parent = &i8042_platform_device->dev; + strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name)); + strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); + } + + return serio; +} + +static struct serio * __init i8042_allocate_aux_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = i8042_aux_write; + serio->open = i8042_open; + serio->close = i8042_close; + serio->port_data = &i8042_aux_values, + serio->dev.parent = &i8042_platform_device->dev; + strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name)); + strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); + } + + return serio; +} + +static struct serio * __init i8042_allocate_mux_port(int index) +{ + struct serio *serio; + struct i8042_values *values = &i8042_mux_values[index]; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + *values = i8042_aux_values; + snprintf(values->name, sizeof(values->name), "AUX%d", index); + values->mux = index; + + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = i8042_aux_write; + serio->open = i8042_open; + serio->close = i8042_close; + serio->port_data = values; + serio->dev.parent = &i8042_platform_device->dev; + snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index); + snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1); + } + + return serio; } int __init i8042_init(void) { int i; + int err; dbg_init(); @@ -961,30 +1013,36 @@ if (i8042_controller_init()) return -ENODEV; - if (i8042_dumbkbd) - i8042_kbd_port.write = NULL; + err = driver_register(&i8042_driver); + if (err) + return err; + + i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0); + if (IS_ERR(i8042_platform_device)) { + driver_unregister(&i8042_driver); + return PTR_ERR(i8042_platform_device); + } if (!i8042_noaux && !i8042_check_aux(&i8042_aux_values)) { if (!i8042_nomux && !i8042_check_mux(&i8042_aux_values)) - for (i = 0; i < 4; i++) { - i8042_init_mux_values(i8042_mux_values + i, i8042_mux_port + i, i); - i8042_port_register(i8042_mux_values + i, i8042_mux_port + i); + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) { + i8042_mux_port[i] = i8042_allocate_mux_port(i); + if (i8042_mux_port[i]) + i8042_port_register(i8042_mux_port[i]); } - else - i8042_port_register(&i8042_aux_values, &i8042_aux_port); + else { + i8042_aux_port = i8042_allocate_aux_port(); + if (i8042_aux_port) + i8042_port_register(i8042_aux_port); + } } - i8042_port_register(&i8042_kbd_values, &i8042_kbd_port); + i8042_kbd_port = i8042_allocate_kbd_port(); + if (i8042_kbd_port) + i8042_port_register(i8042_kbd_port); mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); - if (sysdev_class_register(&kbc_sysclass) == 0) { - if (sysdev_register(&device_i8042) == 0) - i8042_sysdev_initialized = 1; - else - sysdev_class_unregister(&kbc_sysclass); - } - i8042_pm_dev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, i8042_pm_callback); register_reboot_notifier(&i8042_notifier); @@ -1001,23 +1059,22 @@ if (i8042_pm_dev) pm_unregister(i8042_pm_dev); - if (i8042_sysdev_initialized) { - sysdev_unregister(&device_i8042); - sysdev_class_unregister(&kbc_sysclass); - } - i8042_controller_cleanup(); if (i8042_kbd_values.exists) - serio_unregister_port(&i8042_kbd_port); + serio_unregister_port(i8042_kbd_port); if (i8042_aux_values.exists) - serio_unregister_port(&i8042_aux_port); + serio_unregister_port(i8042_aux_port); - for (i = 0; i < 4; i++) + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) if (i8042_mux_values[i].exists) - serio_unregister_port(i8042_mux_port + i); + serio_unregister_port(i8042_mux_port[i]); + del_timer_sync(&i8042_timer); + + platform_device_unregister(i8042_platform_device); + driver_unregister(&i8042_driver); i8042_platform_exit(); } diff -Nru a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h --- a/drivers/input/serio/i8042.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/i8042.h 2004-09-21 20:52:52 -07:00 @@ -104,6 +104,13 @@ #define I8042_BUFFER_SIZE 32 /* + * Number of AUX ports on controllers supporting active multiplexing + * specification + */ + +#define I8042_NUM_MUX_PORTS 4 + +/* * Debug. */ diff -Nru a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c --- a/drivers/input/serio/maceps2.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/maceps2.c 2004-09-21 20:52:51 -07:00 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -46,15 +47,18 @@ #define PS2_CONTROL_RX_CLOCK_ENABLE BIT(4) /* pause reception if set to 0 */ #define PS2_CONTROL_RESET BIT(5) /* reset */ - struct maceps2_data { struct mace_ps2port *port; int irq; }; +static struct maceps2_data port_data[2]; +static struct serio *maceps2_port[2]; +static struct platform_device *maceps2_device; + static int maceps2_write(struct serio *dev, unsigned char val) { - struct mace_ps2port *port = ((struct maceps2_data *)dev->driver)->port; + struct mace_ps2port *port = ((struct maceps2_data *)dev->port_data)->port; unsigned int timeout = MACE_PS2_TIMEOUT; do { @@ -68,11 +72,10 @@ return -1; } -static irqreturn_t maceps2_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t maceps2_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct serio *dev = dev_id; - struct mace_ps2port *port = ((struct maceps2_data *)dev->driver)->port; + struct mace_ps2port *port = ((struct maceps2_data *)dev->port_data)->port; unsigned int byte; if (mace_read(port->status) & PS2_STATUS_RX_FULL) { @@ -85,7 +88,7 @@ static int maceps2_open(struct serio *dev) { - struct maceps2_data *data = (struct maceps2_data *)dev->driver; + struct maceps2_data *data = (struct maceps2_data *)dev->port_data; if (request_irq(data->irq, maceps2_interrupt, 0, "PS/2 port", dev)) { printk(KERN_ERR "Could not allocate PS/2 IRQ\n"); @@ -106,7 +109,7 @@ static void maceps2_close(struct serio *dev) { - struct maceps2_data *data = (struct maceps2_data *)dev->driver; + struct maceps2_data *data = (struct maceps2_data *)dev->port_data; mace_write(PS2_CONTROL_TX_CLOCK_DISABLE | PS2_CONTROL_RESET, data->port->control); @@ -114,46 +117,59 @@ free_irq(data->irq, dev); } -static struct maceps2_data port0_data, port1_data; -static struct serio maceps2_port0 = +static struct serio * __init maceps2_allocate_port(int idx) { - .type = SERIO_8042, - .open = maceps2_open, - .close = maceps2_close, - .write = maceps2_write, - .name = "MACE PS/2 port0", - .phys = "mace/serio0", - .driver = &port0_data, -}; + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = maceps2_write; + serio->open = maceps2_open; + serio->close = maceps2_close; + snprintf(serio->name, sizeof(serio->name), "MACE PS/2 port%d", idx); + snprintf(serio->phys, sizeof(serio->phys), "mace/serio%d", idx); + serio->port_data = &port_data[idx]; + serio->dev.parent = &maceps2_device->dev; + } + + return serio; +} -static struct serio maceps2_port1 = -{ - .type = SERIO_8042, - .open = maceps2_open, - .close = maceps2_close, - .write = maceps2_write, - .name = "MACE PS/2 port1", - .phys = "mace/serio1", - .driver = &port1_data, -}; static int __init maceps2_init(void) { - port0_data.port = &mace->perif.ps2.keyb; - port0_data.irq = MACEISA_KEYB_IRQ; - port1_data.port = &mace->perif.ps2.mouse; - port1_data.irq = MACEISA_MOUSE_IRQ; - serio_register_port(&maceps2_port0); - serio_register_port(&maceps2_port1); + maceps2_device = platform_device_register_simple("maceps2", -1, NULL, 0); + if (IS_ERR(maceps2_device)) + return PTR_ERR(maceps2_device); + + port_data[0].port = &mace->perif.ps2.keyb; + port_data[0].irq = MACEISA_KEYB_IRQ; + port_data[1].port = &mace->perif.ps2.mouse; + port_data[1].irq = MACEISA_MOUSE_IRQ; + + maceps2_port[0] = maceps2_allocate_port(0); + maceps2_port[1] = maceps2_allocate_port(1); + if (!maceps2_port[0] || !maceps2_port[1]) { + kfree(maceps2_port[0]); + kfree(maceps2_port[1]); + platform_device_unregister(maceps2_device); + return -ENOMEM; + } + + serio_register_port(maceps2_port[0]); + serio_register_port(maceps2_port[1]); return 0; } static void __exit maceps2_exit(void) { - serio_unregister_port(&maceps2_port0); - serio_unregister_port(&maceps2_port1); + serio_unregister_port(maceps2_port[0]); + serio_unregister_port(maceps2_port[1]); + platform_device_unregister(maceps2_device); } module_init(maceps2_init); diff -Nru a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c --- a/drivers/input/serio/parkbd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/parkbd.c 2004-09-21 20:52:51 -07:00 @@ -53,9 +53,7 @@ static unsigned long parkbd_start; static struct pardevice *parkbd_dev; - -static char parkbd_name[] = "PARKBD AT/XT keyboard adapter"; -static char parkbd_phys[32]; +static struct serio *parkbd_port; static int parkbd_readlines(void) { @@ -86,13 +84,6 @@ return 0; } -static struct serio parkbd_port = -{ - .write = parkbd_write, - .name = parkbd_name, - .phys = parkbd_phys, -}; - static void parkbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) { @@ -125,7 +116,7 @@ parkbd_buffer |= (parkbd_readlines() >> 1) << parkbd_counter++; if (parkbd_counter == parkbd_mode + 10) - serio_interrupt(&parkbd_port, (parkbd_buffer >> (2 - parkbd_mode)) & 0xff, 0, regs); + serio_interrupt(parkbd_port, (parkbd_buffer >> (2 - parkbd_mode)) & 0xff, 0, regs); } parkbd_last = jiffies; @@ -163,16 +154,38 @@ return 0; } +static struct serio * __init parkbd_allocate_serio(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + serio->type = parkbd_mode; + serio->write = parkbd_write, + strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", parkbd_dev->port->name); + } + + return serio; +} int __init parkbd_init(void) { - if (parkbd_getport()) return -1; - parkbd_writelines(3); - parkbd_port.type = parkbd_mode; + int err; - sprintf(parkbd_phys, "%s/serio0", parkbd_dev->port->name); + err = parkbd_getport(); + if (err) + return err; + + parkbd_port = parkbd_allocate_serio(); + if (!parkbd_port) { + parport_release(parkbd_dev); + return -ENOMEM; + } + + parkbd_writelines(3); - serio_register_port(&parkbd_port); + serio_register_port(parkbd_port); printk(KERN_INFO "serio: PARKBD %s adapter on %s\n", parkbd_mode ? "AT" : "XT", parkbd_dev->port->name); @@ -183,7 +196,7 @@ void __exit parkbd_exit(void) { parport_release(parkbd_dev); - serio_unregister_port(&parkbd_port); + serio_unregister_port(parkbd_port); parport_unregister_device(parkbd_dev); } diff -Nru a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c --- a/drivers/input/serio/pcips2.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/pcips2.c 2004-09-21 20:52:51 -07:00 @@ -38,14 +38,14 @@ #define PS2_STAT_TXEMPTY (1<<7) struct pcips2_data { - struct serio io; + struct serio *io; unsigned int base; struct pci_dev *dev; }; static int pcips2_write(struct serio *io, unsigned char val) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; unsigned int stat; do { @@ -80,7 +80,7 @@ if (hweight8(scancode) & 1) flag ^= SERIO_PARITY; - serio_interrupt(&ps2if->io, scancode, flag, regs); + serio_interrupt(ps2if->io, scancode, flag, regs); } while (1); return IRQ_RETVAL(handled); } @@ -101,7 +101,7 @@ static int pcips2_open(struct serio *io) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; int ret, val = 0; outb(PS2_CTRL_ENABLE, ps2if->base); @@ -119,7 +119,7 @@ static void pcips2_close(struct serio *io) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; outb(0, ps2if->base); @@ -129,46 +129,51 @@ static int __devinit pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct pcips2_data *ps2if; + struct serio *serio; int ret; ret = pci_enable_device(dev); if (ret) - return ret; + goto out; - if (!request_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0), "pcips2")) { - ret = -EBUSY; + ret = pci_request_regions(dev, "pcips2"); + if (ret) goto disable; - } ps2if = kmalloc(sizeof(struct pcips2_data), GFP_KERNEL); - if (!ps2if) { + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2if || !serio) { ret = -ENOMEM; goto release; } memset(ps2if, 0, sizeof(struct pcips2_data)); + memset(serio, 0, sizeof(struct serio)); - ps2if->io.type = SERIO_8042; - ps2if->io.write = pcips2_write; - ps2if->io.open = pcips2_open; - ps2if->io.close = pcips2_close; - ps2if->io.name = pci_name(dev); - ps2if->io.phys = dev->dev.bus_id; - ps2if->io.driver = ps2if; + serio->type = SERIO_8042; + serio->write = pcips2_write; + serio->open = pcips2_open; + serio->close = pcips2_close; + strlcpy(serio->name, pci_name(dev), sizeof(serio->name)); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->port_data = ps2if; + serio->dev.parent = &dev->dev; + ps2if->io = serio; ps2if->dev = dev; ps2if->base = pci_resource_start(dev, 0); pci_set_drvdata(dev, ps2if); - serio_register_port(&ps2if->io); + serio_register_port(ps2if->io); return 0; release: - release_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + kfree(ps2if); + kfree(serio); + pci_release_regions(dev); disable: pci_disable_device(dev); + out: return ret; } @@ -176,11 +181,10 @@ { struct pcips2_data *ps2if = pci_get_drvdata(dev); - serio_unregister_port(&ps2if->io); - release_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + serio_unregister_port(ps2if->io); pci_set_drvdata(dev, NULL); kfree(ps2if); + pci_release_regions(dev); pci_disable_device(dev); } diff -Nru a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c --- a/drivers/input/serio/q40kbd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/q40kbd.c 2004-09-21 20:52:51 -07:00 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -47,43 +48,106 @@ MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); -static struct serio q40kbd_port = -{ - .type = SERIO_8042, - .name = "Q40 kbd port", - .phys = "Q40", - .write = NULL, -}; +spinlock_t q40kbd_lock = SPIN_LOCK_UNLOCKED; +static struct serio *q40kbd_port; +static struct platform_device *q40kbd_device; -static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) { + unsigned long flags; + + spin_lock_irqsave(&q40kbd_lock, flags); + if (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG)) - serio_interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0, regs); + serio_interrupt(q40kbd_port, master_inb(KEYCODE_REG), 0, regs); master_outb(-1, KEYBOARD_UNLOCK_REG); + + spin_unlock_irqrestore(&q40kbd_lock, flags); + return IRQ_HANDLED; } -static int __init q40kbd_init(void) +/* + * q40kbd_flush() flushes all data that may be in the keyboard buffers + */ + +static void q40kbd_flush(void) { - int maxread = 100; + int maxread = 100; + unsigned long flags; + + spin_lock_irqsave(&q40kbd_lock, flags); + + while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) + master_inb(KEYCODE_REG); + + spin_unlock_irqrestore(&q40kbd_lock, flags); +} + +/* + * q40kbd_open() is called when a port is open by the higher layer. + * It allocates the interrupt and enables in in the chip. + */ + +static int q40kbd_open(struct serio *port) +{ + q40kbd_flush(); + + if (request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL)) { + printk(KERN_ERR "q40kbd.c: Can't get irq %d.\n", Q40_IRQ_KEYBOARD); + return -1; + } + + /* off we go */ + master_outb(-1, KEYBOARD_UNLOCK_REG); + master_outb(1, KEY_IRQ_ENABLE_REG); + + return 0; +} +static void q40kbd_close(struct serio *port) +{ + master_outb(0, KEY_IRQ_ENABLE_REG); + master_outb(-1, KEYBOARD_UNLOCK_REG); + free_irq(Q40_IRQ_KEYBOARD, NULL); + + q40kbd_flush(); +} + +static struct serio * __init q40kbd_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->open = q40kbd_open; + serio->close = q40kbd_close; + serio->dev.parent = &q40kbd_device->dev; + strlcpy(serio->name, "Q40 Kbd Port", sizeof(serio->name)); + strlcpy(serio->phys, "Q40", sizeof(serio->phys)); + } + + return serio; +} + +static int __init q40kbd_init(void) +{ if (!MACH_IS_Q40) return -EIO; - /* allocate the IRQ */ - request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL); - - /* flush any pending input */ - while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) - master_inb(KEYCODE_REG); - - /* off we go */ - master_outb(-1,KEYBOARD_UNLOCK_REG); - master_outb(1,KEY_IRQ_ENABLE_REG); + q40kbd_device = platform_device_register_simple("q40kbd", -1, NULL, 0); + if (IS_ERR(q40kbd_device)) + return PTR_ERR(q40kbd_device); + + if (!(q40kbd_port = q40kbd_allocate_port())) { + platform_device_unregister(q40kbd_device); + return -ENOMEM; + } - serio_register_port(&q40kbd_port); + serio_register_port(q40kbd_port); printk(KERN_INFO "serio: Q40 kbd registered\n"); return 0; @@ -91,11 +155,8 @@ static void __exit q40kbd_exit(void) { - master_outb(0,KEY_IRQ_ENABLE_REG); - master_outb(-1,KEYBOARD_UNLOCK_REG); - - serio_unregister_port(&q40kbd_port); - free_irq(Q40_IRQ_KEYBOARD, NULL); + serio_unregister_port(q40kbd_port); + platform_device_unregister(q40kbd_device); } module_init(q40kbd_init); diff -Nru a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c --- a/drivers/input/serio/rpckbd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/rpckbd.c 2004-09-21 20:52:51 -07:00 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,9 @@ MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); +static struct serio *rpckbd_port; +static struct platform_device *rpckbd_device; + static int rpckbd_write(struct serio *port, unsigned char val) { while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) @@ -101,25 +105,49 @@ free_irq(IRQ_KEYBOARDTX, port); } -static struct serio rpckbd_port = -{ - .type = SERIO_8042, - .open = rpckbd_open, - .close = rpckbd_close, - .write = rpckbd_write, - .name = "RiscPC PS/2 kbd port", - .phys = "rpckbd/serio0", -}; +/* + * Allocate and initialize serio structure for subsequent registration + * with serio core. + */ + +static struct serio * __init rpckbd_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = rpckbd_write; + serio->open = rpckbd_open; + serio->close = rpckbd_close; + serio->dev.parent = &rpckbd_device->dev; + strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); + strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); + } + + return serio; +} static int __init rpckbd_init(void) { - serio_register_port(&rpckbd_port); + rpckbd_device = platform_device_register_simple("rpckbd", -1, NULL, 0); + if (IS_ERR(rpckbd_device)) + return PTR_ERR(rpckbd_device); + + if (!(rpckbd_port = rpckbd_allocate_port())) { + platform_device_unregister(rpckbd_device); + return -ENOMEM; + } + + serio_register_port(rpckbd_port); return 0; } static void __exit rpckbd_exit(void) { - serio_unregister_port(&rpckbd_port); + serio_unregister_port(rpckbd_port); + platform_device_unregister(rpckbd_device); } module_init(rpckbd_init); diff -Nru a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c --- a/drivers/input/serio/sa1111ps2.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/sa1111ps2.c 2004-09-21 20:52:52 -07:00 @@ -26,7 +26,7 @@ #include struct ps2if { - struct serio io; + struct serio *io; struct sa1111_dev *dev; unsigned long base; unsigned int open; @@ -59,7 +59,7 @@ if (hweight8(scancode) & 1) flag ^= SERIO_PARITY; - serio_interrupt(&ps2if->io, scancode, flag, regs); + serio_interrupt(ps2if->io, scancode, flag, regs); status = sa1111_readl(ps2if->base + SA1111_PS2STAT); } @@ -95,7 +95,7 @@ */ static int ps2_write(struct serio *io, unsigned char val) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; unsigned long flags; unsigned int head; @@ -122,7 +122,7 @@ static int ps2_open(struct serio *io) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; int ret; sa1111_enable_device(ps2if->dev); @@ -154,7 +154,7 @@ static void ps2_close(struct serio *io) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; sa1111_writel(0, ps2if->base + SA1111_PS2CR); @@ -232,22 +232,28 @@ static int ps2_probe(struct sa1111_dev *dev) { struct ps2if *ps2if; + struct serio *serio; int ret; ps2if = kmalloc(sizeof(struct ps2if), GFP_KERNEL); - if (!ps2if) { - return -ENOMEM; + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2if || !serio) { + ret = -ENOMEM; + goto free; } memset(ps2if, 0, sizeof(struct ps2if)); + memset(serio, 0, sizeof(struct serio)); - ps2if->io.type = SERIO_8042; - ps2if->io.write = ps2_write; - ps2if->io.open = ps2_open; - ps2if->io.close = ps2_close; - ps2if->io.name = dev->dev.bus_id; - ps2if->io.phys = dev->dev.bus_id; - ps2if->io.driver = ps2if; + serio->type = SERIO_8042; + serio->write = ps2_write; + serio->open = ps2_open; + serio->close = ps2_close; + strlcpy(serio->name, dev->dev.bus_id, sizeof(serio->name)); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->port_data = ps2if; + serio->dev.parent = &dev->dev; + ps2if->io = serio; ps2if->dev = dev; sa1111_set_drvdata(dev, ps2if); @@ -292,7 +298,7 @@ ps2_clear_input(ps2if); sa1111_disable_device(ps2if->dev); - serio_register_port(&ps2if->io); + serio_register_port(ps2if->io); return 0; out: @@ -302,6 +308,7 @@ free: sa1111_set_drvdata(dev, NULL); kfree(ps2if); + kfree(serio); return ret; } @@ -312,7 +319,7 @@ { struct ps2if *ps2if = sa1111_get_drvdata(dev); - serio_unregister_port(&ps2if->io); + serio_unregister_port(ps2if->io); release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1); sa1111_set_drvdata(dev, NULL); diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c --- a/drivers/input/serio/serio.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/serio/serio.c 2004-09-21 20:52:51 -07:00 @@ -1,11 +1,9 @@ /* - * $Id: serio.c,v 1.15 2002/01/22 21:12:03 vojtech Exp $ - * - * Copyright (c) 1999-2001 Vojtech Pavlik - */ - -/* * The Serio abstraction module + * + * Copyright (c) 1999-2004 Vojtech Pavlik + * Copyright (c) 2004 Dmitry Torokhov + * Copyright (c) 2003 Daniele Bellucci */ /* @@ -26,10 +24,6 @@ * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic - * - * Changes: - * 20 Jul. 2003 Daniele Bellucci - * Minor cleanups. */ #include @@ -50,100 +44,178 @@ EXPORT_SYMBOL(serio_interrupt); EXPORT_SYMBOL(serio_register_port); EXPORT_SYMBOL(serio_register_port_delayed); -EXPORT_SYMBOL(__serio_register_port); EXPORT_SYMBOL(serio_unregister_port); EXPORT_SYMBOL(serio_unregister_port_delayed); -EXPORT_SYMBOL(__serio_unregister_port); -EXPORT_SYMBOL(serio_register_device); -EXPORT_SYMBOL(serio_unregister_device); +EXPORT_SYMBOL(serio_register_driver); +EXPORT_SYMBOL(serio_unregister_driver); EXPORT_SYMBOL(serio_open); EXPORT_SYMBOL(serio_close); EXPORT_SYMBOL(serio_rescan); EXPORT_SYMBOL(serio_reconnect); +static DECLARE_MUTEX(serio_sem); /* protects serio_list and serio_diriver_list */ +static LIST_HEAD(serio_list); +static LIST_HEAD(serio_driver_list); +static unsigned int serio_no; + +struct bus_type serio_bus = { + .name = "serio", +}; + +static void serio_find_driver(struct serio *serio); +static void serio_create_port(struct serio *serio); +static void serio_destroy_port(struct serio *serio); +static void serio_connect_port(struct serio *serio, struct serio_driver *drv); +static void serio_reconnect_port(struct serio *serio); +static void serio_disconnect_port(struct serio *serio); + +static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) +{ + get_driver(&drv->driver); + + drv->connect(serio, drv); + if (serio->drv) { + down_write(&serio_bus.subsys.rwsem); + serio->dev.driver = &drv->driver; + device_bind_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + return 1; + } + + put_driver(&drv->driver); + return 0; +} + +/* serio_find_driver() must be called with serio_sem down. */ +static void serio_find_driver(struct serio *serio) +{ + struct serio_driver *drv; + + list_for_each_entry(drv, &serio_driver_list, node) + if (!drv->manual_bind) + if (serio_bind_driver(serio, drv)) + break; +} + +/* + * Serio event processing. + */ + struct serio_event { int type; struct serio *serio; struct list_head node; }; -static DECLARE_MUTEX(serio_sem); -static LIST_HEAD(serio_list); -static LIST_HEAD(serio_dev_list); +enum serio_event_type { + SERIO_RESCAN, + SERIO_RECONNECT, + SERIO_REGISTER_PORT, + SERIO_UNREGISTER_PORT, +}; + +static spinlock_t serio_event_lock = SPIN_LOCK_UNLOCKED; /* protects serio_event_list */ static LIST_HEAD(serio_event_list); +static DECLARE_WAIT_QUEUE_HEAD(serio_wait); +static DECLARE_COMPLETION(serio_exited); static int serio_pid; -static void serio_find_dev(struct serio *serio) +static void serio_queue_event(struct serio *serio, int event_type) { - struct serio_dev *dev; + unsigned long flags; + struct serio_event *event; - list_for_each_entry(dev, &serio_dev_list, node) { - if (serio->dev) - break; - if (dev->connect) - dev->connect(serio, dev); - } -} + spin_lock_irqsave(&serio_event_lock, flags); -#define SERIO_RESCAN 1 -#define SERIO_RECONNECT 2 -#define SERIO_REGISTER_PORT 3 -#define SERIO_UNREGISTER_PORT 4 + if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) { + event->type = event_type; + event->serio = serio; -static DECLARE_WAIT_QUEUE_HEAD(serio_wait); -static DECLARE_COMPLETION(serio_exited); + list_add_tail(&event->node, &serio_event_list); + wake_up(&serio_wait); + } + + spin_unlock_irqrestore(&serio_event_lock, flags); +} -static void serio_invalidate_pending_events(struct serio *serio) +static struct serio_event *serio_get_event(void) { struct serio_event *event; + struct list_head *node; + unsigned long flags; + + spin_lock_irqsave(&serio_event_lock, flags); + + if (list_empty(&serio_event_list)) { + spin_unlock_irqrestore(&serio_event_lock, flags); + return NULL; + } + + node = serio_event_list.next; + event = container_of(node, struct serio_event, node); + list_del_init(node); + + spin_unlock_irqrestore(&serio_event_lock, flags); - list_for_each_entry(event, &serio_event_list, node) - if (event->serio == serio) - event->serio = NULL; + return event; } -void serio_handle_events(void) +static void serio_handle_events(void) { - struct list_head *node, *next; struct serio_event *event; - list_for_each_safe(node, next, &serio_event_list) { - event = container_of(node, struct serio_event, node); + while ((event = serio_get_event())) { down(&serio_sem); - if (event->serio == NULL) - goto event_done; switch (event->type) { case SERIO_REGISTER_PORT : - __serio_register_port(event->serio); + serio_create_port(event->serio); + serio_connect_port(event->serio, NULL); break; case SERIO_UNREGISTER_PORT : - __serio_unregister_port(event->serio); + serio_disconnect_port(event->serio); + serio_destroy_port(event->serio); break; case SERIO_RECONNECT : - if (event->serio->dev && event->serio->dev->reconnect) - if (event->serio->dev->reconnect(event->serio) == 0) - break; - /* reconnect failed - fall through to rescan */ + serio_reconnect_port(event->serio); + break; case SERIO_RESCAN : - if (event->serio->dev && event->serio->dev->disconnect) - event->serio->dev->disconnect(event->serio); - serio_find_dev(event->serio); + serio_disconnect_port(event->serio); + serio_connect_port(event->serio, NULL); break; default: break; } -event_done: + up(&serio_sem); - list_del_init(node); kfree(event); } } +static void serio_remove_pending_events(struct serio *serio) +{ + struct list_head *node, *next; + struct serio_event *event; + unsigned long flags; + + spin_lock_irqsave(&serio_event_lock, flags); + + list_for_each_safe(node, next, &serio_event_list) { + event = container_of(node, struct serio_event, node); + if (event->serio == serio) { + list_del_init(node); + kfree(event); + } + } + + spin_unlock_irqrestore(&serio_event_lock, flags); +} + + static int serio_thread(void *nothing) { lock_kernel(); @@ -163,52 +235,239 @@ complete_and_exit(&serio_exited, 0); } -static void serio_queue_event(struct serio *serio, int event_type) + +/* + * Serio port operations + */ + +static ssize_t serio_show_description(struct device *dev, char *buf) { - struct serio_event *event; + struct serio *serio = to_serio_port(dev); + return sprintf(buf, "%s\n", serio->name); +} - if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) { - event->type = event_type; - event->serio = serio; +static ssize_t serio_show_driver(struct device *dev, char *buf) +{ + return sprintf(buf, "%s\n", dev->driver ? dev->driver->name : "(none)"); +} - list_add_tail(&event->node, &serio_event_list); - wake_up(&serio_wait); +static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) +{ + struct serio *serio = to_serio_port(dev); + struct device_driver *drv; + int retval; + + retval = down_interruptible(&serio_sem); + if (retval) + return retval; + + retval = count; + if (!strncmp(buf, "none", count)) { + serio_disconnect_port(serio); + } else if (!strncmp(buf, "reconnect", count)) { + serio_reconnect_port(serio); + } else if (!strncmp(buf, "rescan", count)) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { + serio_disconnect_port(serio); + serio_connect_port(serio, to_serio_driver(drv)); + put_driver(drv); + } else { + retval = -EINVAL; } + + up(&serio_sem); + + return retval; } -void serio_rescan(struct serio *serio) +static ssize_t serio_show_bind_mode(struct device *dev, char *buf) { - serio_queue_event(serio, SERIO_RESCAN); + struct serio *serio = to_serio_port(dev); + return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto"); } -void serio_reconnect(struct serio *serio) +static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t count) { - serio_queue_event(serio, SERIO_RECONNECT); + struct serio *serio = to_serio_port(dev); + int retval; + + retval = count; + if (!strncmp(buf, "manual", count)) { + serio->manual_bind = 1; + } else if (!strncmp(buf, "auto", count)) { + serio->manual_bind = 0; + } else { + retval = -EINVAL; + } + + return retval; } -irqreturn_t serio_interrupt(struct serio *serio, - unsigned char data, unsigned int flags, struct pt_regs *regs) +static struct device_attribute serio_device_attrs[] = { + __ATTR(description, S_IRUGO, serio_show_description, NULL), + __ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver), + __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), + __ATTR_NULL +}; + + +static void serio_release_port(struct device *dev) { - irqreturn_t ret = IRQ_NONE; + struct serio *serio = to_serio_port(dev); - if (serio->dev && serio->dev->interrupt) { - ret = serio->dev->interrupt(serio, data, flags, regs); - } else { - if (!flags) { - if ((serio->type == SERIO_8042 || - serio->type == SERIO_8042_XL) && (data != 0xaa)) - return ret; - serio_rescan(serio); - ret = IRQ_HANDLED; + kfree(serio); + module_put(THIS_MODULE); +} + +static void serio_create_port(struct serio *serio) +{ + try_module_get(THIS_MODULE); + + spin_lock_init(&serio->lock); + list_add_tail(&serio->node, &serio_list); + snprintf(serio->dev.bus_id, sizeof(serio->dev.bus_id), "serio%d", serio_no++); + serio->dev.bus = &serio_bus; + serio->dev.release = serio_release_port; + if (serio->parent) + serio->dev.parent = &serio->parent->dev; + device_register(&serio->dev); +} + +/* + * serio_destroy_port() completes deregistration process and removes + * port from the system + */ +static void serio_destroy_port(struct serio *serio) +{ + struct serio_driver *drv = serio->drv; + unsigned long flags; + + serio_remove_pending_events(serio); + list_del_init(&serio->node); + + if (drv) { + drv->disconnect(serio); + down_write(&serio_bus.subsys.rwsem); + device_release_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + put_driver(&drv->driver); + } + + if (serio->parent) { + spin_lock_irqsave(&serio->parent->lock, flags); + serio->parent->child = NULL; + spin_unlock_irqrestore(&serio->parent->lock, flags); + } + + device_unregister(&serio->dev); +} + +/* + * serio_connect_port() tries to bind the port and possible all its + * children to appropriate drivers. If driver passed in the function will not + * try otehr drivers when binding parent port. + */ +static void serio_connect_port(struct serio *serio, struct serio_driver *drv) +{ + WARN_ON(serio->drv); + WARN_ON(serio->child); + + if (drv) + serio_bind_driver(serio, drv); + else if (!serio->manual_bind) + serio_find_driver(serio); + + /* Ok, now bind children, if any */ + while (serio->child) { + serio = serio->child; + + WARN_ON(serio->drv); + WARN_ON(serio->child); + + serio_create_port(serio); + + if (!serio->manual_bind) { + /* + * With children we just _prefer_ passed in driver, + * but we will try other options in case preferred + * is not the one + */ + if (!drv || !serio_bind_driver(serio, drv)) + serio_find_driver(serio); } } - return ret; +} + +/* + * + */ +static void serio_reconnect_port(struct serio *serio) +{ + do { + if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + /* Ok, old children are now gone, we are done */ + break; + } + serio = serio->child; + } while (serio); +} + +/* + * serio_disconnect_port() unbinds a port from its driver. As a side effect + * all child ports are unbound and destroyed. + */ +static void serio_disconnect_port(struct serio *serio) +{ + struct serio_driver *drv = serio->drv; + struct serio *s; + + if (serio->child) { + /* + * Children ports should be disconnected and destroyed + * first, staring with the leaf one, since we don't want + * to do recursion + */ + do { + s = serio->child; + } while (s->child); + + while (s != serio) { + s = s->parent; + serio_destroy_port(s->child); + } + } + + /* + * Ok, no children left, now disconnect this port + */ + if (drv) { + drv->disconnect(serio); + down_write(&serio_bus.subsys.rwsem); + device_release_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + put_driver(&drv->driver); + } +} + +void serio_rescan(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RESCAN); +} + +void serio_reconnect(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RECONNECT); } void serio_register_port(struct serio *serio) { down(&serio_sem); - __serio_register_port(serio); + serio_create_port(serio); + serio_connect_port(serio, NULL); up(&serio_sem); } @@ -222,21 +481,11 @@ serio_queue_event(serio, SERIO_REGISTER_PORT); } -/* - * Should only be called directly if serio_sem has already been taken, - * for example when unregistering a serio from other input device's - * connect() function. - */ -void __serio_register_port(struct serio *serio) -{ - list_add_tail(&serio->node, &serio_list); - serio_find_dev(serio); -} - void serio_unregister_port(struct serio *serio) { down(&serio_sem); - __serio_unregister_port(serio); + serio_disconnect_port(serio); + serio_destroy_port(serio); up(&serio_sem); } @@ -250,82 +499,171 @@ serio_queue_event(serio, SERIO_UNREGISTER_PORT); } + /* - * Should only be called directly if serio_sem has already been taken, - * for example when unregistering a serio from other input device's - * disconnect() function. + * Serio driver operations */ -void __serio_unregister_port(struct serio *serio) + +static ssize_t serio_driver_show_description(struct device_driver *drv, char *buf) { - serio_invalidate_pending_events(serio); - list_del_init(&serio->node); - if (serio->dev && serio->dev->disconnect) - serio->dev->disconnect(serio); + struct serio_driver *driver = to_serio_driver(drv); + return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)"); +} + +static ssize_t serio_driver_show_bind_mode(struct device_driver *drv, char *buf) +{ + struct serio_driver *serio_drv = to_serio_driver(drv); + return sprintf(buf, "%s\n", serio_drv->manual_bind ? "manual" : "auto"); } -void serio_register_device(struct serio_dev *dev) +static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char *buf, size_t count) +{ + struct serio_driver *serio_drv = to_serio_driver(drv); + int retval; + + retval = count; + if (!strncmp(buf, "manual", count)) { + serio_drv->manual_bind = 1; + } else if (!strncmp(buf, "auto", count)) { + serio_drv->manual_bind = 0; + } else { + retval = -EINVAL; + } + + return retval; +} + + +static struct driver_attribute serio_driver_attrs[] = { + __ATTR(description, S_IRUGO, serio_driver_show_description, NULL), + __ATTR(bind_mode, S_IWUSR | S_IRUGO, + serio_driver_show_bind_mode, serio_driver_set_bind_mode), + __ATTR_NULL +}; + +void serio_register_driver(struct serio_driver *drv) { struct serio *serio; + down(&serio_sem); - list_add_tail(&dev->node, &serio_dev_list); - list_for_each_entry(serio, &serio_list, node) - if (!serio->dev && dev->connect) - dev->connect(serio, dev); + + list_add_tail(&drv->node, &serio_driver_list); + + drv->driver.bus = &serio_bus; + driver_register(&drv->driver); + + if (drv->manual_bind) + goto out; + +start_over: + list_for_each_entry(serio, &serio_list, node) { + if (!serio->drv) { + serio_connect_port(serio, drv); + /* + * if new child appeared then the list is changed, + * we need to start over + */ + if (serio->child) + goto start_over; + } + } + +out: up(&serio_sem); } -void serio_unregister_device(struct serio_dev *dev) +void serio_unregister_driver(struct serio_driver *drv) { struct serio *serio; down(&serio_sem); - list_del_init(&dev->node); + list_del_init(&drv->node); + +start_over: list_for_each_entry(serio, &serio_list, node) { - if (serio->dev == dev && dev->disconnect) - dev->disconnect(serio); - serio_find_dev(serio); + if (serio->drv == drv) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + /* we could've deleted some ports, restart */ + goto start_over; + } } + + driver_unregister(&drv->driver); + up(&serio_sem); } -/* called from serio_dev->connect/disconnect methods under serio_sem */ -int serio_open(struct serio *serio, struct serio_dev *dev) +/* called from serio_driver->connect/disconnect methods under serio_sem */ +int serio_open(struct serio *serio, struct serio_driver *drv) { - serio->dev = dev; + serio_pause_rx(serio); + serio->drv = drv; + serio_continue_rx(serio); + if (serio->open && serio->open(serio)) { - serio->dev = NULL; + serio_pause_rx(serio); + serio->drv = NULL; + serio_continue_rx(serio); return -1; } return 0; } -/* called from serio_dev->connect/disconnect methods under serio_sem */ +/* called from serio_driver->connect/disconnect methods under serio_sem */ void serio_close(struct serio *serio) { if (serio->close) serio->close(serio); - serio->dev = NULL; + + serio_pause_rx(serio); + serio->drv = NULL; + serio_continue_rx(serio); } -static int __init serio_init(void) +irqreturn_t serio_interrupt(struct serio *serio, + unsigned char data, unsigned int dfl, struct pt_regs *regs) { - int pid; + unsigned long flags; + irqreturn_t ret = IRQ_NONE; + + spin_lock_irqsave(&serio->lock, flags); + + if (likely(serio->drv)) { + ret = serio->drv->interrupt(serio, data, dfl, regs); + } else { + if (!dfl) { + if ((serio->type != SERIO_8042 && + serio->type != SERIO_8042_XL) || (data == 0xaa)) { + serio_rescan(serio); + ret = IRQ_HANDLED; + } + } + } + + spin_unlock_irqrestore(&serio->lock, flags); - pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL); + return ret; +} - if (!pid) { +static int __init serio_init(void) +{ + if (!(serio_pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL))) { printk(KERN_WARNING "serio: Failed to start kseriod\n"); return -1; } - serio_pid = pid; + serio_bus.dev_attrs = serio_device_attrs; + serio_bus.drv_attrs = serio_driver_attrs; + bus_register(&serio_bus); return 0; } static void __exit serio_exit(void) { + bus_unregister(&serio_bus); kill_proc(serio_pid, SIGTERM, 1); wait_for_completion(&serio_exited); } diff -Nru a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/input/serio/serio_raw.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,390 @@ +/* + * Raw serio device providing access to a raw byte stream from underlying + * serio port. Closely emulates behavior of pre-2.6 /dev/psaux device + * + * Copyright (c) 2004 Dmitry Torokhov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_DESC "Raw serio driver" + +MODULE_AUTHOR("Dmitry Torokhov "); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + +#define SERIO_RAW_QUEUE_LEN 64 +struct serio_raw { + unsigned char queue[SERIO_RAW_QUEUE_LEN]; + unsigned int tail, head; + + char name[16]; + unsigned int refcnt; + struct serio *serio; + struct miscdevice dev; + wait_queue_head_t wait; + struct list_head list; + struct list_head node; +}; + +struct serio_raw_list { + struct fasync_struct *fasync; + struct serio_raw *serio_raw; + struct list_head node; +}; + +static DECLARE_MUTEX(serio_raw_sem); +static LIST_HEAD(serio_raw_list); +static unsigned int serio_raw_no; + +/********************************************************************* + * Interface with userspace (file operations) * + *********************************************************************/ + +static int serio_raw_fasync(int fd, struct file *file, int on) +{ + struct serio_raw_list *list = file->private_data; + int retval; + + retval = fasync_helper(fd, file, on, &list->fasync); + return retval < 0 ? retval : 0; +} + +static struct serio_raw *serio_raw_locate(int minor) +{ + struct serio_raw *serio_raw; + + list_for_each_entry(serio_raw, &serio_raw_list, node) { + if (serio_raw->dev.minor == minor) + return serio_raw; + } + + return NULL; +} + +static int serio_raw_open(struct inode *inode, struct file *file) +{ + struct serio_raw *serio_raw; + struct serio_raw_list *list; + int retval = 0; + + retval = down_interruptible(&serio_raw_sem); + if (retval) + return retval; + + if (!(serio_raw = serio_raw_locate(iminor(inode)))) { + retval = -ENODEV; + goto out; + } + + if (!serio_raw->serio) { + retval = -ENODEV; + goto out; + } + + if (!(list = kmalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { + retval = -ENOMEM; + goto out; + } + + memset(list, 0, sizeof(struct serio_raw_list)); + list->serio_raw = serio_raw; + file->private_data = list; + + serio_raw->refcnt++; + list_add_tail(&list->node, &serio_raw->list); + +out: + up(&serio_raw_sem); + return retval; +} + +static int serio_raw_cleanup(struct serio_raw *serio_raw) +{ + if (--serio_raw->refcnt == 0) { + misc_deregister(&serio_raw->dev); + list_del_init(&serio_raw->node); + kfree(serio_raw); + + return 1; + } + + return 0; +} + +static int serio_raw_release(struct inode *inode, struct file *file) +{ + struct serio_raw_list *list = file->private_data; + struct serio_raw *serio_raw = list->serio_raw; + + down(&serio_raw_sem); + + serio_raw_fasync(-1, file, 0); + serio_raw_cleanup(serio_raw); + + up(&serio_raw_sem); + return 0; +} + +static int serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c) +{ + unsigned long flags; + int empty; + + spin_lock_irqsave(&serio_raw->serio->lock, flags); + + empty = serio_raw->head == serio_raw->tail; + if (!empty) { + *c = serio_raw->queue[serio_raw->tail]; + serio_raw->tail = (serio_raw->tail + 1) % SERIO_RAW_QUEUE_LEN; + } + + spin_unlock_irqrestore(&serio_raw->serio->lock, flags); + + return !empty; +} + +static ssize_t serio_raw_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +{ + struct serio_raw_list *list = file->private_data; + struct serio_raw *serio_raw = list->serio_raw; + char c; + ssize_t retval = 0; + + if (!serio_raw->serio) + return -ENODEV; + + if (serio_raw->head == serio_raw->tail && (file->f_flags & O_NONBLOCK)) + return -EAGAIN; + + retval = wait_event_interruptible(list->serio_raw->wait, + serio_raw->head != serio_raw->tail || !serio_raw->serio); + if (retval) + return retval; + + if (!serio_raw->serio) + return -ENODEV; + + while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) { + if (put_user(c, buffer++)) + return -EFAULT; + retval++; + } + + return retval; +} + +static ssize_t serio_raw_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +{ + struct serio_raw_list *list = file->private_data; + ssize_t written = 0; + int retval; + unsigned char c; + + retval = down_interruptible(&serio_raw_sem); + if (retval) + return retval; + + if (!list->serio_raw->serio) { + retval = -ENODEV; + goto out; + } + + if (count > 32) + count = 32; + + while (count--) { + if (get_user(c, buffer++)) { + retval = -EFAULT; + goto out; + } + if (serio_write(list->serio_raw->serio, c)) { + retval = -EIO; + goto out; + } + written++; + }; + +out: + up(&serio_raw_sem); + return written; +} + +static unsigned int serio_raw_poll(struct file *file, poll_table *wait) +{ + struct serio_raw_list *list = file->private_data; + + poll_wait(file, &list->serio_raw->wait, wait); + + if (list->serio_raw->head != list->serio_raw->tail) + return POLLIN | POLLRDNORM; + + return 0; +} + +struct file_operations serio_raw_fops = { + .owner = THIS_MODULE, + .open = serio_raw_open, + .release = serio_raw_release, + .read = serio_raw_read, + .write = serio_raw_write, + .poll = serio_raw_poll, + .fasync = serio_raw_fasync, +}; + + +/********************************************************************* + * Interface with serio port * + *********************************************************************/ + +static irqreturn_t serio_raw_interrupt(struct serio *serio, unsigned char data, + unsigned int dfl, struct pt_regs *regs) +{ + struct serio_raw *serio_raw = serio->private; + struct serio_raw_list *list; + unsigned int head = serio_raw->head; + + /* we are holding serio->lock here so we are prootected */ + serio_raw->queue[head] = data; + head = (head + 1) % SERIO_RAW_QUEUE_LEN; + if (likely(head != serio_raw->tail)) { + serio_raw->head = head; + list_for_each_entry(list, &serio_raw->list, node) + kill_fasync(&list->fasync, SIGIO, POLL_IN); + wake_up_interruptible(&serio_raw->wait); + } + + return IRQ_HANDLED; +} + +static void serio_raw_connect(struct serio *serio, struct serio_driver *drv) +{ + struct serio_raw *serio_raw; + int err; + + if ((serio->type & SERIO_TYPE) != SERIO_8042) + return; + + if (!(serio_raw = kmalloc(sizeof(struct serio_raw), GFP_KERNEL))) { + printk(KERN_ERR "serio_raw.c: can't allocate memory for a device\n"); + return; + } + + down(&serio_raw_sem); + + memset(serio_raw, 0, sizeof(struct serio_raw)); + snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); + serio_raw->refcnt = 1; + serio_raw->serio = serio; + INIT_LIST_HEAD(&serio_raw->list); + init_waitqueue_head(&serio_raw->wait); + + serio->private = serio_raw; + if (serio_open(serio, drv)) + goto out_free; + + list_add_tail(&serio_raw->node, &serio_raw_list); + + serio_raw->dev.minor = PSMOUSE_MINOR; + serio_raw->dev.name = serio_raw->name; + serio_raw->dev.fops = &serio_raw_fops; + + err = misc_register(&serio_raw->dev); + if (err) { + serio_raw->dev.minor = MISC_DYNAMIC_MINOR; + err = misc_register(&serio_raw->dev); + } + + if (err) { + printk(KERN_INFO "serio_raw: failed to register raw access device for %s\n", + serio->phys); + goto out_close; + } + + printk(KERN_INFO "serio_raw: raw access enabled on %s (%s, minor %d)\n", + serio->phys, serio_raw->name, serio_raw->dev.minor); + goto out; + +out_close: + serio_close(serio); + list_del_init(&serio_raw->node); +out_free: + serio->private = NULL; + kfree(serio_raw); +out: + up(&serio_raw_sem); +} + +static int serio_raw_reconnect(struct serio *serio) +{ + struct serio_raw *serio_raw = serio->private; + struct serio_driver *drv = serio->drv; + + if (!drv || !serio_raw) { + printk(KERN_DEBUG "serio_raw: reconnect request, but serio is disconnected, ignoring...\n"); + return -1; + } + + /* + * Nothing needs to be done here, we just need this method to + * keep the same device. + */ + return 0; +} + +static void serio_raw_disconnect(struct serio *serio) +{ + struct serio_raw *serio_raw; + + down(&serio_raw_sem); + + serio_raw = serio->private; + + serio_close(serio); + serio->private = NULL; + + serio_raw->serio = NULL; + if (!serio_raw_cleanup(serio_raw)) + wake_up_interruptible(&serio_raw->wait); + + up(&serio_raw_sem); +} + +static struct serio_driver serio_raw_drv = { + .driver = { + .name = "serio_raw", + }, + .description = DRIVER_DESC, + .interrupt = serio_raw_interrupt, + .connect = serio_raw_connect, + .reconnect = serio_raw_reconnect, + .disconnect = serio_raw_disconnect, + .manual_bind = 1, +}; + +int __init serio_raw_init(void) +{ + serio_register_driver(&serio_raw_drv); + return 0; +} + +void __exit serio_raw_exit(void) +{ + serio_unregister_driver(&serio_raw_drv); +} + +module_init(serio_raw_init); +module_exit(serio_raw_exit); diff -Nru a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c --- a/drivers/input/serio/serport.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/serio/serport.c 2004-09-21 20:52:52 -07:00 @@ -31,28 +31,25 @@ struct serport { struct tty_struct *tty; wait_queue_head_t wait; - struct serio serio; + struct serio *serio; unsigned long flags; - char phys[32]; }; -char serport_name[] = "Serial port"; - /* * Callback functions from the serio code. */ static int serport_serio_write(struct serio *serio, unsigned char data) { - struct serport *serport = serio->driver; + struct serport *serport = serio->port_data; return -(serport->tty->driver->write(serport->tty, 0, &data, 1) != 1); } static void serport_serio_close(struct serio *serio) { - struct serport *serport = serio->driver; + struct serport *serport = serio->port_data; - serport->serio.type = 0; + serport->serio->type = 0; wake_up_interruptible(&serport->wait); } @@ -64,26 +61,30 @@ static int serport_ldisc_open(struct tty_struct *tty) { struct serport *serport; + struct serio *serio; char name[64]; serport = kmalloc(sizeof(struct serport), GFP_KERNEL); - if (unlikely(!serport)) + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (unlikely(!serport || !serio)) { + kfree(serport); + kfree(serio); return -ENOMEM; - memset(serport, 0, sizeof(struct serport)); + } + memset(serport, 0, sizeof(struct serport)); + serport->serio = serio; set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); serport->tty = tty; tty->disc_data = serport; - snprintf(serport->phys, sizeof(serport->phys), "%s/serio0", tty_name(tty, name)); - - serport->serio.name = serport_name; - serport->serio.phys = serport->phys; - - serport->serio.type = SERIO_RS232; - serport->serio.write = serport_serio_write; - serport->serio.close = serport_serio_close; - serport->serio.driver = serport; + memset(serio, 0, sizeof(struct serio)); + strlcpy(serio->name, "Serial port", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name)); + serio->type = SERIO_RS232; + serio->write = serport_serio_write; + serio->close = serport_serio_close; + serio->port_data = serport; init_waitqueue_head(&serport->wait); @@ -114,7 +115,7 @@ struct serport *serport = (struct serport*) tty->disc_data; int i; for (i = 0; i < count; i++) - serio_interrupt(&serport->serio, cp[i], 0, NULL); + serio_interrupt(serport->serio, cp[i], 0, NULL); } /* @@ -142,10 +143,10 @@ if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) return -EBUSY; - serio_register_port(&serport->serio); + serio_register_port(serport->serio); printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name)); - wait_event_interruptible(serport->wait, !serport->serio.type); - serio_unregister_port(&serport->serio); + wait_event_interruptible(serport->wait, !serport->serio->type); + serio_unregister_port(serport->serio); clear_bit(SERPORT_BUSY, &serport->flags); @@ -161,7 +162,7 @@ struct serport *serport = (struct serport*) tty->disc_data; if (cmd == SPIOCSTYPE) - return get_user(serport->serio.type, (unsigned long __user *) arg); + return get_user(serport->serio->type, (unsigned long __user *) arg); return -EINVAL; } @@ -170,7 +171,7 @@ { struct serport *sp = (struct serport *) tty->disc_data; - serio_dev_write_wakeup(&sp->serio); + serio_drv_write_wakeup(sp->serio); } /* diff -Nru a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c --- a/drivers/input/touchscreen/gunze.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/input/touchscreen/gunze.c 2004-09-21 20:52:51 -07:00 @@ -36,8 +36,10 @@ #include #include +#define DRIVER_DESC "Gunze AHL-51S touchscreen driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Gunze AHL-51S touchscreen driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -111,7 +113,7 @@ * and if yes, registers it as an input device. */ -static void gunze_connect(struct serio *serio, struct serio_dev *dev) +static void gunze_connect(struct serio *serio, struct serio_driver *drv) { struct gunze *gunze; @@ -142,7 +144,7 @@ gunze->dev.id.product = 0x0051; gunze->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(gunze); return; } @@ -156,10 +158,14 @@ * The serio device structure. */ -static struct serio_dev gunze_dev = { - .interrupt = gunze_interrupt, - .connect = gunze_connect, - .disconnect = gunze_disconnect, +static struct serio_driver gunze_drv = { + .driver = { + .name = "gunze", + }, + .description = DRIVER_DESC, + .interrupt = gunze_interrupt, + .connect = gunze_connect, + .disconnect = gunze_disconnect, }; /* @@ -168,13 +174,13 @@ int __init gunze_init(void) { - serio_register_device(&gunze_dev); + serio_register_driver(&gunze_drv); return 0; } void __exit gunze_exit(void) { - serio_unregister_device(&gunze_dev); + serio_unregister_driver(&gunze_drv); } module_init(gunze_init); diff -Nru a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c --- a/drivers/input/touchscreen/h3600_ts_input.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/touchscreen/h3600_ts_input.c 2004-09-21 20:52:52 -07:00 @@ -45,8 +45,10 @@ #include #include +#define DRIVER_DESC "H3600 touchscreen driver" + MODULE_AUTHOR("James Simmons "); -MODULE_DESCRIPTION("H3600 touchscreen driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -373,7 +375,7 @@ * new serio device. It looks whether it was registered as a H3600 touchscreen * and if yes, registers it as an input device. */ -static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) +static void h3600ts_connect(struct serio *serio, struct serio_driver *drv) { struct h3600_dev *ts; @@ -441,7 +443,7 @@ ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */ ts->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); kfree(ts); @@ -478,10 +480,14 @@ * The serio device structure. */ -static struct serio_dev h3600ts_dev = { - .interrupt = h3600ts_interrupt, - .connect = h3600ts_connect, - .disconnect = h3600ts_disconnect, +static struct serio_driver h3600ts_drv = { + .driver = { + .name = "h3600ts", + }, + .description = DRIVER_DESC, + .interrupt = h3600ts_interrupt, + .connect = h3600ts_connect, + .disconnect = h3600ts_disconnect, }; /* @@ -490,13 +496,13 @@ static int __init h3600ts_init(void) { - serio_register_device(&h3600ts_dev); + serio_register_driver(&h3600ts_drv); return 0; } static void __exit h3600ts_exit(void) { - serio_unregister_device(&h3600ts_dev); + serio_unregister_driver(&h3600ts_drv); } module_init(h3600ts_init); diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c --- a/drivers/input/tsdev.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/input/tsdev.c 2004-09-21 20:52:52 -07:00 @@ -3,32 +3,42 @@ * * Copyright (c) 2001 "Crazy" james Simmons * - * Input driver to Touchscreen device driver module. + * Compaq touchscreen protocol driver. The protocol emulated by this driver + * is obsolete; for new programs use the tslib library which can read directly + * from evdev and perform dejittering, variance filtering and calibration - + * all in user space, not at kernel level. The meaning of this driver is + * to allow usage of newer input drivers with old applications that use the + * old /dev/h3600_ts and /dev/h3600_tsraw devices. * - * Sponsored by Transvirtual Technology + * 09-Apr-2004: Andrew Zabolotny + * Fixed to actually work, not just output random numbers. + * Added support for both h3600_ts and h3600_tsraw protocol + * emulation. */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to . + * e-mail - mail your message to . */ #define TSDEV_MINOR_BASE 128 #define TSDEV_MINORS 32 +/* First 16 devices are h3600_ts compatible; second 16 are h3600_tsraw */ +#define TSDEV_MINOR_MASK 15 #define TSDEV_BUFFER_SIZE 64 #include @@ -52,48 +62,84 @@ #define CONFIG_INPUT_TSDEV_SCREEN_Y 320 #endif +/* This driver emulates both protocols of the old h3600_ts and h3600_tsraw + * devices. The first one must output X/Y data in 'cooked' format, e.g. + * filtered, dejittered and calibrated. Second device just outputs raw + * data received from the hardware. + * + * This driver doesn't support filtering and dejittering; it supports only + * calibration. Filtering and dejittering must be done in the low-level + * driver, if needed, because it may gain additional benefits from knowing + * the low-level details, the nature of noise and so on. + * + * The driver precomputes a calibration matrix given the initial xres and + * yres values (quite innacurate for most touchscreens) that will result + * in a more or less expected range of output values. The driver supports + * the TS_SET_CAL ioctl, which will replace the calibration matrix with a + * new one, supposedly generated from the values taken from the raw device. + */ + MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Input driver to touchscreen converter"); MODULE_LICENSE("GPL"); static int xres = CONFIG_INPUT_TSDEV_SCREEN_X; module_param(xres, uint, 0); -MODULE_PARM_DESC(xres, "Horizontal screen resolution"); +MODULE_PARM_DESC(xres, "Horizontal screen resolution (can be negative for X-mirror)"); static int yres = CONFIG_INPUT_TSDEV_SCREEN_Y; module_param(yres, uint, 0); -MODULE_PARM_DESC(yres, "Vertical screen resolution"); +MODULE_PARM_DESC(yres, "Vertical screen resolution (can be negative for Y-mirror)"); + +/* From Compaq's Touch Screen Specification version 0.2 (draft) */ +struct ts_event { + short pressure; + short x; + short y; + short millisecs; +}; + +struct ts_calibration { + int xscale; + int xtrans; + int yscale; + int ytrans; + int xyswap; +}; struct tsdev { int exist; int open; int minor; - char name[16]; + char name[8]; wait_queue_head_t wait; struct list_head list; struct input_handle handle; + int x, y, pressure; + struct ts_calibration cal; }; -/* From Compaq's Touch Screen Specification version 0.2 (draft) */ -typedef struct { - short pressure; - short x; - short y; - short millisecs; -} TS_EVENT; - struct tsdev_list { struct fasync_struct *fasync; struct list_head node; struct tsdev *tsdev; int head, tail; - int oldx, oldy, pendown; - TS_EVENT event[TSDEV_BUFFER_SIZE]; + struct ts_event event[TSDEV_BUFFER_SIZE]; + int raw; }; +/* The following ioctl codes are defined ONLY for backward compatibility. + * Don't use tsdev for new developement; use the tslib library instead. + * Touchscreen calibration is a fully userspace task. + */ +/* Use 'f' as magic number */ +#define IOC_H3600_TS_MAGIC 'f' +#define TS_GET_CAL _IOR(IOC_H3600_TS_MAGIC, 10, struct ts_calibration) +#define TS_SET_CAL _IOW(IOC_H3600_TS_MAGIC, 11, struct ts_calibration) + static struct input_handler tsdev_handler; -static struct tsdev *tsdev_table[TSDEV_MINORS]; +static struct tsdev *tsdev_table[TSDEV_MINORS/2]; static int tsdev_fasync(int fd, struct file *file, int on) { @@ -109,13 +155,16 @@ int i = iminor(inode) - TSDEV_MINOR_BASE; struct tsdev_list *list; - if (i >= TSDEV_MINORS || !tsdev_table[i]) + if (i >= TSDEV_MINORS || !tsdev_table[i & TSDEV_MINOR_MASK]) return -ENODEV; if (!(list = kmalloc(sizeof(struct tsdev_list), GFP_KERNEL))) return -ENOMEM; memset(list, 0, sizeof(struct tsdev_list)); + list->raw = (i >= TSDEV_MINORS/2) ? 1 : 0; + + i &= TSDEV_MINOR_MASK; list->tsdev = tsdev_table[i]; list_add_tail(&list->node, &tsdev_table[i]->list); file->private_data = list; @@ -161,7 +210,7 @@ return -EAGAIN; retval = wait_event_interruptible(list->tsdev->wait, - (list->head != list->tail) && list->tsdev->exist); + list->head != list->tail || !list->tsdev->exist); if (retval) return retval; @@ -169,11 +218,13 @@ if (!list->tsdev->exist) return -ENODEV; - while (list->head != list->tail && retval + sizeof(TS_EVENT) <= count) { - if (copy_to_user (buffer + retval, list->event + list->tail, sizeof(TS_EVENT))) + while (list->head != list->tail && + retval + sizeof (struct ts_event) <= count) { + if (copy_to_user (buffer + retval, list->event + list->tail, + sizeof (struct ts_event))) return -EFAULT; list->tail = (list->tail + 1) & (TSDEV_BUFFER_SIZE - 1); - retval += sizeof(TS_EVENT); + retval += sizeof (struct ts_event); } return retval; @@ -193,22 +244,27 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { -/* struct tsdev_list *list = file->private_data; - struct tsdev *evdev = list->tsdev; - struct input_dev *dev = tsdev->handle.dev; - int retval; - + struct tsdev *tsdev = list->tsdev; + int retval = 0; + switch (cmd) { - case HHEHE: - return 0; - case hjff: - return 0; - default: - return 0; + case TS_GET_CAL: + if (copy_to_user ((void *)arg, &tsdev->cal, + sizeof (struct ts_calibration))) + retval = -EFAULT; + break; + case TS_SET_CAL: + if (copy_from_user (&tsdev->cal, (void *)arg, + sizeof (struct ts_calibration))) + retval = -EFAULT; + break; + default: + retval = -EINVAL; + break; } -*/ - return -EINVAL; + + return retval; } struct file_operations tsdev_fops = { @@ -227,82 +283,85 @@ struct tsdev *tsdev = handle->private; struct tsdev_list *list; struct timeval time; - int size; - list_for_each_entry(list, &tsdev->list, node) { - switch (type) { - case EV_ABS: - switch (code) { - case ABS_X: - if (!list->pendown) - return; - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size > 0) - list->oldx = ((value - handle->dev->absmin[ABS_X]) * xres / size); - else - list->oldx = ((value - handle->dev->absmin[ABS_X])); - break; - case ABS_Y: - if (!list->pendown) - return; - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size > 0) - list->oldy = ((value - handle->dev->absmin[ABS_Y]) * yres / size); - else - list->oldy = ((value - handle->dev->absmin[ABS_Y])); - break; - case ABS_PRESSURE: - list->pendown = ((value > handle->dev-> absmin[ABS_PRESSURE])) ? - value - handle->dev->absmin[ABS_PRESSURE] : 0; - break; - } + switch (type) { + case EV_ABS: + switch (code) { + case ABS_X: + tsdev->x = value; + break; + case ABS_Y: + tsdev->y = value; break; + case ABS_PRESSURE: + if (value > handle->dev->absmax[ABS_PRESSURE]) + value = handle->dev->absmax[ABS_PRESSURE]; + value -= handle->dev->absmin[ABS_PRESSURE]; + if (value < 0) + value = 0; + tsdev->pressure = value; + break; + } + break; - case EV_REL: - switch (code) { - case REL_X: - if (!list->pendown) - return; - list->oldx += value; - if (list->oldx < 0) - list->oldx = 0; - else if (list->oldx > xres) - list->oldx = xres; + case EV_REL: + switch (code) { + case REL_X: + tsdev->x += value; + if (tsdev->x < 0) + tsdev->x = 0; + else if (tsdev->x > xres) + tsdev->x = xres; + break; + case REL_Y: + tsdev->y += value; + if (tsdev->y < 0) + tsdev->y = 0; + else if (tsdev->y > yres) + tsdev->y = yres; + break; + } + break; + + case EV_KEY: + if (code == BTN_TOUCH || code == BTN_MOUSE) { + switch (value) { + case 0: + tsdev->pressure = 0; break; - case REL_Y: - if (!list->pendown) - return; - list->oldy += value; - if (list->oldy < 0) - list->oldy = 0; - else if (list->oldy > xres) - list->oldy = xres; + case 1: + if (!tsdev->pressure) + tsdev->pressure = 1; break; } - break; - - case EV_KEY: - if (code == BTN_TOUCH || code == BTN_MOUSE) { - switch (value) { - case 0: - list->pendown = 0; - break; - case 1: - if (!list->pendown) - list->pendown = 1; - break; - case 2: - return; - } - } else - return; - break; } + break; + } + + if (type != EV_SYN || code != SYN_REPORT) + return; + + list_for_each_entry(list, &tsdev->list, node) { + int x, y, tmp; + do_gettimeofday(&time); list->event[list->head].millisecs = time.tv_usec / 100; - list->event[list->head].pressure = list->pendown; - list->event[list->head].x = list->oldx; - list->event[list->head].y = list->oldy; + list->event[list->head].pressure = tsdev->pressure; + + x = tsdev->x; + y = tsdev->y; + + /* Calibration */ + if (!list->raw) { + x = ((x * tsdev->cal.xscale) >> 8) + tsdev->cal.xtrans; + y = ((y * tsdev->cal.yscale) >> 8) + tsdev->cal.ytrans; + if (tsdev->cal.xyswap) { + tmp = x; x = y; y = tmp; + } + } + + list->event[list->head].x = x; + list->event[list->head].y = y; list->head = (list->head + 1) & (TSDEV_BUFFER_SIZE - 1); kill_fasync(&list->fasync, SIGIO, POLL_IN); } @@ -314,11 +373,11 @@ struct input_device_id *id) { struct tsdev *tsdev; - int minor; + int minor, delta; - for (minor = 0; minor < TSDEV_MINORS && tsdev_table[minor]; + for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; minor++); - if (minor == TSDEV_MINORS) { + if (minor >= TSDEV_MINORS/2) { printk(KERN_ERR "tsdev: You have way too many touchscreens\n"); return NULL; @@ -340,10 +399,25 @@ tsdev->handle.handler = handler; tsdev->handle.private = tsdev; + /* Precompute the rough calibration matrix */ + delta = dev->absmax [ABS_X] - dev->absmin [ABS_X] + 1; + if (delta == 0) + delta = 1; + tsdev->cal.xscale = (xres << 8) / delta; + tsdev->cal.xtrans = - ((dev->absmin [ABS_X] * tsdev->cal.xscale) >> 8); + + delta = dev->absmax [ABS_Y] - dev->absmin [ABS_Y] + 1; + if (delta == 0) + delta = 1; + tsdev->cal.yscale = (yres << 8) / delta; + tsdev->cal.ytrans = - ((dev->absmin [ABS_Y] * tsdev->cal.yscale) >> 8); + tsdev_table[minor] = tsdev; - + devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor); + devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2), + S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor); class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), dev->dev, "ts%d", minor); @@ -362,6 +436,7 @@ wake_up_interruptible(&tsdev->wait); } else tsdev_free(tsdev); + devfs_remove("input/tsraw%d", tsdev->minor); } static struct input_device_id tsdev_ids[] = { @@ -378,6 +453,12 @@ .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, },/* A tablet like device, at least touch detection, two absolute axes */ + + { + .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, + .evbit = { BIT(EV_ABS) }, + .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, + },/* A tablet like device with several gradations of pressure */ {},/* Terminating entry */ }; diff -Nru a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c --- a/drivers/macintosh/via-pmu.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/macintosh/via-pmu.c 2004-09-21 20:52:52 -07:00 @@ -1446,7 +1446,7 @@ pmu_sr_intr(struct pt_regs *regs) { struct adb_request *req; - int bite; + int bite = 0; if (via[B] & TREQ) { printk(KERN_ERR "PMU: spurious SR intr (%x)\n", via[B]); diff -Nru a/drivers/md/dm-table.c b/drivers/md/dm-table.c --- a/drivers/md/dm-table.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/md/dm-table.c 2004-09-21 20:52:52 -07:00 @@ -825,7 +825,7 @@ * Make sure we obey the optimistic sub devices * restrictions. */ - q->max_sectors = t->limits.max_sectors; + blk_queue_max_sectors(q, t->limits.max_sectors); q->max_phys_segments = t->limits.max_phys_segments; q->max_hw_segments = t->limits.max_hw_segments; q->hardsect_size = t->limits.hardsect_size; diff -Nru a/drivers/md/linear.c b/drivers/md/linear.c --- a/drivers/md/linear.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/md/linear.c 2004-09-21 20:52:51 -07:00 @@ -157,7 +157,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); disk->size = rdev->size; mddev->array_size += rdev->size; diff -Nru a/drivers/md/md.c b/drivers/md/md.c --- a/drivers/md/md.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/md/md.c 2004-09-21 20:52:51 -07:00 @@ -2895,7 +2895,7 @@ return thread; } -void md_interrupt_thread(mdk_thread_t *thread) +static void md_interrupt_thread(mdk_thread_t *thread) { if (!thread->tsk) { MD_BUG(); @@ -3797,6 +3797,5 @@ EXPORT_SYMBOL(md_unregister_thread); EXPORT_SYMBOL(md_wakeup_thread); EXPORT_SYMBOL(md_print_devices); -EXPORT_SYMBOL(md_interrupt_thread); EXPORT_SYMBOL(md_check_recovery); MODULE_LICENSE("GPL"); diff -Nru a/drivers/md/multipath.c b/drivers/md/multipath.c --- a/drivers/md/multipath.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/md/multipath.c 2004-09-21 20:52:51 -07:00 @@ -325,7 +325,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); conf->working_disks++; rdev->raid_disk = path; @@ -479,7 +479,7 @@ * a merge_bvec_fn to be involved in multipath */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); if (!rdev->faulty) conf->working_disks++; diff -Nru a/drivers/md/raid0.c b/drivers/md/raid0.c --- a/drivers/md/raid0.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/md/raid0.c 2004-09-21 20:52:52 -07:00 @@ -162,7 +162,7 @@ if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); if (!smallest || (rdev1->size size)) smallest = rdev1; diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c --- a/drivers/md/raid1.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/md/raid1.c 2004-09-21 20:52:52 -07:00 @@ -753,7 +753,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); p->head_position = 0; rdev->raid_disk = mirror; @@ -1196,7 +1196,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); disk->head_position = 0; if (!rdev->faulty && rdev->in_sync) diff -Nru a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h --- a/drivers/message/fusion/mptbase.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/message/fusion/mptbase.h 2004-09-21 20:52:51 -07:00 @@ -581,8 +581,8 @@ int pci_irq; /* This irq */ char name[MPT_NAME_LENGTH]; /* "iocN" */ char *prod_name; /* "LSIFC9x9" */ - volatile SYSIF_REGS *chip; /* == c8817000 (mmap) */ - volatile SYSIF_REGS *pio_chip; /* Programmed IO (downloadboot) */ + SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ + SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ u32 mem_phys; /* == f4020000 (mmap) */ u32 pio_mem_phys; /* Programmed IO (downloadboot) */ int mem_size; /* mmap memory size */ diff -Nru a/drivers/message/i2o/i2o_core.c b/drivers/message/i2o/i2o_core.c --- a/drivers/message/i2o/i2o_core.c 2004-09-21 20:52:52 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,3977 +0,0 @@ -/* - * Core I2O structure management - * - * (C) Copyright 1999-2002 Red Hat Software - * - * Written by Alan Cox, Building Number Three Ltd - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * A lot of the I2O message side code from this is taken from the - * Red Creek RCPCI45 adapter driver by Red Creek Communications - * - * Fixes/additions: - * Philipp Rumpf - * Juha Sievänen - * Auvo Häkkinen - * Deepak Saxena - * Boji T Kannanthanam - * Alan Cox : - * Ported to Linux 2.5. - * Markus Lidel : - * Minor fixes for 2.6. - * - */ - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#ifdef CONFIG_MTRR -#include -#endif // CONFIG_MTRR - -#include "i2o_lan.h" - -//#define DRIVERDEBUG - -#ifdef DRIVERDEBUG -#define dprintk(s, args...) printk(s, ## args) -#else -#define dprintk(s, args...) -#endif - -/* OSM table */ -static struct i2o_handler *i2o_handlers[MAX_I2O_MODULES]; - -/* Controller list */ -static struct i2o_controller *i2o_controllers[MAX_I2O_CONTROLLERS]; -struct i2o_controller *i2o_controller_chain; -int i2o_num_controllers; - -/* Initiator Context for Core message */ -static int core_context; - -/* Initialization && shutdown functions */ -void i2o_sys_init(void); -static void i2o_sys_shutdown(void); -static int i2o_reset_controller(struct i2o_controller *); -static int i2o_reboot_event(struct notifier_block *, unsigned long , void *); -static int i2o_online_controller(struct i2o_controller *); -static int i2o_init_outbound_q(struct i2o_controller *); -static int i2o_post_outbound_messages(struct i2o_controller *); - -/* Reply handler */ -static void i2o_core_reply(struct i2o_handler *, struct i2o_controller *, - struct i2o_message *); - -/* Various helper functions */ -static int i2o_lct_get(struct i2o_controller *); -static int i2o_lct_notify(struct i2o_controller *); -static int i2o_hrt_get(struct i2o_controller *); - -static int i2o_build_sys_table(void); -static int i2o_systab_send(struct i2o_controller *c); - -/* I2O core event handler */ -static int i2o_core_evt(void *); -static int evt_pid; -static int evt_running; - -/* Dynamic LCT update handler */ -static int i2o_dyn_lct(void *); - -void i2o_report_controller_unit(struct i2o_controller *, struct i2o_device *); - -static void i2o_pci_dispose(struct i2o_controller *c); - -/* - * I2O System Table. Contains information about - * all the IOPs in the system. Used to inform IOPs - * about each other's existence. - * - * sys_tbl_ver is the CurrentChangeIndicator that is - * used by IOPs to track changes. - */ -static struct i2o_sys_tbl *sys_tbl; -static int sys_tbl_ind; -static int sys_tbl_len; - -/* - * This spin lock is used to keep a device from being - * added and deleted concurrently across CPUs or interrupts. - * This can occur when a user creates a device and immediatelly - * deletes it before the new_dev_notify() handler is called. - */ -static spinlock_t i2o_dev_lock = SPIN_LOCK_UNLOCKED; - -/* - * Structures and definitions for synchronous message posting. - * See i2o_post_wait() for description. - */ -struct i2o_post_wait_data -{ - int *status; /* Pointer to status block on caller stack */ - int *complete; /* Pointer to completion flag on caller stack */ - u32 id; /* Unique identifier */ - wait_queue_head_t *wq; /* Wake up for caller (NULL for dead) */ - struct i2o_post_wait_data *next; /* Chain */ - void *mem[2]; /* Memory blocks to recover on failure path */ - dma_addr_t phys[2]; /* Physical address of blocks to recover */ - u32 size[2]; /* Size of blocks to recover */ -}; - -static struct i2o_post_wait_data *post_wait_queue; -static u32 post_wait_id; // Unique ID for each post_wait -static spinlock_t post_wait_lock = SPIN_LOCK_UNLOCKED; -static void i2o_post_wait_complete(struct i2o_controller *, u32, int); - -/* OSM descriptor handler */ -static struct i2o_handler i2o_core_handler = -{ - (void *)i2o_core_reply, - NULL, - NULL, - NULL, - "I2O core layer", - 0, - I2O_CLASS_EXECUTIVE -}; - -/* - * Used when queueing a reply to be handled later - */ - -struct reply_info -{ - struct i2o_controller *iop; - u32 msg[MSG_FRAME_SIZE]; -}; -static struct reply_info evt_reply; -static struct reply_info events[I2O_EVT_Q_LEN]; -static int evt_in; -static int evt_out; -static int evt_q_len; -#define MODINC(x,y) ((x) = ((x) + 1) % (y)) - -/* - * I2O configuration spinlock. This isnt a big deal for contention - * so we have one only - */ - -static DECLARE_MUTEX(i2o_configuration_lock); - -/* - * Event spinlock. Used to keep event queue sane and from - * handling multiple events simultaneously. - */ -static spinlock_t i2o_evt_lock = SPIN_LOCK_UNLOCKED; - -/* - * Semaphore used to synchronize event handling thread with - * interrupt handler. - */ - -static DECLARE_MUTEX(evt_sem); -static DECLARE_COMPLETION(evt_dead); -static DECLARE_WAIT_QUEUE_HEAD(evt_wait); - -static struct notifier_block i2o_reboot_notifier = -{ - i2o_reboot_event, - NULL, - 0 -}; - -/* - * Config options - */ - -static int verbose; - -#if BITS_PER_LONG == 64 -/** - * i2o_context_list_add - append an ptr to the context list and return a - * matching context id. - * @ptr: pointer to add to the context list - * @c: controller to which the context list belong - * returns context id, which could be used in the transaction context - * field. - * - * Because the context field in I2O is only 32-bit large, on 64-bit the - * pointer is to large to fit in the context field. The i2o_context_list - * functiones map pointers to context fields. - */ -u32 i2o_context_list_add(void *ptr, struct i2o_controller *c) { - u32 context = 1; - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->flags & I2O_CONTEXT_LIST_USED)) { - if((*entry)->context >= context) - context = (*entry)->context + 1; - entry = &((*entry)->next); - } - - if(!*entry) { - if(unlikely(!context)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_EMERG "i2o_core: context list overflow\n"); - return 0; - } - - element = kmalloc(sizeof(struct i2o_context_list_element), GFP_KERNEL); - if(!element) { - printk(KERN_EMERG "i2o_core: could not allocate memory for context list element\n"); - return 0; - } - element->context = context; - element->next = NULL; - *entry = element; - } else - element = *entry; - - element->ptr = ptr; - element->flags = I2O_CONTEXT_LIST_USED; - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: add context to list %p -> %d\n", ptr, context); - return context; -} - -/** - * i2o_context_list_remove - remove a ptr from the context list and return - * the matching context id. - * @ptr: pointer to be removed from the context list - * @c: controller to which the context list belong - * returns context id, which could be used in the transaction context - * field. - */ -u32 i2o_context_list_remove(void *ptr, struct i2o_controller *c) { - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - u32 context; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->ptr != ptr)) - entry = &((*entry)->next); - - if(unlikely(!*entry)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_WARNING "i2o_core: could not remove nonexistent ptr %p\n", ptr); - return 0; - } - - element = *entry; - - context = element->context; - element->ptr = NULL; - element->flags |= I2O_CONTEXT_LIST_DELETED; - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: markt as deleted in context list %p -> %d\n", ptr, context); - return context; -} - -/** - * i2o_context_list_get - get a ptr from the context list and remove it - * from the list. - * @context: context id to which the pointer belong - * @c: controller to which the context list belong - * returns pointer to the matching context id - */ -void *i2o_context_list_get(u32 context, struct i2o_controller *c) { - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - void *ptr; - int count = 0; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->context != context)) { - entry = &((*entry)->next); - count ++; - } - - if(unlikely(!*entry)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_WARNING "i2o_core: context id %d not found\n", context); - return NULL; - } - - element = *entry; - ptr = element->ptr; - if(count >= I2O_CONTEXT_LIST_MIN_LENGTH) { - *entry = (*entry)->next; - kfree(element); - } else { - element->ptr = NULL; - element->flags &= !I2O_CONTEXT_LIST_USED; - } - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: get ptr from context list %d -> %p\n", context, ptr); - return ptr; -} -#endif - -/* - * I2O Core reply handler - */ -static void i2o_core_reply(struct i2o_handler *h, struct i2o_controller *c, - struct i2o_message *m) -{ - u32 *msg=(u32 *)m; - u32 status; - u32 context = msg[2]; - - if (msg[0] & MSG_FAIL) // Fail bit is set - { - u32 *preserved_msg = (u32*)(c->msg_virt + msg[7]); - - i2o_report_status(KERN_INFO, "i2o_core", msg); - i2o_dump_message(preserved_msg); - - /* If the failed request needs special treatment, - * it should be done here. */ - - /* Release the preserved msg by resubmitting it as a NOP */ - - preserved_msg[0] = cpu_to_le32(THREE_WORD_MSG_SIZE | SGL_OFFSET_0); - preserved_msg[1] = cpu_to_le32(I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0); - preserved_msg[2] = 0; - i2o_post_message(c, msg[7]); - - /* If reply to i2o_post_wait failed, return causes a timeout */ - - return; - } - -#ifdef DRIVERDEBUG - i2o_report_status(KERN_INFO, "i2o_core", msg); -#endif - - if(msg[2]&0x80000000) // Post wait message - { - if (msg[4] >> 24) - status = (msg[4] & 0xFFFF); - else - status = I2O_POST_WAIT_OK; - - i2o_post_wait_complete(c, context, status); - return; - } - - if(m->function == I2O_CMD_UTIL_EVT_REGISTER) - { - memcpy(events[evt_in].msg, msg, (msg[0]>>16)<<2); - events[evt_in].iop = c; - - spin_lock(&i2o_evt_lock); - MODINC(evt_in, I2O_EVT_Q_LEN); - if(evt_q_len == I2O_EVT_Q_LEN) - MODINC(evt_out, I2O_EVT_Q_LEN); - else - evt_q_len++; - spin_unlock(&i2o_evt_lock); - - up(&evt_sem); - wake_up_interruptible(&evt_wait); - return; - } - - if(m->function == I2O_CMD_LCT_NOTIFY) - { - up(&c->lct_sem); - return; - } - - /* - * If this happens, we want to dump the message to the syslog so - * it can be sent back to the card manufacturer by the end user - * to aid in debugging. - * - */ - printk(KERN_WARNING "%s: Unsolicited message reply sent to core!" - "Message dumped to syslog\n", - c->name); - i2o_dump_message(msg); - - return; -} - -/** - * i2o_install_handler - install a message handler - * @h: Handler structure - * - * Install an I2O handler - these handle the asynchronous messaging - * from the card once it has initialised. If the table of handlers is - * full then -ENOSPC is returned. On a success 0 is returned and the - * context field is set by the function. The structure is part of the - * system from this time onwards. It must not be freed until it has - * been uninstalled - */ - -int i2o_install_handler(struct i2o_handler *h) -{ - int i; - down(&i2o_configuration_lock); - for(i=0;icontext = i; - i2o_handlers[i]=h; - up(&i2o_configuration_lock); - return 0; - } - } - up(&i2o_configuration_lock); - return -ENOSPC; -} - -/** - * i2o_remove_handler - remove an i2o message handler - * @h: handler - * - * Remove a message handler previously installed with i2o_install_handler. - * After this function returns the handler object can be freed or re-used - */ - -int i2o_remove_handler(struct i2o_handler *h) -{ - i2o_handlers[h->context]=NULL; - return 0; -} - - -/* - * Each I2O controller has a chain of devices on it. - * Each device has a pointer to its LCT entry to be used - * for fun purposes. - */ - -/** - * i2o_install_device - attach a device to a controller - * @c: controller - * @d: device - * - * Add a new device to an i2o controller. This can be called from - * non interrupt contexts only. It adds the device and marks it as - * unclaimed. The device memory becomes part of the kernel and must - * be uninstalled before being freed or reused. Zero is returned - * on success. - */ - -int i2o_install_device(struct i2o_controller *c, struct i2o_device *d) -{ - int i; - - down(&i2o_configuration_lock); - d->controller=c; - d->owner=NULL; - d->next=c->devices; - d->prev=NULL; - if (c->devices != NULL) - c->devices->prev=d; - c->devices=d; - *d->dev_name = 0; - - for(i = 0; i < I2O_MAX_MANAGERS; i++) - d->managers[i] = NULL; - - up(&i2o_configuration_lock); - return 0; -} - -/* we need this version to call out of i2o_delete_controller */ - -int __i2o_delete_device(struct i2o_device *d) -{ - struct i2o_device **p; - int i; - - p=&(d->controller->devices); - - /* - * Hey we have a driver! - * Check to see if the driver wants us to notify it of - * device deletion. If it doesn't we assume that it - * is unsafe to delete a device with an owner and - * fail. - */ - if(d->owner) - { - if(d->owner->dev_del_notify) - { - dprintk(KERN_INFO "Device has owner, notifying\n"); - d->owner->dev_del_notify(d->controller, d); - if(d->owner) - { - printk(KERN_WARNING - "Driver \"%s\" did not release device!\n", d->owner->name); - return -EBUSY; - } - } - else - return -EBUSY; - } - - /* - * Tell any other users who are talking to this device - * that it's going away. We assume that everything works. - */ - for(i=0; i < I2O_MAX_MANAGERS; i++) - { - if(d->managers[i] && d->managers[i]->dev_del_notify) - d->managers[i]->dev_del_notify(d->controller, d); - } - - while(*p!=NULL) - { - if(*p==d) - { - /* - * Destroy - */ - *p=d->next; - kfree(d); - return 0; - } - p=&((*p)->next); - } - printk(KERN_ERR "i2o_delete_device: passed invalid device.\n"); - return -EINVAL; -} - -/** - * i2o_delete_device - remove an i2o device - * @d: device to remove - * - * This function unhooks a device from a controller. The device - * will not be unhooked if it has an owner who does not wish to free - * it, or if the owner lacks a dev_del_notify function. In that case - * -EBUSY is returned. On success 0 is returned. Other errors cause - * negative errno values to be returned - */ - -int i2o_delete_device(struct i2o_device *d) -{ - int ret; - - down(&i2o_configuration_lock); - - /* - * Seek, locate - */ - - ret = __i2o_delete_device(d); - - up(&i2o_configuration_lock); - - return ret; -} - -/** - * i2o_install_controller - attach a controller - * @c: controller - * - * Add a new controller to the i2o layer. This can be called from - * non interrupt contexts only. It adds the controller and marks it as - * unused with no devices. If the tables are full or memory allocations - * fail then a negative errno code is returned. On success zero is - * returned and the controller is bound to the system. The structure - * must not be freed or reused until being uninstalled. - */ - -int i2o_install_controller(struct i2o_controller *c) -{ - int i; - down(&i2o_configuration_lock); - for(i=0;idlct = (i2o_lct*)pci_alloc_consistent(c->pdev, 8192, &c->dlct_phys); - if(c->dlct==NULL) - { - up(&i2o_configuration_lock); - return -ENOMEM; - } - i2o_controllers[i]=c; - c->devices = NULL; - c->next=i2o_controller_chain; - i2o_controller_chain=c; - c->unit = i; - c->page_frame = NULL; - c->hrt = NULL; - c->hrt_len = 0; - c->lct = NULL; - c->status_block = NULL; - sprintf(c->name, "i2o/iop%d", i); - i2o_num_controllers++; - init_MUTEX_LOCKED(&c->lct_sem); - up(&i2o_configuration_lock); - return 0; - } - } - printk(KERN_ERR "No free i2o controller slots.\n"); - up(&i2o_configuration_lock); - return -EBUSY; -} - -/** - * i2o_delete_controller - delete a controller - * @c: controller - * - * Remove an i2o controller from the system. If the controller or its - * devices are busy then -EBUSY is returned. On a failure a negative - * errno code is returned. On success zero is returned. - */ - -int i2o_delete_controller(struct i2o_controller *c) -{ - struct i2o_controller **p; - int users; - char name[16]; - int stat; - - dprintk(KERN_INFO "Deleting controller %s\n", c->name); - - /* - * Clear event registration as this can cause weird behavior - */ - if(c->status_block->iop_state == ADAPTER_STATE_OPERATIONAL) - i2o_event_register(c, core_context, 0, 0, 0); - - down(&i2o_configuration_lock); - if((users=atomic_read(&c->users))) - { - dprintk(KERN_INFO "I2O: %d users for controller %s\n", users, - c->name); - up(&i2o_configuration_lock); - return -EBUSY; - } - while(c->devices) - { - if(__i2o_delete_device(c->devices)<0) - { - /* Shouldnt happen */ - I2O_IRQ_WRITE32(c, 0xFFFFFFFF); - c->enabled = 0; - up(&i2o_configuration_lock); - return -EBUSY; - } - } - - /* - * If this is shutdown time, the thread's already been killed - */ - if(c->lct_running) { - stat = kill_proc(c->lct_pid, SIGKILL, 1); - if(!stat) { - int count = 10 * 100; - while(c->lct_running && --count) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } - - if(!count) - printk(KERN_ERR - "%s: LCT thread still running!\n", - c->name); - } - } - - p=&i2o_controller_chain; - - while(*p) - { - if(*p==c) - { - /* Ask the IOP to switch to RESET state */ - i2o_reset_controller(c); - - /* Release IRQ */ - i2o_pci_dispose(c); - - *p=c->next; - up(&i2o_configuration_lock); - - if(c->page_frame) - { - pci_unmap_single(c->pdev, c->page_frame_map, MSG_POOL_SIZE, PCI_DMA_FROMDEVICE); - kfree(c->page_frame); - } - if(c->hrt) - pci_free_consistent(c->pdev, c->hrt_len, c->hrt, c->hrt_phys); - if(c->lct) - pci_free_consistent(c->pdev, c->lct->table_size << 2, c->lct, c->lct_phys); - if(c->status_block) - pci_free_consistent(c->pdev, sizeof(i2o_status_block), c->status_block, c->status_block_phys); - if(c->dlct) - pci_free_consistent(c->pdev, 8192, c->dlct, c->dlct_phys); - - i2o_controllers[c->unit]=NULL; - memcpy(name, c->name, strlen(c->name)+1); - kfree(c); - dprintk(KERN_INFO "%s: Deleted from controller chain.\n", name); - - i2o_num_controllers--; - return 0; - } - p=&((*p)->next); - } - up(&i2o_configuration_lock); - printk(KERN_ERR "i2o_delete_controller: bad pointer!\n"); - return -ENOENT; -} - -/** - * i2o_unlock_controller - unlock a controller - * @c: controller to unlock - * - * Take a lock on an i2o controller. This prevents it being deleted. - * i2o controllers are not refcounted so a deletion of an in use device - * will fail, not take affect on the last dereference. - */ - -void i2o_unlock_controller(struct i2o_controller *c) -{ - atomic_dec(&c->users); -} - -/** - * i2o_find_controller - return a locked controller - * @n: controller number - * - * Returns a pointer to the controller object. The controller is locked - * on return. NULL is returned if the controller is not found. - */ - -struct i2o_controller *i2o_find_controller(int n) -{ - struct i2o_controller *c; - - if(n<0 || n>=MAX_I2O_CONTROLLERS) - return NULL; - - down(&i2o_configuration_lock); - c=i2o_controllers[n]; - if(c!=NULL) - atomic_inc(&c->users); - up(&i2o_configuration_lock); - return c; -} - -/** - * i2o_issue_claim - claim or release a device - * @cmd: command - * @c: controller to claim for - * @tid: i2o task id - * @type: type of claim - * - * Issue I2O UTIL_CLAIM and UTIL_RELEASE messages. The message to be sent - * is set by cmd. The tid is the task id of the object to claim and the - * type is the claim type (see the i2o standard) - * - * Zero is returned on success. - */ - -static int i2o_issue_claim(u32 cmd, struct i2o_controller *c, int tid, u32 type) -{ - u32 msg[5]; - - msg[0] = FIVE_WORD_MSG_SIZE | SGL_OFFSET_0; - msg[1] = cmd << 24 | HOST_TID<<12 | tid; - msg[3] = 0; - msg[4] = type; - - return i2o_post_wait(c, msg, sizeof(msg), 60); -} - -/* - * i2o_claim_device - claim a device for use by an OSM - * @d: device to claim - * @h: handler for this device - * - * Do the leg work to assign a device to a given OSM on Linux. The - * kernel updates the internal handler data for the device and then - * performs an I2O claim for the device, attempting to claim the - * device as primary. If the attempt fails a negative errno code - * is returned. On success zero is returned. - */ - -int i2o_claim_device(struct i2o_device *d, struct i2o_handler *h) -{ - int ret = 0; - - down(&i2o_configuration_lock); - if (d->owner) { - printk(KERN_INFO "Device claim called, but dev already owned by %s!", - h->name); - ret = -EBUSY; - goto out; - } - d->owner=h; - - if(i2o_issue_claim(I2O_CMD_UTIL_CLAIM ,d->controller,d->lct_data.tid, - I2O_CLAIM_PRIMARY)) - { - d->owner = NULL; - ret = -EBUSY; - } -out: - up(&i2o_configuration_lock); - return ret; -} - -/** - * i2o_release_device - release a device that the OSM is using - * @d: device to claim - * @h: handler for this device - * - * Drop a claim by an OSM on a given I2O device. The handler is cleared - * and 0 is returned on success. - * - * AC - some devices seem to want to refuse an unclaim until they have - * finished internal processing. It makes sense since you don't want a - * new device to go reconfiguring the entire system until you are done. - * Thus we are prepared to wait briefly. - */ - -int i2o_release_device(struct i2o_device *d, struct i2o_handler *h) -{ - int err = 0; - int tries; - - down(&i2o_configuration_lock); - if (d->owner != h) { - printk(KERN_INFO "Claim release called, but not owned by %s!\n", - h->name); - up(&i2o_configuration_lock); - return -ENOENT; - } - - for(tries=0;tries<10;tries++) - { - d->owner = NULL; - - /* - * If the controller takes a nonblocking approach to - * releases we have to sleep/poll for a few times. - */ - - if((err=i2o_issue_claim(I2O_CMD_UTIL_RELEASE, d->controller, d->lct_data.tid, I2O_CLAIM_PRIMARY)) ) - { - err = -ENXIO; - msleep(1000); - } - else - { - err=0; - break; - } - } - up(&i2o_configuration_lock); - return err; -} - -/** - * i2o_device_notify_on - Enable deletion notifiers - * @d: device for notification - * @h: handler to install - * - * Called by OSMs to let the core know that they want to be - * notified if the given device is deleted from the system. - */ - -int i2o_device_notify_on(struct i2o_device *d, struct i2o_handler *h) -{ - int i; - - if(d->num_managers == I2O_MAX_MANAGERS) - return -ENOSPC; - - for(i = 0; i < I2O_MAX_MANAGERS; i++) - { - if(!d->managers[i]) - { - d->managers[i] = h; - break; - } - } - - d->num_managers++; - - return 0; -} - -/** - * i2o_device_notify_off - Remove deletion notifiers - * @d: device for notification - * @h: handler to remove - * - * Called by OSMs to let the core know that they no longer - * are interested in the fate of the given device. - */ -int i2o_device_notify_off(struct i2o_device *d, struct i2o_handler *h) -{ - int i; - - for(i=0; i < I2O_MAX_MANAGERS; i++) - { - if(d->managers[i] == h) - { - d->managers[i] = NULL; - d->num_managers--; - return 0; - } - } - - return -ENOENT; -} - -/** - * i2o_event_register - register interest in an event - * @c: Controller to register interest with - * @tid: I2O task id - * @init_context: initiator context to use with this notifier - * @tr_context: transaction context to use with this notifier - * @evt_mask: mask of events - * - * Create and posts an event registration message to the task. No reply - * is waited for, or expected. Errors in posting will be reported. - */ - -int i2o_event_register(struct i2o_controller *c, u32 tid, - u32 init_context, u32 tr_context, u32 evt_mask) -{ - u32 msg[5]; // Not performance critical, so we just - // i2o_post_this it instead of building it - // in IOP memory - - msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1] = I2O_CMD_UTIL_EVT_REGISTER<<24 | HOST_TID<<12 | tid; - msg[2] = init_context; - msg[3] = tr_context; - msg[4] = evt_mask; - - return i2o_post_this(c, msg, sizeof(msg)); -} - -/* - * i2o_event_ack - acknowledge an event - * @c: controller - * @msg: pointer to the UTIL_EVENT_REGISTER reply we received - * - * We just take a pointer to the original UTIL_EVENT_REGISTER reply - * message and change the function code since that's what spec - * describes an EventAck message looking like. - */ - -int i2o_event_ack(struct i2o_controller *c, u32 *msg) -{ - struct i2o_message *m = (struct i2o_message *)msg; - - m->function = I2O_CMD_UTIL_EVT_ACK; - - return i2o_post_wait(c, msg, m->size * 4, 2); -} - -/* - * Core event handler. Runs as a separate thread and is woken - * up whenever there is an Executive class event. - */ -static int i2o_core_evt(void *reply_data) -{ - struct reply_info *reply = (struct reply_info *) reply_data; - u32 *msg = reply->msg; - struct i2o_controller *c = NULL; - unsigned long flags; - - daemonize("i2oevtd"); - allow_signal(SIGKILL); - - evt_running = 1; - - while(1) - { - if(down_interruptible(&evt_sem)) - { - dprintk(KERN_INFO "I2O event thread dead\n"); - printk("exiting..."); - evt_running = 0; - complete_and_exit(&evt_dead, 0); - } - - /* - * Copy the data out of the queue so that we don't have to lock - * around the whole function and just around the qlen update - */ - spin_lock_irqsave(&i2o_evt_lock, flags); - memcpy(reply, &events[evt_out], sizeof(struct reply_info)); - MODINC(evt_out, I2O_EVT_Q_LEN); - evt_q_len--; - spin_unlock_irqrestore(&i2o_evt_lock, flags); - - c = reply->iop; - dprintk(KERN_INFO "I2O IRTOS EVENT: iop%d, event %#10x\n", c->unit, msg[4]); - - /* - * We do not attempt to delete/quiesce/etc. the controller if - * some sort of error indidication occurs. We may want to do - * so in the future, but for now we just let the user deal with - * it. One reason for this is that what to do with an error - * or when to send what ærror is not really agreed on, so - * we get errors that may not be fatal but just look like they - * are...so let the user deal with it. - */ - switch(msg[4]) - { - case I2O_EVT_IND_EXEC_RESOURCE_LIMITS: - printk(KERN_ERR "%s: Out of resources\n", c->name); - break; - - case I2O_EVT_IND_EXEC_POWER_FAIL: - printk(KERN_ERR "%s: Power failure\n", c->name); - break; - - case I2O_EVT_IND_EXEC_HW_FAIL: - { - char *fail[] = - { - "Unknown Error", - "Power Lost", - "Code Violation", - "Parity Error", - "Code Execution Exception", - "Watchdog Timer Expired" - }; - - if(msg[5] <= 6) - printk(KERN_ERR "%s: Hardware Failure: %s\n", - c->name, fail[msg[5]]); - else - printk(KERN_ERR "%s: Unknown Hardware Failure\n", c->name); - - break; - } - - /* - * New device created - * - Create a new i2o_device entry - * - Inform all interested drivers about this device's existence - */ - case I2O_EVT_IND_EXEC_NEW_LCT_ENTRY: - { - struct i2o_device *d = (struct i2o_device *) - kmalloc(sizeof(struct i2o_device), GFP_KERNEL); - int i; - - if (d == NULL) { - printk(KERN_EMERG "i2oevtd: out of memory\n"); - break; - } - memcpy(&d->lct_data, &msg[5], sizeof(i2o_lct_entry)); - - d->next = NULL; - d->controller = c; - d->flags = 0; - - i2o_report_controller_unit(c, d); - i2o_install_device(c,d); - - for(i = 0; i < MAX_I2O_MODULES; i++) - { - if(i2o_handlers[i] && - i2o_handlers[i]->new_dev_notify && - (i2o_handlers[i]->class&d->lct_data.class_id)) - { - spin_lock(&i2o_dev_lock); - i2o_handlers[i]->new_dev_notify(c,d); - spin_unlock(&i2o_dev_lock); - } - } - - break; - } - - /* - * LCT entry for a device has been modified, so update it - * internally. - */ - case I2O_EVT_IND_EXEC_MODIFIED_LCT: - { - struct i2o_device *d; - i2o_lct_entry *new_lct = (i2o_lct_entry *)&msg[5]; - - for(d = c->devices; d; d = d->next) - { - if(d->lct_data.tid == new_lct->tid) - { - memcpy(&d->lct_data, new_lct, sizeof(i2o_lct_entry)); - break; - } - } - break; - } - - case I2O_EVT_IND_CONFIGURATION_FLAG: - printk(KERN_WARNING "%s requires user configuration\n", c->name); - break; - - case I2O_EVT_IND_GENERAL_WARNING: - printk(KERN_WARNING "%s: Warning notification received!" - "Check configuration for errors!\n", c->name); - break; - - case I2O_EVT_IND_EVT_MASK_MODIFIED: - /* Well I guess that was us hey .. */ - break; - - default: - printk(KERN_WARNING "%s: No handler for event (0x%08x)\n", c->name, msg[4]); - break; - } - } - - return 0; -} - -/* - * Dynamic LCT update. This compares the LCT with the currently - * installed devices to check for device deletions..this needed b/c there - * is no DELETED_LCT_ENTRY EventIndicator for the Executive class so - * we can't just have the event handler do this...annoying - * - * This is a hole in the spec that will hopefully be fixed someday. - */ -static int i2o_dyn_lct(void *foo) -{ - struct i2o_controller *c = (struct i2o_controller *)foo; - struct i2o_device *d = NULL; - struct i2o_device *d1 = NULL; - int i = 0; - int found = 0; - int entries; - void *tmp; - - daemonize("iop%d_lctd", c->unit); - allow_signal(SIGKILL); - - c->lct_running = 1; - - while(1) - { - down_interruptible(&c->lct_sem); - if(signal_pending(current)) - { - dprintk(KERN_ERR "%s: LCT thread dead\n", c->name); - c->lct_running = 0; - return 0; - } - - entries = c->dlct->table_size; - entries -= 3; - entries /= 9; - - dprintk(KERN_INFO "%s: Dynamic LCT Update\n",c->name); - dprintk(KERN_INFO "%s: Dynamic LCT contains %d entries\n", c->name, entries); - - if(!entries) - { - printk(KERN_INFO "%s: Empty LCT???\n", c->name); - continue; - } - - /* - * Loop through all the devices on the IOP looking for their - * LCT data in the LCT. We assume that TIDs are not repeated. - * as that is the only way to really tell. It's been confirmed - * by the IRTOS vendor(s?) that TIDs are not reused until they - * wrap arround(4096), and I doubt a system will up long enough - * to create/delete that many devices. - */ - for(d = c->devices; d; ) - { - found = 0; - d1 = d->next; - - for(i = 0; i < entries; i++) - { - if(d->lct_data.tid == c->dlct->lct_entry[i].tid) - { - found = 1; - break; - } - } - if(!found) - { - dprintk(KERN_INFO "i2o_core: Deleted device!\n"); - spin_lock(&i2o_dev_lock); - i2o_delete_device(d); - spin_unlock(&i2o_dev_lock); - } - d = d1; - } - - /* - * Tell LCT to renotify us next time there is a change - */ - i2o_lct_notify(c); - - /* - * Copy new LCT into public LCT - * - * Possible race if someone is reading LCT while we are copying - * over it. If this happens, we'll fix it then. but I doubt that - * the LCT will get updated often enough or will get read by - * a user often enough to worry. - */ - if(c->lct->table_size < c->dlct->table_size) - { - dma_addr_t phys; - tmp = c->lct; - c->lct = pci_alloc_consistent(c->pdev, c->dlct->table_size<<2, &phys); - if(!c->lct) - { - printk(KERN_ERR "%s: No memory for LCT!\n", c->name); - c->lct = tmp; - continue; - } - pci_free_consistent(tmp, c->lct->table_size << 2, c->lct, c->lct_phys); - c->lct_phys = phys; - } - memcpy(c->lct, c->dlct, c->dlct->table_size<<2); - } - - return 0; -} - -/** - * i2o_run_queue - process pending events on a controller - * @c: controller to process - * - * This is called by the bus specific driver layer when an interrupt - * or poll of this card interface is desired. - */ - -void i2o_run_queue(struct i2o_controller *c) -{ - struct i2o_message *m; - u32 mv; - u32 *msg; - - /* - * Old 960 steppings had a bug in the I2O unit that caused - * the queue to appear empty when it wasn't. - */ - if((mv=I2O_REPLY_READ32(c))==0xFFFFFFFF) - mv=I2O_REPLY_READ32(c); - - while(mv!=0xFFFFFFFF) - { - struct i2o_handler *i; - /* Map the message from the page frame map to kernel virtual */ - /* m=(struct i2o_message *)(mv - (unsigned long)c->page_frame_map + (unsigned long)c->page_frame); */ - m=(struct i2o_message *)bus_to_virt(mv); - msg=(u32*)m; - - /* - * Ensure this message is seen coherently but cachably by - * the processor - */ - - pci_dma_sync_single_for_cpu(c->pdev, c->page_frame_map, MSG_FRAME_SIZE, PCI_DMA_FROMDEVICE); - - /* - * Despatch it - */ - - i=i2o_handlers[m->initiator_context&(MAX_I2O_MODULES-1)]; - if(i && i->reply) - i->reply(i,c,m); - else - { - printk(KERN_WARNING "I2O: Spurious reply to handler %d\n", - m->initiator_context&(MAX_I2O_MODULES-1)); - } - i2o_flush_reply(c,mv); - mb(); - - /* That 960 bug again... */ - if((mv=I2O_REPLY_READ32(c))==0xFFFFFFFF) - mv=I2O_REPLY_READ32(c); - } -} - - -/** - * i2o_get_class_name - do i2o class name lookup - * @class: class number - * - * Return a descriptive string for an i2o class - */ - -const char *i2o_get_class_name(int class) -{ - int idx = 16; - static char *i2o_class_name[] = { - "Executive", - "Device Driver Module", - "Block Device", - "Tape Device", - "LAN Interface", - "WAN Interface", - "Fibre Channel Port", - "Fibre Channel Device", - "SCSI Device", - "ATE Port", - "ATE Device", - "Floppy Controller", - "Floppy Device", - "Secondary Bus Port", - "Peer Transport Agent", - "Peer Transport", - "Unknown" - }; - - switch(class&0xFFF) - { - case I2O_CLASS_EXECUTIVE: - idx = 0; break; - case I2O_CLASS_DDM: - idx = 1; break; - case I2O_CLASS_RANDOM_BLOCK_STORAGE: - idx = 2; break; - case I2O_CLASS_SEQUENTIAL_STORAGE: - idx = 3; break; - case I2O_CLASS_LAN: - idx = 4; break; - case I2O_CLASS_WAN: - idx = 5; break; - case I2O_CLASS_FIBRE_CHANNEL_PORT: - idx = 6; break; - case I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL: - idx = 7; break; - case I2O_CLASS_SCSI_PERIPHERAL: - idx = 8; break; - case I2O_CLASS_ATE_PORT: - idx = 9; break; - case I2O_CLASS_ATE_PERIPHERAL: - idx = 10; break; - case I2O_CLASS_FLOPPY_CONTROLLER: - idx = 11; break; - case I2O_CLASS_FLOPPY_DEVICE: - idx = 12; break; - case I2O_CLASS_BUS_ADAPTER_PORT: - idx = 13; break; - case I2O_CLASS_PEER_TRANSPORT_AGENT: - idx = 14; break; - case I2O_CLASS_PEER_TRANSPORT: - idx = 15; break; - } - - return i2o_class_name[idx]; -} - - -/** - * i2o_wait_message - obtain an i2o message from the IOP - * @c: controller - * @why: explanation - * - * This function waits up to 5 seconds for a message slot to be - * available. If no message is available it prints an error message - * that is expected to be what the message will be used for (eg - * "get_status"). 0xFFFFFFFF is returned on a failure. - * - * On a success the message is returned. This is the physical page - * frame offset address from the read port. (See the i2o spec) - */ - -u32 i2o_wait_message(struct i2o_controller *c, char *why) -{ - long time=jiffies; - u32 m; - while((m=I2O_POST_READ32(c))==0xFFFFFFFF) - { - if((jiffies-time)>=5*HZ) - { - dprintk(KERN_ERR "%s: Timeout waiting for message frame to send %s.\n", - c->name, why); - return 0xFFFFFFFF; - } - schedule(); - barrier(); - } - return m; -} - -/** - * i2o_report_controller_unit - print information about a tid - * @c: controller - * @d: device - * - * Dump an information block associated with a given unit (TID). The - * tables are read and a block of text is output to printk that is - * formatted intended for the user. - */ - -void i2o_report_controller_unit(struct i2o_controller *c, struct i2o_device *d) -{ - char buf[64]; - char str[22]; - int ret; - int unit = d->lct_data.tid; - - if(verbose==0) - return; - - printk(KERN_INFO "Target ID %d.\n", unit); - if((ret=i2o_query_scalar(c, unit, 0xF100, 3, buf, 16))>=0) - { - buf[16]=0; - printk(KERN_INFO " Vendor: %s\n", buf); - } - if((ret=i2o_query_scalar(c, unit, 0xF100, 4, buf, 16))>=0) - { - buf[16]=0; - printk(KERN_INFO " Device: %s\n", buf); - } - if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16)>=0) - { - buf[16]=0; - printk(KERN_INFO " Description: %s\n", buf); - } - if((ret=i2o_query_scalar(c, unit, 0xF100, 6, buf, 8))>=0) - { - buf[8]=0; - printk(KERN_INFO " Rev: %s\n", buf); - } - - printk(KERN_INFO " Class: "); - sprintf(str, "%-21s", i2o_get_class_name(d->lct_data.class_id)); - printk("%s\n", str); - - printk(KERN_INFO " Subclass: 0x%04X\n", d->lct_data.sub_class); - printk(KERN_INFO " Flags: "); - - if(d->lct_data.device_flags&(1<<0)) - printk("C"); // ConfigDialog requested - if(d->lct_data.device_flags&(1<<1)) - printk("U"); // Multi-user capable - if(!(d->lct_data.device_flags&(1<<4))) - printk("P"); // Peer service enabled! - if(!(d->lct_data.device_flags&(1<<5))) - printk("M"); // Mgmt service enabled! - printk("\n"); - -} - - -/* - * Parse the hardware resource table. Right now we print it out - * and don't do a lot with it. We should collate these and then - * interact with the Linux resource allocation block. - * - * Lets prove we can read it first eh ? - * - * This is full of endianisms! - */ - -static int i2o_parse_hrt(struct i2o_controller *c) -{ -#ifdef DRIVERDEBUG - u32 *rows=(u32*)c->hrt; - u8 *p=(u8 *)c->hrt; - u8 *d; - int count; - int length; - int i; - int state; - - if(p[3]!=0) - { - printk(KERN_ERR "%s: HRT table for controller is too new a version.\n", - c->name); - return -1; - } - - count=p[0]|(p[1]<<8); - length = p[2]; - - printk(KERN_INFO "%s: HRT has %d entries of %d bytes each.\n", - c->name, count, length<<2); - - rows+=2; - - for(i=0;i>=12; - if(state&(1<<0)) - printk("H"); /* Hidden */ - if(state&(1<<2)) - { - printk("P"); /* Present */ - if(state&(1<<1)) - printk("C"); /* Controlled */ - } - if(state>9) - printk("*"); /* Hard */ - - printk("]:"); - - switch(p[3]&0xFFFF) - { - case 0: - /* Adapter private bus - easy */ - printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", - p[2], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - case 1: - /* ISA bus */ - printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", - p[2], d[2], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 2: /* EISA bus */ - printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", - p[2], d[3], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 3: /* MCA bus */ - printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", - p[2], d[3], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 4: /* PCI bus */ - printk("PCI %d: Bus %d Device %d Function %d", - p[2], d[2], d[1], d[0]); - break; - - case 0x80: /* Other */ - default: - printk("Unsupported bus type."); - break; - } - printk("\n"); - rows+=length; - } -#endif - return 0; -} - -/* - * The logical configuration table tells us what we can talk to - * on the board. Most of the stuff isn't interesting to us. - */ - -static int i2o_parse_lct(struct i2o_controller *c) -{ - int i; - int max; - int tid; - struct i2o_device *d; - i2o_lct *lct = c->lct; - - if (lct == NULL) { - printk(KERN_ERR "%s: LCT is empty???\n", c->name); - return -1; - } - - max = lct->table_size; - max -= 3; - max /= 9; - - printk(KERN_INFO "%s: LCT has %d entries.\n", c->name, max); - - if(lct->iop_flags&(1<<0)) - printk(KERN_WARNING "%s: Configuration dialog desired.\n", c->name); - - for(i=0;icontroller = c; - d->next = NULL; - - memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); - - d->flags = 0; - tid = d->lct_data.tid; - - i2o_report_controller_unit(c, d); - - i2o_install_device(c, d); - } - return 0; -} - - -/** - * i2o_quiesce_controller - quiesce controller - * @c: controller - * - * Quiesce an IOP. Causes IOP to make external operation quiescent - * (i2o 'READY' state). Internal operation of the IOP continues normally. - */ - -int i2o_quiesce_controller(struct i2o_controller *c) -{ - u32 msg[4]; - int ret; - - i2o_status_get(c); - - /* SysQuiesce discarded if IOP not in READY or OPERATIONAL state */ - - if ((c->status_block->iop_state != ADAPTER_STATE_READY) && - (c->status_block->iop_state != ADAPTER_STATE_OPERATIONAL)) - { - return 0; - } - - msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1] = I2O_CMD_SYS_QUIESCE<<24|HOST_TID<<12|ADAPTER_TID; - msg[3] = 0; - - /* Long timeout needed for quiesce if lots of devices */ - - if ((ret = i2o_post_wait(c, msg, sizeof(msg), 240))) - printk(KERN_INFO "%s: Unable to quiesce (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Quiesced.\n", c->name); - - i2o_status_get(c); // Entered READY state - return ret; -} - -/** - * i2o_enable_controller - move controller from ready to operational - * @c: controller - * - * Enable IOP. This allows the IOP to resume external operations and - * reverses the effect of a quiesce. In the event of an error a negative - * errno code is returned. - */ - -int i2o_enable_controller(struct i2o_controller *c) -{ - u32 msg[4]; - int ret; - - i2o_status_get(c); - - /* Enable only allowed on READY state */ - if(c->status_block->iop_state != ADAPTER_STATE_READY) - return -EINVAL; - - msg[0]=FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_SYS_ENABLE<<24|HOST_TID<<12|ADAPTER_TID; - - /* How long of a timeout do we need? */ - - if ((ret = i2o_post_wait(c, msg, sizeof(msg), 240))) - printk(KERN_ERR "%s: Could not enable (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Enabled.\n", c->name); - - i2o_status_get(c); // entered OPERATIONAL state - - return ret; -} - -/** - * i2o_clear_controller - clear a controller - * @c: controller - * - * Clear an IOP to HOLD state, ie. terminate external operations, clear all - * input queues and prepare for a system restart. IOP's internal operation - * continues normally and the outbound queue is alive. - * The IOP is not expected to rebuild its LCT. - */ - -int i2o_clear_controller(struct i2o_controller *c) -{ - struct i2o_controller *iop; - u32 msg[4]; - int ret; - - /* Quiesce all IOPs first */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - i2o_quiesce_controller(iop); - - msg[0]=FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_ADAPTER_CLEAR<<24|HOST_TID<<12|ADAPTER_TID; - msg[3]=0; - - if ((ret=i2o_post_wait(c, msg, sizeof(msg), 30))) - printk(KERN_INFO "%s: Unable to clear (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Cleared.\n",c->name); - - i2o_status_get(c); - - /* Enable other IOPs */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - if (iop != c) - i2o_enable_controller(iop); - - return ret; -} - - -/** - * i2o_reset_controller - reset an IOP - * @c: controller to reset - * - * Reset the IOP into INIT state and wait until IOP gets into RESET state. - * Terminate all external operations, clear IOP's inbound and outbound - * queues, terminate all DDMs, and reload the IOP's operating environment - * and all local DDMs. The IOP rebuilds its LCT. - */ - -static int i2o_reset_controller(struct i2o_controller *c) -{ - struct i2o_controller *iop; - u32 m; - u8 *status; - dma_addr_t status_phys; - u32 *msg; - long time; - - /* Quiesce all IOPs first */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - { - if(!iop->dpt) - i2o_quiesce_controller(iop); - } - - m=i2o_wait_message(c, "AdapterReset"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - status = pci_alloc_consistent(c->pdev, 4, &status_phys); - if(status == NULL) { - printk(KERN_ERR "IOP reset failed - no free memory.\n"); - return -ENOMEM; - } - memset(status, 0, 4); - - msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; - msg[2]=core_context; - msg[3]=0; - msg[4]=0; - msg[5]=0; - msg[6]=status_phys; - msg[7]=0; /* 64bit host FIXME */ - - i2o_post_message(c,m); - - /* Wait for a reply */ - time=jiffies; - while(*status==0) - { - if((jiffies-time)>=20*HZ) - { - printk(KERN_ERR "IOP reset timeout.\n"); - /* The controller still may respond and overwrite - * status_phys, LEAK it to prevent memory corruption. - */ - return -ETIMEDOUT; - } - schedule(); - barrier(); - } - - if (*status==I2O_CMD_IN_PROGRESS) - { - /* - * Once the reset is sent, the IOP goes into the INIT state - * which is indeterminate. We need to wait until the IOP - * has rebooted before we can let the system talk to - * it. We read the inbound Free_List until a message is - * available. If we can't read one in the given ammount of - * time, we assume the IOP could not reboot properly. - */ - - dprintk(KERN_INFO "%s: Reset in progress, waiting for reboot...\n", - c->name); - - time = jiffies; - m = I2O_POST_READ32(c); - while(m == 0XFFFFFFFF) - { - if((jiffies-time) >= 30*HZ) - { - printk(KERN_ERR "%s: Timeout waiting for IOP reset.\n", - c->name); - /* The controller still may respond and - * overwrite status_phys, LEAK it to prevent - * memory corruption. - */ - return -ETIMEDOUT; - } - schedule(); - barrier(); - m = I2O_POST_READ32(c); - } - i2o_flush_reply(c,m); - } - - /* If IopReset was rejected or didn't perform reset, try IopClear */ - - i2o_status_get(c); - if (status[0] == I2O_CMD_REJECTED || - c->status_block->iop_state != ADAPTER_STATE_RESET) - { - printk(KERN_WARNING "%s: Reset rejected, trying to clear\n",c->name); - i2o_clear_controller(c); - } - else - dprintk(KERN_INFO "%s: Reset completed.\n", c->name); - - /* Enable other IOPs */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - if (iop != c) - i2o_enable_controller(iop); - - pci_free_consistent(c->pdev, 4, status, status_phys); - return 0; -} - - -/** - * i2o_status_get - get the status block for the IOP - * @c: controller - * - * Issue a status query on the controller. This updates the - * attached status_block. If the controller fails to reply or an - * error occurs then a negative errno code is returned. On success - * zero is returned and the status_blok is updated. - */ - -int i2o_status_get(struct i2o_controller *c) -{ - long time; - u32 m; - u32 *msg; - u8 *status_block; - - if (c->status_block == NULL) - { - c->status_block = (i2o_status_block *) - pci_alloc_consistent(c->pdev, sizeof(i2o_status_block), &c->status_block_phys); - if (c->status_block == NULL) - { - printk(KERN_CRIT "%s: Get Status Block failed; Out of memory.\n", - c->name); - return -ENOMEM; - } - } - - status_block = (u8*)c->status_block; - memset(c->status_block,0,sizeof(i2o_status_block)); - - m=i2o_wait_message(c, "StatusGet"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - msg[0]=NINE_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID; - msg[2]=core_context; - msg[3]=0; - msg[4]=0; - msg[5]=0; - msg[6]=c->status_block_phys; - msg[7]=0; /* 64bit host FIXME */ - msg[8]=sizeof(i2o_status_block); /* always 88 bytes */ - - i2o_post_message(c,m); - - /* Wait for a reply */ - - time=jiffies; - while(status_block[87]!=0xFF) - { - if((jiffies-time)>=5*HZ) - { - printk(KERN_ERR "%s: Get status timeout.\n",c->name); - return -ETIMEDOUT; - } - yield(); - barrier(); - } - -#ifdef DRIVERDEBUG - printk(KERN_INFO "%s: State = ", c->name); - switch (c->status_block->iop_state) { - case 0x01: - printk("INIT\n"); - break; - case 0x02: - printk("RESET\n"); - break; - case 0x04: - printk("HOLD\n"); - break; - case 0x05: - printk("READY\n"); - break; - case 0x08: - printk("OPERATIONAL\n"); - break; - case 0x10: - printk("FAILED\n"); - break; - case 0x11: - printk("FAULTED\n"); - break; - default: - printk("%x (unknown !!)\n",c->status_block->iop_state); -} -#endif - - return 0; -} - -/* - * Get the Hardware Resource Table for the device. - * The HRT contains information about possible hidden devices - * but is mostly useless to us - */ -int i2o_hrt_get(struct i2o_controller *c) -{ - u32 msg[6]; - int ret, size = sizeof(i2o_hrt); - int loops = 3; /* we only try 3 times to get the HRT, this should be - more then enough. Worst case should be 2 times.*/ - - /* First read just the header to figure out the real size */ - - do { - /* first we allocate the memory for the HRT */ - if (c->hrt == NULL) { - c->hrt=pci_alloc_consistent(c->pdev, size, &c->hrt_phys); - if (c->hrt == NULL) { - printk(KERN_CRIT "%s: Hrt Get failed; Out of memory.\n", c->name); - return -ENOMEM; - } - c->hrt_len = size; - } - - msg[0]= SIX_WORD_MSG_SIZE| SGL_OFFSET_4; - msg[1]= I2O_CMD_HRT_GET<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[3]= 0; - msg[4]= (0xD0000000 | c->hrt_len); /* Simple transaction */ - msg[5]= c->hrt_phys; /* Dump it here */ - - ret = i2o_post_wait_mem(c, msg, sizeof(msg), 20, c->hrt, NULL, c->hrt_phys, 0, c->hrt_len, 0); - - if(ret == -ETIMEDOUT) - { - /* The HRT block we used is in limbo somewhere. When the iop wakes up - we will recover it */ - c->hrt = NULL; - c->hrt_len = 0; - return ret; - } - - if(ret<0) - { - printk(KERN_ERR "%s: Unable to get HRT (status=%#x)\n", - c->name, -ret); - return ret; - } - - if (c->hrt->num_entries * c->hrt->entry_len << 2 > c->hrt_len) { - size = c->hrt->num_entries * c->hrt->entry_len << 2; - pci_free_consistent(c->pdev, c->hrt_len, c->hrt, c->hrt_phys); - c->hrt_len = 0; - c->hrt = NULL; - } - loops --; - } while (c->hrt == NULL && loops > 0); - - if(c->hrt == NULL) - { - printk(KERN_ERR "%s: Unable to get HRT after three tries, giving up\n", c->name); - return -1; - } - - i2o_parse_hrt(c); // just for debugging - - return 0; -} - -/* - * Send the I2O System Table to the specified IOP - * - * The system table contains information about all the IOPs in the - * system. It is build and then sent to each IOP so that IOPs can - * establish connections between each other. - * - */ -static int i2o_systab_send(struct i2o_controller *iop) -{ - u32 msg[12]; - dma_addr_t sys_tbl_phys; - int ret; - struct resource *root; - u32 *privbuf = kmalloc(16, GFP_KERNEL); - if(privbuf == NULL) - return -ENOMEM; - - - if(iop->status_block->current_mem_size < iop->status_block->desired_mem_size) - { - struct resource *res = &iop->mem_resource; - res->name = iop->pdev->bus->name; - res->flags = IORESOURCE_MEM; - res->start = 0; - res->end = 0; - printk("%s: requires private memory resources.\n", iop->name); - root = pci_find_parent_resource(iop->pdev, res); - if(root==NULL) - printk("Can't find parent resource!\n"); - if(root && allocate_resource(root, res, - iop->status_block->desired_mem_size, - iop->status_block->desired_mem_size, - iop->status_block->desired_mem_size, - 1<<20, /* Unspecified, so use 1Mb and play safe */ - NULL, - NULL)>=0) - { - iop->mem_alloc = 1; - iop->status_block->current_mem_size = 1 + res->end - res->start; - iop->status_block->current_mem_base = res->start; - printk(KERN_INFO "%s: allocated %ld bytes of PCI memory at 0x%08lX.\n", - iop->name, 1+res->end-res->start, res->start); - } - } - if(iop->status_block->current_io_size < iop->status_block->desired_io_size) - { - struct resource *res = &iop->io_resource; - res->name = iop->pdev->bus->name; - res->flags = IORESOURCE_IO; - res->start = 0; - res->end = 0; - printk("%s: requires private memory resources.\n", iop->name); - root = pci_find_parent_resource(iop->pdev, res); - if(root==NULL) - printk("Can't find parent resource!\n"); - if(root && allocate_resource(root, res, - iop->status_block->desired_io_size, - iop->status_block->desired_io_size, - iop->status_block->desired_io_size, - 1<<20, /* Unspecified, so use 1Mb and play safe */ - NULL, - NULL)>=0) - { - iop->io_alloc = 1; - iop->status_block->current_io_size = 1 + res->end - res->start; - iop->status_block->current_mem_base = res->start; - printk(KERN_INFO "%s: allocated %ld bytes of PCI I/O at 0x%08lX.\n", - iop->name, 1+res->end-res->start, res->start); - } - } - else - { - privbuf[0] = iop->status_block->current_mem_base; - privbuf[1] = iop->status_block->current_mem_size; - privbuf[2] = iop->status_block->current_io_base; - privbuf[3] = iop->status_block->current_io_size; - } - - msg[0] = I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6; - msg[1] = I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[3] = 0; - msg[4] = (0<<16) | ((iop->unit+2) ); /* Host 0 IOP ID (unit + 2) */ - msg[5] = 0; /* Segment 0 */ - - /* - * Provide three SGL-elements: - * System table (SysTab), Private memory space declaration and - * Private i/o space declaration - * - * Nasty one here. We can't use pci_alloc_consistent to send the - * same table to everyone. We have to go remap it for them all - */ - - sys_tbl_phys = pci_map_single(iop->pdev, sys_tbl, sys_tbl_len, PCI_DMA_TODEVICE); - msg[6] = 0x54000000 | sys_tbl_phys; - - msg[7] = sys_tbl_phys; - msg[8] = 0x54000000 | privbuf[1]; - msg[9] = privbuf[0]; - msg[10] = 0xD4000000 | privbuf[3]; - msg[11] = privbuf[2]; - - ret=i2o_post_wait(iop, msg, sizeof(msg), 120); - - pci_unmap_single(iop->pdev, sys_tbl_phys, sys_tbl_len, PCI_DMA_TODEVICE); - - if(ret==-ETIMEDOUT) - { - printk(KERN_ERR "%s: SysTab setup timed out.\n", iop->name); - } - else if(ret<0) - { - printk(KERN_ERR "%s: Unable to set SysTab (status=%#x).\n", - iop->name, -ret); - } - else - { - dprintk(KERN_INFO "%s: SysTab set.\n", iop->name); - } - i2o_status_get(iop); // Entered READY state - - kfree(privbuf); - return ret; - - } - -/* - * Initialize I2O subsystem. - */ -void __init i2o_sys_init(void) -{ - struct i2o_controller *iop, *niop = NULL; - - printk(KERN_INFO "Activating I2O controllers...\n"); - printk(KERN_INFO "This may take a few minutes if there are many devices\n"); - - /* In INIT state, Activate IOPs */ - for (iop = i2o_controller_chain; iop; iop = niop) { - dprintk(KERN_INFO "Calling i2o_activate_controller for %s...\n", - iop->name); - niop = iop->next; - if (i2o_activate_controller(iop) < 0) - i2o_delete_controller(iop); - } - - /* Active IOPs in HOLD state */ - -rebuild_sys_tab: - if (i2o_controller_chain == NULL) - return; - - /* - * If build_sys_table fails, we kill everything and bail - * as we can't init the IOPs w/o a system table - */ - dprintk(KERN_INFO "i2o_core: Calling i2o_build_sys_table...\n"); - if (i2o_build_sys_table() < 0) { - i2o_sys_shutdown(); - return; - } - - /* If IOP don't get online, we need to rebuild the System table */ - for (iop = i2o_controller_chain; iop; iop = niop) { - niop = iop->next; - dprintk(KERN_INFO "Calling i2o_online_controller for %s...\n", iop->name); - if (i2o_online_controller(iop) < 0) { - i2o_delete_controller(iop); - goto rebuild_sys_tab; - } - } - - /* Active IOPs now in OPERATIONAL state */ - - /* - * Register for status updates from all IOPs - */ - for(iop = i2o_controller_chain; iop; iop=iop->next) { - - /* Create a kernel thread to deal with dynamic LCT updates */ - iop->lct_pid = kernel_thread(i2o_dyn_lct, iop, CLONE_SIGHAND); - - /* Update change ind on DLCT */ - iop->dlct->change_ind = iop->lct->change_ind; - - /* Start dynamic LCT updates */ - i2o_lct_notify(iop); - - /* Register for all events from IRTOS */ - i2o_event_register(iop, core_context, 0, 0, 0xFFFFFFFF); - } -} - -/** - * i2o_sys_shutdown - shutdown I2O system - * - * Bring down each i2o controller and then return. Each controller - * is taken through an orderly shutdown - */ - -static void i2o_sys_shutdown(void) -{ - struct i2o_controller *iop, *niop; - - /* Delete all IOPs from the controller chain */ - /* that will reset all IOPs too */ - - for (iop = i2o_controller_chain; iop; iop = niop) { - niop = iop->next; - i2o_delete_controller(iop); - } -} - -/** - * i2o_activate_controller - bring controller up to HOLD - * @iop: controller - * - * This function brings an I2O controller into HOLD state. The adapter - * is reset if necessary and then the queues and resource table - * are read. -1 is returned on a failure, 0 on success. - * - */ - -int i2o_activate_controller(struct i2o_controller *iop) -{ - /* In INIT state, Wait Inbound Q to initialize (in i2o_status_get) */ - /* In READY state, Get status */ - - if (i2o_status_get(iop) < 0) { - printk(KERN_INFO "Unable to obtain status of %s, " - "attempting a reset.\n", iop->name); - if (i2o_reset_controller(iop) < 0) - return -1; - } - - if(iop->status_block->iop_state == ADAPTER_STATE_FAULTED) { - printk(KERN_CRIT "%s: hardware fault\n", iop->name); - return -1; - } - - if (iop->status_block->i2o_version > I2OVER15) { - printk(KERN_ERR "%s: Not running vrs. 1.5. of the I2O Specification.\n", - iop->name); - return -1; - } - - if (iop->status_block->iop_state == ADAPTER_STATE_READY || - iop->status_block->iop_state == ADAPTER_STATE_OPERATIONAL || - iop->status_block->iop_state == ADAPTER_STATE_HOLD || - iop->status_block->iop_state == ADAPTER_STATE_FAILED) - { - dprintk(KERN_INFO "%s: Already running, trying to reset...\n", - iop->name); - if (i2o_reset_controller(iop) < 0) - return -1; - } - - if (i2o_init_outbound_q(iop) < 0) - return -1; - - if (i2o_post_outbound_messages(iop)) - return -1; - - /* In HOLD state */ - - if (i2o_hrt_get(iop) < 0) - return -1; - - return 0; -} - - -/** - * i2o_init_outbound_queue - setup the outbound queue - * @c: controller - * - * Clear and (re)initialize IOP's outbound queue. Returns 0 on - * success or a negative errno code on a failure. - */ - -int i2o_init_outbound_q(struct i2o_controller *c) -{ - u8 *status; - dma_addr_t status_phys; - u32 m; - u32 *msg; - u32 time; - - dprintk(KERN_INFO "%s: Initializing Outbound Queue...\n", c->name); - m=i2o_wait_message(c, "OutboundInit"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - status = pci_alloc_consistent(c->pdev, 4, &status_phys); - if (status==NULL) { - printk(KERN_ERR "%s: Outbound Queue initialization failed - no free memory.\n", - c->name); - return -ENOMEM; - } - memset(status, 0, 4); - - msg[0]= EIGHT_WORD_MSG_SIZE| TRL_OFFSET_6; - msg[1]= I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[2]= core_context; - msg[3]= 0x0106; /* Transaction context */ - msg[4]= 4096; /* Host page frame size */ - /* Frame size is in words. 256 bytes a frame for now */ - msg[5]= MSG_FRAME_SIZE<<16|0x80; /* Outbound msg frame size in words and Initcode */ - msg[6]= 0xD0000004; /* Simple SG LE, EOB */ - msg[7]= status_phys; - - i2o_post_message(c,m); - - barrier(); - time=jiffies; - while(status[0] < I2O_CMD_REJECTED) - { - if((jiffies-time)>=30*HZ) - { - if(status[0]==0x00) - printk(KERN_ERR "%s: Ignored queue initialize request.\n", - c->name); - else - printk(KERN_ERR "%s: Outbound queue initialize timeout.\n", - c->name); - pci_free_consistent(c->pdev, 4, status, status_phys); - return -ETIMEDOUT; - } - yield(); - barrier(); - } - - if(status[0] != I2O_CMD_COMPLETED) - { - printk(KERN_ERR "%s: IOP outbound initialise failed.\n", c->name); - pci_free_consistent(c->pdev, 4, status, status_phys); - return -ETIMEDOUT; - } - pci_free_consistent(c->pdev, 4, status, status_phys); - return 0; -} - -/** - * i2o_post_outbound_messages - fill message queue - * @c: controller - * - * Allocate a message frame and load the messages into the IOP. The - * function returns zero on success or a negative errno code on - * failure. - */ - -int i2o_post_outbound_messages(struct i2o_controller *c) -{ - int i; - u32 m; - /* Alloc space for IOP's outbound queue message frames */ - - c->page_frame = kmalloc(MSG_POOL_SIZE, GFP_KERNEL); - if(c->page_frame==NULL) { - printk(KERN_ERR "%s: Outbound Q initialize failed; out of memory.\n", - c->name); - return -ENOMEM; - } - - c->page_frame_map = pci_map_single(c->pdev, c->page_frame, MSG_POOL_SIZE, PCI_DMA_FROMDEVICE); - - if(c->page_frame_map == 0) - { - kfree(c->page_frame); - printk(KERN_ERR "%s: Unable to map outbound queue.\n", c->name); - return -ENOMEM; - } - - m = c->page_frame_map; - - /* Post frames */ - - for(i=0; i< NMBR_MSG_FRAMES; i++) { - I2O_REPLY_WRITE32(c,m); - mb(); - m += (MSG_FRAME_SIZE << 2); - } - - return 0; -} - -/* - * Get the IOP's Logical Configuration Table - */ -int i2o_lct_get(struct i2o_controller *c) -{ - u32 msg[8]; - int ret, size = c->status_block->expected_lct_size; - - do { - if (c->lct == NULL) { - c->lct = pci_alloc_consistent(c->pdev, size, &c->lct_phys); - if(c->lct == NULL) { - printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n", - c->name); - return -ENOMEM; - } - } - memset(c->lct, 0, size); - - msg[0] = EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6; - msg[1] = I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID; - /* msg[2] filled in i2o_post_wait */ - msg[3] = 0; - msg[4] = 0xFFFFFFFF; /* All devices */ - msg[5] = 0x00000000; /* Report now */ - msg[6] = 0xD0000000|size; - msg[7] = c->lct_phys; - - ret=i2o_post_wait_mem(c, msg, sizeof(msg), 120, c->lct, NULL, c->lct_phys, 0, size, 0); - - if(ret == -ETIMEDOUT) - { - c->lct = NULL; - return ret; - } - - if(ret<0) - { - printk(KERN_ERR "%s: LCT Get failed (status=%#x.\n", - c->name, -ret); - return ret; - } - - if (c->lct->table_size << 2 > size) { - int new_size = c->lct->table_size << 2; - pci_free_consistent(c->pdev, size, c->lct, c->lct_phys); - size = new_size; - c->lct = NULL; - } - } while (c->lct == NULL); - - if ((ret=i2o_parse_lct(c)) < 0) - return ret; - - return 0; -} - -/* - * Like above, but used for async notification. The main - * difference is that we keep track of the CurrentChangeIndiicator - * so that we only get updates when it actually changes. - * - */ -int i2o_lct_notify(struct i2o_controller *c) -{ - u32 msg[8]; - - msg[0] = EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6; - msg[1] = I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[2] = core_context; - msg[3] = 0xDEADBEEF; - msg[4] = 0xFFFFFFFF; /* All devices */ - msg[5] = c->dlct->change_ind+1; /* Next change */ - msg[6] = 0xD0000000|8192; - msg[7] = c->dlct_phys; - - return i2o_post_this(c, msg, sizeof(msg)); -} - -/* - * Bring a controller online into OPERATIONAL state. - */ - -int i2o_online_controller(struct i2o_controller *iop) -{ - u32 v; - - if (i2o_systab_send(iop) < 0) - return -1; - - /* In READY state */ - - dprintk(KERN_INFO "%s: Attempting to enable...\n", iop->name); - if (i2o_enable_controller(iop) < 0) - return -1; - - /* In OPERATIONAL state */ - - dprintk(KERN_INFO "%s: Attempting to get/parse lct...\n", iop->name); - if (i2o_lct_get(iop) < 0) - return -1; - - /* Check battery status */ - - iop->battery = 0; - if(i2o_query_scalar(iop, ADAPTER_TID, 0x0000, 4, &v, 4)>=0) - { - if(v&16) - iop->battery = 1; - } - - return 0; -} - -/* - * Build system table - * - * The system table contains information about all the IOPs in the - * system (duh) and is used by the Executives on the IOPs to establish - * peer2peer connections. We're not supporting peer2peer at the moment, - * but this will be needed down the road for things like lan2lan forwarding. - */ -static int i2o_build_sys_table(void) -{ - struct i2o_controller *iop = NULL; - struct i2o_controller *niop = NULL; - int count = 0; - - sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs - (i2o_num_controllers) * - sizeof(struct i2o_sys_tbl_entry); - - if(sys_tbl) - kfree(sys_tbl); - - sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL); - if(!sys_tbl) { - printk(KERN_CRIT "SysTab Set failed. Out of memory.\n"); - return -ENOMEM; - } - memset((void*)sys_tbl, 0, sys_tbl_len); - - sys_tbl->num_entries = i2o_num_controllers; - sys_tbl->version = I2OVERSION; /* TODO: Version 2.0 */ - sys_tbl->change_ind = sys_tbl_ind++; - - for(iop = i2o_controller_chain; iop; iop = niop) - { - niop = iop->next; - - /* - * Get updated IOP state so we have the latest information - * - * We should delete the controller at this point if it - * doesn't respond since if it's not on the system table - * it is techninically not part of the I2O subsyßtem... - */ - if(i2o_status_get(iop)) { - printk(KERN_ERR "%s: Deleting b/c could not get status while" - "attempting to build system table\n", iop->name); - i2o_delete_controller(iop); - sys_tbl->num_entries--; - continue; // try the next one - } - - sys_tbl->iops[count].org_id = iop->status_block->org_id; - sys_tbl->iops[count].iop_id = iop->unit + 2; - sys_tbl->iops[count].seg_num = 0; - sys_tbl->iops[count].i2o_version = - iop->status_block->i2o_version; - sys_tbl->iops[count].iop_state = - iop->status_block->iop_state; - sys_tbl->iops[count].msg_type = - iop->status_block->msg_type; - sys_tbl->iops[count].frame_size = - iop->status_block->inbound_frame_size; - sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ?? - sys_tbl->iops[count].iop_capabilities = - iop->status_block->iop_capabilities; - sys_tbl->iops[count].inbound_low = (u32)iop->post_port; - sys_tbl->iops[count].inbound_high = 0; // FIXME: 64-bit support - - count++; - } - -#ifdef DRIVERDEBUG -{ - u32 *table; - table = (u32*)sys_tbl; - for(count = 0; count < (sys_tbl_len >>2); count++) - printk(KERN_INFO "sys_tbl[%d] = %0#10x\n", count, table[count]); -} -#endif - - return 0; -} - - -/* - * Run time support routines - */ - -/* - * Generic "post and forget" helpers. This is less efficient - we do - * a memcpy for example that isnt strictly needed, but for most uses - * this is simply not worth optimising - */ - -int i2o_post_this(struct i2o_controller *c, u32 *data, int len) -{ - u32 m; - u32 *msg; - unsigned long t=jiffies; - - do - { - mb(); - m = I2O_POST_READ32(c); - } - while(m==0xFFFFFFFF && (jiffies-t)name); - return -ETIMEDOUT; - } - msg = (u32 *)(c->msg_virt + m); - memcpy_toio(msg, data, len); - i2o_post_message(c,m); - return 0; -} - -/** - * i2o_post_wait_mem - I2O query/reply with DMA buffers - * @c: controller - * @msg: message to send - * @len: length of message - * @timeout: time in seconds to wait - * @mem1: attached memory buffer 1 - * @mem2: attached memory buffer 2 - * @phys1: physical address of buffer 1 - * @phys2: physical address of buffer 2 - * @size1: size of buffer 1 - * @size2: size of buffer 2 - * - * This core API allows an OSM to post a message and then be told whether - * or not the system received a successful reply. - * - * If the message times out then the value '-ETIMEDOUT' is returned. This - * is a special case. In this situation the message may (should) complete - * at an indefinite time in the future. When it completes it will use the - * memory buffers attached to the request. If -ETIMEDOUT is returned then - * the memory buffers must not be freed. Instead the event completion will - * free them for you. In all other cases the buffers are your problem. - * - * Pass NULL for unneeded buffers. - */ - -int i2o_post_wait_mem(struct i2o_controller *c, u32 *msg, int len, int timeout, void *mem1, void *mem2, dma_addr_t phys1, dma_addr_t phys2, int size1, int size2) -{ - DECLARE_WAIT_QUEUE_HEAD(wq_i2o_post); - DECLARE_WAITQUEUE(wait, current); - int complete = 0; - int status; - unsigned long flags = 0; - struct i2o_post_wait_data *wait_data = - kmalloc(sizeof(struct i2o_post_wait_data), GFP_KERNEL); - - if(!wait_data) - return -ENOMEM; - - /* - * Create a new notification object - */ - wait_data->status = &status; - wait_data->complete = &complete; - wait_data->mem[0] = mem1; - wait_data->mem[1] = mem2; - wait_data->phys[0] = phys1; - wait_data->phys[1] = phys2; - wait_data->size[0] = size1; - wait_data->size[1] = size2; - - /* - * Queue the event with its unique id - */ - spin_lock_irqsave(&post_wait_lock, flags); - - wait_data->next = post_wait_queue; - post_wait_queue = wait_data; - wait_data->id = (++post_wait_id) & 0x7fff; - wait_data->wq = &wq_i2o_post; - - spin_unlock_irqrestore(&post_wait_lock, flags); - - /* - * Fill in the message id - */ - - msg[2] = 0x80000000|(u32)core_context|((u32)wait_data->id<<16); - - /* - * Post the message to the controller. At some point later it - * will return. If we time out before it returns then - * complete will be zero. From the point post_this returns - * the wait_data may have been deleted. - */ - - add_wait_queue(&wq_i2o_post, &wait); - set_current_state(TASK_INTERRUPTIBLE); - if ((status = i2o_post_this(c, msg, len))==0) { - schedule_timeout(HZ * timeout); - } - else - { - remove_wait_queue(&wq_i2o_post, &wait); - return -EIO; - } - remove_wait_queue(&wq_i2o_post, &wait); - - if(signal_pending(current)) - status = -EINTR; - - spin_lock_irqsave(&post_wait_lock, flags); - barrier(); /* Be sure we see complete as it is locked */ - if(!complete) - { - /* - * Mark the entry dead. We cannot remove it. This is important. - * When it does terminate (which it must do if the controller hasnt - * died..) then it will otherwise scribble on stuff. - * !complete lets us safely check if the entry is still - * allocated and thus we can write into it - */ - wait_data->wq = NULL; - status = -ETIMEDOUT; - } - else - { - /* Debugging check - remove me soon */ - if(status == -ETIMEDOUT) - { - printk("TIMEDOUT BUG!\n"); - status = -EIO; - } - } - /* And the wait_data is not leaked either! */ - spin_unlock_irqrestore(&post_wait_lock, flags); - return status; -} - -/** - * i2o_post_wait - I2O query/reply - * @c: controller - * @msg: message to send - * @len: length of message - * @timeout: time in seconds to wait - * - * This core API allows an OSM to post a message and then be told whether - * or not the system received a successful reply. - */ - -int i2o_post_wait(struct i2o_controller *c, u32 *msg, int len, int timeout) -{ - return i2o_post_wait_mem(c, msg, len, timeout, NULL, NULL, 0, 0, 0, 0); -} - -/* - * i2o_post_wait is completed and we want to wake up the - * sleeping proccess. Called by core's reply handler. - */ - -static void i2o_post_wait_complete(struct i2o_controller *c, u32 context, int status) -{ - struct i2o_post_wait_data **p1, *q; - unsigned long flags; - - /* - * We need to search through the post_wait - * queue to see if the given message is still - * outstanding. If not, it means that the IOP - * took longer to respond to the message than we - * had allowed and timer has already expired. - * Not much we can do about that except log - * it for debug purposes, increase timeout, and recompile - * - * Lock needed to keep anyone from moving queue pointers - * around while we're looking through them. - */ - - spin_lock_irqsave(&post_wait_lock, flags); - - for(p1 = &post_wait_queue; *p1!=NULL; p1 = &((*p1)->next)) - { - q = (*p1); - if(q->id == ((context >> 16) & 0x7fff)) { - /* - * Delete it - */ - - *p1 = q->next; - - /* - * Live or dead ? - */ - - if(q->wq) - { - /* Live entry - wakeup and set status */ - *q->status = status; - *q->complete = 1; - wake_up(q->wq); - } - else - { - /* - * Free resources. Caller is dead - */ - - if(q->mem[0]) - pci_free_consistent(c->pdev, q->size[0], q->mem[0], q->phys[0]); - if(q->mem[1]) - pci_free_consistent(c->pdev, q->size[1], q->mem[1], q->phys[1]); - - printk(KERN_WARNING "i2o_post_wait event completed after timeout.\n"); - } - kfree(q); - spin_unlock(&post_wait_lock); - return; - } - } - spin_unlock(&post_wait_lock); - - printk(KERN_DEBUG "i2o_post_wait: Bogus reply!\n"); -} - -/* Issue UTIL_PARAMS_GET or UTIL_PARAMS_SET - * - * This function can be used for all UtilParamsGet/Set operations. - * The OperationList is given in oplist-buffer, - * and results are returned in reslist-buffer. - * Note that the minimum sized reslist is 8 bytes and contains - * ResultCount, ErrorInfoSize, BlockStatus and BlockSize. - */ - -int i2o_issue_params(int cmd, struct i2o_controller *iop, int tid, - void *oplist, int oplen, void *reslist, int reslen) -{ - u32 msg[9]; - u32 *res32 = (u32*)reslist; - u32 *restmp = (u32*)reslist; - int len = 0; - int i = 0; - int wait_status; - u32 *opmem, *resmem; - dma_addr_t opmem_phys, resmem_phys; - - /* Get DMAable memory */ - opmem = pci_alloc_consistent(iop->pdev, oplen, &opmem_phys); - if(opmem == NULL) - return -ENOMEM; - memcpy(opmem, oplist, oplen); - - resmem = pci_alloc_consistent(iop->pdev, reslen, &resmem_phys); - if(resmem == NULL) - { - pci_free_consistent(iop->pdev, oplen, opmem, opmem_phys); - return -ENOMEM; - } - - msg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_5; - msg[1] = cmd << 24 | HOST_TID << 12 | tid; - msg[3] = 0; - msg[4] = 0; - msg[5] = 0x54000000 | oplen; /* OperationList */ - msg[6] = opmem_phys; - msg[7] = 0xD0000000 | reslen; /* ResultList */ - msg[8] = resmem_phys; - - wait_status = i2o_post_wait_mem(iop, msg, sizeof(msg), 10, opmem, resmem, opmem_phys, resmem_phys, oplen, reslen); - - /* - * This only looks like a memory leak - don't "fix" it. - */ - if(wait_status == -ETIMEDOUT) - return wait_status; - - memcpy(reslist, resmem, reslen); - pci_free_consistent(iop->pdev, reslen, resmem, resmem_phys); - pci_free_consistent(iop->pdev, oplen, opmem, opmem_phys); - - /* Query failed */ - if(wait_status != 0) - return wait_status; - /* - * Calculate number of bytes of Result LIST - * We need to loop through each Result BLOCK and grab the length - */ - restmp = res32 + 1; - len = 1; - for(i = 0; i < (res32[0]&0X0000FFFF); i++) - { - if(restmp[0]&0x00FF0000) /* BlockStatus != SUCCESS */ - { - printk(KERN_WARNING "%s - Error:\n ErrorInfoSize = 0x%02x, " - "BlockStatus = 0x%02x, BlockSize = 0x%04x\n", - (cmd == I2O_CMD_UTIL_PARAMS_SET) ? "PARAMS_SET" - : "PARAMS_GET", - res32[1]>>24, (res32[1]>>16)&0xFF, res32[1]&0xFFFF); - - /* - * If this is the only request,than we return an error - */ - if((res32[0]&0x0000FFFF) == 1) - { - return -((res32[1] >> 16) & 0xFF); /* -BlockStatus */ - } - } - len += restmp[0] & 0x0000FFFF; /* Length of res BLOCK */ - restmp += restmp[0] & 0x0000FFFF; /* Skip to next BLOCK */ - } - return (len << 2); /* bytes used by result list */ -} - -/* - * Query one scalar group value or a whole scalar group. - */ -int i2o_query_scalar(struct i2o_controller *iop, int tid, - int group, int field, void *buf, int buflen) -{ - u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field }; - u8 resblk[8+buflen]; /* 8 bytes for header */ - int size; - - if (field == -1) /* whole group */ - opblk[4] = -1; - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, iop, tid, - opblk, sizeof(opblk), resblk, sizeof(resblk)); - - memcpy(buf, resblk+8, buflen); /* cut off header */ - - if(size>buflen) - return buflen; - return size; -} - -/* - * Set a scalar group value or a whole group. - */ -int i2o_set_scalar(struct i2o_controller *iop, int tid, - int group, int field, void *buf, int buflen) -{ - u16 *opblk; - u8 resblk[8+buflen]; /* 8 bytes for header */ - int size; - - opblk = kmalloc(buflen+64, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for operation buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = I2O_PARAMS_FIELD_SET; - opblk[3] = group; - - if(field == -1) { /* whole group */ - opblk[4] = -1; - memcpy(opblk+5, buf, buflen); - } - else /* single field */ - { - opblk[4] = 1; - opblk[5] = field; - memcpy(opblk+6, buf, buflen); - } - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, 12+buflen, resblk, sizeof(resblk)); - - kfree(opblk); - if(size>buflen) - return buflen; - return size; -} - -/* - * if oper == I2O_PARAMS_TABLE_GET, get from all rows - * if fieldcount == -1 return all fields - * ibuf and ibuflen are unused (use NULL, 0) - * else return specific fields - * ibuf contains fieldindexes - * - * if oper == I2O_PARAMS_LIST_GET, get from specific rows - * if fieldcount == -1 return all fields - * ibuf contains rowcount, keyvalues - * else return specific fields - * fieldcount is # of fieldindexes - * ibuf contains fieldindexes, rowcount, keyvalues - * - * You could also use directly function i2o_issue_params(). - */ -int i2o_query_table(int oper, struct i2o_controller *iop, int tid, int group, - int fieldcount, void *ibuf, int ibuflen, - void *resblk, int reslen) -{ - u16 *opblk; - int size; - - opblk = kmalloc(10 + ibuflen, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for query buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = oper; - opblk[3] = group; - opblk[4] = fieldcount; - memcpy(opblk+5, ibuf, ibuflen); /* other params */ - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET,iop, tid, - opblk, 10+ibuflen, resblk, reslen); - - kfree(opblk); - if(size>reslen) - return reslen; - return size; -} - -/* - * Clear table group, i.e. delete all rows. - */ -int i2o_clear_table(struct i2o_controller *iop, int tid, int group) -{ - u16 opblk[] = { 1, 0, I2O_PARAMS_TABLE_CLEAR, group }; - u8 resblk[32]; /* min 8 bytes for result header */ - - return i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, sizeof(opblk), resblk, sizeof(resblk)); -} - -/* - * Add a new row into a table group. - * - * if fieldcount==-1 then we add whole rows - * buf contains rowcount, keyvalues - * else just specific fields are given, rest use defaults - * buf contains fieldindexes, rowcount, keyvalues - */ -int i2o_row_add_table(struct i2o_controller *iop, int tid, - int group, int fieldcount, void *buf, int buflen) -{ - u16 *opblk; - u8 resblk[32]; /* min 8 bytes for header */ - int size; - - opblk = kmalloc(buflen+64, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for operation buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = I2O_PARAMS_ROW_ADD; - opblk[3] = group; - opblk[4] = fieldcount; - memcpy(opblk+5, buf, buflen); - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, 10+buflen, resblk, sizeof(resblk)); - - kfree(opblk); - if(size>buflen) - return buflen; - return size; -} - - -/* - * Used for error reporting/debugging purposes. - * Following fail status are common to all classes. - * The preserved message must be handled in the reply handler. - */ -void i2o_report_fail_status(u8 req_status, u32* msg) -{ - static char *FAIL_STATUS[] = { - "0x80", /* not used */ - "SERVICE_SUSPENDED", /* 0x81 */ - "SERVICE_TERMINATED", /* 0x82 */ - "CONGESTION", - "FAILURE", - "STATE_ERROR", - "TIME_OUT", - "ROUTING_FAILURE", - "INVALID_VERSION", - "INVALID_OFFSET", - "INVALID_MSG_FLAGS", - "FRAME_TOO_SMALL", - "FRAME_TOO_LARGE", - "INVALID_TARGET_ID", - "INVALID_INITIATOR_ID", - "INVALID_INITIATOR_CONTEX", /* 0x8F */ - "UNKNOWN_FAILURE" /* 0xFF */ - }; - - if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) - printk("TRANSPORT_UNKNOWN_FAILURE (%0#2x)\n.", req_status); - else - printk("TRANSPORT_%s.\n", FAIL_STATUS[req_status & 0x0F]); - - /* Dump some details */ - - printk(KERN_ERR " InitiatorId = %d, TargetId = %d\n", - (msg[1] >> 12) & 0xFFF, msg[1] & 0xFFF); - printk(KERN_ERR " LowestVersion = 0x%02X, HighestVersion = 0x%02X\n", - (msg[4] >> 8) & 0xFF, msg[4] & 0xFF); - printk(KERN_ERR " FailingHostUnit = 0x%04X, FailingIOP = 0x%03X\n", - msg[5] >> 16, msg[5] & 0xFFF); - - printk(KERN_ERR " Severity: 0x%02X ", (msg[4] >> 16) & 0xFF); - if (msg[4] & (1<<16)) - printk("(FormatError), " - "this msg can never be delivered/processed.\n"); - if (msg[4] & (1<<17)) - printk("(PathError), " - "this msg can no longer be delivered/processed.\n"); - if (msg[4] & (1<<18)) - printk("(PathState), " - "the system state does not allow delivery.\n"); - if (msg[4] & (1<<19)) - printk("(Congestion), resources temporarily not available;" - "do not retry immediately.\n"); -} - -/* - * Used for error reporting/debugging purposes. - * Following reply status are common to all classes. - */ -void i2o_report_common_status(u8 req_status) -{ - static char *REPLY_STATUS[] = { - "SUCCESS", - "ABORT_DIRTY", - "ABORT_NO_DATA_TRANSFER", - "ABORT_PARTIAL_TRANSFER", - "ERROR_DIRTY", - "ERROR_NO_DATA_TRANSFER", - "ERROR_PARTIAL_TRANSFER", - "PROCESS_ABORT_DIRTY", - "PROCESS_ABORT_NO_DATA_TRANSFER", - "PROCESS_ABORT_PARTIAL_TRANSFER", - "TRANSACTION_ERROR", - "PROGRESS_REPORT" - }; - - if (req_status >= ARRAY_SIZE(REPLY_STATUS)) - printk("RequestStatus = %0#2x", req_status); - else - printk("%s", REPLY_STATUS[req_status]); -} - -/* - * Used for error reporting/debugging purposes. - * Following detailed status are valid for executive class, - * utility class, DDM class and for transaction error replies. - */ -static void i2o_report_common_dsc(u16 detailed_status) -{ - static char *COMMON_DSC[] = { - "SUCCESS", - "0x01", // not used - "BAD_KEY", - "TCL_ERROR", - "REPLY_BUFFER_FULL", - "NO_SUCH_PAGE", - "INSUFFICIENT_RESOURCE_SOFT", - "INSUFFICIENT_RESOURCE_HARD", - "0x08", // not used - "CHAIN_BUFFER_TOO_LARGE", - "UNSUPPORTED_FUNCTION", - "DEVICE_LOCKED", - "DEVICE_RESET", - "INAPPROPRIATE_FUNCTION", - "INVALID_INITIATOR_ADDRESS", - "INVALID_MESSAGE_FLAGS", - "INVALID_OFFSET", - "INVALID_PARAMETER", - "INVALID_REQUEST", - "INVALID_TARGET_ADDRESS", - "MESSAGE_TOO_LARGE", - "MESSAGE_TOO_SMALL", - "MISSING_PARAMETER", - "TIMEOUT", - "UNKNOWN_ERROR", - "UNKNOWN_FUNCTION", - "UNSUPPORTED_VERSION", - "DEVICE_BUSY", - "DEVICE_NOT_AVAILABLE" - }; - - if (detailed_status > I2O_DSC_DEVICE_NOT_AVAILABLE) - printk(" / DetailedStatus = %0#4x.\n", detailed_status); - else - printk(" / %s.\n", COMMON_DSC[detailed_status]); -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_lan_dsc(u16 detailed_status) -{ - static char *LAN_DSC[] = { // Lan detailed status code strings - "SUCCESS", - "DEVICE_FAILURE", - "DESTINATION_NOT_FOUND", - "TRANSMIT_ERROR", - "TRANSMIT_ABORTED", - "RECEIVE_ERROR", - "RECEIVE_ABORTED", - "DMA_ERROR", - "BAD_PACKET_DETECTED", - "OUT_OF_MEMORY", - "BUCKET_OVERRUN", - "IOP_INTERNAL_ERROR", - "CANCELED", - "INVALID_TRANSACTION_CONTEXT", - "DEST_ADDRESS_DETECTED", - "DEST_ADDRESS_OMITTED", - "PARTIAL_PACKET_RETURNED", - "TEMP_SUSPENDED_STATE", // last Lan detailed status code - "INVALID_REQUEST" // general detailed status code - }; - - if (detailed_status > I2O_DSC_INVALID_REQUEST) - printk(" / %0#4x.\n", detailed_status); - else - printk(" / %s.\n", LAN_DSC[detailed_status]); -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_util_cmd(u8 cmd) -{ - switch (cmd) { - case I2O_CMD_UTIL_NOP: - printk("UTIL_NOP, "); - break; - case I2O_CMD_UTIL_ABORT: - printk("UTIL_ABORT, "); - break; - case I2O_CMD_UTIL_CLAIM: - printk("UTIL_CLAIM, "); - break; - case I2O_CMD_UTIL_RELEASE: - printk("UTIL_CLAIM_RELEASE, "); - break; - case I2O_CMD_UTIL_CONFIG_DIALOG: - printk("UTIL_CONFIG_DIALOG, "); - break; - case I2O_CMD_UTIL_DEVICE_RESERVE: - printk("UTIL_DEVICE_RESERVE, "); - break; - case I2O_CMD_UTIL_DEVICE_RELEASE: - printk("UTIL_DEVICE_RELEASE, "); - break; - case I2O_CMD_UTIL_EVT_ACK: - printk("UTIL_EVENT_ACKNOWLEDGE, "); - break; - case I2O_CMD_UTIL_EVT_REGISTER: - printk("UTIL_EVENT_REGISTER, "); - break; - case I2O_CMD_UTIL_LOCK: - printk("UTIL_LOCK, "); - break; - case I2O_CMD_UTIL_LOCK_RELEASE: - printk("UTIL_LOCK_RELEASE, "); - break; - case I2O_CMD_UTIL_PARAMS_GET: - printk("UTIL_PARAMS_GET, "); - break; - case I2O_CMD_UTIL_PARAMS_SET: - printk("UTIL_PARAMS_SET, "); - break; - case I2O_CMD_UTIL_REPLY_FAULT_NOTIFY: - printk("UTIL_REPLY_FAULT_NOTIFY, "); - break; - default: - printk("Cmd = %0#2x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_exec_cmd(u8 cmd) -{ - switch (cmd) { - case I2O_CMD_ADAPTER_ASSIGN: - printk("EXEC_ADAPTER_ASSIGN, "); - break; - case I2O_CMD_ADAPTER_READ: - printk("EXEC_ADAPTER_READ, "); - break; - case I2O_CMD_ADAPTER_RELEASE: - printk("EXEC_ADAPTER_RELEASE, "); - break; - case I2O_CMD_BIOS_INFO_SET: - printk("EXEC_BIOS_INFO_SET, "); - break; - case I2O_CMD_BOOT_DEVICE_SET: - printk("EXEC_BOOT_DEVICE_SET, "); - break; - case I2O_CMD_CONFIG_VALIDATE: - printk("EXEC_CONFIG_VALIDATE, "); - break; - case I2O_CMD_CONN_SETUP: - printk("EXEC_CONN_SETUP, "); - break; - case I2O_CMD_DDM_DESTROY: - printk("EXEC_DDM_DESTROY, "); - break; - case I2O_CMD_DDM_ENABLE: - printk("EXEC_DDM_ENABLE, "); - break; - case I2O_CMD_DDM_QUIESCE: - printk("EXEC_DDM_QUIESCE, "); - break; - case I2O_CMD_DDM_RESET: - printk("EXEC_DDM_RESET, "); - break; - case I2O_CMD_DDM_SUSPEND: - printk("EXEC_DDM_SUSPEND, "); - break; - case I2O_CMD_DEVICE_ASSIGN: - printk("EXEC_DEVICE_ASSIGN, "); - break; - case I2O_CMD_DEVICE_RELEASE: - printk("EXEC_DEVICE_RELEASE, "); - break; - case I2O_CMD_HRT_GET: - printk("EXEC_HRT_GET, "); - break; - case I2O_CMD_ADAPTER_CLEAR: - printk("EXEC_IOP_CLEAR, "); - break; - case I2O_CMD_ADAPTER_CONNECT: - printk("EXEC_IOP_CONNECT, "); - break; - case I2O_CMD_ADAPTER_RESET: - printk("EXEC_IOP_RESET, "); - break; - case I2O_CMD_LCT_NOTIFY: - printk("EXEC_LCT_NOTIFY, "); - break; - case I2O_CMD_OUTBOUND_INIT: - printk("EXEC_OUTBOUND_INIT, "); - break; - case I2O_CMD_PATH_ENABLE: - printk("EXEC_PATH_ENABLE, "); - break; - case I2O_CMD_PATH_QUIESCE: - printk("EXEC_PATH_QUIESCE, "); - break; - case I2O_CMD_PATH_RESET: - printk("EXEC_PATH_RESET, "); - break; - case I2O_CMD_STATIC_MF_CREATE: - printk("EXEC_STATIC_MF_CREATE, "); - break; - case I2O_CMD_STATIC_MF_RELEASE: - printk("EXEC_STATIC_MF_RELEASE, "); - break; - case I2O_CMD_STATUS_GET: - printk("EXEC_STATUS_GET, "); - break; - case I2O_CMD_SW_DOWNLOAD: - printk("EXEC_SW_DOWNLOAD, "); - break; - case I2O_CMD_SW_UPLOAD: - printk("EXEC_SW_UPLOAD, "); - break; - case I2O_CMD_SW_REMOVE: - printk("EXEC_SW_REMOVE, "); - break; - case I2O_CMD_SYS_ENABLE: - printk("EXEC_SYS_ENABLE, "); - break; - case I2O_CMD_SYS_MODIFY: - printk("EXEC_SYS_MODIFY, "); - break; - case I2O_CMD_SYS_QUIESCE: - printk("EXEC_SYS_QUIESCE, "); - break; - case I2O_CMD_SYS_TAB_SET: - printk("EXEC_SYS_TAB_SET, "); - break; - default: - printk("Cmd = %#02x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_lan_cmd(u8 cmd) -{ - switch (cmd) { - case LAN_PACKET_SEND: - printk("LAN_PACKET_SEND, "); - break; - case LAN_SDU_SEND: - printk("LAN_SDU_SEND, "); - break; - case LAN_RECEIVE_POST: - printk("LAN_RECEIVE_POST, "); - break; - case LAN_RESET: - printk("LAN_RESET, "); - break; - case LAN_SUSPEND: - printk("LAN_SUSPEND, "); - break; - default: - printk("Cmd = %0#2x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes. - * Report Cmd name, Request status, Detailed Status. - */ -void i2o_report_status(const char *severity, const char *str, u32 *msg) -{ - u8 cmd = (msg[1]>>24)&0xFF; - u8 req_status = (msg[4]>>24)&0xFF; - u16 detailed_status = msg[4]&0xFFFF; - struct i2o_handler *h = i2o_handlers[msg[2] & (MAX_I2O_MODULES-1)]; - - if (cmd == I2O_CMD_UTIL_EVT_REGISTER) - return; // No status in this reply - - printk("%s%s: ", severity, str); - - if (cmd < 0x1F) // Utility cmd - i2o_report_util_cmd(cmd); - - else if (cmd >= 0xA0 && cmd <= 0xEF) // Executive cmd - i2o_report_exec_cmd(cmd); - - else if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F) - i2o_report_lan_cmd(cmd); // LAN cmd - else - printk("Cmd = %0#2x, ", cmd); // Other cmds - - if (msg[0] & MSG_FAIL) { - i2o_report_fail_status(req_status, msg); - return; - } - - i2o_report_common_status(req_status); - - if (cmd < 0x1F || (cmd >= 0xA0 && cmd <= 0xEF)) - i2o_report_common_dsc(detailed_status); - else if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F) - i2o_report_lan_dsc(detailed_status); - else - printk(" / DetailedStatus = %0#4x.\n", detailed_status); -} - -/* Used to dump a message to syslog during debugging */ -void i2o_dump_message(u32 *msg) -{ -#ifdef DRIVERDEBUG - int i; - printk(KERN_INFO "Dumping I2O message size %d @ %p\n", - msg[0]>>16&0xffff, msg); - for(i = 0; i < ((msg[0]>>16)&0xffff); i++) - printk(KERN_INFO " msg[%d] = %0#10x\n", i, msg[i]); -#endif -} - -/* - * I2O reboot/shutdown notification. - * - * - Call each OSM's reboot notifier (if one exists) - * - Quiesce each IOP in the system - * - * Each IOP has to be quiesced before we can ensure that the system - * can be properly shutdown as a transaction that has already been - * acknowledged still needs to be placed in permanent store on the IOP. - * The SysQuiesce causes the IOP to force all HDMs to complete their - * transactions before returning, so only at that point is it safe - * - */ -static int i2o_reboot_event(struct notifier_block *n, unsigned long code, void -*p) -{ - int i = 0; - struct i2o_controller *c = NULL; - - if(code != SYS_RESTART && code != SYS_HALT && code != SYS_POWER_OFF) - return NOTIFY_DONE; - - printk(KERN_INFO "Shutting down I2O system.\n"); - printk(KERN_INFO - " This could take a few minutes if there are many devices attached\n"); - - for(i = 0; i < MAX_I2O_MODULES; i++) - { - if(i2o_handlers[i] && i2o_handlers[i]->reboot_notify) - i2o_handlers[i]->reboot_notify(); - } - - for(c = i2o_controller_chain; c; c = c->next) - { - if(i2o_quiesce_controller(c)) - { - printk(KERN_WARNING "i2o: Could not quiesce %s.\n" - "Verify setup on next system power up.\n", - c->name); - } - } - - printk(KERN_INFO "I2O system down.\n"); - return NOTIFY_DONE; -} - - - - -/** - * i2o_pci_dispose - Free bus specific resources - * @c: I2O controller - * - * Disable interrupts and then free interrupt, I/O and mtrr resources - * used by this controller. Called by the I2O core on unload. - */ - -static void i2o_pci_dispose(struct i2o_controller *c) -{ - I2O_IRQ_WRITE32(c,0xFFFFFFFF); - if(c->irq > 0) - free_irq(c->irq, c); - iounmap(c->base_virt); - if(c->raptor) - iounmap(c->msg_virt); - -#ifdef CONFIG_MTRR - if(c->mtrr_reg0 > 0) - mtrr_del(c->mtrr_reg0, 0, 0); - if(c->mtrr_reg1 > 0) - mtrr_del(c->mtrr_reg1, 0, 0); -#endif -} - -/** - * i2o_pci_interrupt - Bus specific interrupt handler - * @irq: interrupt line - * @dev_id: cookie - * - * Handle an interrupt from a PCI based I2O controller. This turns out - * to be rather simple. We keep the controller pointer in the cookie. - */ - -static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) -{ - struct i2o_controller *c = dev_id; - i2o_run_queue(c); - return IRQ_HANDLED; -} - -/** - * i2o_pci_install - Install a PCI i2o controller - * @dev: PCI device of the I2O controller - * - * Install a PCI (or in theory AGP) i2o controller. Devices are - * initialized, configured and registered with the i2o core subsystem. Be - * very careful with ordering. There may be pending interrupts. - * - * To Do: Add support for polled controllers - */ - -int __init i2o_pci_install(struct pci_dev *dev) -{ - struct i2o_controller *c=kmalloc(sizeof(struct i2o_controller), - GFP_KERNEL); - void *bar0_virt; - void *bar1_virt; - unsigned long bar0_phys = 0; - unsigned long bar1_phys = 0; - unsigned long bar0_size = 0; - unsigned long bar1_size = 0; - - int i; - - if(c==NULL) - { - printk(KERN_ERR "i2o: Insufficient memory to add controller.\n"); - return -ENOMEM; - } - memset(c, 0, sizeof(*c)); - - c->irq = -1; - c->dpt = 0; - c->raptor = 0; - c->short_req = 0; - c->pdev = dev; - -#if BITS_PER_LONG == 64 - c->context_list_lock = SPIN_LOCK_UNLOCKED; -#endif - - /* - * Cards that fall apart if you hit them with large I/O - * loads... - */ - - if(dev->vendor == PCI_VENDOR_ID_NCR && dev->device == 0x0630) - { - c->short_req = 1; - printk(KERN_INFO "I2O: Symbios FC920 workarounds activated.\n"); - } - - if(dev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) - { - c->promise = 1; - printk(KERN_INFO "I2O: Promise workarounds activated.\n"); - } - - /* - * Cards that go bananas if you quiesce them before you reset - * them - */ - - if(dev->vendor == PCI_VENDOR_ID_DPT) { - c->dpt=1; - if(dev->device == 0xA511) - c->raptor=1; - } - - for(i=0; i<6; i++) - { - /* Skip I/O spaces */ - if(!(pci_resource_flags(dev, i) & IORESOURCE_IO)) - { - if(!bar0_phys) - { - bar0_phys = pci_resource_start(dev, i); - bar0_size = pci_resource_len(dev, i); - if(!c->raptor) - break; - } - else - { - bar1_phys = pci_resource_start(dev, i); - bar1_size = pci_resource_len(dev, i); - break; - } - } - } - - if(i==6) - { - printk(KERN_ERR "i2o: I2O controller has no memory regions defined.\n"); - kfree(c); - return -EINVAL; - } - - - /* Map the I2O controller */ - if(!c->raptor) - printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n", bar0_phys, bar0_size); - else - printk(KERN_INFO "i2o: PCI I2O controller\n BAR0 at 0x%08lX size=%ld\n BAR1 at 0x%08lX size=%ld\n", bar0_phys, bar0_size, bar1_phys, bar1_size); - - bar0_virt = ioremap(bar0_phys, bar0_size); - if(bar0_virt==0) - { - printk(KERN_ERR "i2o: Unable to map controller.\n"); - kfree(c); - return -EINVAL; - } - - if(c->raptor) - { - bar1_virt = ioremap(bar1_phys, bar1_size); - if(bar1_virt==0) - { - printk(KERN_ERR "i2o: Unable to map controller.\n"); - kfree(c); - iounmap(bar0_virt); - return -EINVAL; - } - } else { - bar1_virt = bar0_virt; - bar1_phys = bar0_phys; - bar1_size = bar0_size; - } - - c->irq_mask = bar0_virt+0x34; - c->post_port = bar0_virt+0x40; - c->reply_port = bar0_virt+0x44; - - c->base_phys = bar0_phys; - c->base_virt = bar0_virt; - c->msg_phys = bar1_phys; - c->msg_virt = bar1_virt; - - /* - * Enable Write Combining MTRR for IOP's memory region - */ -#ifdef CONFIG_MTRR - c->mtrr_reg0 = mtrr_add(c->base_phys, bar0_size, MTRR_TYPE_WRCOMB, 1); - /* - * If it is an INTEL i960 I/O processor then set the first 64K to - * Uncacheable since the region contains the Messaging unit which - * shouldn't be cached. - */ - c->mtrr_reg1 = -1; - if(dev->vendor == PCI_VENDOR_ID_INTEL || dev->vendor == PCI_VENDOR_ID_DPT) - { - printk(KERN_INFO "I2O: MTRR workaround for Intel i960 processor\n"); - c->mtrr_reg1 = mtrr_add(c->base_phys, 65536, MTRR_TYPE_UNCACHABLE, 1); - if(c->mtrr_reg1< 0) - { - printk(KERN_INFO "i2o_pci: Error in setting MTRR_TYPE_UNCACHABLE\n"); - mtrr_del(c->mtrr_reg0, c->msg_phys, bar1_size); - c->mtrr_reg0 = -1; - } - } - if(c->raptor) - c->mtrr_reg1 = mtrr_add(c->msg_phys, bar1_size, MTRR_TYPE_WRCOMB, 1); - -#endif - - I2O_IRQ_WRITE32(c,0xFFFFFFFF); - - i = i2o_install_controller(c); - - if(i<0) - { - printk(KERN_ERR "i2o: Unable to install controller.\n"); - kfree(c); - iounmap(bar0_virt); - if(c->raptor) - iounmap(bar1_virt); - return i; - } - - c->irq = dev->irq; - if(c->irq) - { - i=request_irq(dev->irq, i2o_pci_interrupt, SA_SHIRQ, - c->name, c); - if(i<0) - { - printk(KERN_ERR "%s: unable to allocate interrupt %d.\n", - c->name, dev->irq); - c->irq = -1; - i2o_delete_controller(c); - iounmap(bar0_virt); - if(c->raptor) - iounmap(bar1_virt); - return -EBUSY; - } - } - - printk(KERN_INFO "%s: Installed at IRQ%d\n", c->name, dev->irq); - I2O_IRQ_WRITE32(c,0x0); - c->enabled = 1; - return 0; -} - -/** - * i2o_pci_scan - Scan the pci bus for controllers - * - * Scan the PCI devices on the system looking for any device which is a - * memory of the Intelligent, I2O class. We attempt to set up each such device - * and register it with the core. - * - * Returns the number of controllers registered - * - * Note; Do not change this to a hot plug interface. I2O 1.5 itself - * does not support hot plugging. - */ - -int __init i2o_pci_scan(void) -{ - struct pci_dev *dev = NULL; - int count=0; - - printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); - - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) - { - if((dev->class>>8)!=PCI_CLASS_INTELLIGENT_I2O && - (dev->vendor!=PCI_VENDOR_ID_DPT || dev->device!=0xA511)) - continue; - - if((dev->class>>8)==PCI_CLASS_INTELLIGENT_I2O && - (dev->class&0xFF)>1) - { - printk(KERN_INFO "i2o: I2O Controller found but does not support I2O 1.5 (skipping).\n"); - continue; - } - if (pci_enable_device(dev)) - continue; - printk(KERN_INFO "i2o: I2O controller on bus %d at %d.\n", - dev->bus->number, dev->devfn); - if(pci_set_dma_mask(dev, 0xffffffff)) - { - printk(KERN_WARNING "I2O controller on bus %d at %d : No suitable DMA available\n", dev->bus->number, dev->devfn); - continue; - } - pci_set_master(dev); - if(i2o_pci_install(dev)==0) - count++; - } - if(count) - printk(KERN_INFO "i2o: %d I2O controller%s found and installed.\n", count, - count==1?"":"s"); - return count?count:-ENODEV; -} - -static int i2o_core_init(void) -{ - printk(KERN_INFO "I2O Core - (C) Copyright 1999 Red Hat Software\n"); - if (i2o_install_handler(&i2o_core_handler) < 0) - { - printk(KERN_ERR "i2o_core: Unable to install core handler.\nI2O stack not loaded!"); - return 0; - } - - core_context = i2o_core_handler.context; - - /* - * Initialize event handling thread - */ - - init_MUTEX_LOCKED(&evt_sem); - evt_pid = kernel_thread(i2o_core_evt, &evt_reply, CLONE_SIGHAND); - if(evt_pid < 0) - { - printk(KERN_ERR "I2O: Could not create event handler kernel thread\n"); - i2o_remove_handler(&i2o_core_handler); - return 0; - } - else - printk(KERN_INFO "I2O: Event thread created as pid %d\n", evt_pid); - - i2o_pci_scan(); - if(i2o_num_controllers) - i2o_sys_init(); - - register_reboot_notifier(&i2o_reboot_notifier); - - return 0; -} - -static void i2o_core_exit(void) -{ - int stat; - - unregister_reboot_notifier(&i2o_reboot_notifier); - - if(i2o_num_controllers) - i2o_sys_shutdown(); - - /* - * If this is shutdown time, the thread has already been killed - */ - if(evt_running) { - printk("Terminating i2o threads..."); - stat = kill_proc(evt_pid, SIGKILL, 1); - if(!stat) { - printk("waiting...\n"); - wait_for_completion(&evt_dead); - } - printk("done.\n"); - } - i2o_remove_handler(&i2o_core_handler); -} - -module_init(i2o_core_init); -module_exit(i2o_core_exit); - -MODULE_PARM(verbose, "i"); -MODULE_PARM_DESC(verbose, "Verbose diagnostics"); - -MODULE_AUTHOR("Red Hat Software"); -MODULE_DESCRIPTION("I2O Core"); -MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(i2o_controller_chain); -EXPORT_SYMBOL(i2o_num_controllers); -EXPORT_SYMBOL(i2o_find_controller); -EXPORT_SYMBOL(i2o_unlock_controller); -EXPORT_SYMBOL(i2o_status_get); -EXPORT_SYMBOL(i2o_install_handler); -EXPORT_SYMBOL(i2o_remove_handler); -EXPORT_SYMBOL(i2o_install_controller); -EXPORT_SYMBOL(i2o_delete_controller); -EXPORT_SYMBOL(i2o_run_queue); -EXPORT_SYMBOL(i2o_claim_device); -EXPORT_SYMBOL(i2o_release_device); -EXPORT_SYMBOL(i2o_device_notify_on); -EXPORT_SYMBOL(i2o_device_notify_off); -EXPORT_SYMBOL(i2o_post_this); -EXPORT_SYMBOL(i2o_post_wait); -EXPORT_SYMBOL(i2o_post_wait_mem); -EXPORT_SYMBOL(i2o_query_scalar); -EXPORT_SYMBOL(i2o_set_scalar); -EXPORT_SYMBOL(i2o_query_table); -EXPORT_SYMBOL(i2o_clear_table); -EXPORT_SYMBOL(i2o_row_add_table); -EXPORT_SYMBOL(i2o_issue_params); -EXPORT_SYMBOL(i2o_event_register); -EXPORT_SYMBOL(i2o_event_ack); -EXPORT_SYMBOL(i2o_report_status); -EXPORT_SYMBOL(i2o_dump_message); -EXPORT_SYMBOL(i2o_get_class_name); -EXPORT_SYMBOL(i2o_context_list_add); -EXPORT_SYMBOL(i2o_context_list_get); -EXPORT_SYMBOL(i2o_context_list_remove); diff -Nru a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c --- a/drivers/message/i2o/pci.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/message/i2o/pci.c 2004-09-21 20:52:51 -07:00 @@ -133,6 +133,21 @@ if (!c->base.phys) { c->base.phys = pci_resource_start(pdev, i); c->base.len = pci_resource_len(pdev, i); + + /* + * If we know what card it is, set the size + * correctly. Code is taken from dpt_i2o.c + */ + if(pdev->device == 0xa501) { + if(pdev->subsystem_device >= 0xc032 && + pdev->subsystem_device <= 0xc03b) { + if(c->base.len > 0x400000) + c->base.len = 0x400000; + } else { + if(c->base.len > 0x100000) + c->base.len = 0x100000; + } + } if (!c->raptor) break; } else { diff -Nru a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c --- a/drivers/mmc/mmc.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/mmc/mmc.c 2004-09-21 20:52:52 -07:00 @@ -300,58 +300,121 @@ return ocr; } -static void mmc_decode_cid(struct mmc_cid *cid, u32 *resp) +#define UNSTUFF_BITS(resp,start,size) \ + ({ \ + const u32 __mask = (1 << (size)) - 1; \ + const int __off = 3 - ((start) / 32); \ + const int __shft = (start) & 31; \ + u32 __res; \ + \ + __res = resp[__off] >> __shft; \ + if ((size) + __shft >= 32) \ + __res |= resp[__off-1] << (32 - __shft); \ + __res & __mask; \ + }) + +/* + * Given the decoded CSD structure, decode the raw CID to our CID structure. + */ +static void mmc_decode_cid(struct mmc_card *card) { - memset(cid, 0, sizeof(struct mmc_cid)); + u32 *resp = card->raw_cid; - cid->manfid = resp[0] >> 8; - cid->prod_name[0] = resp[0]; - cid->prod_name[1] = resp[1] >> 24; - cid->prod_name[2] = resp[1] >> 16; - cid->prod_name[3] = resp[1] >> 8; - cid->prod_name[4] = resp[1]; - cid->prod_name[5] = resp[2] >> 24; - cid->prod_name[6] = resp[2] >> 16; - cid->prod_name[7] = '\0'; - cid->hwrev = (resp[2] >> 12) & 15; - cid->fwrev = (resp[2] >> 8) & 15; - cid->serial = (resp[2] & 255) << 16 | (resp[3] >> 16); - cid->month = (resp[3] >> 12) & 15; - cid->year = (resp[3] >> 8) & 15; -} - -static void mmc_decode_csd(struct mmc_csd *csd, u32 *resp) -{ - unsigned int e, m; - - csd->mmc_prot = (resp[0] >> 26) & 15; - m = (resp[0] >> 19) & 15; - e = (resp[0] >> 16) & 7; + memset(&card->cid, 0, sizeof(struct mmc_cid)); + + /* + * The selection of the format here is guesswork based upon + * information people have sent to date. + */ + switch (card->csd.mmca_vsn) { + case 0: /* MMC v1.? */ + case 1: /* MMC v1.4 */ + card->cid.manfid = UNSTUFF_BITS(resp, 104, 24); + card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8); + card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8); + card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8); + card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8); + card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8); + card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8); + card->cid.prod_name[6] = UNSTUFF_BITS(resp, 48, 8); + card->cid.hwrev = UNSTUFF_BITS(resp, 44, 4); + card->cid.fwrev = UNSTUFF_BITS(resp, 40, 4); + card->cid.serial = UNSTUFF_BITS(resp, 16, 24); + card->cid.month = UNSTUFF_BITS(resp, 12, 4); + card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997; + break; + + case 2: /* MMC v2.x ? */ + case 3: /* MMC v3.x ? */ + card->cid.manfid = UNSTUFF_BITS(resp, 120, 8); + card->cid.oemid = UNSTUFF_BITS(resp, 104, 16); + card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8); + card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8); + card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8); + card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8); + card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8); + card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8); + card->cid.serial = UNSTUFF_BITS(resp, 16, 32); + card->cid.month = UNSTUFF_BITS(resp, 12, 4); + card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997; + break; + + default: + printk("%s: card has unknown MMCA version %d\n", + card->host->host_name, card->csd.mmca_vsn); + mmc_card_set_bad(card); + break; + } +} + +/* + * Given a 128-bit response, decode to our card CSD structure. + */ +static void mmc_decode_csd(struct mmc_card *card) +{ + struct mmc_csd *csd = &card->csd; + unsigned int e, m, csd_struct; + u32 *resp = card->raw_csd; + + /* + * We only understand CSD structure v1.1 and v2. + * v2 has extra information in bits 15, 11 and 10. + */ + csd_struct = UNSTUFF_BITS(resp, 126, 2); + if (csd_struct != 1 && csd_struct != 2) { + printk("%s: unrecognised CSD structure version %d\n", + card->host->host_name, csd_struct); + mmc_card_set_bad(card); + return; + } + + csd->mmca_vsn = UNSTUFF_BITS(resp, 122, 4); + m = UNSTUFF_BITS(resp, 115, 4); + e = UNSTUFF_BITS(resp, 112, 3); csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10; - csd->tacc_clks = ((resp[0] >> 8) & 255) * 100; + csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100; - m = (resp[0] >> 3) & 15; - e = resp[0] & 7; + m = UNSTUFF_BITS(resp, 99, 4); + e = UNSTUFF_BITS(resp, 96, 3); csd->max_dtr = tran_exp[e] * tran_mant[m]; - csd->cmdclass = (resp[1] >> 20) & 0xfff; + csd->cmdclass = UNSTUFF_BITS(resp, 84, 12); - e = (resp[2] >> 15) & 7; - m = (resp[1] << 2 | resp[2] >> 30) & 0x3fff; + e = UNSTUFF_BITS(resp, 47, 3); + m = UNSTUFF_BITS(resp, 62, 12); csd->capacity = (1 + m) << (e + 2); - csd->read_blkbits = (resp[1] >> 16) & 15; + csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4); } /* - * Locate a MMC card on this MMC host given a CID. + * Locate a MMC card on this MMC host given a raw CID. */ -static struct mmc_card * -mmc_find_card(struct mmc_host *host, struct mmc_cid *cid) +static struct mmc_card *mmc_find_card(struct mmc_host *host, u32 *raw_cid) { struct mmc_card *card; list_for_each_entry(card, &host->cards, node) { - if (memcmp(&card->cid, cid, sizeof(struct mmc_cid)) == 0) + if (memcmp(card->raw_cid, raw_cid, sizeof(card->raw_cid)) == 0) return card; } return NULL; @@ -361,7 +424,7 @@ * Allocate a new MMC card, and assign a unique RCA. */ static struct mmc_card * -mmc_alloc_card(struct mmc_host *host, struct mmc_cid *cid, unsigned int *frca) +mmc_alloc_card(struct mmc_host *host, u32 *raw_cid, unsigned int *frca) { struct mmc_card *card, *c; unsigned int rca = *frca; @@ -371,7 +434,7 @@ return ERR_PTR(-ENOMEM); mmc_init_card(card, host); - memcpy(&card->cid, cid, sizeof(struct mmc_cid)); + memcpy(card->raw_cid, raw_cid, sizeof(card->raw_cid)); again: list_for_each_entry(c, &host->cards, node) @@ -456,7 +519,7 @@ * to be discovered. Add new cards to the list. * * Create a mmc_card entry for each discovered card, assigning - * it an RCA, and save the CID. + * it an RCA, and save the raw CID for decoding later. */ static void mmc_discover_cards(struct mmc_host *host) { @@ -465,7 +528,6 @@ while (1) { struct mmc_command cmd; - struct mmc_cid cid; cmd.opcode = MMC_ALL_SEND_CID; cmd.arg = 0; @@ -482,11 +544,9 @@ break; } - mmc_decode_cid(&cid, cmd.resp); - - card = mmc_find_card(host, &cid); + card = mmc_find_card(host, cmd.resp); if (!card) { - card = mmc_alloc_card(host, &cid, &first_rca); + card = mmc_alloc_card(host, cmd.resp, &first_rca); if (IS_ERR(card)) { err = PTR_ERR(card); break; @@ -502,7 +562,7 @@ err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); if (err != MMC_ERR_NONE) - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); } } @@ -523,11 +583,14 @@ err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); if (err != MMC_ERR_NONE) { - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); continue; } - mmc_decode_csd(&card->csd, cmd.resp); + memcpy(card->raw_csd, cmd.resp, sizeof(card->raw_csd)); + + mmc_decode_csd(card); + mmc_decode_cid(card); } } @@ -573,7 +636,7 @@ if (err == MMC_ERR_NONE) continue; - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); } } @@ -678,9 +741,9 @@ */ if (!mmc_card_present(card) && !mmc_card_dead(card)) { if (mmc_register_card(card)) - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); else - card->state |= MMC_STATE_PRESENT; + mmc_card_set_present(card); } /* diff -Nru a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c --- a/drivers/mmc/mmc_block.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/mmc/mmc_block.c 2004-09-21 20:52:52 -07:00 @@ -428,7 +428,7 @@ struct mmc_blk_data *md = mmc_get_drvdata(card); if (md) { - blk_stop_queue(md->queue.queue); + mmc_queue_suspend(&md->queue); } return 0; } @@ -439,7 +439,7 @@ if (md) { mmc_blk_set_blksize(md, card); - blk_start_queue(md->queue.queue); + mmc_queue_resume(&md->queue); } return 0; } diff -Nru a/drivers/mmc/mmc_queue.c b/drivers/mmc/mmc_queue.c --- a/drivers/mmc/mmc_queue.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/mmc/mmc_queue.c 2004-09-21 20:52:52 -07:00 @@ -15,6 +15,9 @@ #include #include "mmc_queue.h" +#define MMC_QUEUE_EXIT (1 << 0) +#define MMC_QUEUE_SUSPENDED (1 << 1) + /* * Prepare a MMC request. Essentially, this means passing the * preparation off to the media driver. The media driver will @@ -66,14 +69,9 @@ daemonize("mmcqd"); - spin_lock_irq(¤t->sighand->siglock); - sigfillset(¤t->blocked); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - mq->thread = current; complete(&mq->thread_complete); + down(&mq->thread_sem); add_wait_queue(&mq->thread_wq, &wait); do { struct request *req = NULL; @@ -85,9 +83,11 @@ spin_unlock(q->queue_lock); if (!req) { - if (!mq->thread) + if (mq->flags & MMC_QUEUE_EXIT) break; + up(&mq->thread_sem); schedule(); + down(&mq->thread_sem); continue; } set_current_state(TASK_RUNNING); @@ -95,6 +95,7 @@ mq->issue_fn(mq, req); } while (1); remove_wait_queue(&mq->thread_wq, &wait); + up(&mq->thread_sem); complete_and_exit(&mq->thread_complete, 0); return 0; @@ -148,6 +149,7 @@ init_completion(&mq->thread_complete); init_waitqueue_head(&mq->thread_wq); + init_MUTEX(&mq->thread_sem); ret = kernel_thread(mmc_queue_thread, mq, CLONE_KERNEL); if (ret < 0) { @@ -160,17 +162,61 @@ return ret; } - EXPORT_SYMBOL(mmc_init_queue); void mmc_cleanup_queue(struct mmc_queue *mq) { - mq->thread = NULL; + mq->flags |= MMC_QUEUE_EXIT; wake_up(&mq->thread_wq); wait_for_completion(&mq->thread_complete); blk_cleanup_queue(mq->queue); mq->card = NULL; } - EXPORT_SYMBOL(mmc_cleanup_queue); + +/** + * mmc_queue_suspend - suspend a MMC request queue + * @mq: MMC queue to suspend + * + * Stop the block request queue, and wait for our thread to + * complete any outstanding requests. This ensures that we + * won't suspend while a request is being processed. + */ +void mmc_queue_suspend(struct mmc_queue *mq) +{ + request_queue_t *q = mq->queue; + unsigned long flags; + + if (!(mq->flags & MMC_QUEUE_SUSPENDED)) { + mq->flags |= MMC_QUEUE_SUSPENDED; + + spin_lock_irqsave(q->queue_lock, flags); + blk_stop_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + + down(&mq->thread_sem); + } +} +EXPORT_SYMBOL(mmc_queue_suspend); + +/** + * mmc_queue_resume - resume a previously suspended MMC request queue + * @mq: MMC queue to resume + */ +void mmc_queue_resume(struct mmc_queue *mq) +{ + request_queue_t *q = mq->queue; + unsigned long flags; + + if (mq->flags & MMC_QUEUE_SUSPENDED) { + mq->flags &= ~MMC_QUEUE_SUSPENDED; + + up(&mq->thread_sem); + + spin_lock_irqsave(q->queue_lock, flags); + blk_start_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + } +} +EXPORT_SYMBOL(mmc_queue_resume); diff -Nru a/drivers/mmc/mmc_queue.h b/drivers/mmc/mmc_queue.h --- a/drivers/mmc/mmc_queue.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/mmc/mmc_queue.h 2004-09-21 20:52:51 -07:00 @@ -8,7 +8,8 @@ struct mmc_card *card; struct completion thread_complete; wait_queue_head_t thread_wq; - struct task_struct *thread; + struct semaphore thread_sem; + unsigned int flags; struct request *req; int (*prep_fn)(struct mmc_queue *, struct request *); int (*issue_fn)(struct mmc_queue *, struct request *); @@ -25,5 +26,7 @@ extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); extern void mmc_cleanup_queue(struct mmc_queue *); +extern void mmc_queue_suspend(struct mmc_queue *); +extern void mmc_queue_resume(struct mmc_queue *); #endif diff -Nru a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c --- a/drivers/mmc/mmc_sysfs.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/mmc/mmc_sysfs.c 2004-09-21 20:52:52 -07:00 @@ -31,11 +31,12 @@ /* * This currently matches any MMC driver to any MMC card - drivers * themselves make the decision whether to drive this card in their - * probe method. + * probe method. However, we force "bad" cards to fail. */ static int mmc_bus_match(struct device *dev, struct device_driver *drv) { - return 1; + struct mmc_card *card = dev_to_mmc_card(dev); + return !mmc_card_bad(card); } static int @@ -66,8 +67,9 @@ i = 0; add_env("MMC_CCC=%s", ccc); - add_env("MMC_MANFID=%03x", card->cid.manfid); - add_env("MMC_SLOT_NAME=%s", card->dev.bus_id); + add_env("MMC_MANFID=%06x", card->cid.manfid); + add_env("MMC_NAME=%s", mmc_card_name(card)); + add_env("MMC_OEMID=%04x", card->cid.oemid); return 0; } @@ -157,20 +159,28 @@ } \ static DEVICE_ATTR(name, S_IRUGO, mmc_dev_show_##name, NULL) -MMC_ATTR(date, "%02d/%04d\n", card->cid.month, 1997 + card->cid.year); +MMC_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], + card->raw_cid[2], card->raw_cid[3]); +MMC_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], + card->raw_csd[2], card->raw_csd[3]); +MMC_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); MMC_ATTR(fwrev, "0x%x\n", card->cid.fwrev); MMC_ATTR(hwrev, "0x%x\n", card->cid.hwrev); -MMC_ATTR(manfid, "0x%03x\n", card->cid.manfid); -MMC_ATTR(serial, "0x%06x\n", card->cid.serial); +MMC_ATTR(manfid, "0x%06x\n", card->cid.manfid); MMC_ATTR(name, "%s\n", card->cid.prod_name); +MMC_ATTR(oemid, "0x%04x\n", card->cid.oemid); +MMC_ATTR(serial, "0x%08x\n", card->cid.serial); static struct device_attribute *mmc_dev_attributes[] = { + &dev_attr_cid, + &dev_attr_csd, &dev_attr_date, &dev_attr_fwrev, &dev_attr_hwrev, &dev_attr_manfid, - &dev_attr_serial, &dev_attr_name, + &dev_attr_oemid, + &dev_attr_serial, }; /* diff -Nru a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c --- a/drivers/mmc/pxamci.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/mmc/pxamci.c 2004-09-21 20:52:52 -07:00 @@ -33,6 +33,8 @@ #include #include +#include + #include "pxamci.h" #ifdef CONFIG_MMC_DEBUG @@ -52,6 +54,7 @@ unsigned int cmdat; unsigned int imask; unsigned int power_mode; + struct pxamci_platform_data *pdata; struct mmc_request *mrq; struct mmc_command *cmd; @@ -384,9 +387,8 @@ if (host->power_mode != ios->power_mode) { host->power_mode = ios->power_mode; - /* - * power control? none on the lubbock. - */ + if (host->pdata && host->pdata->setpower) + host->pdata->setpower(mmc->dev, ios->vdd); if (ios->power_mode == MMC_POWER_ON) host->cmdat |= CMDAT_INIT; @@ -407,6 +409,12 @@ DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; } +static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) +{ + mmc_detect_change(devid); + return IRQ_HANDLED; +} + static int pxamci_probe(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -433,11 +441,14 @@ mmc->ops = &pxamci_ops; mmc->f_min = 312500; mmc->f_max = 20000000; - mmc->ocr_avail = MMC_VDD_32_33; host = mmc_priv(mmc); host->mmc = mmc; host->dma = -1; + host->pdata = pdev->dev.platform_data; + mmc->ocr_avail = host->pdata ? + host->pdata->ocr_mask : + MMC_VDD_32_33|MMC_VDD_33_34; host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); if (!host->sg_cpu) { @@ -464,6 +475,7 @@ pxamci_stop_clock(host); writel(0, host->base + MMC_SPI); writel(64, host->base + MMC_RESTO); + writel(host->imask, host->base + MMC_I_MASK); pxa_gpio_mode(GPIO6_MMCCLK_MD); pxa_gpio_mode(GPIO8_MMCCS0_MD); @@ -481,6 +493,9 @@ dev_set_drvdata(dev, mmc); + if (host->pdata && host->pdata->init) + host->pdata->init(dev, pxamci_detect_irq, mmc); + mmc_add_host(mmc); return 0; @@ -509,12 +524,17 @@ if (mmc) { struct pxamci_host *host = mmc_priv(mmc); + if (host->pdata && host->pdata->exit) + host->pdata->exit(dev, mmc); + mmc_remove_host(mmc); pxamci_stop_clock(host); writel(TXFIFO_WR_REQ|RXFIFO_RD_REQ|CLK_IS_OFF|STOP_CMD| END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, host->base + MMC_I_MASK); + + pxa_set_cken(CKEN12_MMC, 0); free_irq(host->irq, host); pxa_free_dma(host->dma); diff -Nru a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig --- a/drivers/mtd/maps/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/drivers/mtd/maps/Kconfig 2004-09-21 20:52:52 -07:00 @@ -473,6 +473,15 @@ IXDP425 and Coyote. If you have an IXP4xx based board and would like to use the flash chips on it, say 'Y'. +config MTD_IXP2000 + tristate "CFI Flash device mapped on Intel IXP2000 based systems" + depends on ARM && MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000 + help + This enables MTD access to flash devices on platforms based + on Intel's IXP2000 family of network processors such as the + IXDP2400 and IXDP2401. If you have an IXP2000 based board and + would like to use the flash chips on it, say 'Y'. + config MTD_EPXA10DB tristate "CFI Flash device mapped on Epxa10db" depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT diff -Nru a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile --- a/drivers/mtd/maps/Makefile 2004-09-21 20:52:51 -07:00 +++ b/drivers/mtd/maps/Makefile 2004-09-21 20:52:51 -07:00 @@ -62,5 +62,6 @@ obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o obj-$(CONFIG_MTD_MPC1211) += mpc1211.o obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o +obj-$(CONFIG_MTD_IXP2000) += ixp2000.o obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o obj-$(CONFIG_MTD_DMV182) += dmv182.o diff -Nru a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/mtd/maps/ixp2000.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,281 @@ +/* + * $Id: ixp2000.c,v 1.1 2004/09/02 00:13:41 dsaxena Exp $ + * + * drivers/mtd/maps/ixp2000.c + * + * Mapping for the Intel XScale IXP2000 based systems + * + * Copyright (C) 2002 Intel Corp. + * Copyright (C) 2003-2004 MontaVista Software, Inc. + * + * Original Author: Naeem M Afzal + * Maintainer: Deepak Saxena + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +struct ixp2000_flash_info { + struct mtd_info *mtd; + struct map_info map; + struct mtd_partition *partitions; + struct resource *res; + int nr_banks; +}; + +static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) +{ + unsigned long (*set_bank)(unsigned long) = + (unsigned long(*)(unsigned long))map->map_priv_2; + + return (set_bank ? set_bank(ofs) : ofs); +} + +#ifdef __ARMEB__ +/* + * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which + * causes the lower address bits to be XORed with 0x11 on 8 bit accesses + * and XORed with 0x10 on 16 bit accesses. See the spec update, erratta 44. + */ +static int errata44_workaround = 0; + +static inline unsigned long address_fix8_write(unsigned long addr) +{ + if (errata44_workaround) { + return (addr ^ 3); + } + return addr; +} +#else + +#define address_fix8_write(x) (x) +#endif + +static map_word ixp2000_flash_read8(struct map_info *map, unsigned long ofs) +{ + map_word val; + + val.x[0] = *((u8 *)(map->map_priv_1 + flash_bank_setup(map, ofs))); + return val; +} + +/* + * We can't use the standard memcpy due to the broken SlowPort + * address translation on rev A0 and A1 silicon and the fact that + * we have banked flash. + */ +static void ixp2000_flash_copy_from(struct map_info *map, void *to, + unsigned long from, ssize_t len) +{ + from = flash_bank_setup(map, from); + while(len--) + *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++); +} + +static void ixp2000_flash_write8(struct map_info *map, map_word d, unsigned long ofs) +{ + *(__u8 *) (address_fix8_write(map->map_priv_1 + + flash_bank_setup(map, ofs))) = d.x[0]; +} + +static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, + const void *from, ssize_t len) +{ + to = flash_bank_setup(map, to); + while(len--) { + unsigned long tmp = address_fix8_write(map->map_priv_1 + to++); + *(__u8 *)(tmp) = *(__u8 *)(from++); + } +} + + +static int ixp2000_flash_remove(struct device *_dev) +{ + struct platform_device *dev = to_platform_device(_dev); + struct flash_platform_data *plat = dev->dev.platform_data; + struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); + + dev_set_drvdata(&dev->dev, NULL); + + if(!info) + return 0; + + if (info->mtd) { + del_mtd_partitions(info->mtd); + map_destroy(info->mtd); + } + if (info->map.map_priv_1) + iounmap((void *) info->map.map_priv_1); + + if (info->partitions) + kfree(info->partitions); + + if (info->res) { + release_resource(info->res); + kfree(info->res); + } + + if (plat->exit) + plat->exit(); + + return 0; +} + + +static int ixp2000_flash_probe(struct device *_dev) +{ + static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; + struct platform_device *dev = to_platform_device(_dev); + struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; + struct flash_platform_data *plat; + struct ixp2000_flash_info *info; + unsigned long window_size; + int err = -1; + + if (!ixp_data) + return -ENODEV; + + plat = ixp_data->platform_data; + if (!plat) + return -ENODEV; + + window_size = dev->resource->end - dev->resource->start + 1; + dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dM)\n", + ixp_data->nr_banks, ((u32)window_size >> 20)); + + if (plat->width != 1) { + dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", + plat->width * 8); + return -EIO; + } + + info = kmalloc(sizeof(struct ixp2000_flash_info), GFP_KERNEL); + if(!info) { + err = -ENOMEM; + goto Error; + } + memzero(info, sizeof(struct ixp2000_flash_info)); + + dev_set_drvdata(&dev->dev, info); + + /* + * Tell the MTD layer we're not 1:1 mapped so that it does + * not attempt to do a direct access on us. + */ + info->map.phys = NO_XIP; + + info->nr_banks = ixp_data->nr_banks; + info->map.size = ixp_data->nr_banks * window_size; + info->map.bankwidth = 1; + + /* + * map_priv_2 is used to store a ptr to to the bank_setup routine + */ + info->map.map_priv_2 = (u32) ixp_data->bank_setup; + + info->map.name = dev->dev.bus_id; + info->map.read = ixp2000_flash_read8; + info->map.write = ixp2000_flash_write8; + info->map.copy_from = ixp2000_flash_copy_from; + info->map.copy_to = ixp2000_flash_copy_to; + + info->res = request_mem_region(dev->resource->start, + dev->resource->end - dev->resource->start + 1, + dev->dev.bus_id); + if (!info->res) { + dev_err(_dev, "Could not reserve memory region\n"); + err = -ENOMEM; + goto Error; + } + + info->map.map_priv_1 = + (unsigned long) ioremap(dev->resource->start, + dev->resource->end - dev->resource->start + 1); + if (!info->map.map_priv_1) { + dev_err(_dev, "Failed to ioremap flash region\n"); + err = -EIO; + goto Error; + } + + /* + * Setup read mode for FLASH + */ + *IXP2000_SLOWPORT_FRM = 1; + +#if defined(__ARMEB__) + /* + * Enable errata 44 workaround for NPUs with broken slowport + */ + + errata44_workaround = ixp2000_has_broken_slowport(); + dev_info(_dev, "Errata 44 workaround %s\n", + errata44_workaround ? "enabled" : "disabled"); +#endif + + info->mtd = do_map_probe(plat->map_name, &info->map); + if (!info->mtd) { + dev_err(_dev, "map_probe failed\n"); + err = -ENXIO; + goto Error; + } + info->mtd->owner = THIS_MODULE; + + err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); + if (err > 0) { + err = add_mtd_partitions(info->mtd, info->partitions, err); + if(err) + dev_err(_dev, "Could not parse partitions\n"); + } + + if (err) + goto Error; + + return 0; + +Error: + ixp2000_flash_remove(_dev); + return err; +} + +static struct device_driver ixp2000_flash_driver = { + .name = "IXP2000-Flash", + .bus = &platform_bus_type, + .probe = &ixp2000_flash_probe, + .remove = &ixp2000_flash_remove +}; + +static int __init ixp2000_flash_init(void) +{ + return driver_register(&ixp2000_flash_driver); +} + +static void __exit ixp2000_flash_exit(void) +{ + driver_unregister(&ixp2000_flash_driver); +} + +module_init(ixp2000_flash_init); +module_exit(ixp2000_flash_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Deepak Saxena "); + diff -Nru a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c --- a/drivers/mtd/maps/ixp4xx.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/mtd/maps/ixp4xx.c 2004-09-21 20:52:51 -07:00 @@ -1,5 +1,5 @@ /* - * $Id: ixp4xx.c,v 1.3 2004/07/12 22:38:29 dwmw2 Exp $ + * $Id: ixp4xx.c,v 1.4 2004/08/31 22:55:51 dsaxena Exp $ * * drivers/mtd/maps/ixp4xx.c * @@ -88,6 +88,7 @@ struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); + map_word d; dev_set_drvdata(&dev->dev, NULL); @@ -97,7 +98,8 @@ /* * This is required for a soft reboot to work. */ - ixp4xx_write16(&info->map, 0xff, 0x55 * 0x2); + d.x[0] = 0xff; + ixp4xx_write16(&info->map, d, 0x55 * 0x2); if (info->mtd) { del_mtd_partitions(info->mtd); diff -Nru a/drivers/net/8390.c b/drivers/net/8390.c --- a/drivers/net/8390.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/8390.c 2004-09-21 20:52:51 -07:00 @@ -42,6 +42,7 @@ Alan Cox : Spinlocking work, added 'BUG_83C690' Paul Gortmaker : Separate out Tx timeout code from Tx path. Paul Gortmaker : Remove old unused single Tx buffer code. + Hayato Fujiwara : Add m32r support. Sources: The National Semiconductor LAN Databook, and the 3Com 3c503 databook. @@ -219,6 +220,15 @@ int txsr, isr, tickssofar = jiffies - dev->trans_start; unsigned long flags; +#if defined(CONFIG_M32R) && defined(CONFIG_SMP) + unsigned long icucr; + + local_irq_save(flags); + icucr = inl(ICUCR1); + icucr |= M32R_ICUCR_ISMOD11; + outl(icucr, ICUCR1); + local_irq_restore(flags); +#endif ei_local->stat.tx_errors++; spin_lock_irqsave(&ei_local->page_lock, flags); diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig --- a/drivers/net/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/Kconfig 2004-09-21 20:52:52 -07:00 @@ -200,7 +200,7 @@ config MACE tristate "MACE (Power Mac ethernet) support" - depends on NET_ETHERNET && PPC_PMAC + depends on NET_ETHERNET && PPC_PMAC && PPC32 select CRC32 help Power Macintoshes and clones with Ethernet built-in on the @@ -223,7 +223,7 @@ config BMAC tristate "BMAC (G3 ethernet) support" - depends on NET_ETHERNET && PPC_PMAC + depends on NET_ETHERNET && PPC_PMAC && PPC32 select CRC32 help Say Y for support of BMAC Ethernet interfaces. These are used on G3 @@ -817,7 +817,7 @@ tristate "SMC 91C9x/91C1xxx support" select CRC32 select MII - depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6) + depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R) help This is a driver for SMC's 91x series of Ethernet chipsets, including the SMC91C94 and the SMC91C111. Say Y if you want it @@ -1075,7 +1075,7 @@ config NE2000 tristate "NE2000/NE1000 support" - depends on NET_ISA || (Q40 && m) + depends on NET_ISA || (Q40 && m) || M32R select CRC32 ---help--- If you have a network (Ethernet) card of this type, say Y and read diff -Nru a/drivers/net/b44.c b/drivers/net/b44.c --- a/drivers/net/b44.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/b44.c 2004-09-21 20:52:51 -07:00 @@ -98,13 +98,24 @@ static void b44_init_rings(struct b44 *); static void b44_init_hw(struct b44 *); +static inline unsigned long br32(const struct b44 *bp, unsigned long reg) +{ + return readl(bp->regs + reg); +} + +static inline void bw32(const struct b44 *bp, + unsigned long reg, unsigned long val) +{ + writel(val, bp->regs + reg); +} + static int b44_wait_bit(struct b44 *bp, unsigned long reg, u32 bit, unsigned long timeout, const int clear) { unsigned long i; for (i = 0; i < timeout; i++) { - u32 val = br32(reg); + u32 val = br32(bp, reg); if (clear && !(val & bit)) break; @@ -168,7 +179,7 @@ static u32 ssb_get_core_rev(struct b44 *bp) { - return (br32(B44_SBIDHIGH) & SBIDHIGH_RC_MASK); + return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK); } static u32 ssb_pci_setup(struct b44 *bp, u32 cores) @@ -180,13 +191,13 @@ ssb_get_addr(bp, SBID_REG_PCI, 0)); pci_rev = ssb_get_core_rev(bp); - val = br32(B44_SBINTVEC); + val = br32(bp, B44_SBINTVEC); val |= cores; - bw32(B44_SBINTVEC, val); + bw32(bp, B44_SBINTVEC, val); - val = br32(SSB_PCI_TRANS_2); + val = br32(bp, SSB_PCI_TRANS_2); val |= SSB_PCI_PREF | SSB_PCI_BURST; - bw32(SSB_PCI_TRANS_2, val); + bw32(bp, SSB_PCI_TRANS_2, val); pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig); @@ -195,18 +206,18 @@ static void ssb_core_disable(struct b44 *bp) { - if (br32(B44_SBTMSLOW) & SBTMSLOW_RESET) + if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET) return; - bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK)); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK)); b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0); b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1); - bw32(B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK | + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK | SBTMSLOW_REJECT | SBTMSLOW_RESET)); - br32(B44_SBTMSLOW); + br32(bp, B44_SBTMSLOW); udelay(1); - bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET)); + br32(bp, B44_SBTMSLOW); udelay(1); } @@ -215,31 +226,31 @@ u32 val; ssb_core_disable(bp); - bw32(B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC)); + br32(bp, B44_SBTMSLOW); udelay(1); /* Clear SERR if set, this is a hw bug workaround. */ - if (br32(B44_SBTMSHIGH) & SBTMSHIGH_SERR) - bw32(B44_SBTMSHIGH, 0); + if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR) + bw32(bp, B44_SBTMSHIGH, 0); - val = br32(B44_SBIMSTATE); + val = br32(bp, B44_SBIMSTATE); if (val & (SBIMSTATE_IBE | SBIMSTATE_TO)) - bw32(B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO)); + bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO)); - bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC)); + br32(bp, B44_SBTMSLOW); udelay(1); - bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK)); + br32(bp, B44_SBTMSLOW); udelay(1); } static int ssb_core_unit(struct b44 *bp) { #if 0 - u32 val = br32(B44_SBADMATCH0); + u32 val = br32(bp, B44_SBADMATCH0); u32 base; type = val & SBADMATCH0_TYPE_MASK; @@ -263,7 +274,7 @@ static int ssb_is_core_up(struct b44 *bp) { - return ((br32(B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK)) + return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK)) == SBTMSLOW_CLOCK); } @@ -275,19 +286,19 @@ val |= ((u32) data[3]) << 16; val |= ((u32) data[4]) << 8; val |= ((u32) data[5]) << 0; - bw32(B44_CAM_DATA_LO, val); + bw32(bp, B44_CAM_DATA_LO, val); val = (CAM_DATA_HI_VALID | (((u32) data[0]) << 8) | (((u32) data[1]) << 0)); - bw32(B44_CAM_DATA_HI, val); - bw32(B44_CAM_CTRL, (CAM_CTRL_WRITE | + bw32(bp, B44_CAM_DATA_HI, val); + bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE | (index << CAM_CTRL_INDEX_SHIFT))); b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1); } static inline void __b44_disable_ints(struct b44 *bp) { - bw32(B44_IMASK, 0); + bw32(bp, B44_IMASK, 0); } static void b44_disable_ints(struct b44 *bp) @@ -295,34 +306,34 @@ __b44_disable_ints(bp); /* Flush posted writes. */ - br32(B44_IMASK); + br32(bp, B44_IMASK); } static void b44_enable_ints(struct b44 *bp) { - bw32(B44_IMASK, bp->imask); + bw32(bp, B44_IMASK, bp->imask); } static int b44_readphy(struct b44 *bp, int reg, u32 *val) { int err; - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII); + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START | (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) | (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | (reg << MDIO_DATA_RA_SHIFT) | (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT))); err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0); - *val = br32(B44_MDIO_DATA) & MDIO_DATA_DATA; + *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA; return err; } static int b44_writephy(struct b44 *bp, int reg, u32 val) { - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII); + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START | (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) | (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | (reg << MDIO_DATA_RA_SHIFT) | @@ -382,20 +393,20 @@ bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE); bp->flags |= pause_flags; - val = br32(B44_RXCONFIG); + val = br32(bp, B44_RXCONFIG); if (pause_flags & B44_FLAG_RX_PAUSE) val |= RXCONFIG_FLOW; else val &= ~RXCONFIG_FLOW; - bw32(B44_RXCONFIG, val); + bw32(bp, B44_RXCONFIG, val); - val = br32(B44_MAC_FLOW); + val = br32(bp, B44_MAC_FLOW); if (pause_flags & B44_FLAG_TX_PAUSE) val |= (MAC_FLOW_PAUSE_ENAB | (0xc0 & MAC_FLOW_RX_HI_WATER)); else val &= ~MAC_FLOW_PAUSE_ENAB; - bw32(B44_MAC_FLOW, val); + bw32(bp, B44_MAC_FLOW, val); } static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) @@ -491,11 +502,11 @@ val = &bp->hw_stats.tx_good_octets; for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { - *val++ += br32(reg); + *val++ += br32(bp, reg); } val = &bp->hw_stats.rx_good_octets; for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { - *val++ += br32(reg); + *val++ += br32(bp, reg); } } @@ -535,14 +546,14 @@ if (!netif_carrier_ok(bp->dev) && (bmsr & BMSR_LSTATUS)) { - u32 val = br32(B44_TX_CTRL); + u32 val = br32(bp, B44_TX_CTRL); u32 local_adv, remote_adv; if (bp->flags & B44_FLAG_FULL_DUPLEX) val |= TX_CTRL_DUPLEX; else val &= ~TX_CTRL_DUPLEX; - bw32(B44_TX_CTRL, val); + bw32(bp, B44_TX_CTRL, val); if (!(bp->flags & B44_FLAG_FORCE_LINK) && !b44_readphy(bp, MII_ADVERTISE, &local_adv) && @@ -587,7 +598,7 @@ { u32 cur, cons; - cur = br32(B44_DMATX_STAT) & DMATX_STAT_CDMASK; + cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK; cur /= sizeof(struct dma_desc); /* XXX needs updating when NETIF_F_SG is supported */ @@ -611,7 +622,7 @@ TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH) netif_wake_queue(bp->dev); - bw32(B44_GPTIMER, 0); + bw32(bp, B44_GPTIMER, 0); } /* Works like this. This chip writes a 'struct rx_header" 30 bytes @@ -708,7 +719,7 @@ u32 cons, prod; received = 0; - prod = br32(B44_DMARX_STAT) & DMARX_STAT_CDMASK; + prod = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK; prod /= sizeof(struct dma_desc); cons = bp->rx_cons; @@ -787,7 +798,7 @@ } bp->rx_cons = cons; - bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc)); + bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc)); return received; } @@ -851,8 +862,8 @@ spin_lock_irqsave(&bp->lock, flags); - istat = br32(B44_ISTAT); - imask = br32(B44_IMASK); + istat = br32(bp, B44_ISTAT); + imask = br32(bp, B44_IMASK); /* ??? What the fuck is the purpose of the interrupt mask * ??? register if we have to mask it out by hand anyways? @@ -872,8 +883,8 @@ dev->name); } - bw32(B44_ISTAT, istat); - br32(B44_ISTAT); + bw32(bp, B44_ISTAT, istat); + br32(bp, B44_ISTAT); } spin_unlock_irqrestore(&bp->lock, flags); return IRQ_RETVAL(handled); @@ -937,11 +948,11 @@ wmb(); - bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc)); + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc)); if (bp->flags & B44_FLAG_BUGGY_TXPTR) - bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc)); + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc)); if (bp->flags & B44_FLAG_REORDER_BUG) - br32(B44_DMATX_PTR); + br32(bp, B44_DMATX_PTR); if (TX_BUFFS_AVAIL(bp) < 1) netif_stop_queue(dev); @@ -1109,27 +1120,27 @@ { unsigned long reg; - bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) - br32(reg); + br32(bp, reg); for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) - br32(reg); + br32(bp, reg); } /* bp->lock is held. */ static void b44_chip_reset(struct b44 *bp) { if (ssb_is_core_up(bp)) { - bw32(B44_RCV_LAZY, 0); - bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE); + bw32(bp, B44_RCV_LAZY, 0); + bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1); - bw32(B44_DMATX_CTRL, 0); + bw32(bp, B44_DMATX_CTRL, 0); bp->tx_prod = bp->tx_cons = 0; - if (br32(B44_DMARX_STAT) & DMARX_STAT_EMASK) { + if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) { b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE, 100, 0); } - bw32(B44_DMARX_CTRL, 0); + bw32(bp, B44_DMARX_CTRL, 0); bp->rx_prod = bp->rx_cons = 0; } else { ssb_pci_setup(bp, (bp->core_unit == 0 ? @@ -1142,20 +1153,20 @@ b44_clear_stats(bp); /* Make PHY accessible. */ - bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | + bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | (0x0d & MDIO_CTRL_MAXF_MASK))); - br32(B44_MDIO_CTRL); + br32(bp, B44_MDIO_CTRL); - if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) { - bw32(B44_ENET_CTRL, ENET_CTRL_EPSEL); - br32(B44_ENET_CTRL); + if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) { + bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL); + br32(bp, B44_ENET_CTRL); bp->flags &= ~B44_FLAG_INTERNAL_PHY; } else { - u32 val = br32(B44_DEVCTRL); + u32 val = br32(bp, B44_DEVCTRL); if (val & DEVCTRL_EPR) { - bw32(B44_DEVCTRL, (val & ~DEVCTRL_EPR)); - br32(B44_DEVCTRL); + bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR)); + br32(bp, B44_DEVCTRL); udelay(100); } bp->flags |= B44_FLAG_INTERNAL_PHY; @@ -1172,13 +1183,13 @@ /* bp->lock is held. */ static void __b44_set_mac_addr(struct b44 *bp) { - bw32(B44_CAM_CTRL, 0); + bw32(bp, B44_CAM_CTRL, 0); if (!(bp->dev->flags & IFF_PROMISC)) { u32 val; __b44_cam_write(bp, bp->dev->dev_addr, 0); - val = br32(B44_CAM_CTRL); - bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE); + val = br32(bp, B44_CAM_CTRL); + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE); } } @@ -1212,30 +1223,30 @@ b44_setup_phy(bp); /* Enable CRC32, set proper LED modes and power on PHY */ - bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL); - bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT)); + bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL); + bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT)); /* This sets the MAC address too. */ __b44_set_rx_mode(bp->dev); /* MTU + eth header + possible VLAN tag + struct rx_header */ - bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); - bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); + bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); + bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); - bw32(B44_TX_WMARK, 56); /* XXX magic */ - bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE); - bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); - bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | + bw32(bp, B44_TX_WMARK, 56); /* XXX magic */ + bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE); + bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); + bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | (bp->rx_offset << DMARX_CTRL_ROSHIFT))); - bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); + bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); - bw32(B44_DMARX_PTR, bp->rx_pending); + bw32(bp, B44_DMARX_PTR, bp->rx_pending); bp->rx_prod = bp->rx_pending; - bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); - val = br32(B44_ENET_CTRL); - bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); + val = br32(bp, B44_ENET_CTRL); + bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); } static int b44_open(struct net_device *dev) @@ -1372,11 +1383,11 @@ int i=0; unsigned char zero[6] = {0,0,0,0,0,0}; - val = br32(B44_RXCONFIG); + val = br32(bp, B44_RXCONFIG); val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); if (dev->flags & IFF_PROMISC) { val |= RXCONFIG_PROMISC; - bw32(B44_RXCONFIG, val); + bw32(bp, B44_RXCONFIG, val); } else { __b44_set_mac_addr(bp); @@ -1388,9 +1399,9 @@ for(;i<64;i++) { __b44_cam_write(bp, zero, i); } - bw32(B44_RXCONFIG, val); - val = br32(B44_CAM_CTRL); - bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE); + bw32(bp, B44_RXCONFIG, val); + val = br32(bp, B44_CAM_CTRL); + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE); } } @@ -1760,7 +1771,7 @@ spin_lock_init(&bp->lock); - bp->regs = (unsigned long) ioremap(b44reg_base, b44reg_len); + bp->regs = ioremap(b44reg_base, b44reg_len); if (bp->regs == 0UL) { printk(KERN_ERR PFX "Cannot map device registers, " "aborting.\n"); @@ -1826,7 +1837,7 @@ return 0; err_out_iounmap: - iounmap((void *) bp->regs); + iounmap(bp->regs); err_out_free_dev: free_netdev(dev); @@ -1848,7 +1859,7 @@ struct b44 *bp = netdev_priv(dev); unregister_netdev(dev); - iounmap((void *) bp->regs); + iounmap(bp->regs); free_netdev(dev); pci_release_regions(pdev); pci_disable_device(pdev); diff -Nru a/drivers/net/b44.h b/drivers/net/b44.h --- a/drivers/net/b44.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/b44.h 2004-09-21 20:52:52 -07:00 @@ -395,9 +395,6 @@ #define SSB_PCI_MASK1 0xfc000000 #define SSB_PCI_MASK2 0xc0000000 -#define br32(REG) readl(bp->regs + (REG)) -#define bw32(REG,VAL) writel((VAL), bp->regs + (REG)) - /* 4400 PHY registers */ #define B44_MII_AUXCTRL 24 /* Auxiliary Control */ #define MII_AUXCTRL_DUPLEX 0x0001 /* Full Duplex */ @@ -530,7 +527,7 @@ struct net_device_stats stats; struct b44_hw_stats hw_stats; - unsigned long regs; + void __iomem *regs; struct pci_dev *pdev; struct net_device *dev; diff -Nru a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c --- a/drivers/net/ibmveth.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/ibmveth.c 2004-09-21 20:52:51 -07:00 @@ -885,13 +885,16 @@ mac_addr_p = (unsigned char *) vio_get_attribute(dev, VETH_MAC_ADDR, 0); if(!mac_addr_p) { - ibmveth_error_printk("Can't find VETH_MAC_ADDR attribute\n"); + printk(KERN_ERR "(%s:%3.3d) ERROR: Can't find VETH_MAC_ADDR " + "attribute\n", __FILE__, __LINE__); return 0; } mcastFilterSize_p= (unsigned int *) vio_get_attribute(dev, VETH_MCAST_FILTER_SIZE, 0); if(!mcastFilterSize_p) { - ibmveth_error_printk("Can't find VETH_MCAST_FILTER_SIZE attribute\n"); + printk(KERN_ERR "(%s:%3.3d) ERROR: Can't find " + "VETH_MCAST_FILTER_SIZE attribute\n", + __FILE__, __LINE__); return 0; } diff -Nru a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c --- a/drivers/net/myri_sbus.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/myri_sbus.c 2004-09-21 20:52:51 -07:00 @@ -85,7 +85,7 @@ static struct myri_eth *root_myri_dev; #endif -static void myri_reset_off(unsigned long lp, unsigned long cregs) +static void myri_reset_off(void __iomem *lp, void __iomem *cregs) { /* Clear IRQ mask. */ sbus_writel(0, lp + LANAI_EIMASK); @@ -94,7 +94,7 @@ sbus_writel(CONTROL_ROFF, cregs + MYRICTRL_CTRL); } -static void myri_reset_on(unsigned long cregs) +static void myri_reset_on(void __iomem *cregs) { /* Enable RESET function. */ sbus_writel(CONTROL_RON, cregs + MYRICTRL_CTRL); @@ -103,14 +103,14 @@ sbus_writel(CONTROL_DIRQ, cregs + MYRICTRL_CTRL); } -static void myri_disable_irq(unsigned long lp, unsigned long cregs) +static void myri_disable_irq(void __iomem *lp, void __iomem *cregs) { sbus_writel(CONTROL_DIRQ, cregs + MYRICTRL_CTRL); sbus_writel(0, lp + LANAI_EIMASK); sbus_writel(ISTAT_HOST, lp + LANAI_ISTAT); } -static void myri_enable_irq(unsigned long lp, unsigned long cregs) +static void myri_enable_irq(void __iomem *lp, void __iomem *cregs) { sbus_writel(CONTROL_EIRQ, cregs + MYRICTRL_CTRL); sbus_writel(ISTAT_HOST, lp + LANAI_EIMASK); @@ -119,7 +119,7 @@ static inline void bang_the_chip(struct myri_eth *mp) { struct myri_shmem *shmem = mp->shmem; - unsigned long cregs = mp->cregs; + void __iomem *cregs = mp->cregs; sbus_writel(1, &shmem->send); sbus_writel(CONTROL_WON, cregs + MYRICTRL_CTRL); @@ -128,7 +128,7 @@ static int myri_do_handshake(struct myri_eth *mp) { struct myri_shmem *shmem = mp->shmem; - unsigned long cregs = mp->cregs; + void __iomem *cregs = mp->cregs; struct myri_channel *chan = &shmem->channel; int tick = 0; @@ -176,27 +176,27 @@ static int myri_load_lanai(struct myri_eth *mp) { struct net_device *dev = mp->dev; - struct myri_shmem *shmem = mp->shmem; - unsigned char *rptr; + struct myri_shmem __iomem *shmem = mp->shmem; + void __iomem *rptr; int i; myri_disable_irq(mp->lregs, mp->cregs); myri_reset_on(mp->cregs); - rptr = (unsigned char *) mp->lanai; + rptr = mp->lanai; for (i = 0; i < mp->eeprom.ramsz; i++) - sbus_writeb(0, &rptr[i]); + sbus_writeb(0, rptr + i); if (mp->eeprom.cpuvers >= CPUVERS_3_0) sbus_writel(mp->eeprom.cval, mp->lregs + LANAI_CVAL); /* Load executable code. */ for (i = 0; i < sizeof(lanai4_code); i++) - sbus_writeb(lanai4_code[i], &rptr[(lanai4_code_off * 2) + i]); + sbus_writeb(lanai4_code[i], rptr + (lanai4_code_off * 2) + i); /* Load data segment. */ for (i = 0; i < sizeof(lanai4_data); i++) - sbus_writeb(lanai4_data[i], &rptr[(lanai4_data_off * 2) + i]); + sbus_writeb(lanai4_data[i], rptr + (lanai4_data_off * 2) + i); /* Set device address. */ sbus_writeb(0, &shmem->addr[0]); @@ -237,15 +237,15 @@ static void myri_clean_rings(struct myri_eth *mp) { - struct sendq *sq = mp->sq; - struct recvq *rq = mp->rq; + struct sendq __iomem *sq = mp->sq; + struct recvq __iomem *rq = mp->rq; int i; sbus_writel(0, &rq->tail); sbus_writel(0, &rq->head); for (i = 0; i < (RX_RING_SIZE+1); i++) { if (mp->rx_skbs[i] != NULL) { - struct myri_rxd *rxd = &rq->myri_rxd[i]; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[i]; u32 dma_addr; dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); @@ -261,7 +261,7 @@ for (i = 0; i < TX_RING_SIZE; i++) { if (mp->tx_skbs[i] != NULL) { struct sk_buff *skb = mp->tx_skbs[i]; - struct myri_txd *txd = &sq->myri_txd[i]; + struct myri_txd __iomem *txd = &sq->myri_txd[i]; u32 dma_addr; dma_addr = sbus_readl(&txd->myri_gathers[0].addr); @@ -274,8 +274,8 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq) { - struct recvq *rq = mp->rq; - struct myri_rxd *rxd = &rq->myri_rxd[0]; + struct recvq __iomem *rq = mp->rq; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[0]; struct net_device *dev = mp->dev; int gfp_flags = GFP_KERNEL; int i; @@ -343,7 +343,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) { - struct sendq *sq = mp->sq; + struct sendq __iomem *sq= mp->sq; int entry = mp->tx_old; int limit = sbus_readl(&sq->head); @@ -411,8 +411,8 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) { - struct recvq *rq = mp->rq; - struct recvq *rqa = mp->rqack; + struct recvq __iomem *rq = mp->rq; + struct recvq __iomem *rqa = mp->rqack; int entry = sbus_readl(&rqa->head); int limit = sbus_readl(&rqa->tail); int drops; @@ -423,11 +423,11 @@ drops = 0; DRX(("\n")); while (entry != limit) { - struct myri_rxd *rxdack = &rqa->myri_rxd[entry]; + struct myri_rxd __iomem *rxdack = &rqa->myri_rxd[entry]; u32 csum = sbus_readl(&rxdack->csum); int len = sbus_readl(&rxdack->myri_scatters[0].len); int index = sbus_readl(&rxdack->ctx); - struct myri_rxd *rxd = &rq->myri_rxd[rq->tail]; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[rq->tail]; struct sk_buff *skb = mp->rx_skbs[index]; /* Ack it. */ @@ -545,7 +545,7 @@ { struct net_device *dev = (struct net_device *) dev_id; struct myri_eth *mp = (struct myri_eth *) dev->priv; - unsigned long lregs = mp->lregs; + void __iomem *lregs = mp->lregs; struct myri_channel *chan = &mp->shmem->channel; unsigned long flags; u32 status; @@ -610,8 +610,8 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct myri_eth *mp = (struct myri_eth *) dev->priv; - struct sendq *sq = mp->sq; - struct myri_txd *txd; + struct sendq __iomem *sq = mp->sq; + struct myri_txd __iomem *txd; unsigned long flags; unsigned int head, tail; int len, entry; @@ -998,22 +998,20 @@ printk("MyriCOM: Cannot map MyriCOM registers.\n"); goto err; } - mp->lanai = (unsigned short *) (mp->regs + (256 * 1024)); - mp->lanai3 = (unsigned int *) mp->lanai; - mp->lregs = (unsigned long) &mp->lanai[0x10000]; + mp->lanai = mp->regs + (256 * 1024); + mp->lregs = mp->lanai + (0x10000 * 2); } else { DET(("Mapping regs for cpuvers >= CPUVERS_4_0\n")); mp->cregs = sbus_ioremap(&sdev->resource[0], 0, PAGE_SIZE, "MyriCOM Control Regs"); mp->lregs = sbus_ioremap(&sdev->resource[0], (256 * 1024), PAGE_SIZE, "MyriCOM LANAI Regs"); - mp->lanai = (unsigned short *) + mp->lanai = sbus_ioremap(&sdev->resource[0], (512 * 1024), mp->eeprom.ramsz, "MyriCOM SRAM"); - mp->lanai3 = (unsigned int *) mp->lanai; } - DET(("Registers mapped: cregs[%lx] lregs[%lx] lanai[%p] lanai3[%p]\n", - mp->cregs, mp->lregs, mp->lanai, mp->lanai3)); + DET(("Registers mapped: cregs[%p] lregs[%p] lanai[%p]\n", + mp->cregs, mp->lregs, mp->lanai)); if (mp->eeprom.cpuvers >= CPUVERS_4_0) mp->shmem_base = 0xf000; @@ -1022,7 +1020,8 @@ DET(("Shared memory base is %04x, ", mp->shmem_base)); - mp->shmem = (struct myri_shmem *) &mp->lanai[mp->shmem_base]; + mp->shmem = (struct myri_shmem __iomem *) + (mp->lanai + (mp->shmem_base * 2)); DET(("shmem mapped at %p\n", mp->shmem)); mp->rqack = &mp->shmem->channel.recvqa; diff -Nru a/drivers/net/myri_sbus.h b/drivers/net/myri_sbus.h --- a/drivers/net/myri_sbus.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/myri_sbus.h 2004-09-21 20:52:52 -07:00 @@ -270,22 +270,21 @@ * to obtain good cache hit rates. */ spinlock_t irq_lock; - struct myri_shmem *shmem; /* Shared data structures. */ - unsigned long cregs; /* Control register space. */ - struct recvq *rqack; /* Where we ack rx's. */ - struct recvq *rq; /* Where we put buffers. */ - struct sendq *sq; /* Where we stuff tx's. */ + struct myri_shmem __iomem *shmem; /* Shared data structures. */ + void __iomem *cregs; /* Control register space. */ + struct recvq __iomem *rqack; /* Where we ack rx's. */ + struct recvq __iomem *rq; /* Where we put buffers. */ + struct sendq __iomem *sq; /* Where we stuff tx's. */ struct net_device *dev; /* Linux/NET dev struct. */ int tx_old; /* To speed up tx cleaning. */ - unsigned long lregs; /* Quick ptr to LANAI regs. */ + void __iomem *lregs; /* Quick ptr to LANAI regs. */ struct sk_buff *rx_skbs[RX_RING_SIZE+1];/* RX skb's */ struct sk_buff *tx_skbs[TX_RING_SIZE]; /* TX skb's */ struct net_device_stats enet_stats; /* Interface stats. */ /* These are less frequently accessed. */ - unsigned long regs; /* MyriCOM register space. */ - unsigned short *lanai; /* View 2 of register space. */ - unsigned int *lanai3; /* View 3 of register space. */ + void __iomem *regs; /* MyriCOM register space. */ + void __iomem *lanai; /* View 2 of register space. */ unsigned int myri_bursts; /* SBUS bursts. */ struct myri_eeprom eeprom; /* Local copy of EEPROM. */ unsigned int reg_size; /* Size of register space. */ diff -Nru a/drivers/net/ne.c b/drivers/net/ne.c --- a/drivers/net/ne.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/ne.c 2004-09-21 20:52:51 -07:00 @@ -29,6 +29,7 @@ last in cleanup_modue() Richard Guenther : Added support for ISAPnP cards Paul Gortmaker : Discontinued PCI support - use ne2k-pci.c instead. + Hayato Fujiwara : Add m32r support. */ @@ -128,6 +129,14 @@ #define NESM_START_PG 0x40 /* First page of TX buffer */ #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ +#ifdef CONFIG_PLAT_MAPPI +# define DCR_VAL 0x4b +#elif CONFIG_PLAT_OAKS32R +# define DCR_VAL 0x48 +#else +# define DCR_VAL 0x49 +#endif + static int ne_probe1(struct net_device *dev, int ioaddr); static int ne_probe_isapnp(struct net_device *dev); @@ -387,7 +396,7 @@ for (i = 0; i < 16; i++) SA_prom[i] = SA_prom[i+i]; /* We must set the 8390 for word mode. */ - outb_p(0x49, ioaddr + EN0_DCFG); + outb_p(DCR_VAL, ioaddr + EN0_DCFG); start_page = NESM_START_PG; stop_page = NESM_STOP_PG; } else { @@ -395,7 +404,12 @@ stop_page = NE1SM_STOP_PG; } +#if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) + neX000 = ((SA_prom[14] == 0x57 && SA_prom[15] == 0x57) + || (SA_prom[14] == 0x42 && SA_prom[15] == 0x42)); +#else neX000 = (SA_prom[14] == 0x57 && SA_prom[15] == 0x57); +#endif ctron = (SA_prom[0] == 0x00 && SA_prom[1] == 0x00 && SA_prom[2] == 0x1d); copam = (SA_prom[14] == 0x49 && SA_prom[15] == 0x00); @@ -476,10 +490,20 @@ dev->base_addr = ioaddr; +#ifdef CONFIG_PLAT_MAPPI + outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, + ioaddr + E8390_CMD); /* 0x61 */ + for (i = 0 ; i < ETHER_ADDR_LEN ; i++) { + dev->dev_addr[i] = SA_prom[i] + = inb_p(ioaddr + EN1_PHYS_SHIFT(i)); + printk(" %2.2x", SA_prom[i]); + } +#else for(i = 0; i < ETHER_ADDR_LEN; i++) { printk(" %2.2x", SA_prom[i]); dev->dev_addr[i] = SA_prom[i]; } +#endif printk("\n%s: %s found at %#x, using IRQ %d.\n", dev->name, name, ioaddr, dev->irq); @@ -487,7 +511,11 @@ ei_status.name = name; ei_status.tx_start_page = start_page; ei_status.stop_page = stop_page; +#ifdef CONFIG_PLAT_OAKS32R + ei_status.word16 = 0; +#else ei_status.word16 = (wordlength == 2); +#endif ei_status.rx_start_page = start_page + TX_PAGES; #ifdef PACKETBUF_MEMSIZE diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c --- a/drivers/net/r8169.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/r8169.c 2004-09-21 20:52:52 -07:00 @@ -156,6 +156,7 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); static int rx_copybreak = 200; +static int use_dac; enum RTL8169_registers { MAC0 = 0, /* Ethernet hardware address. */ @@ -358,6 +359,8 @@ MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver"); MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM(rx_copybreak, "i"); +MODULE_PARM(use_dac, "i"); +MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); MODULE_LICENSE("GPL"); static int rtl8169_open(struct net_device *dev); @@ -375,7 +378,7 @@ #endif static const u16 rtl8169_intr_mask = - LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; + SYSErr | LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; static const u16 rtl8169_napi_event = RxOK | RxOverflow | RxFIFOOver | TxOK | TxErr; static const unsigned int rtl8169_rx_config = @@ -984,7 +987,7 @@ tp->cp_cmd = PCIMulRW | RxChkSum; if ((sizeof(dma_addr_t) > 4) && - !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) + !pci_set_dma_mask(pdev, DMA_64BIT_MASK) && use_dac) tp->cp_cmd |= PCIDAC; else { rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); @@ -1760,6 +1763,15 @@ if (!(status & rtl8169_intr_mask)) break; + + if (unlikely(status & SYSErr)) { + printk(KERN_ERR PFX "%s: PCI error (status: 0x%04x)." + " Device disabled.\n", dev->name, status); + RTL_W8(ChipCmd, 0x00); + RTL_W16(IntrMask, 0x0000); + RTL_R16(IntrMask); + break; + } if (status & LinkChg) rtl8169_check_link_status(dev, tp, ioaddr); diff -Nru a/drivers/net/smc91x.c b/drivers/net/smc91x.c --- a/drivers/net/smc91x.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/smc91x.c 2004-09-21 20:52:52 -07:00 @@ -55,6 +55,9 @@ * smc_phy_configure * - clean up (and fix stack overrun) in PHY * MII read/write functions + * 09/15/04 Hayato Fujiwara - Add m32r support. + * - Modify for SMP kernel; Change spin-locked + * regions. */ static const char version[] = "smc91x.c: v1.0, mar 07 2003 by Nicolas Pitre \n"; @@ -256,24 +259,18 @@ /* this enables an interrupt in the interrupt mask register */ #define SMC_ENABLE_INT(x) do { \ - unsigned long flags; \ unsigned char mask; \ - spin_lock_irqsave(&lp->lock, flags); \ mask = SMC_GET_INT_MASK(); \ mask |= (x); \ SMC_SET_INT_MASK(mask); \ - spin_unlock_irqrestore(&lp->lock, flags); \ } while (0) /* this disables an interrupt from the interrupt mask register */ #define SMC_DISABLE_INT(x) do { \ - unsigned long flags; \ unsigned char mask; \ - spin_lock_irqsave(&lp->lock, flags); \ mask = SMC_GET_INT_MASK(); \ mask &= ~(x); \ SMC_SET_INT_MASK(mask); \ - spin_unlock_irqrestore(&lp->lock, flags); \ } while (0) /* @@ -580,9 +577,12 @@ struct smc_local *lp = netdev_priv(dev); unsigned long ioaddr = dev->base_addr; unsigned int numPages, poll_count, status, saved_bank; + unsigned long flags; DBG(3, "%s: %s\n", dev->name, __FUNCTION__); + spin_lock_irqsave(&lp->lock, flags); + BUG_ON(lp->saved_skb != NULL); lp->saved_skb = skb; @@ -604,6 +604,7 @@ lp->stats.tx_errors++; lp->stats.tx_dropped++; dev_kfree_skb(skb); + spin_unlock_irqrestore(&lp->lock, flags); return 0; } @@ -652,6 +653,7 @@ } SMC_SELECT_BANK(saved_bank); + spin_unlock_irqrestore(&lp->lock, flags); return 0; } @@ -1166,6 +1168,8 @@ DBG(3, "%s: %s\n", dev->name, __FUNCTION__); + spin_lock(&lp->lock); + saved_bank = SMC_CURRENT_BANK(); SMC_SELECT_BANK(2); saved_pointer = SMC_GET_PTR(); @@ -1189,8 +1193,6 @@ if (!status) break; - spin_lock(&lp->lock); - if (status & IM_RCV_INT) { DBG(3, "%s: RX irq\n", dev->name); smc_rcv(dev); @@ -1239,7 +1241,6 @@ PRINTK("%s: UNSUPPORTED: ERCV INTERRUPT \n", dev->name); } - spin_unlock(&lp->lock); } while (--timeout); /* restore register states */ @@ -1249,6 +1250,7 @@ DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout); + spin_unlock(&lp->lock); /* * We return IRQ_HANDLED unconditionally here even if there was * nothing to do. There is a possibility that a packet might @@ -1264,7 +1266,9 @@ static void smc_timeout(struct net_device *dev) { struct smc_local *lp = netdev_priv(dev); + unsigned long flags; + spin_lock_irqsave(&lp->lock, flags); DBG(2, "%s: %s\n", dev->name, __FUNCTION__); smc_reset(dev); @@ -1298,6 +1302,9 @@ } /* We can accept TX packets again */ dev->trans_start = jiffies; + + spin_unlock_irqrestore(&lp->lock, flags); + netif_wake_queue(dev); } @@ -1438,7 +1445,7 @@ * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx */ if (!is_valid_ether_addr(dev->dev_addr)) { - DBG(2, (KERN_DEBUG "smc_open: no valid ethernet hw addr\n")); + DBG(2, "smc_open: no valid ethernet hw addr\n"); return -EINVAL; } @@ -1878,7 +1885,9 @@ if (retval) goto err_out; +#if !defined(__m32r__) set_irq_type(dev->irq, IRQT_RISING); +#endif #ifdef SMC_USE_PXA_DMA { int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, diff -Nru a/drivers/net/smc91x.h b/drivers/net/smc91x.h --- a/drivers/net/smc91x.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/smc91x.h 2004-09-21 20:52:52 -07:00 @@ -160,6 +160,19 @@ #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) +#elif defined(CONFIG_M32R) + +#define SMC_CAN_USE_8BIT 0 +#define SMC_CAN_USE_16BIT 1 +#define SMC_CAN_USE_32BIT 0 + +#define SMC_inb(a, r) inb((a) + (r) - 0xa0000000) +#define SMC_inw(a, r) inw((a) + (r) - 0xa0000000) +#define SMC_outb(v, a, r) outb(v, (a) + (r) - 0xa0000000) +#define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000) +#define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, p, l) +#define SMC_outsw(a, r, p, l) outsw((a) + (r) - 0xa0000000, p, l) + #else #define SMC_CAN_USE_8BIT 1 diff -Nru a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c --- a/drivers/net/sunbmac.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/sunbmac.c 2004-09-21 20:52:52 -07:00 @@ -68,7 +68,7 @@ #define QEC_RESET_TRIES 200 -static int qec_global_reset(unsigned long gregs) +static int qec_global_reset(void __iomem *gregs) { int tries = QEC_RESET_TRIES; @@ -88,7 +88,7 @@ static void qec_init(struct bigmac *bp) { - unsigned long gregs = bp->gregs; + void __iomem *gregs = bp->gregs; struct sbus_dev *qec_sdev = bp->qec_sdev; u8 bsizes = bp->bigmac_bursts; u32 regval; @@ -117,7 +117,7 @@ #define TX_RESET_TRIES 32 #define RX_RESET_TRIES 32 -static void bigmac_tx_reset(unsigned long bregs) +static void bigmac_tx_reset(void __iomem *bregs) { int tries = TX_RESET_TRIES; @@ -137,7 +137,7 @@ } } -static void bigmac_rx_reset(unsigned long bregs) +static void bigmac_rx_reset(void __iomem *bregs) { int tries = RX_RESET_TRIES; @@ -159,7 +159,7 @@ bigmac_rx_reset(bp->bregs); } -static void bigmac_get_counters(struct bigmac *bp, unsigned long bregs) +static void bigmac_get_counters(struct bigmac *bp, void __iomem *bregs) { struct net_device_stats *stats = &bp->enet_stats; @@ -244,7 +244,7 @@ #define MGMT_CLKON (MGMT_PAL_INT_MDIO|MGMT_PAL_EXT_MDIO|MGMT_PAL_OENAB|MGMT_PAL_DCLOCK) #define MGMT_CLKOFF (MGMT_PAL_INT_MDIO|MGMT_PAL_EXT_MDIO|MGMT_PAL_OENAB) -static void idle_transceiver(unsigned long tregs) +static void idle_transceiver(void __iomem *tregs) { int i = 20; @@ -256,7 +256,7 @@ } } -static void write_tcvr_bit(struct bigmac *bp, unsigned long tregs, int bit) +static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit) { if (bp->tcvr_type == internal) { bit = (bit & 1) << 3; @@ -279,7 +279,7 @@ } } -static int read_tcvr_bit(struct bigmac *bp, unsigned long tregs) +static int read_tcvr_bit(struct bigmac *bp, void __iomem *tregs) { int retval = 0; @@ -302,7 +302,7 @@ return retval; } -static int read_tcvr_bit2(struct bigmac *bp, unsigned long tregs) +static int read_tcvr_bit2(struct bigmac *bp, void __iomem *tregs) { int retval = 0; @@ -325,7 +325,7 @@ } static void put_tcvr_byte(struct bigmac *bp, - unsigned long tregs, + void __iomem *tregs, unsigned int byte) { int shift = 4; @@ -336,7 +336,7 @@ } while (shift >= 0); } -static void bigmac_tcvr_write(struct bigmac *bp, unsigned long tregs, +static void bigmac_tcvr_write(struct bigmac *bp, void __iomem *tregs, int reg, unsigned short val) { int shift; @@ -376,7 +376,7 @@ } static unsigned short bigmac_tcvr_read(struct bigmac *bp, - unsigned long tregs, + void __iomem *tregs, int reg) { unsigned short retval = 0; @@ -444,7 +444,7 @@ static void bigmac_tcvr_init(struct bigmac *bp) { - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; u32 mpal; idle_transceiver(tregs); @@ -482,7 +482,7 @@ static int bigmac_init(struct bigmac *, int); -static int try_next_permutation(struct bigmac *bp, unsigned long tregs) +static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) { if (bp->sw_bmcr & BMCR_SPEED100) { int timeout; @@ -518,7 +518,7 @@ static void bigmac_timer(unsigned long data) { struct bigmac *bp = (struct bigmac *) data; - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; int restart_timer = 0; bp->timer_ticks++; @@ -573,7 +573,7 @@ */ static void bigmac_begin_auto_negotiation(struct bigmac *bp) { - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; int timeout; /* Grab new software copies of PHY registers. */ @@ -612,9 +612,9 @@ static int bigmac_init(struct bigmac *bp, int from_irq) { - unsigned long gregs = bp->gregs; - unsigned long cregs = bp->creg; - unsigned long bregs = bp->bregs; + void __iomem *gregs = bp->gregs; + void __iomem *cregs = bp->creg; + void __iomem *bregs = bp->bregs; unsigned char *e = &bp->dev->dev_addr[0]; /* Latch current counters into statistics. */ @@ -987,7 +987,7 @@ static void bigmac_set_multicast(struct net_device *dev) { struct bigmac *bp = (struct bigmac *) dev->priv; - unsigned long bregs = bp->bregs; + void __iomem *bregs = bp->bregs; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; diff -Nru a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h --- a/drivers/net/sunbmac.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunbmac.h 2004-09-21 20:52:51 -07:00 @@ -303,10 +303,10 @@ }; struct bigmac { - unsigned long gregs; /* QEC Global Registers */ - unsigned long creg; /* QEC BigMAC Channel Registers */ - unsigned long bregs; /* BigMAC Registers */ - unsigned long tregs; /* BigMAC Transceiver */ + void __iomem *gregs; /* QEC Global Registers */ + void __iomem *creg; /* QEC BigMAC Channel Registers */ + void __iomem *bregs; /* BigMAC Registers */ + void __iomem *tregs; /* BigMAC Transceiver */ struct bmac_init_block *bmac_block; /* RX and TX descriptors */ __u32 bblock_dvma; /* RX and TX descriptors */ diff -Nru a/drivers/net/sungem.c b/drivers/net/sungem.c --- a/drivers/net/sungem.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/sungem.c 2004-09-21 20:52:52 -07:00 @@ -5,6 +5,9 @@ * * Support for Apple GMAC and assorted PHYs by * Benjamin Herrenscmidt (benh@kernel.crashing.org) + * + * NAPI and NETPOLL support + * (C) 2004 by Eric Lemoine (eric.lemoine@gmail.com) * * TODO: * - Get rid of all those nasty mdelay's and replace them @@ -832,7 +835,9 @@ } /* Run TX completion thread */ + spin_lock(&gp->tx_lock); gem_tx(dev, gp, gp->status); + spin_unlock(&gp->tx_lock); spin_unlock_irqrestore(&gp->lock, flags); @@ -896,6 +901,16 @@ return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void gem_poll_controller(struct net_device *dev) +{ + /* gem_interrupt is safe to reentrance so no need + * to disable_irq here. + */ + gem_interrupt(dev->irq, dev, NULL); +} +#endif + static void gem_tx_timeout(struct net_device *dev) { struct gem *gp = dev->priv; @@ -917,10 +932,12 @@ readl(gp->regs + MAC_RXCFG)); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->reset_task_pending = 2; schedule_work(&gp->reset_task); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } @@ -938,6 +955,7 @@ struct gem *gp = dev->priv; int entry; u64 ctrl; + unsigned long flags; ctrl = 0; if (skb->ip_summed == CHECKSUM_HW) { @@ -951,12 +969,17 @@ (csum_stuff_off << 21)); } - spin_lock_irq(&gp->lock); + local_irq_save(flags); + if (!spin_trylock(&gp->tx_lock)) { + /* Tell upper layer to requeue */ + local_irq_restore(flags); + return -1; + } /* This is a hard error, log it. */ if (TX_BUFFS_AVAIL(gp) <= (skb_shinfo(skb)->nr_frags + 1)) { netif_stop_queue(dev); - spin_unlock_irq(&gp->lock); + spin_unlock_irqrestore(&gp->tx_lock, flags); printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", dev->name); return 1; @@ -1043,7 +1066,7 @@ dev->name, entry, skb->len); mb(); writel(gp->tx_new, gp->regs + TXDMA_KICK); - spin_unlock_irq(&gp->lock); + spin_unlock_irqrestore(&gp->tx_lock, flags); dev->trans_start = jiffies; @@ -1074,9 +1097,11 @@ } spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); dev->mtu = new_mtu; gp->reset_task_pending = 1; schedule_work(&gp->reset_task); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); flush_scheduled_work(); @@ -1086,7 +1111,7 @@ #define STOP_TRIES 32 -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_stop(struct gem *gp) { int limit; @@ -1112,7 +1137,7 @@ printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_start_dma(struct gem *gp) { unsigned long val; @@ -1137,7 +1162,7 @@ } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ // XXX dbl check what that function should do when called on PCS PHY static void gem_begin_auto_negotiation(struct gem *gp, struct ethtool_cmd *ep) { @@ -1224,7 +1249,7 @@ /* A link-up condition has occurred, initialize and enable the * rest of the chip. * - * Must be invoked under gp->lock. + * Must be invoked under gp->lock and gp->tx_lock. */ static int gem_set_link_modes(struct gem *gp) { @@ -1331,7 +1356,7 @@ return 0; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static int gem_mdio_link_not_up(struct gem *gp) { switch (gp->lstate) { @@ -1389,6 +1414,7 @@ netif_poll_disable(gp->dev); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); if (gp->hw_running && gp->opened) { netif_stop_queue(gp->dev); @@ -1404,6 +1430,7 @@ } gp->reset_task_pending = 0; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); netif_poll_enable(gp->dev); } @@ -1417,6 +1444,7 @@ return; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* If the link of task is still pending, we just * reschedule the link timer @@ -1486,10 +1514,11 @@ restart: mod_timer(&gp->link_timer, jiffies + ((12 * HZ) / 10)); out_unlock: + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_clean_rings(struct gem *gp) { struct gem_init_block *gb = gp->init_block; @@ -1540,7 +1569,7 @@ } } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_rings(struct gem *gp) { struct gem_init_block *gb = gp->init_block; @@ -1590,7 +1619,7 @@ wmb(); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_phy(struct gem *gp) { u32 mifcfg; @@ -1728,7 +1757,7 @@ } } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_dma(struct gem *gp) { u64 desc_dma = (u64) gp->gblock_dvma; @@ -1766,7 +1795,7 @@ gp->regs + RXDMA_BLANK); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static u32 gem_setup_multicast(struct gem *gp) { @@ -1809,7 +1838,7 @@ return rxcfg; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_mac(struct gem *gp) { unsigned char *e = &gp->dev->dev_addr[0]; @@ -1887,7 +1916,7 @@ writel(0xffffffff, gp->regs + MAC_MCMASK); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_pause_thresholds(struct gem *gp) { u32 cfg; @@ -2023,7 +2052,7 @@ return 0; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_hw(struct gem *gp, int restart_link) { /* On Apple's gmac, I initialize the PHY only after @@ -2121,9 +2150,11 @@ if (!gp->wake_on_lan) { spin_lock_irqsave(&gp->lock, flags); + spin_lock(&gp->tx_lock); gem_stop(gp); writel(MAC_TXRST_CMD, gp->regs + MAC_TXRST); writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST); + spin_unlock(&gp->tx_lock); spin_unlock_irqrestore(&gp->lock, flags); } @@ -2171,8 +2202,10 @@ unsigned long flags; spin_lock_irqsave(&gp->lock, flags); + spin_lock(&gp->tx_lock); gem_stop(gp); - spin_unlock_irqrestore(&gp->lock, flags); + spin_unlock(&gp->tx_lock); + spin_unlock_irqrestore(&gp->lock, flags); } } @@ -2232,7 +2265,9 @@ /* Reset the chip */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); gp->hw_running = 1; @@ -2246,6 +2281,7 @@ printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); #ifdef CONFIG_PPC_PMAC if (!hw_was_up && gp->pdev->vendor == PCI_VENDOR_ID_APPLE) gem_apple_powerdown(gp); @@ -2254,12 +2290,14 @@ gp->pm_timer.expires = jiffies + 10*HZ; add_timer(&gp->pm_timer); up(&gp->pm_sem); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return -EAGAIN; } spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* Allocate & setup ring buffers */ gem_init_rings(gp); @@ -2269,6 +2307,7 @@ gp->opened = 1; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); up(&gp->pm_sem); @@ -2289,6 +2328,7 @@ /* Stop traffic, mark us closed */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->opened = 0; @@ -2303,6 +2343,7 @@ /* Bye, the pm timer will finish the job */ free_irq(gp->pdev->irq, (void *) dev); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); /* Fire the PM timer that will shut us down in about 10 seconds */ @@ -2333,6 +2374,7 @@ /* If the driver is opened, we stop the DMA */ if (gp->opened) { spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* Stop traffic, mark us closed */ netif_device_detach(dev); @@ -2343,6 +2385,7 @@ /* Get rid of ring buffers */ gem_clean_rings(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) @@ -2376,12 +2419,14 @@ } #endif /* CONFIG_PPC_PMAC */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); gp->hw_running = 1; gem_init_rings(gp); gem_init_hw(gp, 1); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); netif_device_attach(dev); @@ -2402,6 +2447,7 @@ struct net_device_stats *stats = &gp->net_stats; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); if (gp->hw_running) { stats->rx_crc_errors += readl(gp->regs + MAC_FCSERR); @@ -2421,6 +2467,7 @@ writel(0, gp->regs + MAC_LCOLL); } + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return &gp->net_stats; @@ -2436,6 +2483,7 @@ return; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); netif_stop_queue(dev); @@ -2460,6 +2508,7 @@ netif_wake_queue(dev); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } @@ -2491,6 +2540,7 @@ /* Return current PHY settings */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); cmd->autoneg = gp->want_autoneg; cmd->speed = gp->phy_mii.speed; cmd->duplex = gp->phy_mii.duplex; @@ -2502,6 +2552,7 @@ */ if (cmd->advertising == 0) cmd->advertising = cmd->supported; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } else { // XXX PCS ? cmd->supported = @@ -2541,7 +2592,9 @@ /* Apply settings and restart link process. */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_begin_auto_negotiation(gp, cmd); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return 0; @@ -2556,7 +2609,9 @@ /* Restart link process. */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_begin_auto_negotiation(gp, NULL); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return 0; @@ -2808,6 +2863,7 @@ gp->msg_enable = DEFAULT_MSG; spin_lock_init(&gp->lock); + spin_lock_init(&gp->tx_lock); init_MUTEX(&gp->pm_sem); init_timer(&gp->link_timer); @@ -2843,7 +2899,9 @@ gem_apple_powerup(gp); #endif spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); /* Fill up the mii_phy structure (even if we won't use it) */ @@ -2889,6 +2947,9 @@ dev->change_mtu = gem_change_mtu; dev->irq = pdev->irq; dev->dma = 0; +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = gem_poll_controller; +#endif if (register_netdev(dev)) { printk(KERN_ERR PFX "Cannot register net device, " @@ -2906,9 +2967,11 @@ /* Detect & init PHY, start autoneg */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->hw_running = 1; gem_init_phy(gp); gem_begin_auto_negotiation(gp, NULL); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); if (gp->phy_type == phy_mii_mdio0 || @@ -2919,7 +2982,7 @@ pci_set_drvdata(pdev, dev); /* GEM can do it all... */ - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; + dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_LLTX; if (pci_using_dac) dev->features |= NETIF_F_HIGHDMA; diff -Nru a/drivers/net/sungem.h b/drivers/net/sungem.h --- a/drivers/net/sungem.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/sungem.h 2004-09-21 20:52:52 -07:00 @@ -953,6 +953,7 @@ struct gem { spinlock_t lock; + spinlock_t tx_lock; void __iomem *regs; int rx_new, rx_old; int tx_new, tx_old; diff -Nru a/drivers/net/sunhme.c b/drivers/net/sunhme.c --- a/drivers/net/sunhme.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunhme.c 2004-09-21 20:52:51 -07:00 @@ -203,12 +203,12 @@ */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) -static void sbus_hme_write32(unsigned long reg, u32 val) +static void sbus_hme_write32(void __iomem *reg, u32 val) { sbus_writel(val, reg); } -static u32 sbus_hme_read32(unsigned long reg) +static u32 sbus_hme_read32(void __iomem *reg) { return sbus_readl(reg); } @@ -232,12 +232,12 @@ return *p; } -static void pci_hme_write32(unsigned long reg, u32 val) +static void pci_hme_write32(void __iomem *reg, u32 val) { writel(val, reg); } -static u32 pci_hme_read32(unsigned long reg) +static u32 pci_hme_read32(void __iomem *reg) { return readl(reg); } @@ -354,7 +354,7 @@ /* Oh yes, the MIF BitBang is mighty fun to program. BitBucket is more like it. */ -static void BB_PUT_BIT(struct happy_meal *hp, unsigned long tregs, int bit) +static void BB_PUT_BIT(struct happy_meal *hp, void __iomem *tregs, int bit) { hme_write32(hp, tregs + TCVR_BBDATA, bit); hme_write32(hp, tregs + TCVR_BBCLOCK, 0); @@ -362,7 +362,7 @@ } #if 0 -static u32 BB_GET_BIT(struct happy_meal *hp, unsigned long tregs, int internal) +static u32 BB_GET_BIT(struct happy_meal *hp, void __iomem *tregs, int internal) { u32 ret; @@ -378,7 +378,7 @@ } #endif -static u32 BB_GET_BIT2(struct happy_meal *hp, unsigned long tregs, int internal) +static u32 BB_GET_BIT2(struct happy_meal *hp, void __iomem *tregs, int internal) { u32 retval; @@ -397,7 +397,7 @@ #define TCVR_FAILURE 0x80000000 /* Impossible MIF read value */ static int happy_meal_bb_read(struct happy_meal *hp, - unsigned long tregs, int reg) + void __iomem *tregs, int reg) { u32 tmp; int retval = 0; @@ -443,7 +443,7 @@ } static void happy_meal_bb_write(struct happy_meal *hp, - unsigned long tregs, int reg, + void __iomem *tregs, int reg, unsigned short value) { u32 tmp; @@ -488,7 +488,7 @@ #define TCVR_READ_TRIES 16 static int happy_meal_tcvr_read(struct happy_meal *hp, - unsigned long tregs, int reg) + void __iomem *tregs, int reg) { int tries = TCVR_READ_TRIES; int retval; @@ -520,7 +520,7 @@ #define TCVR_WRITE_TRIES 16 static void happy_meal_tcvr_write(struct happy_meal *hp, - unsigned long tregs, int reg, + void __iomem *tregs, int reg, unsigned short value) { int tries = TCVR_WRITE_TRIES; @@ -579,7 +579,7 @@ * service routine, and the chip is reset, or the link is ifconfig'd down * and then back up, this entire process repeats itself all over again. */ -static int try_next_permutation(struct happy_meal *hp, unsigned long tregs) +static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs) { hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); @@ -603,7 +603,7 @@ return -1; } -static void display_link_mode(struct happy_meal *hp, unsigned long tregs) +static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) { printk(KERN_INFO "%s: Link is up using ", hp->dev->name); if (hp->tcvr_type == external) @@ -625,7 +625,7 @@ } } -static void display_forced_link_mode(struct happy_meal *hp, unsigned long tregs) +static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) { printk(KERN_INFO "%s: Link has been forced up using ", hp->dev->name); if (hp->tcvr_type == external) @@ -644,7 +644,7 @@ printk("Half Duplex.\n"); } -static int set_happy_link_modes(struct happy_meal *hp, unsigned long tregs) +static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs) { int full; @@ -708,7 +708,7 @@ static int is_lucent_phy(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; unsigned short mr2, mr3; int ret = 0; @@ -724,7 +724,7 @@ static void happy_meal_timer(unsigned long data) { struct happy_meal *hp = (struct happy_meal *) data; - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; int restart_timer = 0; spin_lock_irq(&hp->happy_lock); @@ -905,7 +905,7 @@ #define RX_RESET_TRIES 32 /* hp->happy_lock must be held */ -static void happy_meal_tx_reset(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_tx_reset(struct happy_meal *hp, void __iomem *bregs) { int tries = TX_RESET_TRIES; @@ -925,7 +925,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_rx_reset(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_rx_reset(struct happy_meal *hp, void __iomem *bregs) { int tries = RX_RESET_TRIES; @@ -947,7 +947,7 @@ #define STOP_TRIES 16 /* hp->happy_lock must be held */ -static void happy_meal_stop(struct happy_meal *hp, unsigned long gregs) +static void happy_meal_stop(struct happy_meal *hp, void __iomem *gregs) { int tries = STOP_TRIES; @@ -967,7 +967,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_get_counters(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_get_counters(struct happy_meal *hp, void __iomem *bregs) { struct net_device_stats *stats = &hp->net_stats; @@ -990,7 +990,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_poll_stop(struct happy_meal *hp, unsigned long tregs) +static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) { ASD(("happy_meal_poll_stop: ")); @@ -1025,7 +1025,7 @@ #define TCVR_UNISOLATE_TRIES 32 /* Dis-isolation can take longer. */ /* hp->happy_lock must be held */ -static int happy_meal_tcvr_reset(struct happy_meal *hp, unsigned long tregs) +static int happy_meal_tcvr_reset(struct happy_meal *hp, void __iomem *tregs) { u32 tconfig; int result, tries = TCVR_RESET_TRIES; @@ -1123,7 +1123,7 @@ * * hp->happy_lock must be held */ -static void happy_meal_transceiver_check(struct happy_meal *hp, unsigned long tregs) +static void happy_meal_transceiver_check(struct happy_meal *hp, void __iomem *tregs) { unsigned long tconfig = hme_read32(hp, tregs + TCVR_CFG); @@ -1318,7 +1318,7 @@ /* hp->happy_lock must be held */ static void happy_meal_begin_auto_negotiation(struct happy_meal *hp, - unsigned long tregs, + void __iomem *tregs, struct ethtool_cmd *ep) { int timeout; @@ -1443,11 +1443,11 @@ /* hp->happy_lock must be held */ static int happy_meal_init(struct happy_meal *hp) { - unsigned long gregs = hp->gregs; - unsigned long etxregs = hp->etxregs; - unsigned long erxregs = hp->erxregs; - unsigned long bregs = hp->bigmacregs; - unsigned long tregs = hp->tcvregs; + void __iomem *gregs = hp->gregs; + void __iomem *etxregs = hp->etxregs; + void __iomem *erxregs = hp->erxregs; + void __iomem *bregs = hp->bigmacregs; + void __iomem *tregs = hp->tcvregs; u32 regtmp, rxcfg; unsigned char *e = &hp->dev->dev_addr[0]; @@ -1736,9 +1736,9 @@ /* hp->happy_lock must be held */ static void happy_meal_set_initial_advertisement(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; - unsigned long bregs = hp->bigmacregs; - unsigned long gregs = hp->gregs; + void __iomem *tregs = hp->tcvregs; + void __iomem *bregs = hp->bigmacregs; + void __iomem *gregs = hp->gregs; happy_meal_stop(hp, gregs); hme_write32(hp, tregs + TCVR_IMASK, 0xffff); @@ -1910,7 +1910,7 @@ /* hp->happy_lock must be held */ static void happy_meal_mif_interrupt(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; printk(KERN_INFO "%s: Link status change.\n", hp->dev->name); hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); @@ -2390,7 +2390,7 @@ static void happy_meal_set_multicast(struct net_device *dev) { struct happy_meal *hp = dev->priv; - unsigned long bregs = hp->bigmacregs; + void __iomem *bregs = hp->bigmacregs; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; @@ -3025,7 +3025,8 @@ #endif struct happy_meal *hp; struct net_device *dev; - unsigned long hpreg_base; + void __iomem *hpreg_base; + unsigned long hpreg_res; int i, qfe_slot = -1; char prom_name[64]; int err; @@ -3084,7 +3085,7 @@ qp->happy_meals[qfe_slot] = dev; } - hpreg_base = pci_resource_start(pdev, 0); + hpreg_res = pci_resource_start(pdev, 0); err = -ENODEV; if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) { printk(KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n"); @@ -3096,7 +3097,7 @@ goto err_out_clear_quattro; } - if ((hpreg_base = (unsigned long) ioremap(hpreg_base, 0x8000)) == 0) { + if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == 0) { printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n"); goto err_out_free_res; } diff -Nru a/drivers/net/sunhme.h b/drivers/net/sunhme.h --- a/drivers/net/sunhme.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunhme.h 2004-09-21 20:52:51 -07:00 @@ -397,7 +397,7 @@ /* Happy happy, joy joy! */ struct happy_meal { - unsigned long gregs; /* Happy meal global registers */ + void __iomem *gregs; /* Happy meal global registers */ struct hmeal_init_block *happy_block; /* RX and TX descriptors (CPU addr) */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) @@ -423,14 +423,14 @@ struct net_device_stats net_stats; /* Statistical counters */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) - u32 (*read32)(unsigned long); - void (*write32)(unsigned long, u32); + u32 (*read32)(void __iomem *); + void (*write32)(void __iomem *, u32); #endif - unsigned long etxregs; /* External transmitter regs */ - unsigned long erxregs; /* External receiver regs */ - unsigned long bigmacregs; /* BIGMAC core regs */ - unsigned long tcvregs; /* MIF transceiver regs */ + void __iomem *etxregs; /* External transmitter regs */ + void __iomem *erxregs; /* External receiver regs */ + void __iomem *bigmacregs; /* BIGMAC core regs */ + void __iomem *tcvregs; /* MIF transceiver regs */ dma_addr_t hblock_dvma; /* DVMA visible address happy block */ unsigned int happy_flags; /* Driver state flags */ diff -Nru a/drivers/net/sunlance.c b/drivers/net/sunlance.c --- a/drivers/net/sunlance.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunlance.c 2004-09-21 20:52:51 -07:00 @@ -230,9 +230,9 @@ ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem][0]))))) struct lance_private { - unsigned long lregs; /* Lance RAP/RDP regs. */ - unsigned long dregs; /* DMA controller regs. */ - volatile struct lance_init_block *init_block; + void __iomem *lregs; /* Lance RAP/RDP regs. */ + void __iomem *dregs; /* DMA controller regs. */ + struct lance_init_block *init_block; spinlock_t lock; @@ -270,7 +270,7 @@ #define LANCE_REG_SIZE 0x04UL #define STOP_LANCE(__lp) \ -do { unsigned long __base = (__lp)->lregs; \ +do { void __iomem *__base = (__lp)->lregs; \ sbus_writew(LE_CSR0, __base + RAP); \ sbus_writew(LE_C0_STOP, __base + RDP); \ } while (0) @@ -314,7 +314,7 @@ static void lance_init_ring_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; dma_addr_t aib = lp->init_block_dvma; __u32 leptr; int i; @@ -371,7 +371,7 @@ static void lance_init_ring_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u32 leptr; int i; @@ -501,8 +501,8 @@ static void lance_rx_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile struct lance_rx_desc *rd; + struct lance_init_block *ib = lp->init_block; + struct lance_rx_desc *rd; u8 bits; int len, entry = lp->rx_new; struct sk_buff *skb; @@ -564,14 +564,14 @@ static void lance_tx_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int i, j; spin_lock(&lp->lock); j = lp->tx_old; for (i = j; i != lp->tx_new; i = j) { - volatile struct lance_tx_desc *td = &ib->btx_ring [i]; + struct lance_tx_desc *td = &ib->btx_ring [i]; u8 bits = td->tmd1_bits; /* If we hit a packet not owned by us, stop */ @@ -641,12 +641,12 @@ spin_unlock(&lp->lock); } -static void lance_piocopy_to_skb(struct sk_buff *skb, volatile void *piobuf, int len) +static void lance_piocopy_to_skb(struct sk_buff *skb, void __iomem *piobuf, int len) { u16 *p16 = (u16 *) skb->data; u32 *p32; u8 *p8; - unsigned long pbuf = (unsigned long) piobuf; + void __iomem *pbuf = piobuf; /* We know here that both src and dest are on a 16bit boundary. */ *p16++ = sbus_readw(pbuf); @@ -674,8 +674,8 @@ static void lance_rx_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile struct lance_rx_desc *rd; + struct lance_init_block *ib = lp->init_block; + struct lance_rx_desc *rd; unsigned char bits; int len, entry; struct sk_buff *skb; @@ -736,14 +736,14 @@ static void lance_tx_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int i, j; spin_lock(&lp->lock); j = lp->tx_old; for (i = j; i != lp->tx_new; i = j) { - volatile struct lance_tx_desc *td = &ib->btx_ring [i]; + struct lance_tx_desc *td = &ib->btx_ring [i]; u8 bits = sbus_readb(&td->tmd1_bits); /* If we hit a packet not owned by us, stop */ @@ -880,7 +880,7 @@ static void build_fake_packet(struct lance_private *lp) { struct net_device *dev = lp->dev; - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u16 *packet; struct ethhdr *eth; int i, entry; @@ -916,7 +916,7 @@ static int lance_open(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int status = 0; last_dev = dev; @@ -1006,9 +1006,9 @@ return status; } -static void lance_piocopy_from_skb(volatile void *dest, unsigned char *src, int len) +static void lance_piocopy_from_skb(void __iomem *dest, unsigned char *src, int len) { - unsigned long piobuf = (unsigned long) dest; + void __iomem *piobuf = dest; u32 *p32; u16 *p16; u8 *p8; @@ -1064,11 +1064,11 @@ sbus_writeb(src[0], piobuf); } -static void lance_piozero(volatile void *dest, int len) +static void lance_piozero(void __iomem *dest, int len) { - unsigned long piobuf = (unsigned long) dest; + void __iomem *piobuf = dest; - if (piobuf & 1) { + if ((unsigned long)piobuf & 1) { sbus_writeb(0, piobuf); piobuf += 1; len -= 1; @@ -1079,7 +1079,7 @@ sbus_writeb(0, piobuf); return; } - if (piobuf & 2) { + if ((unsigned long)piobuf & 2) { sbus_writew(0, piobuf); piobuf += 2; len -= 2; @@ -1113,7 +1113,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int entry, skblen, len; skblen = skb->len; @@ -1174,8 +1174,8 @@ static void lance_load_multicast(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile u16 *mcast_table = (u16 *) &ib->filter; + struct lance_init_block *ib = lp->init_block; + u16 *mcast_table = (u16 *) &ib->filter; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; @@ -1224,7 +1224,7 @@ static void lance_set_multicast(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u16 mode; if (!netif_running(dev)) @@ -1277,12 +1277,12 @@ sbus_iounmap(lp->lregs, LANCE_REG_SIZE); if (lp->init_block != NULL) { if (lp->pio_buffer) { - sbus_iounmap((unsigned long)lp->init_block, + sbus_iounmap(lp->init_block, sizeof(struct lance_init_block)); } else { sbus_free_consistent(lp->sdev, sizeof(struct lance_init_block), - (void *)lp->init_block, + lp->init_block, lp->init_block_dvma); } } @@ -1349,7 +1349,7 @@ lp->sdev = sdev; if (lebuffer) { - lp->init_block = (volatile struct lance_init_block *) + lp->init_block = sbus_ioremap(&lebuffer->resource[0], 0, sizeof(struct lance_init_block), "lebuffer"); if (lp->init_block == NULL) { @@ -1362,7 +1362,7 @@ lp->rx = lance_rx_pio; lp->tx = lance_tx_pio; } else { - lp->init_block = (volatile struct lance_init_block *) + lp->init_block = sbus_alloc_consistent(sdev, sizeof(struct lance_init_block), &lp->init_block_dvma); if (lp->init_block == NULL || diff -Nru a/drivers/net/sunqe.c b/drivers/net/sunqe.c --- a/drivers/net/sunqe.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunqe.c 2004-09-21 20:52:51 -07:00 @@ -49,7 +49,7 @@ #define QEC_RESET_TRIES 200 -static inline int qec_global_reset(unsigned long gregs) +static inline int qec_global_reset(void __iomem *gregs) { int tries = QEC_RESET_TRIES; @@ -73,8 +73,8 @@ static inline int qe_stop(struct sunqe *qep) { - unsigned long cregs = qep->qcregs; - unsigned long mregs = qep->mregs; + void __iomem *cregs = qep->qcregs; + void __iomem *mregs = qep->mregs; int tries; /* Reset the MACE, then the QEC channel. */ @@ -130,9 +130,9 @@ static int qe_init(struct sunqe *qep, int from_irq) { struct sunqec *qecp = qep->parent; - unsigned long cregs = qep->qcregs; - unsigned long mregs = qep->mregs; - unsigned long gregs = qecp->gregs; + void __iomem *cregs = qep->qcregs; + void __iomem *mregs = qep->mregs; + void __iomem *gregs = qecp->gregs; unsigned char *e = &qep->dev->dev_addr[0]; u32 tmp; int i; @@ -699,7 +699,7 @@ static u32 qe_get_link(struct net_device *dev) { struct sunqe *qep = dev->priv; - unsigned long mregs = qep->mregs; + void __iomem *mregs = qep->mregs; u8 phyconfig; spin_lock_irq(&qep->lock); diff -Nru a/drivers/net/sunqe.h b/drivers/net/sunqe.h --- a/drivers/net/sunqe.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/sunqe.h 2004-09-21 20:52:51 -07:00 @@ -311,7 +311,7 @@ struct sunqe; struct sunqec { - unsigned long gregs; /* QEC Global Registers */ + void __iomem *gregs; /* QEC Global Registers */ struct sunqe *qes[4]; /* Each child MACE */ unsigned int qec_bursts; /* Support burst sizes */ struct sbus_dev *qec_sdev; /* QEC's SBUS device */ @@ -331,8 +331,8 @@ ((__u32)((unsigned long)(&(((struct sunqe_buffers *)0)->mem[elem][0])))) struct sunqe { - unsigned long qcregs; /* QEC per-channel Registers */ - unsigned long mregs; /* Per-channel MACE Registers */ + void __iomem *qcregs; /* QEC per-channel Registers */ + void __iomem *mregs; /* Per-channel MACE Registers */ struct qe_init_block *qe_block; /* RX and TX descriptors */ __u32 qblock_dvma; /* RX and TX descriptors */ spinlock_t lock; /* Protects txfull state */ diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c --- a/drivers/net/tg3.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/tg3.c 2004-09-21 20:52:52 -07:00 @@ -60,8 +60,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 @@ -1122,29 +1122,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; @@ -2168,7 +2172,7 @@ else val |= 0x4010880; - tw32_f(MAC_SERDES_CFG, serdes_cfg); + tw32_f(MAC_SERDES_CFG, val); } tw32_f(SG_DIG_CTRL, 0x01388400); @@ -3698,7 +3702,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); /* @@ -3829,7 +3833,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); @@ -6585,8 +6589,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) @@ -6601,13 +6605,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); @@ -6799,7 +6803,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, @@ -6886,8 +6890,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; } @@ -7222,11 +7226,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; } @@ -7287,27 +7291,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; @@ -7324,8 +7322,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 @@ -7707,7 +7705,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)) @@ -7729,7 +7727,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); @@ -8340,6 +8338,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) { diff -Nru a/drivers/net/tg3.h b/drivers/net/tg3.h --- a/drivers/net/tg3.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/tg3.h 2004-09-21 20:52:51 -07:00 @@ -2069,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/net/typhoon.c b/drivers/net/typhoon.c --- a/drivers/net/typhoon.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/net/typhoon.c 2004-09-21 20:52:52 -07:00 @@ -248,11 +248,11 @@ /* Tx cache line section */ struct transmit_ring txLoRing ____cacheline_aligned; struct pci_dev * tx_pdev; - unsigned long tx_ioaddr; + void __iomem *tx_ioaddr; u32 txlo_dma_addr; /* Irq/Rx cache line section */ - unsigned long ioaddr ____cacheline_aligned; + void __iomem *ioaddr ____cacheline_aligned; struct typhoon_indexes *indexes; u8 awaiting_resp; u8 duplex; @@ -373,7 +373,7 @@ } static int -typhoon_reset(unsigned long ioaddr, int wait_type) +typhoon_reset(void __iomem *ioaddr, int wait_type) { int i, err = 0; int timeout; @@ -428,7 +428,7 @@ } static int -typhoon_wait_status(unsigned long ioaddr, u32 wait_value) +typhoon_wait_status(void __iomem *ioaddr, u32 wait_value) { int i, err = 0; @@ -1240,7 +1240,7 @@ } static int -typhoon_wait_interrupt(unsigned long ioaddr) +typhoon_wait_interrupt(void __iomem *ioaddr) { int i, err = 0; @@ -1348,7 +1348,7 @@ static int typhoon_download_firmware(struct typhoon *tp) { - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct pci_dev *pdev = tp->pdev; struct typhoon_file_header *fHdr; struct typhoon_section_header *sHdr; @@ -1497,7 +1497,7 @@ static int typhoon_boot_3XP(struct typhoon *tp, u32 initial_status) { - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; if(typhoon_wait_status(ioaddr, initial_status) < 0) { printk(KERN_ERR "%s: boot ready timeout\n", tp->name); @@ -1812,7 +1812,8 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *) dev_instance; - unsigned long ioaddr = dev->base_addr; + struct typhoon *tp = dev->priv; + void __iomem *ioaddr = tp->ioaddr; u32 intr_status; intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS); @@ -1852,7 +1853,7 @@ typhoon_sleep(struct typhoon *tp, int state, u16 events) { struct pci_dev *pdev = tp->pdev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int err; @@ -1890,7 +1891,7 @@ typhoon_wakeup(struct typhoon *tp, int wait_type) { struct pci_dev *pdev = tp->pdev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); @@ -1911,7 +1912,7 @@ typhoon_start_runtime(struct typhoon *tp) { struct net_device *dev = tp->dev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int err; @@ -2006,7 +2007,7 @@ { struct typhoon_indexes *indexes = tp->indexes; struct transmit_ring *txLo = &tp->txLoRing; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int i; @@ -2070,7 +2071,7 @@ { struct typhoon *tp = (struct typhoon *) dev->priv; - if(typhoon_reset(dev->base_addr, WaitNoSleep) < 0) { + if(typhoon_reset(tp->ioaddr, WaitNoSleep) < 0) { printk(KERN_WARNING "%s: could not reset in tx timeout\n", dev->name); goto truely_dead; @@ -2091,7 +2092,7 @@ truely_dead: /* Reset the hardware, and turn off carrier to avoid more timeouts */ - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); netif_carrier_off(dev); } @@ -2126,7 +2127,7 @@ if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { printk(KERN_ERR "%s: unable to reboot into sleep img\n", dev->name); - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); goto out; } @@ -2192,7 +2193,7 @@ return 0; reset: - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); return -EBUSY; } @@ -2276,6 +2277,7 @@ struct typhoon *tp; int card_id = (int) ent->driver_data; unsigned long ioaddr; + void __iomem *ioaddr_mapped; void *shared; dma_addr_t shared_dma; struct cmd_desc xp_cmd; @@ -2345,14 +2347,13 @@ /* map our MMIO region */ ioaddr = pci_resource_start(pdev, 1); - ioaddr = (unsigned long) ioremap(ioaddr, 128); - if(!ioaddr) { + ioaddr_mapped = ioremap(ioaddr, 128); + if (!ioaddr_mapped) { printk(ERR_PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); err = -EIO; goto error_out_regions; } - dev->base_addr = ioaddr; /* allocate pci dma space for rx and tx descriptor rings */ @@ -2371,8 +2372,8 @@ tp->shared_dma = shared_dma; tp->pdev = pdev; tp->tx_pdev = pdev; - tp->ioaddr = dev->base_addr; - tp->tx_ioaddr = dev->base_addr; + tp->ioaddr = ioaddr_mapped; + tp->tx_ioaddr = ioaddr_mapped; tp->dev = dev; /* need to be able to restore PCI state after a suspend */ @@ -2385,7 +2386,7 @@ * 4) Get the hardware address. * 5) Put the card to sleep. */ - if(typhoon_reset(ioaddr, WaitSleep) < 0) { + if (typhoon_reset(ioaddr_mapped, WaitSleep) < 0) { printk(ERR_PFX "%s: could not reset 3XP\n", pci_name(pdev)); err = -EIO; goto error_out_dma; @@ -2518,13 +2519,13 @@ return 0; error_out_reset: - typhoon_reset(ioaddr, NoWait); + typhoon_reset(ioaddr_mapped, NoWait); error_out_dma: pci_free_consistent(pdev, sizeof(struct typhoon_shared), shared, shared_dma); error_out_remap: - iounmap((void *) ioaddr); + iounmap(ioaddr_mapped); error_out_regions: pci_release_regions(pdev); error_out_dev: @@ -2542,8 +2543,8 @@ unregister_netdev(dev); pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); - typhoon_reset(dev->base_addr, NoWait); - iounmap((char *) (dev->base_addr)); + typhoon_reset(tp->ioaddr, NoWait); + iounmap(tp->ioaddr); pci_free_consistent(pdev, sizeof(struct typhoon_shared), tp->shared, tp->shared_dma); pci_release_regions(pdev); diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c --- a/drivers/net/wireless/airo.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/net/wireless/airo.c 2004-09-21 20:52:51 -07:00 @@ -1816,7 +1816,8 @@ if (!test_bit (FLAG_COMMIT, &ai->flags)) return SUCCESS; - clear_bit (FLAG_COMMIT | FLAG_RESET, &ai->flags); + clear_bit (FLAG_COMMIT, &ai->flags); + clear_bit (FLAG_RESET, &ai->flags); checkThrottle(ai); cfgr = ai->config; @@ -1980,9 +1981,6 @@ ai->txfids[0].tx_desc.eoc = 1; ai->txfids[0].tx_desc.len =len+sizeof(WifiHdr); - memcpy((char *)ai->txfids[0].card_ram_off, - (char *)&ai->txfids[0].tx_desc, sizeof(TxFid)); - /* * Magic, the cards firmware needs a length count (2 bytes) in the host buffer * right after TXFID_HDR.The TXFID_HDR contains the status short so payloadlen @@ -2012,6 +2010,7 @@ return ERROR; *payloadLen = cpu_to_le16(len-sizeof(etherHead)+sizeof(pMic)); + ai->txfids[0].tx_desc.len += sizeof(pMic); /* copy data into airo dma buffer */ memcpy (sendbuf, buffer, sizeof(etherHead)); buffer += sizeof(etherHead); @@ -2030,6 +2029,9 @@ memcpy(sendbuf, buffer, len); } + memcpy((char *)ai->txfids[0].card_ram_off, + (char *)&ai->txfids[0].tx_desc, sizeof(TxFid)); + OUT4500(ai, EVACK, 8); dev_kfree_skb_any(skb); @@ -2184,6 +2186,12 @@ struct airo_info *priv = dev->priv; u32 *fids = priv->fids; + if (test_bit(FLAG_MPI, &priv->flags)) { + /* Not implemented yet for MPI350 */ + netif_stop_queue(dev); + return -ENETDOWN; + } + if ( skb == NULL ) { printk( KERN_ERR "airo: skb == NULL!!!\n" ); return 0; @@ -2249,12 +2257,14 @@ { struct airo_info *local = dev->priv; - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_STATS, &local->flags); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_stats(local); + if (!test_bit(JOB_STATS, &local->flags)) { + /* Get stats out of the card if available */ + if (down_trylock(&local->sem) != 0) { + set_bit(JOB_STATS, &local->flags); + wake_up_interruptible(&local->thr_wait); + } else + airo_read_stats(local); + } return &local->stats; } @@ -2340,6 +2350,9 @@ void stop_airo_card( struct net_device *dev, int freeres ) { struct airo_info *ai = dev->priv; + + set_bit(FLAG_RADIO_DOWN, &ai->flags); + disable_MAC(ai, 1); disable_interrupts(ai); free_irq( dev->irq, dev ); takedown_proc_entry( dev, ai ); @@ -3406,13 +3419,8 @@ } static void enable_interrupts( struct airo_info *ai ) { - /* Reset the status register */ - u16 status = IN4500( ai, EVSTAT ); - OUT4500( ai, EVACK, status ); /* Enable the interrupts */ OUT4500( ai, EVINTEN, STATUS_INTS ); - /* Note there is a race condition between the last two lines that - I don't know how to get rid of right now... */ } static void disable_interrupts( struct airo_info *ai ) { @@ -3460,7 +3468,7 @@ memcpy(buffer + ETH_ALEN * 2, ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2 + off, len - ETH_ALEN * 2 - off); - if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off)) { + if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off - ETH_ALEN * 2)) { badmic: dev_kfree_skb_irq (skb); goto badrx; @@ -3670,18 +3678,6 @@ status = readCapabilityRid(ai, &cap_rid, lock); if ( status != SUCCESS ) return ERROR; - /* - * This driver supports MPI350 firmwares up to, and - * including 5.30.17 - */ - if (test_bit(FLAG_MPI, &ai->flags) && - strncmp (cap_rid.prodVer, "5.00.", 5) && - strncmp (cap_rid.prodVer, "5b00.", 5) && - strncmp (cap_rid.prodVer, "5.02.", 5) && - strncmp (cap_rid.prodVer, "5.20.", 5) && - strncmp (cap_rid.prodVer, "5.30.", 5)) - printk(KERN_ERR "airo: Firmware version %s is not supported. Use it at your own risk!\n", cap_rid.prodVer); - status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock); if ( status == SUCCESS ) { if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL) @@ -3716,9 +3712,9 @@ /* Check to see if there are any insmod configured rates to add */ - if ( rates ) { + if ( rates[0] ) { int i = 0; - if ( rates[0] ) memset(ai->config.rates,0,sizeof(ai->config.rates)); + memset(ai->config.rates,0,sizeof(ai->config.rates)); for( i = 0; i < 8 && rates[i]; i++ ) { ai->config.rates[i] = rates[i]; } @@ -3785,7 +3781,6 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { // Im really paranoid about letting it run forever! int max_tries = 600000; - u16 cmd; if (IN4500(ai, EVSTAT) & EV_CMD) OUT4500(ai, EVACK, EV_CMD); @@ -3794,26 +3789,23 @@ OUT4500(ai, PARAM1, pCmd->parm1); OUT4500(ai, PARAM2, pCmd->parm2); OUT4500(ai, COMMAND, pCmd->cmd); - while ( max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0 && - (cmd = IN4500(ai, COMMAND)) != 0 ) - if (cmd == pCmd->cmd) - // PC4500 didn't notice command, try again - OUT4500(ai, COMMAND, pCmd->cmd); - if ( max_tries == -1 ) { - printk( KERN_ERR - "airo: Max tries exceeded when issueing command\n" ); - return ERROR; - } while (max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0) { + if ((IN4500(ai, COMMAND)) == pCmd->cmd) + // PC4500 didn't notice command, try again + OUT4500(ai, COMMAND, pCmd->cmd); if (!in_atomic() && (max_tries & 255) == 0) schedule(); } + if ( max_tries == -1 ) { printk( KERN_ERR - "airo: Max tries exceeded waiting for command\n" ); - return ERROR; + "airo: Max tries exceeded when issueing command\n" ); + if (IN4500(ai, COMMAND) & COMMAND_BUSY) + OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); + return ERROR; } + // command completed pRsp->status = IN4500(ai, STATUS); pRsp->rsp0 = IN4500(ai, RESP0); @@ -4509,8 +4501,6 @@ len = priv->readlen - pos; if (copy_to_user(buffer, priv->rbuffer + pos, len)) return -EFAULT; - if (pos + len > priv->writelen) - priv->writelen = pos + len; *offset = pos + len; return len; } @@ -5521,7 +5511,6 @@ mpi_init_descriptors(ai); setup_card(ai, dev->dev_addr, 0); clear_bit(FLAG_RADIO_OFF, &ai->flags); - clear_bit(FLAG_RADIO_DOWN, &ai->flags); clear_bit(FLAG_PENDING_XMIT, &ai->flags); } else { OUT4500(ai, EVACK, EV_AWAKEN); @@ -5606,6 +5595,30 @@ * would not work at all... - Jean II */ +static int airo_get_quality (StatusRid *status_rid, CapabilityRid *cap_rid) +{ + int quality = 0; + + if ((status_rid->mode & 0x3f) == 0x3f && (cap_rid->hardCap & 8)) { + if (memcmp(cap_rid->prodName, "350", 3)) + if (status_rid->signalQuality > 0x20) + quality = 0; + else + quality = 0x20 - status_rid->signalQuality; + else + if (status_rid->signalQuality > 0xb0) + quality = 0; + else if (status_rid->signalQuality < 0x10) + quality = 0xa0; + else + quality = 0xb0 - status_rid->signalQuality; + } + return quality; +} + +#define airo_get_max_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x20 : 0xa0) +#define airo_get_avg_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x10 : 0x50); + /*------------------------------------------------------------------*/ /* * Wireless Handler : get protocol name @@ -6293,7 +6306,8 @@ readCapabilityRid(local, &cap_rid, 1); if (vwrq->disabled) { - set_bit (FLAG_RADIO_OFF | FLAG_COMMIT, &local->flags); + set_bit (FLAG_RADIO_OFF, &local->flags); + set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if (vwrq->flags != IW_TXPOW_MWATT) { @@ -6432,7 +6446,7 @@ range->num_frequency = k; /* Hum... Should put the right values there */ - range->max_qual.qual = 10; + range->max_qual.qual = airo_get_max_quality(&cap_rid); range->max_qual.level = 0x100 - 120; /* -120 dBm */ range->max_qual.noise = 0; range->sensitivity = 65535; @@ -6499,7 +6513,7 @@ /* Experimental measurements - boundary 11/5.5 Mb/s */ /* Note : with or without the (local->rssi), results * are somewhat different. - Jean II */ - range->avg_qual.qual = 6; + range->avg_qual.qual = airo_get_avg_quality(&cap_rid); if (local->rssi) range->avg_qual.level = 186; /* -70 dBm */ else @@ -7113,6 +7127,7 @@ { StatusRid status_rid; StatsRid stats_rid; + CapabilityRid cap_rid; u32 *vals = stats_rid.vals; /* Get stats out of the card */ @@ -7121,6 +7136,7 @@ up(&local->sem); return; } + readCapabilityRid(local, &cap_rid, 0); readStatusRid(local, &status_rid, 0); readStatsRid(local, &stats_rid, RID_STATS, 0); up(&local->sem); @@ -7129,7 +7145,7 @@ local->wstats.status = status_rid.mode; /* Signal quality and co. But where is the noise level ??? */ - local->wstats.qual.qual = status_rid.signalQuality; + local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); if (local->rssi) local->wstats.qual.level = 0x100 - local->rssi[status_rid.sigQuality].rssidBm; else @@ -7156,12 +7172,14 @@ { struct airo_info *local = dev->priv; - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_WSTATS, &local->flags); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_wireless_stats(local); + if (!test_bit(JOB_WSTATS, &local->flags)) { + /* Get stats out of the card if available */ + if (down_trylock(&local->sem) != 0) { + set_bit(JOB_WSTATS, &local->flags); + wake_up_interruptible(&local->thr_wait); + } else + airo_read_wireless_stats(local); + } return &local->wstats; } @@ -7188,9 +7206,11 @@ { case AIROGCAP: ridcode = RID_CAPABILITIES; break; case AIROGCFG: ridcode = RID_CONFIG; - disable_MAC (ai, 1); - writeConfigRid (ai, 1); - enable_MAC (ai, &rsp, 1); + if (test_bit(FLAG_COMMIT, &ai->flags)) { + disable_MAC (ai, 1); + writeConfigRid (ai, 1); + enable_MAC (ai, &rsp, 1); + } break; case AIROGSLIST: ridcode = RID_SSID; break; case AIROGVLIST: ridcode = RID_APLIST; break; @@ -7270,6 +7290,7 @@ case AIROPCAP: ridcode = RID_CAPABILITIES; break; case AIROPAPLIST: ridcode = RID_APLIST; break; case AIROPCFG: ai->config.len = 0; + clear_bit(FLAG_COMMIT, &ai->flags); ridcode = RID_CONFIG; break; case AIROPWEPKEYNV: ridcode = RID_WEP_PERM; break; case AIROPLEAPUSR: ridcode = RID_LEAPUSERNAME; break; diff -Nru a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c --- a/drivers/oprofile/buffer_sync.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/oprofile/buffer_sync.c 2004-09-21 20:52:51 -07:00 @@ -133,7 +133,7 @@ static void end_sync(void) { - end_cpu_timers(); + end_cpu_work(); /* make sure we don't leak task structs */ process_task_mortuary(); process_task_mortuary(); @@ -144,7 +144,7 @@ { int err; - start_cpu_timers(); + start_cpu_work(); err = task_handoff_register(&task_free_nb); if (err) @@ -339,40 +339,25 @@ } } - + static void release_mm(struct mm_struct * mm) { - if (mm) - up_read(&mm->mmap_sem); + if (!mm) + return; + up_read(&mm->mmap_sem); + mmput(mm); } -/* Take the task's mmap_sem to protect ourselves from - * races when we do lookup_dcookie(). - */ static struct mm_struct * take_tasks_mm(struct task_struct * task) { - struct mm_struct * mm; - - /* Subtle. We don't need to keep a reference to this task's mm, - * because, for the mm to be freed on another CPU, that would have - * to go through the task exit notifier, which ends up sleeping - * on the buffer_sem we hold, so we end up with mutual exclusion - * anyway. - */ - task_lock(task); - mm = task->mm; - task_unlock(task); - - if (mm) { - /* needed to walk the task's VMAs */ + struct mm_struct * mm = get_task_mm(task); + if (mm) down_read(&mm->mmap_sem); - } - return mm; } - - + + static inline int is_ctx_switch(unsigned long val) { return val == ~0UL; diff -Nru a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c --- a/drivers/oprofile/cpu_buffer.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/oprofile/cpu_buffer.c 2004-09-21 20:52:51 -07:00 @@ -30,7 +30,7 @@ static void wq_sync_buffer(void *); #define DEFAULT_TIMER_EXPIRE (HZ / 10) -int timers_enabled; +int work_enabled; static void __free_cpu_buffers(int num) { @@ -80,11 +80,11 @@ } -void start_cpu_timers(void) +void start_cpu_work(void) { int i; - timers_enabled = 1; + work_enabled = 1; for_each_online_cpu(i) { struct oprofile_cpu_buffer * b = &cpu_buffer[i]; @@ -98,11 +98,11 @@ } -void end_cpu_timers(void) +void end_cpu_work(void) { int i; - timers_enabled = 0; + work_enabled = 0; for_each_online_cpu(i) { struct oprofile_cpu_buffer * b = &cpu_buffer[i]; @@ -220,6 +220,6 @@ sync_buffer(b->cpu); /* don't re-add the work if we're shutting down */ - if (timers_enabled) + if (work_enabled) schedule_delayed_work(&b->work, DEFAULT_TIMER_EXPIRE); } diff -Nru a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h --- a/drivers/oprofile/cpu_buffer.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/oprofile/cpu_buffer.h 2004-09-21 20:52:52 -07:00 @@ -20,8 +20,8 @@ int alloc_cpu_buffers(void); void free_cpu_buffers(void); -void start_cpu_timers(void); -void end_cpu_timers(void); +void start_cpu_work(void); +void end_cpu_work(void); /* CPU buffer is composed of such entries (which are * also used for context switch notes) diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c --- a/drivers/pci/hotplug/rpaphp_core.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/pci/hotplug/rpaphp_core.c 2004-09-21 20:52:52 -07:00 @@ -449,7 +449,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) { - int retval; + int retval = -EINVAL; struct slot *slot = (struct slot *)hotplug_slot->private; dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name); diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c --- a/drivers/pci/hotplug/rpaphp_pci.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/pci/hotplug/rpaphp_pci.c 2004-09-21 20:52:51 -07:00 @@ -186,7 +186,7 @@ rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) { struct device_node *eads_first_child = dn->child; - struct pci_dev *dev; + struct pci_dev *dev = NULL; int num; dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); diff -Nru a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c --- a/drivers/pnp/pnpbios/rsparser.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/pnp/pnpbios/rsparser.c 2004-09-21 20:52:51 -07:00 @@ -346,12 +346,12 @@ { unsigned int len, tag; int priority = 0; - struct pnp_option *option; + struct pnp_option *option, *option_independent; if (!p) return NULL; - option = pnp_register_independent_option(dev); + option_independent = option = pnp_register_independent_option(dev); if (!option) return NULL; @@ -428,9 +428,14 @@ case SMALL_TAG_ENDDEP: if (len != 0) goto len_err; + if (option_independent == option) + printk(KERN_WARNING "PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n"); + option = option_independent; break; case SMALL_TAG_END: + if (option_independent != option) + printk(KERN_WARNING "PnPBIOS: Missing SMALL_TAG_ENDDEP tag\n"); p = p + 2; return (unsigned char *)p; break; diff -Nru a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c --- a/drivers/sbus/char/cpwatchdog.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/sbus/char/cpwatchdog.c 2004-09-21 20:52:52 -07:00 @@ -118,40 +118,26 @@ * UNKNOWN, MAGICAL MYSTERY REGISTER * */ -struct wd_timer_regblk { - volatile __u16 dcntr; /* down counter - hw */ - volatile __u16 dcntr_pad; - volatile __u16 limit; /* limit register - hw */ - volatile __u16 limit_pad; - volatile __u8 status; /* status register - b */ - volatile __u8 status_pad; - volatile __u16 status_pad2; - volatile __u32 pad32; /* yet more padding */ -}; - -struct wd_pld_regblk { - volatile __u8 intr_mask; /* interrupt mask - b */ - volatile __u8 intr_mask_pad; - volatile __u16 intr_mask_pad2; - volatile __u8 status; /* device status - b */ - volatile __u8 status_pad; - volatile __u16 status_pad2; -}; +#define WD_TIMER_REGSZ 16 +#define WD0_OFF 0 +#define WD1_OFF (WD_TIMER_REGSZ * 1) +#define WD2_OFF (WD_TIMER_REGSZ * 2) +#define PLD_OFF (WD_TIMER_REGSZ * 3) + +#define WD_DCNTR 0x00 +#define WD_LIMIT 0x04 +#define WD_STATUS 0x08 -struct wd_regblk { - volatile struct wd_timer_regblk wd0_regs; - volatile struct wd_timer_regblk wd1_regs; - volatile struct wd_timer_regblk wd2_regs; - volatile struct wd_pld_regblk pld_regs; -}; +#define PLD_IMASK (PLD_OFF + 0x00) +#define PLD_STATUS (PLD_OFF + 0x04) /* Individual timer structure */ struct wd_timer { __u16 timeout; __u8 intr_mask; - unsigned char runstatus; - volatile struct wd_timer_regblk* regs; + unsigned char runstatus; + void __iomem *regs; }; /* Device structure @@ -165,7 +151,7 @@ unsigned short opt_timeout; unsigned char initialized; struct wd_timer watchdog[WD_NUMDEVS]; - volatile struct wd_regblk* regs; + void __iomem *regs; }; static struct wd_device wd_dev = { @@ -495,12 +481,12 @@ i, wd_getstatus(&wd_dev.watchdog[i])); } - printk("\tintr_mask at 0x%lx: 0x%x\n", - (unsigned long)(&wd_dev.regs->pld_regs.intr_mask), - readb(&wd_dev.regs->pld_regs.intr_mask)); - printk("\tpld_status at 0x%lx: 0x%x\n", - (unsigned long)(&wd_dev.regs->pld_regs.status), - readb(&wd_dev.regs->pld_regs.status)); + printk("\tintr_mask at %p: 0x%x\n", + wd_dev.regs + PLD_IMASK, + readb(wd_dev.regs + PLD_IMASK)); + printk("\tpld_status at %p: 0x%x\n", + wd_dev.regs + PLD_STATUS, + readb(wd_dev.regs + PLD_STATUS)); } #endif @@ -513,7 +499,7 @@ */ static void wd_toggleintr(struct wd_timer* pTimer, int enable) { - unsigned char curregs = wd_readb(&wd_dev.regs->pld_regs.intr_mask); + unsigned char curregs = wd_readb(wd_dev.regs + PLD_IMASK); unsigned char setregs = (NULL == pTimer) ? (WD0_INTR_MASK | WD1_INTR_MASK | WD2_INTR_MASK) : @@ -523,7 +509,7 @@ (curregs &= ~setregs): (curregs |= setregs); - wd_writeb(curregs, &wd_dev.regs->pld_regs.intr_mask); + wd_writeb(curregs, wd_dev.regs + PLD_IMASK); return; } @@ -534,8 +520,8 @@ */ static void wd_pingtimer(struct wd_timer* pTimer) { - if(wd_readb(&pTimer->regs->status) & WD_S_RUNNING) { - wd_readw(&pTimer->regs->dcntr); + if (wd_readb(pTimer->regs + WD_STATUS) & WD_S_RUNNING) { + wd_readw(pTimer->regs + WD_DCNTR); } } @@ -547,7 +533,7 @@ */ static void wd_stoptimer(struct wd_timer* pTimer) { - if(wd_readb(&pTimer->regs->status) & WD_S_RUNNING) { + if(wd_readb(pTimer->regs + WD_STATUS) & WD_S_RUNNING) { wd_toggleintr(pTimer, WD_INTR_OFF); if(wd_dev.isbaddoggie) { @@ -574,7 +560,7 @@ } pTimer->runstatus &= ~WD_STAT_SVCD; - wd_writew(pTimer->timeout, &pTimer->regs->limit); + wd_writew(pTimer->timeout, pTimer->regs + WD_LIMIT); wd_toggleintr(pTimer, WD_INTR_ON); } @@ -584,7 +570,7 @@ static void wd_resetbrokentimer(struct wd_timer* pTimer) { wd_toggleintr(pTimer, WD_INTR_ON); - wd_writew(WD_BLIMIT, &pTimer->regs->limit); + wd_writew(WD_BLIMIT, pTimer->regs + WD_LIMIT); } /* Timer device initialization helper. @@ -593,7 +579,7 @@ static int wd_inittimer(int whichdog) { struct miscdevice *whichmisc; - volatile struct wd_timer_regblk *whichregs; + void __iomem *whichregs; char whichident[8]; int whichmask; __u16 whichlimit; @@ -603,7 +589,7 @@ case WD0_ID: whichmisc = &wd0_miscdev; strcpy(whichident, "RIC"); - whichregs = &wd_dev.regs->wd0_regs; + whichregs = wd_dev.regs + WD0_OFF; whichmask = WD0_INTR_MASK; whichlimit= (0 == wd0_timeout) ? (wd_dev.opt_timeout): @@ -612,7 +598,7 @@ case WD1_ID: whichmisc = &wd1_miscdev; strcpy(whichident, "XIR"); - whichregs = &wd_dev.regs->wd1_regs; + whichregs = wd_dev.regs + WD1_OFF; whichmask = WD1_INTR_MASK; whichlimit= (0 == wd1_timeout) ? (wd_dev.opt_timeout): @@ -621,7 +607,7 @@ case WD2_ID: whichmisc = &wd2_miscdev; strcpy(whichident, "POR"); - whichregs = &wd_dev.regs->wd2_regs; + whichregs = wd_dev.regs + WD2_OFF; whichmask = WD2_INTR_MASK; whichlimit= (0 == wd2_timeout) ? (wd_dev.opt_timeout): @@ -686,8 +672,8 @@ static int wd_getstatus(struct wd_timer* pTimer) { - unsigned char stat = wd_readb(&pTimer->regs->status); - unsigned char intr = wd_readb(&wd_dev.regs->pld_regs.intr_mask); + unsigned char stat = wd_readb(pTimer->regs + WD_STATUS); + unsigned char intr = wd_readb(wd_dev.regs + PLD_IMASK); unsigned char ret = WD_STOPPED; /* determine STOPPED */ @@ -805,7 +791,7 @@ * also now eventually trip. */ for(id = WD0_ID; id < WD_NUMDEVS; ++id) { - if(WD_S_RUNNING == wd_readb(&wd_dev.watchdog[id].regs->status)) { + if(WD_S_RUNNING == wd_readb(wd_dev.watchdog[id].regs + WD_STATUS)) { if(wd_dev.opt_enable) { printk(KERN_WARNING "%s%i: timer not stopped at release\n", WD_OBPNAME, id); @@ -818,7 +804,7 @@ "%s%i: defect workaround disabled at release, "\ "timer expires in ~%01i sec\n", WD_OBPNAME, id, - wd_readw(&wd_dev.watchdog[id].regs->limit) / 10); + wd_readw(wd_dev.watchdog[id].regs + WD_LIMIT) / 10); } } } diff -Nru a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c --- a/drivers/sbus/char/display7seg.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/sbus/char/display7seg.c 2004-09-21 20:52:52 -07:00 @@ -70,7 +70,7 @@ * FLIP - Inverts display for upside-down mounted board * bits 0-4 - 7-segment display contents */ -volatile u8* d7s_regs = NULL; +static void __iomem* d7s_regs; static inline void d7s_free(void) { diff -Nru a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c --- a/drivers/sbus/char/envctrl.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/sbus/char/envctrl.c 2004-09-21 20:52:51 -07:00 @@ -130,10 +130,8 @@ */ #define ENVCTRL_CPCI_IGNORED_NODE 0x70 -struct pcf8584_reg { - unsigned char data; - unsigned char csr; -}; +#define PCF8584_DATA 0x00 +#define PCF8584_CSR 0x01 /* Each child device can be monitored by up to PCF8584_MAX_CHANNELS. * Property of a port or channel as defined by the firmware. @@ -175,7 +173,7 @@ char mon_type[PCF8584_MAX_CHANNELS]; }; -volatile static struct pcf8584_reg *i2c = NULL; +static void __iomem *i2c; static struct i2c_child_t i2c_childlist[ENVCTRL_MAX_CPU*2]; static unsigned char chnls_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; static unsigned int warning_temperature = 0; @@ -185,22 +183,6 @@ /* Forward declarations. */ static struct i2c_child_t *envctrl_get_i2c_child(unsigned char); -/* Function description: Read a byte from an i2c controller register. - * Return: A byte from the passed in address. - */ -static inline unsigned char envctrl_readb(volatile unsigned char *p) -{ - return readb(p); -} - -/* Function description: Write a byte to an i2c controller register. - * Return: Nothing. - */ -static inline void envctrl_writeb(unsigned char val, volatile unsigned char *p) -{ - writeb(val, p); -} - /* Function Description: Test the PIN bit (Pending Interrupt Not) * to test when serial transmission is completed . * Return : None. @@ -210,7 +192,7 @@ int limit = 1000000; while (--limit > 0) { - if (!(envctrl_readb(&i2c->csr) & STATUS_PIN)) + if (!(readb(i2c + PCF8584_CSR) & STATUS_PIN)) break; udelay(1); } @@ -228,7 +210,7 @@ while (--limit > 0) { /* Busy bit 0 means busy. */ - if (envctrl_readb(&i2c->csr) & STATUS_BB) + if (readb(i2c + PCF8584_CSR) & STATUS_BB) break; udelay(1); } @@ -245,20 +227,20 @@ envctrl_i2c_test_bb(); /* Load address. */ - envctrl_writeb(addr + 1, &i2c->data); + writeb(addr + 1, i2c + PCF8584_DATA); envctrl_i2c_test_bb(); - envctrl_writeb(OBD_SEND_START, &i2c->csr); + writeb(OBD_SEND_START, i2c + PCF8584_CSR); /* Wait for PIN. */ envtrl_i2c_test_pin(); /* CSR 0 means acknowledged. */ - if (!(envctrl_readb(&i2c->csr) & STATUS_LRB)) { - return envctrl_readb(&i2c->data); + if (!(readb(i2c + PCF8584_CSR) & STATUS_LRB)) { + return readb(i2c + PCF8584_DATA); } else { - envctrl_writeb(OBD_SEND_STOP, &i2c->csr); + writeb(OBD_SEND_STOP, i2c + PCF8584_CSR); return 0; } } @@ -269,10 +251,10 @@ static void envctrl_i2c_write_addr(unsigned char addr) { envctrl_i2c_test_bb(); - envctrl_writeb(addr, &i2c->data); + writeb(addr, i2c + PCF8584_DATA); /* Generate Start condition. */ - envctrl_writeb(OBD_SEND_START, &i2c->csr); + writeb(OBD_SEND_START, i2c + PCF8584_CSR); } /* Function Description: Read 1 byte of data from addr @@ -282,8 +264,8 @@ static unsigned char envctrl_i2c_read_data(void) { envtrl_i2c_test_pin(); - envctrl_writeb(CONTROL_ES0, &i2c->csr); /* Send neg ack. */ - return envctrl_readb(&i2c->data); + writeb(CONTROL_ES0, i2c + PCF8584_CSR); /* Send neg ack. */ + return readb(i2c + PCF8584_DATA); } /* Function Description: Instruct the device which port to read data from. @@ -292,7 +274,7 @@ static void envctrl_i2c_write_data(unsigned char port) { envtrl_i2c_test_pin(); - envctrl_writeb(port, &i2c->data); + writeb(port, i2c + PCF8584_DATA); } /* Function Description: Generate Stop condition after last byte is sent. @@ -301,7 +283,7 @@ static void envctrl_i2c_stop(void) { envtrl_i2c_test_pin(); - envctrl_writeb(OBD_SEND_STOP, &i2c->csr); + writeb(OBD_SEND_STOP, i2c + PCF8584_CSR); } /* Function Description: Read adc device. @@ -323,7 +305,7 @@ envctrl_i2c_read_data(); envctrl_i2c_stop(); - return envctrl_readb(&i2c->data); + return readb(i2c + PCF8584_DATA); } /* Function Description: Read gpio device. @@ -1084,8 +1066,7 @@ for_each_ebus(ebus) { for_each_ebusdev(edev, ebus) { if (!strcmp(edev->prom_name, "i2c")) { - i2c = ioremap( edev->resource[0].start, - sizeof(struct pcf8584_reg)); + i2c = ioremap(edev->resource[0].start, 0x2); for_each_edevchild(edev, edev_child) { if (!strcmp("gpio", edev_child->prom_name)) { i2c_childlist[i].i2ctype = I2C_GPIO; @@ -1108,15 +1089,15 @@ } /* Set device address. */ - envctrl_writeb(CONTROL_PIN, &i2c->csr); - envctrl_writeb(PCF8584_ADDRESS, &i2c->data); + writeb(CONTROL_PIN, i2c + PCF8584_CSR); + writeb(PCF8584_ADDRESS, i2c + PCF8584_DATA); /* Set system clock and SCL frequencies. */ - envctrl_writeb(CONTROL_PIN | CONTROL_ES1, &i2c->csr); - envctrl_writeb(CLK_4_43 | BUS_CLK_90, &i2c->data); + writeb(CONTROL_PIN | CONTROL_ES1, i2c + PCF8584_CSR); + writeb(CLK_4_43 | BUS_CLK_90, i2c + PCF8584_DATA); /* Enable serial interface. */ - envctrl_writeb(CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK, &i2c->csr); + writeb(CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK, i2c + PCF8584_CSR); udelay(200); /* Register the device as a minor miscellaneous device. */ diff -Nru a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c --- a/drivers/sbus/char/flash.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/sbus/char/flash.c 2004-09-21 20:52:52 -07:00 @@ -22,6 +22,7 @@ #include #include #include +#include static spinlock_t flash_lock = SPIN_LOCK_UNLOCKED; static struct { @@ -115,7 +116,7 @@ count = flash.read_size - p; for (i = 0; i < count; i++) { - u8 data = readb(flash.read_base + p + i); + u8 data = upa_readb(flash.read_base + p + i); if (put_user(data, buf)) return -EFAULT; buf++; diff -Nru a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c --- a/drivers/sbus/dvma.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/sbus/dvma.c 2004-09-21 20:52:52 -07:00 @@ -17,14 +17,6 @@ struct sbus_dma *dma_chain; -/* Print out the current values in the DMA control registers */ -extern __inline__ void dump_dma_regs(unsigned long dregs) -{ - printk("DMA CONTROL<%08x> ADDR<%08x> CNT<%08x> TEST<%08x>\n", - sbus_readl(dregs + DMA_CSR), sbus_readl(dregs + DMA_ADDR), - sbus_readl(dregs + DMA_COUNT), sbus_readl(dregs + DMA_TEST)); -} - void __init init_one_dvma(struct sbus_dma *dma, int num_dma) { printk("dma%d: ", num_dma); @@ -64,9 +56,6 @@ break; } printk("\n"); -#if 0 /* Clutters up the screen */ - dump_dma_regs(dma->regs); -#endif } /* Probe this SBus DMA module(s) */ diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c --- a/drivers/scsi/ata_piix.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/scsi/ata_piix.c 2004-09-21 20:52:52 -07:00 @@ -125,15 +125,16 @@ .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, + .dev_select = ata_std_dev_select, .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, @@ -149,15 +150,16 @@ 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, + .dev_select = ata_std_dev_select, .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/esp.h b/drivers/scsi/esp.h --- a/drivers/scsi/esp.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/scsi/esp.h 2004-09-21 20:52:51 -07:00 @@ -77,8 +77,8 @@ /* We get one of these for each ESP probed. */ struct esp { - unsigned long eregs; /* ESP controller registers */ - unsigned long dregs; /* DMA controller registers */ + void __iomem *eregs; /* ESP controller registers */ + void __iomem *dregs; /* DMA controller registers */ struct sbus_dma *dma; /* DMA controller sw state */ struct Scsi_Host *ehost; /* Backpointer to SCSI Host */ struct sbus_dev *sdev; /* Pointer to SBus entry */ diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c --- a/drivers/scsi/libata-core.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/scsi/libata-core.c 2004-09-21 20:52:51 -07:00 @@ -50,7 +50,6 @@ static unsigned int ata_busy_sleep (struct ata_port *ap, unsigned long tmout_pat, unsigned long tmout); -static void __ata_dev_select (struct ata_port *ap, unsigned int device); static void ata_set_mode(struct ata_port *ap); static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); @@ -68,17 +67,17 @@ MODULE_LICENSE("GPL"); /** - * 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; @@ -136,7 +135,7 @@ * 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; @@ -183,19 +182,27 @@ 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); @@ -216,7 +223,7 @@ * 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); @@ -224,12 +231,20 @@ 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: @@ -252,7 +267,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: @@ -272,7 +287,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: @@ -286,18 +301,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; @@ -329,7 +344,7 @@ * 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; @@ -349,18 +364,26 @@ } } +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); } @@ -376,11 +399,18 @@ * 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 __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); +} + /** * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure * @tf: Taskfile to convert @@ -606,7 +636,7 @@ struct ata_ioports *ioaddr = &ap->ioaddr; u8 nsect, lbal; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); outb(0x55, ioaddr->nsect_addr); outb(0xaa, ioaddr->lbal_addr); @@ -650,7 +680,7 @@ struct ata_ioports *ioaddr = &ap->ioaddr; u8 nsect, lbal; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); writeb(0x55, (void __iomem *) ioaddr->nsect_addr); writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); @@ -671,7 +701,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) * @@ -683,7 +713,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) @@ -707,7 +737,7 @@ * the event of failure. */ -static unsigned int ata_dev_classify(struct ata_taskfile *tf) +unsigned int ata_dev_classify(struct ata_taskfile *tf) { /* Apple's open source Darwin code hints that some devices only * put a proper signature into the LBA mid/high registers, @@ -755,7 +785,7 @@ unsigned int class; u8 err; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); memset(&tf, 0, sizeof(tf)); @@ -818,8 +848,12 @@ } } +void ata_noop_dev_select (struct ata_port *ap, unsigned int device) +{ +} + /** - * __ata_dev_select - Select device 0/1 on ATA bus + * ata_std_dev_select - Select device 0/1 on ATA bus * @ap: ATA channel to manipulate * @device: ATA device (numbered from zero) to select * @@ -831,7 +865,7 @@ * caller. */ -static void __ata_dev_select (struct ata_port *ap, unsigned int device) +void ata_std_dev_select (struct ata_port *ap, unsigned int device) { u8 tmp; @@ -859,7 +893,7 @@ * make either device 0, or device 1, active on the * ATA channel. * - * This is a high-level version of __ata_dev_select(), + * This is a high-level version of ata_std_dev_select(), * which additionally provides the services of inserting * the proper pauses and status polling, where needed. * @@ -876,7 +910,7 @@ if (wait) ata_wait_idle(ap); - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); if (wait) { if (can_sleep && ap->device[device].class == ATA_DEV_ATAPI) @@ -1183,13 +1217,13 @@ } /** - * sata_phy_reset - + * __sata_phy_reset - * @ap: * * LOCKING: * */ -void sata_phy_reset(struct ata_port *ap) +void __sata_phy_reset(struct ata_port *ap) { u32 sstatus; unsigned long timeout = jiffies + (HZ * 5); @@ -1227,6 +1261,21 @@ return; } + ap->cbl = ATA_CBL_SATA; +} + +/** + * __sata_phy_reset - + * @ap: + * + * LOCKING: + * + */ +void sata_phy_reset(struct ata_port *ap) +{ + __sata_phy_reset(ap); + if (ap->flags & ATA_FLAG_PORT_DISABLED) + return; ata_bus_reset(ap); } @@ -1439,20 +1488,20 @@ 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; while (dev1) { u8 nsect, lbal; - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (ap->flags & ATA_FLAG_MMIO) { nsect = readb((void __iomem *) ioaddr->nsect_addr); lbal = readb((void __iomem *) ioaddr->lbal_addr); @@ -1472,11 +1521,11 @@ ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); /* is all this really necessary? */ - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); if (dev1) - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (dev0) - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); } /** @@ -1580,9 +1629,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) @@ -1591,7 +1640,7 @@ devmask |= (1 << 1); /* select device 0 again */ - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); /* issue bus reset */ if (ap->flags & ATA_FLAG_SRST) @@ -1620,9 +1669,9 @@ /* is double-select really necessary? */ if (ap->device[1].class != ATA_DEV_NONE) - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (ap->device[0].class != ATA_DEV_NONE) - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); /* if no devices were detected, disable this port */ if ((ap->device[0].class == ATA_DEV_NONE) && @@ -2135,9 +2184,7 @@ qc->cursg_ofs = 0; } - DPRINTK("data %s, drv_stat 0x%X\n", - qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read", - status); + DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); /* do the actual data transfer */ do_write = (qc->tf.flags & ATA_TFLAG_WRITE); @@ -2162,7 +2209,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) @@ -2178,7 +2225,7 @@ for (i = 0; i < (bytes >> 9); i++) ata_pio_sector(qc); - + return; err_out: @@ -2606,14 +2653,14 @@ } /** - * 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); @@ -2636,14 +2683,14 @@ } /** - * 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 __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; @@ -2674,7 +2721,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); @@ -2702,7 +2749,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; @@ -2713,6 +2760,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); @@ -3205,6 +3268,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 @@ -3222,20 +3374,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); @@ -3296,77 +3448,17 @@ 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); /* FIXME: check ata_device_add return */ @@ -3375,17 +3467,13 @@ ata_device_add(probe_ent); if (legacy_mode & (1 << 1)) ata_device_add(probe_ent2); - kfree(probe_ent2); } else { ata_device_add(probe_ent); - assert(probe_ent2 == NULL); } kfree(probe_ent); return 0; -err_out_free_ent: - kfree(probe_ent); err_out_regions: if (legacy_mode & (1 << 0)) release_region(0x1f0, 8); @@ -3535,27 +3623,26 @@ 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_noop_dev_select); +EXPORT_SYMBOL_GPL(ata_std_dev_select); 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); +EXPORT_SYMBOL_GPL(__sata_phy_reset); EXPORT_SYMBOL_GPL(ata_bus_reset); EXPORT_SYMBOL_GPL(ata_port_disable); EXPORT_SYMBOL_GPL(ata_pci_init_one); @@ -3566,4 +3653,5 @@ EXPORT_SYMBOL_GPL(ata_scsi_slave_config); EXPORT_SYMBOL_GPL(ata_scsi_release); EXPORT_SYMBOL_GPL(ata_host_intr); +EXPORT_SYMBOL_GPL(ata_dev_classify); EXPORT_SYMBOL_GPL(ata_dev_id_string); diff -Nru a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c --- a/drivers/scsi/qlogicpti.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/scsi/qlogicpti.c 2004-09-21 20:52:52 -07:00 @@ -987,7 +987,7 @@ static char buf[80]; struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; - sprintf(buf, "PTI Qlogic,ISP SBUS SCSI irq %s regs at %lx", + sprintf(buf, "PTI Qlogic,ISP SBUS SCSI irq %s regs at %p", __irq_itoa(qpti->qhost->irq), qpti->qregs); return buf; } diff -Nru a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h --- a/drivers/scsi/qlogicpti.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/scsi/qlogicpti.h 2004-09-21 20:52:51 -07:00 @@ -335,7 +335,7 @@ /* Software state for the driver. */ struct qlogicpti { /* These are the hot elements in the cache, so they come first. */ - unsigned long qregs; /* Adapter registers */ + void __iomem *qregs; /* Adapter registers */ struct pti_queue_entry *res_cpu; /* Ptr to RESPONSE bufs (CPU) */ struct pti_queue_entry *req_cpu; /* Ptr to REQUEST bufs (CPU) */ @@ -370,7 +370,7 @@ struct host_param host_param; struct dev_param dev_param[MAX_TARGETS]; - unsigned long sreg; + void __iomem *sreg; #define SREG_TPOWER 0x80 /* State of termpwr */ #define SREG_FUSE 0x40 /* State of on board fuse */ #define SREG_PDISAB 0x20 /* Disable state for power on */ diff -Nru a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c --- a/drivers/scsi/sata_nv.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/scsi/sata_nv.c 2004-09-21 20:52:51 -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 @@ -187,7 +185,7 @@ .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = ATA_MAX_PRD, + .sg_tablesize = LIBATA_MAX_PRD, .max_sectors = ATA_MAX_SECTORS, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, @@ -200,13 +198,14 @@ 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, + .dev_select = ata_std_dev_select, .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, @@ -219,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"); @@ -299,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; @@ -320,7 +332,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; @@ -333,40 +346,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-21 20:52:52 -07:00 +++ b/drivers/scsi/sata_promise.c 2004-09-21 20:52:52 -07:00 @@ -107,9 +107,10 @@ 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, + .dev_select = ata_std_dev_select, .phy_reset = pdc_phy_reset, .qc_prep = pdc_qc_prep, .qc_issue = pdc_qc_issue_prot, @@ -468,7 +469,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_tf_load_mmio(ap, tf); + ata_tf_load(ap, tf); } @@ -476,7 +477,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-21 20:52:51 -07:00 +++ b/drivers/scsi/sata_sil.c 2004-09-21 20:52:51 -07:00 @@ -125,14 +125,15 @@ 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, + .dev_select = ata_std_dev_select, .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-21 20:52:52 -07:00 +++ b/drivers/scsi/sata_sis.c 2004-09-21 20:52:52 -07:00 @@ -94,13 +94,14 @@ 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, + .dev_select = ata_std_dev_select, .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, @@ -112,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"); @@ -185,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) @@ -201,20 +213,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) @@ -231,32 +236,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-21 20:52:52 -07:00 +++ b/drivers/scsi/sata_svw.c 2004-09-21 20:52:52 -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); @@ -230,10 +296,11 @@ .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, + .dev_select = ata_std_dev_select, .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, @@ -373,6 +440,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-21 20:52:51 -07:00 +++ b/drivers/scsi/sata_sx4.c 2004-09-21 20:52:51 -07:00 @@ -193,9 +193,10 @@ 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, + .dev_select = ata_std_dev_select, .phy_reset = pdc_20621_phy_reset, .qc_prep = pdc20621_qc_prep, .qc_issue = pdc20621_qc_issue_prot, @@ -533,7 +534,7 @@ readl(dimm_mmio); /* MMIO PCI posting flush */ - VPRINTK("ata pkt buf ofs %u, prd size %u, mmio copied\n", i, sgt_len); + VPRINTK("ata pkt buf ofs %u, mmio copied\n", i); } static void pdc20621_qc_prep(struct ata_queued_cmd *qc) @@ -887,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); } @@ -895,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-21 20:52:51 -07:00 +++ b/drivers/scsi/sata_via.c 2004-09-21 20:52:51 -07:00 @@ -100,15 +100,16 @@ 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, + .dev_select = ata_std_dev_select, .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, @@ -124,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"); @@ -157,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; @@ -197,42 +208,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-21 20:52:52 -07:00 +++ b/drivers/scsi/sata_vsc.c 2004-09-21 20:52:52 -07:00 @@ -211,11 +211,12 @@ .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, + .dev_select = ata_std_dev_select, .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/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h --- a/drivers/scsi/sym53c8xx_2/sym_glue.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h 2004-09-21 20:52:52 -07:00 @@ -288,32 +288,32 @@ * MEMORY mapped IO input / output */ -#define INB_OFF(o) readb((char *)np->s.mmio_va + sym_offb(o)) -#define OUTB_OFF(o, val) writeb((val), (char *)np->s.mmio_va + sym_offb(o)) +#define INB_OFF(o) readb(np->s.mmio_va + sym_offb(o)) +#define OUTB_OFF(o, val) writeb((val), np->s.mmio_va + sym_offb(o)) #if defined(__BIG_ENDIAN) && !defined(SYM_CONF_CHIP_BIG_ENDIAN) -#define INW_OFF(o) readw_l2b((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_l2b((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_l2b(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_l2b(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_b2l((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_b2l((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_b2l((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_b2l((val), np->s.mmio_va + (o)) #elif defined(__LITTLE_ENDIAN) && defined(SYM_CONF_CHIP_BIG_ENDIAN) -#define INW_OFF(o) readw_b2l((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_b2l((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_b2l(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_b2l(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_l2b((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_l2b((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_l2b((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_l2b((val), np->s.mmio_va + (o)) #else -#define INW_OFF(o) readw_raw((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_raw((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_raw(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_raw(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_raw((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_raw((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_raw((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_raw((val), np->s.mmio_va + (o)) #endif @@ -390,8 +390,8 @@ struct Scsi_Host *host; - void * mmio_va; /* MMIO kernel virtual address */ - void * ram_va; /* RAM kernel virtual address */ + void __iomem * mmio_va; /* MMIO kernel virtual address */ + void __iomem * ram_va; /* RAM kernel virtual address */ u_long io_port; /* IO port address cookie */ u_short io_ws; /* IO window size */ int irq; /* IRQ number */ @@ -423,7 +423,7 @@ int irq; /* port and address fields to fit INB, OUTB macros */ u_long io_port; - void * mmio_va; + void __iomem * mmio_va; char inst_name[16]; }; diff -Nru a/drivers/serial/8250.c b/drivers/serial/8250.c --- a/drivers/serial/8250.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/serial/8250.c 2004-09-21 20:52:51 -07:00 @@ -188,6 +188,9 @@ case UPIO_MEM: return readb(up->port.membase + offset); + case UPIO_MEM32: + return readl(up->port.membase + offset); + default: return inb(up->port.iobase + offset); } @@ -206,6 +209,10 @@ case UPIO_MEM: writeb(value, up->port.membase + offset); + break; + + case UPIO_MEM32: + writel(value, up->port.membase + offset); break; default: diff -Nru a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c --- a/drivers/serial/serial_core.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/serial/serial_core.c 2004-09-21 20:52:51 -07:00 @@ -1978,6 +1978,7 @@ printk("I/O 0x%x offset 0x%x", port->iobase, port->hub6); break; case UPIO_MEM: + case UPIO_MEM32: printk("MMIO 0x%lx", port->mapbase); break; } diff -Nru a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c --- a/drivers/serial/serial_cs.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/serial/serial_cs.c 2004-09-21 20:52:52 -07:00 @@ -363,9 +363,10 @@ /*====================================================================*/ -static int simple_config(dev_link_t * link) +static int simple_config(dev_link_t *link) { static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; + static int size_table[2] = { 8, 16 }; client_handle_t handle = link->handle; struct serial_info *info = link->priv; tuple_t tuple; @@ -374,6 +375,7 @@ cistpl_cftable_entry_t *cf = &parse.cftable_entry; config_info_t config; int i, j, try; + int s; /* If the card is already configured, look up the port and irq */ i = pcmcia_get_configuration_info(handle, &config); @@ -399,29 +401,30 @@ tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; /* Two tries: without IO aliases, then with aliases */ - for (try = 0; try < 2; try++) { - i = first_tuple(handle, &tuple, &parse); - while (i != CS_NO_MORE_ITEMS) { - if (i != CS_SUCCESS) - goto next_entry; - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - link->conf.Vpp1 = link->conf.Vpp2 = - cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && - (cf->io.win[0].base != 0)) { - link->conf.ConfigIndex = cf->index; - link->io.BasePort1 = cf->io.win[0].base; - link->io.IOAddrLines = (try == 0) ? - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - i = pcmcia_request_io(link->handle, &link->io); - if (i == CS_SUCCESS) - goto found_port; + for (s = 0; s < 2; s++) { + for (try = 0; try < 2; try++) { + i = first_tuple(handle, &tuple, &parse); + while (i != CS_NO_MORE_ITEMS) { + if (i != CS_SUCCESS) + goto next_entry; + if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) + link->conf.Vpp1 = link->conf.Vpp2 = + cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; + if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[s]) && + (cf->io.win[0].base != 0)) { + link->conf.ConfigIndex = cf->index; + link->io.BasePort1 = cf->io.win[0].base; + link->io.IOAddrLines = (try == 0) ? + 16 : cf->io.flags & CISTPL_IO_LINES_MASK; + i = pcmcia_request_io(link->handle, &link->io); + if (i == CS_SUCCESS) + goto found_port; + } +next_entry: + i = next_tuple(handle, &tuple, &parse); } - next_entry: - i = next_tuple(handle, &tuple, &parse); } } - /* Second pass: try to find an entry that isn't picky about its base address, then try to grab any standard serial port address, and finally try to get any free port. */ diff -Nru a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c --- a/drivers/serial/sn_console.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/serial/sn_console.c 2004-09-21 20:52:51 -07:00 @@ -596,10 +596,15 @@ sysrq_requested = jiffies; sysrq_serial_ptr = sysrq_serial_str; } - continue; /* ignore the whole sysrq string */ + /* + * ignore the whole sysrq string except for the + * leading escape + */ + if (ch != '\e') + continue; } else - sysrq_serial_ptr = sysrq_serial_str; + sysrq_serial_ptr = sysrq_serial_str; #endif /* CONFIG_MAGIC_SYSRQ */ /* record the character to pass up to the tty layer */ @@ -610,8 +615,6 @@ tty->flip.count++; if (tty->flip.count == TTY_FLIPBUF_SIZE) break; - } - else { } port->sc_port.icount.rx++; } diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c --- a/drivers/serial/sunsu.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/serial/sunsu.c 2004-09-21 20:52:51 -07:00 @@ -98,7 +98,7 @@ unsigned int irq; #ifdef CONFIG_SERIO - struct serio serio; + struct serio *serio; int serio_open; #endif }; @@ -520,7 +520,7 @@ /* Stop-A is handled by drivers/char/keyboard.c now. */ if (up->su_type == SU_PORT_KBD) { #ifdef CONFIG_SERIO - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif } else if (up->su_type == SU_PORT_MS) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -534,7 +534,7 @@ case 0: #ifdef CONFIG_SERIO - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif break; }; @@ -994,7 +994,7 @@ static int sunsu_serio_write(struct serio *serio, unsigned char ch) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; int lsr; @@ -1014,7 +1014,7 @@ static int sunsu_serio_open(struct serio *serio) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; int ret; @@ -1031,7 +1031,7 @@ static void sunsu_serio_close(struct serio *serio) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunsu_serio_lock, flags); @@ -1284,54 +1284,58 @@ .major = TTY_MAJOR, }; -static int __init sunsu_kbd_ms_init(void) +static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) { - struct uart_sunsu_port *up; - int i; + struct serio *serio; - for (i = 0, up = sunsu_ports; i < 2; i++, up++) { - up->port.line = i; - up->port.type = PORT_UNKNOWN; - up->port.uartclk = (SU_BASE_BAUD * 16); + up->port.line = channel; + up->port.type = PORT_UNKNOWN; + up->port.uartclk = (SU_BASE_BAUD * 16); - if (up->su_type == SU_PORT_KBD) - up->cflag = B1200 | CS8 | CLOCAL | CREAD; - else - up->cflag = B4800 | CS8 | CLOCAL | CREAD; + if (up->su_type == SU_PORT_KBD) + up->cflag = B1200 | CS8 | CLOCAL | CREAD; + else + up->cflag = B4800 | CS8 | CLOCAL | CREAD; - sunsu_autoconfig(up); - if (up->port.type == PORT_UNKNOWN) - continue; + sunsu_autoconfig(up); + if (up->port.type == PORT_UNKNOWN) + return -1; - printk(KERN_INFO "su%d at 0x%p (irq = %s) is a %s\n", - i, - up->port.membase, __irq_itoa(up->irq), - sunsu_type(&up->port)); + printk(KERN_INFO "su%d at 0x%p (irq = %s) is a %s\n", + channel, + up->port.membase, __irq_itoa(up->irq), + sunsu_type(&up->port)); #ifdef CONFIG_SERIO - memset(&up->serio, 0, sizeof(up->serio)); + up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(*serio)); - up->serio.driver = up; + serio->port_data = up; - up->serio.type = SERIO_RS232; + serio->type = SERIO_RS232; if (up->su_type == SU_PORT_KBD) { - up->serio.type |= SERIO_SUNKBD; - up->serio.name = "sukbd"; + serio->type |= SERIO_SUNKBD; + strlcpy(serio->name, "sukbd", sizeof(serio->name)); } else { - up->serio.type |= (SERIO_SUN | (1 << 16)); - up->serio.name = "sums"; + serio->type |= (SERIO_SUN | (1 << 16)); + strlcpy(serio->name, "sums", sizeof(serio->name)); } - up->serio.phys = (i == 0 ? "su/serio0" : "su/serio1"); + strlcpy(serio->phys, (channel == 0 ? "su/serio0" : "su/serio1"), + sizeof(serio->phys)); - up->serio.write = sunsu_serio_write; - up->serio.open = sunsu_serio_open; - up->serio.close = sunsu_serio_close; + serio->write = sunsu_serio_write; + serio->open = sunsu_serio_open; + serio->close = sunsu_serio_close; - serio_register_port(&up->serio); + serio_register_port(serio); + } else { + printk(KERN_WARNING "su%d: not enough memory for serio port\n", + channel); + } #endif - sunsu_startup(&up->port); - } + sunsu_startup(&up->port); return 0; } @@ -1680,10 +1684,12 @@ if (scan.msx != -1 && scan.kbx != -1) { sunsu_ports[0].su_type = SU_PORT_MS; sunsu_ports[0].port_node = scan.msnode; + sunsu_kbd_ms_init(&sunsu_ports[0], 0); + sunsu_ports[1].su_type = SU_PORT_KBD; sunsu_ports[1].port_node = scan.kbnode; + sunsu_kbd_ms_init(&sunsu_ports[1], 1); - sunsu_kbd_ms_init(); return 0; } @@ -1715,7 +1721,10 @@ if (up->su_type == SU_PORT_MS || up->su_type == SU_PORT_KBD) { #ifdef CONFIG_SERIO - serio_unregister_port(&up->serio); + if (up->serio) { + serio_unregister_port(up->serio); + up->serio = NULL; + } #endif } else if (up->port.type != PORT_UNKNOWN) { uart_remove_one_port(&sunsu_reg, &up->port); diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c --- a/drivers/serial/sunzilog.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/serial/sunzilog.c 2004-09-21 20:52:52 -07:00 @@ -107,7 +107,7 @@ unsigned char prev_status; #ifdef CONFIG_SERIO - struct serio serio; + struct serio *serio; int serio_open; #endif }; @@ -291,7 +291,7 @@ /* Stop-A is handled by drivers/char/keyboard.c now. */ #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif } else if (ZS_IS_MOUSE(up)) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -306,7 +306,7 @@ case 0: #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif break; }; @@ -1295,7 +1295,7 @@ static int sunzilog_serio_write(struct serio *serio, unsigned char ch) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunzilog_serio_lock, flags); @@ -1309,7 +1309,7 @@ static int sunzilog_serio_open(struct serio *serio) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; int ret; @@ -1326,7 +1326,7 @@ static void sunzilog_serio_close(struct serio *serio) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunzilog_serio_lock, flags); @@ -1545,33 +1545,44 @@ up->curregs[R15] = BRKIE; brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); sunzilog_convert_to_zs(up, up->cflag, 0, brg); + sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); + __sunzilog_startup(up); +} #ifdef CONFIG_SERIO - memset(&up->serio, 0, sizeof(up->serio)); +static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int channel) +{ + struct serio *serio; - up->serio.driver = up; + up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(*serio)); - up->serio.type = SERIO_RS232; - if (channel == KEYBOARD_LINE) { - up->serio.type |= SERIO_SUNKBD; - up->serio.name = "zskbd"; - } else { - up->serio.type |= (SERIO_SUN | (1 << 16)); - up->serio.name = "zsms"; - } - up->serio.phys = (channel == KEYBOARD_LINE ? - "zs/serio0" : "zs/serio1"); + serio->port_data = up; - up->serio.write = sunzilog_serio_write; - up->serio.open = sunzilog_serio_open; - up->serio.close = sunzilog_serio_close; - - serio_register_port(&up->serio); -#endif + serio->type = SERIO_RS232; + if (channel == KEYBOARD_LINE) { + serio->type |= SERIO_SUNKBD; + strlcpy(serio->name, "zskbd", sizeof(serio->name)); + } else { + serio->type |= (SERIO_SUN | (1 << 16)); + strlcpy(serio->name, "zsms", sizeof(serio->name)); + } + strlcpy(serio->phys, + (channel == KEYBOARD_LINE ? "zs/serio0" : "zs/serio1"), + sizeof(serio->phys)); + + serio->write = sunzilog_serio_write; + serio->open = sunzilog_serio_open; + serio->close = sunzilog_serio_close; - sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); - __sunzilog_startup(up); + serio_register_port(serio); + } else { + printk(KERN_WARNING "zs%d: not enough memory for serio port\n", + channel); + } } +#endif static void __init sunzilog_init_hw(void) { @@ -1615,6 +1626,11 @@ } spin_unlock_irqrestore(&up->port.lock, flags); + +#ifdef CONFIG_SERIO + if (i == KEYBOARD_LINE || i == MOUSE_LINE) + sunzilog_register_serio(up, i); +#endif } } @@ -1732,10 +1748,15 @@ for (i = 0; i < NUM_CHANNELS; i++) { struct uart_sunzilog_port *up = &sunzilog_port_table[i]; - if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) - continue; - - uart_remove_one_port(&sunzilog_reg, &up->port); + if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) { +#ifdef CONFIG_SERIO + if (up->serio) { + serio_unregister_port(up->serio); + up->serio = NULL; + } +#endif + } else + uart_remove_one_port(&sunzilog_reg, &up->port); } uart_unregister_driver(&sunzilog_reg); diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c --- a/drivers/usb/core/hcd-pci.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/core/hcd-pci.c 2004-09-21 20:52:52 -07:00 @@ -65,7 +65,7 @@ { struct hc_driver *driver; unsigned long resource, len; - void *base; + void __iomem *base; struct usb_hcd *hcd; int retval, region; char buf [8], *bufp = buf; @@ -121,7 +121,7 @@ dev_dbg (&dev->dev, "no i/o regions available\n"); return -EBUSY; } - base = (void *) resource; + base = (void __iomem *) resource; } // driver->reset(), later on, will transfer device from diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h --- a/drivers/usb/core/hcd.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/usb/core/hcd.h 2004-09-21 20:52:51 -07:00 @@ -77,7 +77,7 @@ unsigned can_wakeup:1; /* hw supports wakeup? */ unsigned remote_wakeup:1;/* sw should use wakeup? */ int irq; /* irq allocated */ - void *regs; /* device memory/io */ + void __iomem *regs; /* device memory/io */ #ifdef CONFIG_PCI int region; /* pci region for regs */ diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c --- a/drivers/usb/host/ehci-hcd.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/host/ehci-hcd.c 2004-09-21 20:52:52 -07:00 @@ -155,7 +155,7 @@ * before driver shutdown. But it also seems to be caused by bugs in cardbus * bridge shutdown: shutting down the bridge before the devices using it. */ -static int handshake (u32 *ptr, u32 mask, u32 done, int usec) +static int handshake (u32 __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; @@ -340,8 +340,8 @@ spin_lock_init (&ehci->lock); - ehci->caps = (struct ehci_caps *) hcd->regs; - ehci->regs = (struct ehci_regs *) (hcd->regs + + ehci->caps = hcd->regs; + ehci->regs = (hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase))); dbg_hcs_params (ehci, "reset"); dbg_hcc_params (ehci, "reset"); diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h --- a/drivers/usb/host/ehci.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/host/ehci.h 2004-09-21 20:52:52 -07:00 @@ -70,8 +70,8 @@ /* glue to PCI and HCD framework */ struct usb_hcd hcd; - struct ehci_caps *caps; - struct ehci_regs *regs; + struct ehci_caps __iomem *caps; + struct ehci_regs __iomem *regs; u32 hcs_params; /* cached register copy */ /* per-HC memory pools (could be per-bus, but ...) */ diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c --- a/drivers/usb/host/ohci-dbg.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/host/ohci-dbg.c 2004-09-21 20:52:52 -07:00 @@ -131,7 +131,7 @@ static void ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) { - struct ohci_regs *regs = controller->regs; + struct ohci_regs __iomem *regs = controller->regs; u32 temp; temp = ohci_readl (®s->revision) & 0xff; @@ -599,7 +599,7 @@ struct usb_bus *bus; struct usb_hcd *hcd; struct ohci_hcd *ohci; - struct ohci_regs *regs; + struct ohci_regs __iomem *regs; unsigned long flags; unsigned temp, size; char *next; diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c --- a/drivers/usb/host/ohci-hcd.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/usb/host/ohci-hcd.c 2004-09-21 20:52:51 -07:00 @@ -594,7 +594,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); - struct ohci_regs *regs = ohci->regs; + struct ohci_regs __iomem *regs = ohci->regs; int ints; /* we can eliminate a (slow) ohci_readl() diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c --- a/drivers/usb/host/ohci-hub.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/usb/host/ohci-hub.c 2004-09-21 20:52:51 -07:00 @@ -487,7 +487,7 @@ /* called from some task, normally khubd */ static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port) { - u32 *portstat = &ohci->regs->roothub.portstatus [port]; + u32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; u32 temp; u16 now = readl(&ohci->regs->fmnumber); u16 reset_done = now + PORT_RESET_MSEC; diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h --- a/drivers/usb/host/ohci.h 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/host/ohci.h 2004-09-21 20:52:52 -07:00 @@ -343,7 +343,7 @@ /* * I/O memory used to communicate with the HC (dma-consistent) */ - struct ohci_regs *regs; + struct ohci_regs __iomem *regs; /* * main memory used to communicate with the HC (dma-consistent). @@ -450,7 +450,7 @@ #else /* Standard version of ohci_readl uses standard, platform * specific implementation. */ -static inline unsigned int ohci_readl (void* regs) +static inline unsigned int ohci_readl (void __iomem * regs) { return readl (regs); } diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c --- a/drivers/usb/input/hid-core.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/usb/input/hid-core.c 2004-09-21 20:52:52 -07:00 @@ -219,17 +219,13 @@ dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); return -1; } - usages = parser->local.usage_index; + + if (!(usages = max_t(int, parser->local.usage_index, parser->global.report_count))) + return 0; /* Ignore padding fields */ offset = report->size; report->size += parser->global.report_size * parser->global.report_count; - if (usages < parser->global.report_count) - usages = parser->global.report_count; - - if (usages == 0) - return 0; /* ignore padding fields */ - if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL) return 0; @@ -923,20 +919,20 @@ int status; switch (urb->status) { - case 0: /* success */ - hid_input_report(HID_INPUT_REPORT, urb, regs); - break; - case -ECONNRESET: /* unlink */ - case -ENOENT: - case -ESHUTDOWN: - return; - default: /* error */ - dbg("nonzero status in input irq %d", urb->status); + case 0: /* success */ + hid_input_report(HID_INPUT_REPORT, urb, regs); + break; + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + return; + default: /* error */ + warn("input irq status %d received", urb->status); } - status = usb_submit_urb (urb, SLAB_ATOMIC); + status = usb_submit_urb(urb, SLAB_ATOMIC); if (status) - err ("can't resubmit intr, %s-%s/input%d, status %d", + err("can't resubmit intr, %s-%s/input%d, status %d", hid->dev->bus->bus_name, hid->dev->devpath, hid->ifnum, status); } @@ -1137,23 +1133,31 @@ struct hid_device *hid = urb->context; unsigned long flags; - if (urb->status) - warn("output irq status %d received", urb->status); + switch (urb->status) { + case 0: /* success */ + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + break; + default: /* error */ + warn("output irq status %d received", urb->status); + } spin_lock_irqsave(&hid->outlock, flags); hid->outtail = (hid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); if (hid->outhead != hid->outtail) { - hid_submit_out(hid); + if (hid_submit_out(hid)) { + clear_bit(HID_OUT_RUNNING, &hid->iofl);; + wake_up(&hid->wait); + } spin_unlock_irqrestore(&hid->outlock, flags); return; } clear_bit(HID_OUT_RUNNING, &hid->iofl); - spin_unlock_irqrestore(&hid->outlock, flags); - wake_up(&hid->wait); } @@ -1166,26 +1170,34 @@ struct hid_device *hid = urb->context; unsigned long flags; - if (urb->status) - warn("ctrl urb status %d received", urb->status); - spin_lock_irqsave(&hid->ctrllock, flags); - if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) - hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); + switch (urb->status) { + case 0: /* success */ + if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) + hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + case -EPIPE: /* report not available */ + break; + default: /* error */ + warn("ctrl urb status %d received", urb->status); + } hid->ctrltail = (hid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); if (hid->ctrlhead != hid->ctrltail) { - hid_submit_ctrl(hid); + if (hid_submit_ctrl(hid)) { + clear_bit(HID_CTRL_RUNNING, &hid->iofl); + wake_up(&hid->wait); + } spin_unlock_irqrestore(&hid->ctrllock, flags); return; } clear_bit(HID_CTRL_RUNNING, &hid->iofl); - spin_unlock_irqrestore(&hid->ctrllock, flags); - wake_up(&hid->wait); } @@ -1211,7 +1223,8 @@ hid->outhead = head; if (!test_and_set_bit(HID_OUT_RUNNING, &hid->iofl)) - hid_submit_out(hid); + if (hid_submit_out(hid)) + clear_bit(HID_OUT_RUNNING, &hid->iofl); spin_unlock_irqrestore(&hid->outlock, flags); return; @@ -1230,7 +1243,8 @@ hid->ctrlhead = head; if (!test_and_set_bit(HID_CTRL_RUNNING, &hid->iofl)) - hid_submit_ctrl(hid); + if (hid_submit_ctrl(hid)) + clear_bit(HID_CTRL_RUNNING, &hid->iofl); spin_unlock_irqrestore(&hid->ctrllock, flags); } @@ -1282,7 +1296,7 @@ void hid_close(struct hid_device *hid) { if (!--hid->open) - usb_unlink_urb(hid->urbin); + usb_kill_urb(hid->urbin); } /* @@ -1439,6 +1453,11 @@ #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 +#define USB_VENDOR_ID_CODEMERCS 0x07c0 +#define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 +#define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 + + static struct hid_blacklist { __u16 idVendor; __u16 idProduct; @@ -1453,20 +1472,20 @@ { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 1, HID_QUIRK_IGNORE }, @@ -1644,7 +1663,7 @@ usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, len, hid_irq_in, hid, interval); hid->urbin->transfer_dma = hid->inbuf_dma; - hid->urbin->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + hid->urbin->transfer_flags |=(URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); } else { if (hid->urbout) continue; @@ -1654,7 +1673,7 @@ usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 0, hid_irq_out, hid, interval); hid->urbout->transfer_dma = hid->outbuf_dma; - hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + hid->urbout->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); } } @@ -1704,8 +1723,7 @@ hid->ctrlbuf, 1, hid_ctrl, hid); hid->urbctrl->setup_dma = hid->cr_dma; hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; - hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP - | URB_NO_SETUP_DMA_MAP); + hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | URB_ASYNC_UNLINK); return hid; @@ -1731,9 +1749,9 @@ return; usb_set_intfdata(intf, NULL); - usb_unlink_urb(hid->urbin); - usb_unlink_urb(hid->urbout); - usb_unlink_urb(hid->urbctrl); + usb_kill_urb(hid->urbin); + usb_kill_urb(hid->urbout); + usb_kill_urb(hid->urbctrl); if (hid->claimed & HID_CLAIMED_INPUT) hidinput_disconnect(hid); diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c --- a/drivers/usb/input/hiddev.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/usb/input/hiddev.c 2004-09-21 20:52:51 -07:00 @@ -626,16 +626,19 @@ goto inval; field = report->field[uref->field_index]; - if (uref->usage_index >= field->maxusage) - goto inval; - if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { - if (uref_multi->num_values >= HID_MAX_USAGES || - uref->usage_index >= field->maxusage || - (uref->usage_index + uref_multi->num_values) >= field->maxusage) + if (cmd == HIDIOCGCOLLECTIONINDEX) { + if (uref->usage_index >= field->maxusage) goto inval; + } else if (uref->usage_index >= field->report_count) + goto inval; + + else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && + (uref_multi->num_values >= HID_MAX_MULTI_USAGES || + uref->usage_index + uref_multi->num_values >= field->report_count || + uref->usage_index + uref_multi->num_values < uref->usage_index)) + goto inval; } - } switch (cmd) { case HIDIOCGUSAGE: diff -Nru a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c --- a/drivers/video/cfbcopyarea.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/video/cfbcopyarea.c 2004-09-21 20:52:52 -07:00 @@ -43,8 +43,9 @@ #define BYTES_PER_LONG 8 #endif -static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, - int src_idx, unsigned long n) +static void bitcpy(unsigned long __iomem *dst, int dst_idx, + const unsigned long __iomem *src, int src_idx, + unsigned long n) { unsigned long first, last; int shift = dst_idx-src_idx, left, right; @@ -185,8 +186,8 @@ } } -static void bitcpy_rev(unsigned long *dst, int dst_idx, - const unsigned long *src, int src_idx, unsigned long n) +static void bitcpy_rev(unsigned long __iomem *dst, int dst_idx, + const unsigned long __iomem *src, int src_idx, unsigned long n) { unsigned long first, last; int shift = dst_idx-src_idx, left, right; @@ -344,7 +345,7 @@ int x2, y2, old_dx, old_dy, vxres, vyres; unsigned long next_line = p->fix.line_length; int dst_idx = 0, src_idx = 0, rev_copy = 0; - unsigned long *dst = NULL, *src = NULL; + unsigned long __iomem *dst = NULL, *src = NULL; if (p->state != FBINFO_STATE_RUNNING) return; @@ -394,7 +395,7 @@ rev_copy = 1; } - dst = src = (unsigned long *)((unsigned long)p->screen_base & + dst = src = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(BYTES_PER_LONG-1)); dst_idx = src_idx = (unsigned long)p->screen_base & (BYTES_PER_LONG-1); dst_idx += dy*next_line*8 + dx*p->var.bits_per_pixel; diff -Nru a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c --- a/drivers/video/cfbfillrect.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/video/cfbfillrect.c 2004-09-21 20:52:52 -07:00 @@ -119,7 +119,7 @@ * Unaligned 32-bit pattern fill using 32/64-bit memory accesses */ -void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) +void bitfill32(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat; unsigned long first, last; @@ -178,7 +178,7 @@ * used for the next 32/64-bit word */ -void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, +void bitfill(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last; @@ -228,7 +228,7 @@ } } -void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) +void bitfill32_rev(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat, dat; unsigned long first, last; @@ -300,7 +300,7 @@ * used for the next 32/64-bit word */ -void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, +void bitfill_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last, dat; @@ -364,7 +364,7 @@ u32 bpp = p->var.bits_per_pixel; unsigned long x2, y2, vxres, vyres; unsigned long height, width, fg; - unsigned long *dst; + unsigned long __iomem *dst; int dst_idx, left; if (p->state != FBINFO_STATE_RUNNING) @@ -397,7 +397,7 @@ else fg = rect->color; - dst = (unsigned long *)((unsigned long)p->screen_base & + dst = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(BYTES_PER_LONG-1)); dst_idx = ((unsigned long)p->screen_base & (BYTES_PER_LONG-1))*8; dst_idx += rect->dy*p->fix.line_length*8+rect->dx*bpp; @@ -407,7 +407,7 @@ p->fbops->fb_sync(p); if (!left) { u32 pat = pixel_to_pat32(p, fg); - void (*fill_op32)(unsigned long *dst, int dst_idx, u32 pat, + void (*fill_op32)(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) = NULL; switch (rect->rop) { @@ -429,7 +429,7 @@ unsigned long pat = pixel_to_pat(p, fg, (left-dst_idx) % bpp); int right = bpp-left; int r; - void (*fill_op)(unsigned long *dst, int dst_idx, + void (*fill_op)(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) = NULL; 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-21 20:52:52 -07:00 +++ b/drivers/video/matrox/matroxfb_base.h 2004-09-21 20:52:52 -07:00 @@ -99,21 +99,16 @@ #endif #endif -#if defined(__alpha__) || defined(__mc68000__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__i386__) || defined(__x86_64__) #define READx_WORKS #define MEMCPYTOIO_WORKS #else +/* ppc/ppc64 must use __raw_{read,write}[bwl] as we drive adapter + in big-endian mode for compatibility with XFree mga driver, and + so we do not want little-endian {read,write}[bwl] */ #define READx_FAILS -/* recheck __ppc__, maybe that __ppc__ needs MEMCPYTOIO_WRITEL */ -/* I benchmarked PII/350MHz with G200... MEMCPY, MEMCPYTOIO and WRITEL are on same speed ( <2% diff) */ -/* so that means that G200 speed (or AGP speed?) is our limit... I do not have benchmark to test, how */ -/* much of PCI bandwidth is used during transfers... */ -#if defined(__i386__) || defined(__x86_64__) -#define MEMCPYTOIO_MEMCPY -#else #define MEMCPYTOIO_WRITEL #endif -#endif #if defined(__mc68000__) #define MAP_BUSTOVIRT @@ -160,7 +155,7 @@ #endif typedef struct { - u_int8_t* vaddr; + u_int8_t __iomem* vaddr; } vaddr_t; #ifdef READx_WORKS @@ -189,27 +184,27 @@ } #else static inline unsigned int mga_readb(vaddr_t va, unsigned int offs) { - return *(volatile u_int8_t*)(va.vaddr + offs); + return __raw_readb(va.vaddr + offs); } static inline unsigned int mga_readw(vaddr_t va, unsigned int offs) { - return *(volatile u_int16_t*)(va.vaddr + offs); + return __raw_readw(va.vaddr + offs); } static inline u_int32_t mga_readl(vaddr_t va, unsigned int offs) { - return *(volatile u_int32_t*)(va.vaddr + offs); + return __raw_readl(va.vaddr + offs); } static inline void mga_writeb(vaddr_t va, unsigned int offs, u_int8_t value) { - *(volatile u_int8_t*)(va.vaddr + offs) = value; + __raw_writeb(value, va.vaddr + offs); } static inline void mga_writew(vaddr_t va, unsigned int offs, u_int16_t value) { - *(volatile u_int16_t*)(va.vaddr + offs) = value; + __raw_writew(value, va.vaddr + offs); } static inline void mga_writel(vaddr_t va, unsigned int offs, u_int32_t value) { - *(volatile u_int32_t*)(va.vaddr + offs) = value; + __raw_writel(value, va.vaddr + offs); } #endif @@ -238,8 +233,6 @@ memcpy(&tmp, src, len); mga_writel(va, offs, tmp); } -#elif defined(MEMCPYTOIO_MEMCPY) - memcpy(va.vaddr + offs, src, len); #else #error "Sorry, do not know how to write block of data to device" #endif @@ -249,7 +242,7 @@ va->vaddr += offs; } -static inline void* vaddr_va(vaddr_t va) { +static inline void __iomem* vaddr_va(vaddr_t va) { return va.vaddr; } diff -Nru a/drivers/video/matrox/matroxfb_crtc2.h b/drivers/video/matrox/matroxfb_crtc2.h --- a/drivers/video/matrox/matroxfb_crtc2.h 2004-09-21 20:52:51 -07:00 +++ b/drivers/video/matrox/matroxfb_crtc2.h 2004-09-21 20:52:51 -07:00 @@ -27,7 +27,7 @@ unsigned int len; } mmio; - int interlaced:1; + unsigned int interlaced:1; u_int32_t cmap[17]; }; diff -Nru a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c --- a/drivers/video/matrox/matroxfb_misc.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/video/matrox/matroxfb_misc.c 2004-09-21 20:52:52 -07:00 @@ -391,7 +391,7 @@ CRITEND } -static void get_pins(unsigned char* pins, struct matrox_bios* bd) { +static void get_pins(unsigned char __iomem* pins, struct matrox_bios* bd) { unsigned int b0 = readb(pins); if (b0 == 0x2E && readb(pins+1) == 0x41) { @@ -427,7 +427,7 @@ } } -static void get_bios_version(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_version(unsigned char __iomem * vbios, struct matrox_bios* bd) { unsigned int pcir_offset; pcir_offset = readb(vbios + 24) | (readb(vbios + 25) << 8); @@ -452,7 +452,7 @@ } } -static void get_bios_output(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_output(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned char b; b = readb(vbios + 0x7FF1); @@ -462,7 +462,7 @@ bd->output.state = b; } -static void get_bios_tvout(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_tvout(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned int i; /* Check for 'IBM .*(V....TVO' string - it means TVO BIOS */ @@ -489,7 +489,7 @@ } } -static void parse_bios(unsigned char* vbios, struct matrox_bios* bd) { +static void parse_bios(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned int pins_offset; if (readb(vbios) != 0x55 || readb(vbios + 1) != 0xAA) { @@ -738,7 +738,7 @@ pci_write_config_dword(pdev, PCI_OPTION_REG, opt); #ifdef CONFIG_X86 if (!ACCESS_FBINFO(bios).bios_valid) { - unsigned char* b; + unsigned char __iomem* b; b = ioremap(0x000C0000, 65536); if (!b) { diff -Nru a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c --- a/drivers/video/riva/rivafb-i2c.c 2004-09-21 20:52:52 -07:00 +++ b/drivers/video/riva/rivafb-i2c.c 2004-09-21 20:52:52 -07:00 @@ -105,9 +105,9 @@ chan->algo.setscl = riva_gpio_setscl; chan->algo.getsda = riva_gpio_getsda; chan->algo.getscl = riva_gpio_getscl; - chan->algo.udelay = 5; + chan->algo.udelay = 40; chan->algo.mdelay = 5; - chan->algo.timeout = 10; + chan->algo.timeout = 20; chan->algo.data = chan; i2c_set_adapdata(&chan->adapter, chan); diff -Nru a/drivers/video/vgastate.c b/drivers/video/vgastate.c --- a/drivers/video/vgastate.c 2004-09-21 20:52:51 -07:00 +++ b/drivers/video/vgastate.c 2004-09-21 20:52:51 -07:00 @@ -32,21 +32,21 @@ __u8 misc; }; -static inline unsigned char vga_rcrtcs(caddr_t regbase, unsigned short iobase, +static inline unsigned char vga_rcrtcs(void __iomem *regbase, unsigned short iobase, unsigned char reg) { vga_w(regbase, iobase + 0x4, reg); return vga_r(regbase, iobase + 0x5); } -static inline void vga_wcrtcs(caddr_t regbase, unsigned short iobase, +static inline void vga_wcrtcs(void __iomem *regbase, unsigned short iobase, unsigned char reg, unsigned char val) { vga_w(regbase, iobase + 0x4, reg); vga_w(regbase, iobase + 0x5, val); } -static void save_vga_text(struct vgastate *state, caddr_t fbbase) +static void save_vga_text(struct vgastate *state, void __iomem *fbbase) { struct regstate *saved = (struct regstate *) state->vidstate; int i; @@ -134,7 +134,7 @@ vga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, seq1); } -static void restore_vga_text(struct vgastate *state, caddr_t fbbase) +static void restore_vga_text(struct vgastate *state, void __iomem *fbbase) { struct regstate *saved = (struct regstate *) state->vidstate; int i; @@ -403,7 +403,7 @@ } if (state->flags & VGA_SAVE_FONTS) { - caddr_t fbbase; + void __iomem *fbbase; /* exit if window is less than 32K */ if (state->memsize && state->memsize < 4 * 8192) { @@ -473,7 +473,7 @@ restore_vga_mode(state); if (state->flags & VGA_SAVE_FONTS) { - caddr_t fbbase = ioremap(state->membase, state->memsize); + void __iomem *fbbase = ioremap(state->membase, state->memsize); if (!fbbase) { vga_cleanup(state); diff -Nru a/fs/adfs/adfs.h b/fs/adfs/adfs.h --- a/fs/adfs/adfs.h 2004-09-21 20:52:52 -07:00 +++ b/fs/adfs/adfs.h 2004-09-21 20:52:52 -07:00 @@ -66,7 +66,7 @@ /* Inode stuff */ struct inode *adfs_iget(struct super_block *sb, struct object_info *obj); -void adfs_write_inode(struct inode *inode,int unused); +int adfs_write_inode(struct inode *inode,int unused); int adfs_notify_change(struct dentry *dentry, struct iattr *attr); /* map.c */ diff -Nru a/fs/adfs/inode.c b/fs/adfs/inode.c --- a/fs/adfs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/adfs/inode.c 2004-09-21 20:52:51 -07:00 @@ -373,10 +373,11 @@ * The adfs-specific inode data has already been updated by * adfs_notify_change() */ -void adfs_write_inode(struct inode *inode, int unused) +int adfs_write_inode(struct inode *inode, int unused) { struct super_block *sb = inode->i_sb; struct object_info obj; + int ret; lock_kernel(); obj.file_id = inode->i_ino; @@ -387,7 +388,8 @@ obj.attr = ADFS_I(inode)->attr; obj.size = inode->i_size; - adfs_dir_update(sb, &obj); + ret = adfs_dir_update(sb, &obj); unlock_kernel(); + return ret; } MODULE_LICENSE("GPL"); diff -Nru a/fs/affs/inode.c b/fs/affs/inode.c --- a/fs/affs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/affs/inode.c 2004-09-21 20:52:51 -07:00 @@ -181,7 +181,7 @@ return; } -void +int affs_write_inode(struct inode *inode, int unused) { struct super_block *sb = inode->i_sb; @@ -194,11 +194,11 @@ if (!inode->i_nlink) // possibly free block - return; + return 0; bh = affs_bread(sb, inode->i_ino); if (!bh) { affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); - return; + return -EIO; } tail = AFFS_TAIL(sb, bh); if (tail->stype == cpu_to_be32(ST_ROOT)) { @@ -226,6 +226,7 @@ mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); affs_free_prealloc(inode); + return 0; } int diff -Nru a/fs/bfs/inode.c b/fs/bfs/inode.c --- a/fs/bfs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/bfs/inode.c 2004-09-21 20:52:51 -07:00 @@ -85,7 +85,7 @@ brelse(bh); } -static void bfs_write_inode(struct inode * inode, int unused) +static int bfs_write_inode(struct inode * inode, int unused) { unsigned long ino = inode->i_ino; struct bfs_inode * di; @@ -94,7 +94,7 @@ if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); - return; + return -EIO; } lock_kernel(); @@ -103,7 +103,7 @@ if (!bh) { printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); unlock_kernel(); - return; + return -EIO; } off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; @@ -129,6 +129,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } static void bfs_delete_inode(struct inode * inode) diff -Nru a/fs/bio.c b/fs/bio.c --- a/fs/bio.c 2004-09-21 20:52:52 -07:00 +++ b/fs/bio.c 2004-09-21 20:52:52 -07:00 @@ -137,33 +137,29 @@ **/ struct bio *bio_alloc(int gfp_mask, int nr_iovecs) { - struct bio_vec *bvl = NULL; - unsigned long idx; - struct bio *bio; + struct bio *bio = mempool_alloc(bio_pool, gfp_mask); - bio = mempool_alloc(bio_pool, gfp_mask); - if (unlikely(!bio)) - goto out; + if (likely(bio)) { + struct bio_vec *bvl = NULL; - bio_init(bio); + bio_init(bio); + if (likely(nr_iovecs)) { + unsigned long idx; - if (unlikely(!nr_iovecs)) - goto noiovec; - - bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx); - if (bvl) { - bio->bi_flags |= idx << BIO_POOL_OFFSET; - bio->bi_max_vecs = bvec_array[idx].nr_vecs; -noiovec: + bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx); + if (unlikely(!bvl)) { + mempool_free(bio, bio_pool); + bio = NULL; + goto out; + } + bio->bi_flags |= idx << BIO_POOL_OFFSET; + bio->bi_max_vecs = bvec_array[idx].nr_vecs; + } bio->bi_io_vec = bvl; bio->bi_destructor = bio_destructor; -out: - return bio; } - - mempool_free(bio, bio_pool); - bio = NULL; - goto out; +out: + return bio; } /** diff -Nru a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c --- a/fs/cifs/cifs_debug.c 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/cifs_debug.c 2004-09-21 20:52:51 -07:00 @@ -126,26 +126,28 @@ i = 0; read_lock(&GlobalSMBSeslock); list_for_each(tmp, &GlobalTreeConnectionList) { + __u32 dev_type; i++; tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); + dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); length = sprintf(buf, "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d", i, tcon->treeName, atomic_read(&tcon->useCount), tcon->nativeFileSystem, - tcon->fsDevInfo.DeviceCharacteristics, - tcon->fsAttrInfo.Attributes, - tcon->fsAttrInfo.MaxPathNameComponentLength,tcon->tidStatus); + le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), + le32_to_cpu(tcon->fsAttrInfo.Attributes), + le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), + tcon->tidStatus); buf += length; - if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_DISK) + if (dev_type == FILE_DEVICE_DISK) length = sprintf(buf, " type: DISK "); - else if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_CD_ROM) + else if (dev_type == FILE_DEVICE_CD_ROM) length = sprintf(buf, " type: CDROM "); else length = - sprintf(buf, " type: %d ", - tcon->fsDevInfo.DeviceType); + sprintf(buf, " type: %d ", dev_type); buf += length; if(tcon->tidStatus == CifsNeedReconnect) { buf += sprintf(buf, "\tDISCONNECTED "); diff -Nru a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c --- a/fs/cifs/cifsencrypt.c 2004-09-21 20:52:52 -07:00 +++ b/fs/cifs/cifsencrypt.c 2004-09-21 20:52:52 -07:00 @@ -61,7 +61,7 @@ if((cifs_pdu == NULL) || (ses == NULL)) return -EINVAL; - if((le32_to_cpu(cifs_pdu->Flags2) & SMBFLG2_SECURITY_SIGNATURE) == 0) + if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) return rc; spin_lock(&GlobalMid_Lock); @@ -107,13 +107,11 @@ if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0) cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command)); - expected_sequence_number = cpu_to_le32(expected_sequence_number); - /* save off the origiginal signature so we can modify the smb and check its signature against what the server sent */ memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8); - cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number; + cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number); cifs_pdu->Signature.Sequence.Reserved = 0; rc = cifs_calculate_signature(cifs_pdu, mac_key, diff -Nru a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h --- a/fs/cifs/cifspdu.h 2004-09-21 20:52:52 -07:00 +++ b/fs/cifs/cifspdu.h 2004-09-21 20:52:52 -07:00 @@ -137,15 +137,15 @@ /* * SMB flag2 definitions */ -#define SMBFLG2_KNOWS_LONG_NAMES 0x0001 /* can send long (non-8.3) path names in response */ -#define SMBFLG2_KNOWS_EAS 0x0002 -#define SMBFLG2_SECURITY_SIGNATURE 0x0004 -#define SMBFLG2_IS_LONG_NAME 0x0040 -#define SMBFLG2_EXT_SEC 0x0800 -#define SMBFLG2_DFS 0x1000 -#define SMBFLG2_PAGING_IO 0x2000 -#define SMBFLG2_ERR_STATUS 0x4000 -#define SMBFLG2_UNICODE 0x8000 +#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) path names in response */ +#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) +#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) +#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) +#define SMBFLG2_EXT_SEC cpu_to_le16(0x80) +#define SMBFLG2_DFS cpu_to_le16(0x1000) +#define SMBFLG2_PAGING_IO cpu_to_le16(0x2000) +#define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000) +#define SMBFLG2_UNICODE cpu_to_le16(0x8000) /* * These are the file access permission bits defined in CIFS for the @@ -303,23 +303,23 @@ struct { __u8 ErrorClass; __u8 Reserved; - __u16 Error; /* note: treated as little endian (le) on wire */ + __le16 Error; } DosError; - __u32 CifsError; /* note: le */ + __le32 CifsError; } Status; __u8 Flags; - __u16 Flags2; /* note: le */ - __u16 PidHigh; /* note: le */ + __le16 Flags2; /* note: le */ + __le16 PidHigh; union { struct { - __u32 SequenceNumber; /* le */ + __le32 SequenceNumber; /* le */ __u32 Reserved; /* zero */ } Sequence; __u8 SecuritySignature[8]; /* le */ } Signature; __u8 pad[2]; __u16 Tid; - __u16 Pid; /* note: le */ + __le16 Pid; __u16 Uid; __u16 Mid; __u8 WordCount; @@ -328,7 +328,7 @@ #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ -#define pByteArea(smb_var) ((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) +#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) /* * Computer Name Length @@ -373,23 +373,23 @@ typedef struct negotiate_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; unsigned char DialectsArray[1]; } NEGOTIATE_REQ; typedef struct negotiate_rsp { struct smb_hdr hdr; /* wct = 17 */ - __u16 DialectIndex; + __le16 DialectIndex; __u8 SecurityMode; - __u16 MaxMpxCount; - __u16 MaxNumberVcs; - __u32 MaxBufferSize; - __u32 MaxRawSize; - __u32 SessionKey; - __u32 Capabilities; /* see below */ - __u32 SystemTimeLow; - __u32 SystemTimeHigh; - __u16 ServerTimeZone; + __le16 MaxMpxCount; + __le16 MaxNumberVcs; + __le32 MaxBufferSize; + __le32 MaxRawSize; + __le32 SessionKey; + __le32 Capabilities; /* see below */ + __le32 SystemTimeLow; + __le32 SystemTimeHigh; + __le16 ServerTimeZone; __u8 EncryptionKeyLength; __u16 ByteCount; union { @@ -436,15 +436,15 @@ struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 SecurityBlobLength; + __le16 SecurityBlobLength; __u32 Reserved; - __u32 Capabilities; /* see below */ - __u16 ByteCount; + __le32 Capabilities; /* see below */ + __le16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* STRING NativeOS */ /* STRING NativeLanMan */ @@ -454,16 +454,16 @@ struct smb_hdr hdr; /* wct = 13 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 CaseInsensitivePasswordLength; /* ASCII password length */ - __u16 CaseSensitivePasswordLength; /* Unicode password length */ + __le16 CaseInsensitivePasswordLength; /* ASCII password length */ + __le16 CaseSensitivePasswordLength; /* Unicode password length */ __u32 Reserved; /* see below */ - __u32 Capabilities; - __u16 ByteCount; + __le32 Capabilities; + __le16 ByteCount; unsigned char CaseInsensitivePassword[1]; /* followed by: */ /* unsigned char * CaseSensitivePassword; */ /* STRING AccountName */ @@ -476,9 +476,9 @@ struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ - __u16 SecurityBlobLength; + __le16 AndXOffset; + __le16 Action; /* see below */ + __le16 SecurityBlobLength; __u16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* unsigned char * NativeOS; */ @@ -490,14 +490,14 @@ struct smb_hdr hdr; /* wct = 10 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 PassswordLength; + __le16 PassswordLength; __u32 Reserved; - __u16 ByteCount; + __le16 ByteCount; unsigned char AccountPassword[1]; /* followed by */ /* STRING AccountName */ /* STRING PrimaryDomain */ @@ -509,8 +509,8 @@ struct smb_hdr hdr; /* wct = 3 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ + __le16 AndXOffset; + __le16 Action; /* see below */ __u16 ByteCount; unsigned char NativeOS[1]; /* followed by */ /* unsigned char * NativeLanMan; */ @@ -537,10 +537,10 @@ struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Flags; /* see below */ - __u16 PasswordLength; - __u16 ByteCount; + __le16 AndXOffset; + __le16 Flags; /* see below */ + __le16 PasswordLength; + __le16 ByteCount; unsigned char Password[1]; /* followed by */ /* STRING Path *//* \\server\share name */ /* STRING Service */ @@ -550,8 +550,8 @@ struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 OptionalSupport; /* see below */ + __le16 AndXOffset; + __le16 OptionalSupport; /* see below */ __u16 ByteCount; unsigned char Service[1]; /* always ASCII, not Unicode */ /* STRING NativeFileSystem */ @@ -619,20 +619,20 @@ struct smb_hdr hdr; /* wct = 24 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 Reserved; /* Must Be Zero */ - __u16 NameLength; - __u32 OpenFlags; - __u32 RootDirectoryFid; - __u32 DesiredAccess; - __u64 AllocationSize; - __u32 FileAttributes; - __u32 ShareAccess; - __u32 CreateDisposition; - __u32 CreateOptions; - __u32 ImpersonationLevel; + __le16 NameLength; + __le32 OpenFlags; + __le32 RootDirectoryFid; + __le32 DesiredAccess; + __le64 AllocationSize; + __le32 FileAttributes; + __le32 ShareAccess; + __le32 CreateDisposition; + __le32 CreateOptions; + __le32 ImpersonationLevel; __u8 SecurityFlags; - __u16 ByteCount; + __le16 ByteCount; char fileName[1]; } OPEN_REQ; @@ -649,19 +649,19 @@ struct smb_hdr hdr; /* wct = 34 BB */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 OplockLevel; __u16 Fid; - __u32 CreateAction; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 FileAttributes; - __u64 AllocationSize; - __u64 EndOfFile; - __u16 FileType; - __u16 DeviceState; + __le32 CreateAction; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 FileAttributes; + __le64 AllocationSize; + __le64 EndOfFile; + __le16 FileType; + __le16 DeviceState; __u8 DirectoryFlag; __u16 ByteCount; /* bct = 0 */ } OPEN_RSP; @@ -670,17 +670,17 @@ struct smb_hdr hdr; /* wct = 14 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; + __le32 OffsetLow; __u32 Reserved; - __u16 WriteMode; - __u16 Remaining; - __u16 DataLengthHigh; - __u16 DataLengthLow; - __u16 DataOffset; - __u32 OffsetHigh; - __u16 ByteCount; + __le16 WriteMode; + __le16 Remaining; + __le16 DataLengthHigh; + __le16 DataLengthLow; + __le16 DataOffset; + __le32 OffsetHigh; + __le16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ char Data[1]; } WRITE_REQ; @@ -689,10 +689,10 @@ struct smb_hdr hdr; /* wct = 6 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Count; - __u16 Remaining; - __u32 Reserved; + __le16 AndXOffset; + __le16 Count; + __le16 Remaining; + __le32 Reserved; __u16 ByteCount; } WRITE_RSP; @@ -700,28 +700,28 @@ struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; - __u16 MaxCount; - __u16 MinCount; /* obsolete */ - __u32 MaxCountHigh; - __u16 Remaining; - __u32 OffsetHigh; - __u16 ByteCount; + __le32 OffsetLow; + __le16 MaxCount; + __le16 MinCount; /* obsolete */ + __le32 MaxCountHigh; + __le16 Remaining; + __le32 OffsetHigh; + __le16 ByteCount; } READ_REQ; typedef struct smb_com_read_rsp { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Remaining; - __u16 DataCompactionMode; - __u16 Reserved; - __u16 DataLength; - __u16 DataOffset; - __u16 DataLengthHigh; + __le16 AndXOffset; + __le16 Remaining; + __le16 DataCompactionMode; + __le16 Reserved; + __le16 DataLength; + __le16 DataOffset; + __le16 DataLengthHigh; __u64 Reserved2; __u16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ @@ -729,12 +729,12 @@ } READ_RSP; typedef struct locking_andx_range { - __u16 Pid; - __u16 Pad; - __u32 OffsetHigh; - __u32 OffsetLow; - __u32 LengthHigh; - __u32 LengthLow; + __le16 Pid; + __le16 Pad; + __le32 OffsetHigh; + __le32 OffsetLow; + __le32 LengthHigh; + __le32 LengthLow; } LOCKING_ANDX_RANGE; #define LOCKING_ANDX_SHARED_LOCK 0x01 @@ -747,14 +747,14 @@ struct smb_hdr hdr; /* wct = 8 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; __u8 LockType; __u8 OplockLevel; - __u32 Timeout; - __u16 NumberOfUnlocks; - __u16 NumberOfLocks; - __u16 ByteCount; + __le32 Timeout; + __le16 NumberOfUnlocks; + __le16 NumberOfLocks; + __le16 ByteCount; LOCKING_ANDX_RANGE Locks[1]; } LOCK_REQ; @@ -762,14 +762,14 @@ struct smb_hdr hdr; /* wct = 2 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 ByteCount; } LOCK_RSP; typedef struct smb_com_rename_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -787,9 +787,9 @@ typedef struct smb_com_copy_req { struct smb_hdr hdr; /* wct = 3 */ __u16 Tid2; - __u16 OpenFunction; - __u16 Flags; - __u16 ByteCount; + __le16 OpenFunction; + __le16 Flags; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -798,7 +798,7 @@ typedef struct smb_com_copy_rsp { struct smb_hdr hdr; /* wct = 1 */ - __u16 CopyCount; /* number of files copied */ + __le16 CopyCount; /* number of files copied */ __u16 ByteCount; /* may be zero */ __u8 BufferFormat; /* 0x04 - only present if errored file follows */ unsigned char ErrorFileName[1]; /* only present if error in copy */ @@ -810,10 +810,10 @@ typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ struct smb_hdr hdr; /* wct = 4 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 Flags; /* spec says Information Level */ - __u32 ClusterCount; - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 Flags; /* spec says Information Level */ + __le32 ClusterCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -827,8 +827,8 @@ typedef struct smb_com_delete_file_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; - __u16 ByteCount; + __le16 SearchAttributes; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char fileName[1]; } DELETE_FILE_REQ; @@ -840,7 +840,7 @@ typedef struct smb_com_delete_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } DELETE_DIRECTORY_REQ; @@ -852,7 +852,7 @@ typedef struct smb_com_create_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } CREATE_DIRECTORY_REQ; @@ -870,22 +870,22 @@ struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; __u8 SetupCount; /* four setup words follow subcommand */ /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 2 = IOCTL/FSCTL */ - __u32 FunctionCode; + __le16 SubCommand;/* 2 = IOCTL/FSCTL */ + __le32 FunctionCode; __u16 Fid; __u8 IsFsctl; /* 1 = File System Control, 0 = device control (IOCTL)*/ __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/ - __u16 ByteCount; + __le16 ByteCount; __u8 Pad[3]; __u8 Data[1]; } TRANSACT_IOCTL_REQ; @@ -893,16 +893,16 @@ typedef struct smb_com_transaction_ioctl_rsp { struct smb_hdr hdr; /* wct = 19 */ __u8 Reserved[3]; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 ParameterDisplacement; - __u32 DataCount; - __u32 DataOffset; - __u32 DataDisplacement; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; __u8 SetupCount; /* 1 */ - __u16 ReturnedDataLen; + __le16 ReturnedDataLen; __u16 ByteCount; __u8 Pad[3]; } TRANSACT_IOCTL_RSP; @@ -911,22 +911,22 @@ struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; __u8 SetupCount; /* four setup words follow subcommand */ /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 4 = Change Notify */ - __u32 CompletionFilter; /* operation to monitor */ + __le16 SubCommand;/* 4 = Change Notify */ + __le32 CompletionFilter; /* operation to monitor */ __u16 Fid; __u8 WatchTree; /* 1 = Monitor subdirectories */ __u8 Reserved2; - __u16 ByteCount; + __le16 ByteCount; /* __u8 Pad[3];*/ /* __u8 Data[1];*/ } TRANSACT_CHANGE_NOTIFY_REQ; @@ -934,14 +934,14 @@ typedef struct smb_com_transaction_change_notify_rsp { struct smb_hdr hdr; /* wct = 18 */ __u8 Reserved[3]; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 ParameterDisplacement; - __u32 DataCount; - __u32 DataOffset; - __u32 DataDisplacement; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; __u8 SetupCount; /* 0 */ __u16 ByteCount; /* __u8 Pad[3]; */ @@ -1090,40 +1090,40 @@ typedef struct smb_com_transaction2_qpi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_QPI_REQ; typedef struct smb_com_transaction2_qpi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 Reserved; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1132,41 +1132,41 @@ typedef struct smb_com_transaction2_spi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_SPI_REQ; typedef struct smb_com_transaction2_spi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1174,49 +1174,49 @@ } TRANSACTION2_SPI_RSP; struct set_file_rename { - __u32 overwrite; /* 1 = overwrite dest */ + __le32 overwrite; /* 1 = overwrite dest */ __u32 root_fid; /* zero */ - __u32 target_name_len; + __le32 target_name_len; char target_name[0]; /* Must be unicode */ }; struct smb_com_transaction2_sfi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; __u16 Fid; - __u16 InformationLevel; + __le16 InformationLevel; __u16 Reserved4; }; struct smb_com_transaction2_sfi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1240,43 +1240,43 @@ typedef struct smb_com_transaction2_ffirst_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_FIRST */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_FIRST */ + __le16 ByteCount; __u8 Pad; - __u16 SearchAttributes; - __u16 SearchCount; - __u16 SearchFlags; - __u16 InformationLevel; - __u32 SearchStorageType; + __le16 SearchAttributes; + __le16 SearchCount; + __le16 SearchFlags; + __le16 InformationLevel; + __le32 SearchStorageType; char FileName[1]; } TRANSACTION2_FFIRST_REQ; typedef struct smb_com_transaction2_ffirst_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1284,61 +1284,61 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms { __u16 SearchHandle; - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FFIRST_RSP_PARMS; typedef struct smb_com_transaction2_fnext_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_NEXT */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_NEXT */ + __le16 ByteCount; __u8 Pad; __u16 SearchHandle; - __u16 SearchCount; - __u16 InformationLevel; + __le16 SearchCount; + __le16 InformationLevel; __u32 ResumeKey; - __u16 SearchFlags; + __le16 SearchFlags; char ResumeFileName[1]; } TRANSACTION2_FNEXT_REQ; typedef struct smb_com_transaction2_fnext_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; } TRANSACTION2_FNEXT_RSP; typedef struct smb_com_transaction2_fnext_rsp_parms { - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FNEXT_RSP_PARMS; /* QFSInfo Levels */ @@ -1354,38 +1354,38 @@ typedef struct smb_com_transaction2_qfsi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; } TRANSACTION2_QFSI_REQ; typedef struct smb_com_transaction_qfsi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1394,58 +1394,58 @@ typedef struct smb_com_transaction2_get_dfs_refer_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ - __u16 MaxReferralLevel; + __le16 MaxReferralLevel; char RequestFileName[1]; } TRANSACTION2_GET_DFS_REFER_REQ; typedef struct dfs_referral_level_3 { - __u16 VersionNumber; - __u16 ReferralSize; - __u16 ServerType; /* 0x0001 = CIFS server */ - __u16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ - __u16 TimeToLive; - __u16 Proximity; - __u16 DfsPathOffset; - __u16 DfsAlternatePathOffset; - __u16 NetworkAddressOffset; + __le16 VersionNumber; + __le16 ReferralSize; + __le16 ServerType; /* 0x0001 = CIFS server */ + __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ + __le16 TimeToLive; + __le16 Proximity; + __le16 DfsPathOffset; + __le16 DfsAlternatePathOffset; + __le16 NetworkAddressOffset; } REFERRAL3; typedef struct smb_com_transaction_get_dfs_refer_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* zero setup words following */ __u16 ByteCount; __u8 Pad; - __u16 PathConsumed; - __u16 NumberOfReferrals; - __u16 DFSFlags; + __le16 PathConsumed; + __le16 NumberOfReferrals; + __le16 DFSFlags; __u16 Pad2; REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ /* followed by the strings pointed to by the referral structures */ @@ -1531,16 +1531,16 @@ }; typedef struct { - __u64 TotalAllocationUnits; - __u64 FreeAllocationUnits; - __u32 SectorsPerAllocationUnit; - __u32 BytesPerSector; + __le64 TotalAllocationUnits; + __le64 FreeAllocationUnits; + __le32 SectorsPerAllocationUnit; + __le32 BytesPerSector; } FILE_SYSTEM_INFO; /* size info, level 0x103 */ typedef struct { - __u16 MajorVersionNumber; - __u16 MinorVersionNumber; - __u64 Capability; + __le16 MajorVersionNumber; + __le16 MinorVersionNumber; + __le64 Capability; } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ /* Linux/Unix extensions capability flags */ #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ @@ -1567,55 +1567,55 @@ #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 typedef struct { - __u32 DeviceType; - __u32 DeviceCharacteristics; + __le32 DeviceType; + __le32 DeviceCharacteristics; } FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ typedef struct { - __u32 Attributes; - __u32 MaxPathNameComponentLength; - __u32 FileSystemNameLen; + __le32 Attributes; + __le32 MaxPathNameComponentLength; + __le32 FileSystemNameLen; char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ } FILE_SYSTEM_ATTRIBUTE_INFO; typedef struct { /* data block encoding of response to level 263 QPathInfo */ - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad1; - __u64 AllocationSize; - __u64 EndOfFile; /* size ie offset to first free byte in file */ - __u32 NumberOfLinks; /* hard links */ + __le64 AllocationSize; + __le64 EndOfFile; /* size ie offset to first free byte in file */ + __le32 NumberOfLinks; /* hard links */ __u8 DeletePending; __u8 Directory; __u16 Pad2; __u64 IndexNumber; - __u32 EASize; - __u32 AccessFlags; + __le32 EASize; + __le32 AccessFlags; __u64 IndexNumber1; - __u64 CurrentByteOffset; - __u32 Mode; - __u32 AlignmentRequirement; - __u32 FileNameLength; + __le64 CurrentByteOffset; + __le32 Mode; + __le32 AlignmentRequirement; + __le32 FileNameLength; char FileName[1]; } FILE_ALL_INFO; /* level 263 QPathInfo */ typedef struct { - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le64 Permissions; + __le64 Nlinks; } FILE_UNIX_BASIC_INFO; /* level 512 QPathInfo */ typedef struct { @@ -1645,52 +1645,52 @@ #define UNIX_SOCKET 6 typedef struct { - __u32 NextEntryOffset; - __u32 ResumeKey; - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; - __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le32 NextEntryOffset; + __le32 ResumeKey; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; + __le64 UniqueId; + __le64 Permissions; + __le64 Nlinks; char FileName[1]; } FILE_UNIX_INFO; typedef struct { - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad; } FILE_BASIC_INFO; /* size info, level 0x101 */ struct file_allocation_info { - __u64 AllocationSize; + __le64 AllocationSize; }; /* size info, level 0x103 */ struct file_end_of_file_info { - __u64 FileSize; /* offset to end of file */ + __le64 FileSize; /* offset to end of file */ }; /* size info, level 0x104 */ typedef struct { - __u32 NextEntryOffset; + __le32 NextEntryOffset; __u32 FileIndex; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u64 EndOfFile; - __u64 AllocationSize; - __u32 ExtFileAttributes; - __u32 FileNameLength; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le64 EndOfFile; + __le64 AllocationSize; + __le32 ExtFileAttributes; + __le32 FileNameLength; char FileName[1]; } FILE_DIRECTORY_INFO; /* level 257 FF response data area */ @@ -1707,7 +1707,7 @@ struct fea { unsigned char EA_flags; __u8 name_len; - __u16 value_len; + __le16 value_len; char name[1]; /* optionally followed by value */ }; @@ -1715,7 +1715,7 @@ #define FEA_NEEDEA 0x80 /* need EA bit */ struct fealist { - __u32 list_len; + __le32 list_len; struct fea list[1]; }; diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c --- a/fs/cifs/cifssmb.c 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/cifssmb.c 2004-09-21 20:52:51 -07:00 @@ -183,6 +183,7 @@ int rc = 0; int bytes_returned; struct TCP_Server_Info * server; + u16 count; if(ses->server) server = ses->server; @@ -199,12 +200,12 @@ if (extended_security) pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; - pSMB->ByteCount = strlen(protocols[0].name) + 1; + count = strlen(protocols[0].name) + 1; strncpy(pSMB->DialectsArray, protocols[0].name, 30); /* null guaranteed to be at end of source and target buffers anyway */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -236,7 +237,7 @@ if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) && (server->capabilities & CAP_EXTENDED_SECURITY)) { - __u16 count = le16_to_cpu(pSMBr->ByteCount); + count = pSMBr->ByteCount; if (count < 16) rc = -EIO; else if (count == 16) { @@ -435,10 +436,9 @@ } pSMB->SearchAttributes = cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM); - pSMB->ByteCount = name_len + 1; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -487,10 +487,9 @@ strncpy(pSMB->DirName, dirName, name_len); } - pSMB->ByteCount = name_len + 1; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -538,10 +537,9 @@ strncpy(pSMB->DirName, name, name_len); } - pSMB->ByteCount = name_len + 1 /* for buf format */ ; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -571,6 +569,7 @@ OPEN_RSP *pSMBr = NULL; int bytes_returned; int name_len; + __u16 count; openRetry: rc = smb_init(SMB_COM_NT_CREATE_ANDX, 24, tcon, (void **) &pSMB, @@ -581,7 +580,7 @@ pSMB->AndXCommand = 0xFF; /* none */ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { - pSMB->ByteCount = 1; /* account for one byte pad to word boundary */ + count = 1; /* account for one byte pad to word boundary */ name_len = cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), fileName, 530 @@ -591,7 +590,7 @@ name_len *= 2; pSMB->NameLength = cpu_to_le16(name_len); } else { /* BB improve the check for buffer overruns BB */ - pSMB->ByteCount = 0; /* no pad */ + count = 0; /* no pad */ name_len = strnlen(fileName, 530); name_len++; /* trailing null */ pSMB->NameLength = cpu_to_le16(name_len); @@ -604,30 +603,29 @@ } pSMB->DesiredAccess = cpu_to_le32(access_flags); pSMB->AllocationSize = 0; - pSMB->FileAttributes = ATTR_NORMAL; + pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); /* XP does not handle ATTR_POSIX_SEMANTICS */ /* but it helps speed up case sensitive checks for other servers such as Samba */ if (tcon->ses->capabilities & CAP_UNIX) - pSMB->FileAttributes |= ATTR_POSIX_SEMANTICS; + pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); /* if ((omode & S_IWUGO) == 0) - pSMB->FileAttributes |= ATTR_READONLY;*/ + pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ /* Above line causes problems due to vfs splitting create into two pieces - need to set mode after file created not while it is being created */ - pSMB->FileAttributes = cpu_to_le32(pSMB->FileAttributes); pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); pSMB->CreateDisposition = cpu_to_le32(openDisposition); pSMB->CreateOptions = cpu_to_le32(create_options); pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); /* BB ??*/ pSMB->SecurityFlags = - cpu_to_le32(SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY); + SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY; - pSMB->ByteCount += name_len; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + count += name_len; + pSMB->hdr.smb_buf_length += count; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(count); /* long_op set to 1 to allow for oplock break timeouts */ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 1); @@ -699,24 +697,24 @@ if (rc) { cERROR(1, ("Send error in read = %d", rc)); } else { - pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength); - *nbytes = pSMBr->DataLength; + __u16 data_length = le16_to_cpu(pSMBr->DataLength); + *nbytes = data_length; /*check that DataLength would not go beyond end of SMB */ - if ((pSMBr->DataLength > CIFS_MAX_MSGSIZE) - || (pSMBr->DataLength > count)) { - cFYI(1,("bad length %d for count %d",pSMBr->DataLength,count)); + if ((data_length > CIFS_MAX_MSGSIZE) + || (data_length > count)) { + cFYI(1,("bad length %d for count %d",data_length,count)); rc = -EIO; *nbytes = 0; } else { pReadData = (char *) (&pSMBr->hdr.Protocol) + le16_to_cpu(pSMBr->DataOffset); -/* if(rc = copy_to_user(buf, pReadData, pSMBr->DataLength)) { +/* if(rc = copy_to_user(buf, pReadData, data_length)) { cERROR(1,("Faulting on read rc = %d",rc)); rc = -EFAULT; }*/ /* can not use copy_to_user when using page cache*/ if(*buf) - memcpy(*buf,pReadData,pSMBr->DataLength); + memcpy(*buf,pReadData,data_length); } } if (pSMB) { @@ -741,6 +739,8 @@ WRITE_REQ *pSMB = NULL; WRITE_RSP *pSMBr = NULL; int bytes_returned; + unsigned bytes_sent; + __u16 byte_count; rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB, (void **) &pSMBr); @@ -755,21 +755,20 @@ pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); pSMB->OffsetHigh = cpu_to_le32(offset >> 32); pSMB->Remaining = 0; - if (count > ((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00)) - pSMB->DataLengthLow = - (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00; - else - pSMB->DataLengthLow = count; + bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & ~0xFF; + if (bytes_sent > count) + bytes_sent = count; pSMB->DataLengthHigh = 0; pSMB->DataOffset = cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4); - memcpy(pSMB->Data,buf,pSMB->DataLengthLow); + memcpy(pSMB->Data,buf,bytes_sent); - pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ; - pSMB->DataLengthLow = cpu_to_le16(pSMB->DataLengthLow); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + byte_count = bytes_sent + 1 /* pad */ ; + pSMB->DataLengthLow = cpu_to_le16(bytes_sent); + pSMB->DataLengthHigh = 0; + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, long_op); @@ -812,7 +811,7 @@ pSMB->Timeout = 0; } else if (waitFlag == TRUE) { timeout = 3; /* blocking operation, no timeout */ - pSMB->Timeout = -1; /* blocking - do not time out */ + pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ } else { pSMB->Timeout = 0; } @@ -900,6 +899,7 @@ RENAME_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSSMBRename")); renameRetry: @@ -941,9 +941,9 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* 1st signature byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -977,6 +977,7 @@ int rc = 0; int bytes_returned = 0; int len_of_str; + __u16 params, param_offset, offset, count, byte_count; cFYI(1, ("Rename to File by handle")); rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB, @@ -984,28 +985,27 @@ if (rc) return rc; - pSMB->ParameterCount = 6; + params = 6; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, - Fid) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; rename_info = (struct set_file_rename *) data_offset; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); /* construct random name ".cifs_tmp" */ rename_info->overwrite = cpu_to_le32(1); rename_info->root_fid = 0; @@ -1017,16 +1017,16 @@ len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage); } rename_info->target_name_len = cpu_to_le32(2 * len_of_str); - pSMB->DataCount = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; - pSMB->ByteCount += pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; + byte_count += count; + pSMB->DataCount = cpu_to_le16(count); pSMB->TotalDataCount = pSMB->DataCount; pSMB->Fid = netfid; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_RENAME_INFORMATION); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1056,6 +1056,7 @@ COPY_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSSMBCopy")); copyRetry: @@ -1067,9 +1068,7 @@ pSMB->BufferFormat = 0x04; pSMB->Tid2 = target_tid; - if(flags & COPY_TREE) - pSMB->Flags |= COPY_TREE; - pSMB->Flags = cpu_to_le16(pSMB->Flags); + pSMB->Flags = cpu_to_le16(flags & COPY_TREE); if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, @@ -1098,15 +1097,15 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* 1st signature byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in copy = %d with %d files copied", - rc, pSMBr->CopyCount)); + rc, le16_to_cpu(pSMBr->CopyCount))); } if (pSMB) cifs_buf_release(pSMB); @@ -1129,6 +1128,7 @@ int name_len_target; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, offset, byte_count; cFYI(1, ("In Symlink Unix style")); createSymLinkRetry: @@ -1150,17 +1150,17 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, fromName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len_target = cifs_strtoUCS((wchar_t *) data_offset, toName, 530 @@ -1174,24 +1174,23 @@ strncpy(data_offset, toName, name_len_target); } - pSMB->DataCount = name_len_target; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max on data count below from sess */ pSMB->MaxDataCount = cpu_to_le16(1000); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + name_len_target; + pSMB->DataCount = cpu_to_le16(name_len_target); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_LINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1221,6 +1220,7 @@ int name_len_target; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, offset, byte_count; cFYI(1, ("In Create Hard link Unix style")); createHardLinkRetry: @@ -1241,17 +1241,17 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, toName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len_target = cifs_strtoUCS((wchar_t *) data_offset, fromName, 530 @@ -1265,24 +1265,23 @@ strncpy(data_offset, fromName, name_len_target); } - pSMB->DataCount = name_len_target; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max on data count below from sess*/ pSMB->MaxDataCount = cpu_to_le16(1000); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + name_len_target; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + pSMB->DataCount = cpu_to_le16(name_len_target); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_HLINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1307,6 +1306,7 @@ RENAME_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSCreateHardLink")); winCreateHardLinkRetry: @@ -1351,9 +1351,9 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* string type byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* string type byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1380,6 +1380,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathSymLinkInfo (Unix) for path %s", searchName)); @@ -1402,8 +1403,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = - 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; + params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max data count below from sess structure BB */ @@ -1420,38 +1420,38 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QuerySymLinkInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); - if ((pSMBr->ByteCount < 2) || (pSMBr->DataOffset > 512)) + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + __u16 count = le16_to_cpu(pSMBr->DataCount); + if ((pSMBr->ByteCount < 2) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { name_len = UniStrnlen((wchar_t *) ((char *) - &pSMBr->hdr.Protocol +pSMBr->DataOffset), - min_t(const int, buflen,pSMBr->DataCount) / 2); + &pSMBr->hdr.Protocol +data_offset), + min_t(const int, buflen,count) / 2); cifs_strfromUCS_le(symlinkinfo, (wchar_t *) ((char *)&pSMBr->hdr.Protocol + - pSMBr->DataOffset), + data_offset), name_len, nls_codepage); } else { strncpy(symlinkinfo, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, - min_t(const int, buflen, pSMBr->DataCount)); + data_offset, + min_t(const int, buflen, count)); } symlinkinfo[buflen] = 0; /* just in case so calling code does not go off the end of buffer */ @@ -1562,6 +1562,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathInfo path %s", searchName)); QPathInfoRetry: @@ -1583,8 +1584,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -1600,29 +1600,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QPathInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 40) || (data_offset > 512)) rc = -EIO; /* bad smb */ else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, sizeof (FILE_ALL_INFO)); + data_offset, sizeof (FILE_ALL_INFO)); } else rc = -ENOMEM; } @@ -1646,6 +1646,7 @@ int rc = 0; int bytes_returned = 0; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathInfo (Unix) the path %s", searchName)); UnixQPathInfoRetry: @@ -1667,8 +1668,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max SMB PDU from sess structure BB */ @@ -1685,31 +1685,31 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QPathInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check if enough total bytes returned */ if ((pSMBr->ByteCount < sizeof(FILE_UNIX_BASIC_INFO)) || - (pSMBr->DataOffset > 512) || - (pSMBr->DataOffset < sizeof(struct smb_hdr))) { + (data_offset > 512) || + (data_offset < sizeof(struct smb_hdr))) { cFYI(1,("UnixQPathinfo invalid data offset %d bytes returned %d", - (int)pSMBr->DataOffset,bytes_returned)); + (int)data_offset,bytes_returned)); rc = -EIO; /* bad smb */ } else { memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, + data_offset, sizeof (FILE_UNIX_BASIC_INFO)); } } @@ -1732,6 +1732,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In FindUnique")); findUniqueRetry: @@ -1753,7 +1754,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; + params = 12 + name_len /* includes null */ ; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -1769,8 +1770,8 @@ pSMB->SetupCount = 1; /* one byte, no need to le convert */ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalDataCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->SearchAttributes = cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | @@ -1779,8 +1780,8 @@ pSMB->SearchFlags = cpu_to_le16(1); pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1813,6 +1814,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In FindFirst")); findFirstRetry: @@ -1834,7 +1836,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; + params = 12 + name_len /* includes null */ ; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(10); pSMB->MaxDataCount = cpu_to_le16((tcon->ses->server->maxBuf - @@ -1844,8 +1846,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof(struct smb_com_transaction2_ffirst_req, SearchAttributes) - 4); @@ -1870,8 +1872,8 @@ *pUnixFlag = FALSE; } pSMB->SearchStorageType = 0; /* BB what should we set this to? It is not clear if it matters BB */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1888,11 +1890,6 @@ (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->ParameterOffset), sizeof (T2_FFIRST_RSP_PARMS)); - /* search handle can stay LE and EAoffset not needed so not converted */ - findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); - findParms->LastNameOffset = - le16_to_cpu(findParms->LastNameOffset); - findParms->SearchCount = le16_to_cpu(findParms->SearchCount); response_data = (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->DataOffset); @@ -1919,6 +1916,7 @@ char *response_data; int rc = 0; int bytes_returned; + __u16 params, byte_count; cFYI(1, ("In FindNext")); @@ -1930,7 +1928,8 @@ if (rc) return rc; - pSMB->TotalParameterCount = 14; /* includes 2 bytes of null string, converted to LE below */ + params = 14; /* includes 2 bytes of null string, converted to LE below */ + byte_count = 0; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(8); pSMB->MaxDataCount = @@ -1966,15 +1965,15 @@ /* BB add check to make sure we do not cross end of smb */ if(name_len < CIFS_MAX_MSGSIZE) { memcpy(pSMB->ResumeFileName, resume_file_name, name_len); - pSMB->ByteCount += name_len; + byte_count += name_len; } - pSMB->TotalParameterCount += name_len; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + params += name_len; + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; /* BB improve error handling here */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1994,10 +1993,6 @@ (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->ParameterOffset), sizeof (T2_FNEXT_RSP_PARMS)); - findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); - findParms->LastNameOffset = - le16_to_cpu(findParms->LastNameOffset); - findParms->SearchCount = le16_to_cpu(findParms->SearchCount); response_data = (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->DataOffset); @@ -2063,6 +2058,7 @@ int name_len; unsigned int i; char * temp; + __u16 params, byte_count; *number_of_UNC_in_array = 0; *targetUNCs = NULL; @@ -2099,7 +2095,7 @@ strncpy(pSMB->RequestFileName, searchName, name_len); } - pSMB->ParameterCount = 2 /* level */ + name_len /*includes null */ ; + params = 2 /* level */ + name_len /*includes null */ ; pSMB->TotalDataCount = 0; pSMB->DataCount = 0; pSMB->DataOffset = 0; @@ -2115,12 +2111,12 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL); - pSMB->ByteCount = pSMB->ParameterCount + 3 /* pad */ ; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = params + 3 /* pad */ ; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->MaxReferralLevel = cpu_to_le16(3); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -2128,20 +2124,21 @@ cFYI(1, ("Send error in GetDFSRefer = %d", rc)); } else { /* decode response */ /* BB Add logic to parse referrals here */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_count = le16_to_cpu(pSMBr->DataCount); cFYI(1, ("Decoding GetDFSRefer response. BCC: %d Offset %d", - pSMBr->ByteCount, pSMBr->DataOffset)); - if ((pSMBr->ByteCount < 17) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ + pSMBr->ByteCount, data_offset)); + if ((pSMBr->ByteCount < 17) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { referrals = (struct dfs_referral_level_3 *) (8 /* sizeof start of data block */ + - pSMBr->DataOffset + + data_offset + (char *) &pSMBr->hdr.Protocol); - cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x",pSMBr->NumberOfReferrals,pSMBr->DFSFlags, referrals->ReferralSize,referrals->ServerType,referrals->ReferralFlags,referrals->TimeToLive)); + cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x", + le16_to_cpu(pSMBr->NumberOfReferrals),le16_to_cpu(pSMBr->DFSFlags), le16_to_cpu(referrals->ReferralSize),le16_to_cpu(referrals->ServerType),le16_to_cpu(referrals->ReferralFlags),le16_to_cpu(referrals->TimeToLive))); /* BB This field is actually two bytes in from start of data block so we could do safety check that DataBlock begins at address of pSMBr->NumberOfReferrals */ @@ -2155,19 +2152,19 @@ name_len = 0; for(i=0;i<*number_of_UNC_in_array;i++) { /* make sure that DfsPathOffset not past end */ - referrals->DfsPathOffset = le16_to_cpu(referrals->DfsPathOffset); - if(referrals->DfsPathOffset > pSMBr->DataCount) { + __u16 offset = le16_to_cpu(referrals->DfsPathOffset); + if (offset > data_count) { /* if invalid referral, stop here and do not try to copy any more */ *number_of_UNC_in_array = i; break; } - temp = ((char *)referrals) + referrals->DfsPathOffset; + temp = ((char *)referrals) + offset; if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { - name_len += UniStrnlen((wchar_t *)temp,pSMBr->DataCount); + name_len += UniStrnlen((wchar_t *)temp,data_count); } else { - name_len += strnlen(temp,pSMBr->DataCount); + name_len += strnlen(temp,data_count); } referrals++; /* BB add check that referral pointer does not fall off end PDU */ @@ -2184,11 +2181,11 @@ referrals = (struct dfs_referral_level_3 *) (8 /* sizeof data hdr */ + - pSMBr->DataOffset + + data_offset + (char *) &pSMBr->hdr.Protocol); for(i=0;i<*number_of_UNC_in_array;i++) { - temp = ((char *)referrals) + referrals->DfsPathOffset; + temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset); if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { cifs_strfromUCS_le(*targetUNCs, (wchar_t *) temp, name_len, nls_codepage); @@ -2223,6 +2220,7 @@ FILE_SYSTEM_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSInfo")); QFSInfoRetry: @@ -2231,7 +2229,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2240,8 +2238,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2251,25 +2249,25 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); cFYI(1, ("Decoding qfsinfo response. BCC: %d Offset %d", - pSMBr->ByteCount, pSMBr->DataOffset)); - if ((pSMBr->ByteCount < 24) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ + pSMBr->ByteCount, data_offset)); + if ((pSMBr->ByteCount < 24) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { response_data = (FILE_SYSTEM_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); + data_offset); FSData->f_bsize = le32_to_cpu(response_data->BytesPerSector) * le32_to_cpu(response_data-> @@ -2304,6 +2302,7 @@ FILE_SYSTEM_ATTRIBUTE_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSAttributeInfo")); QFSAttributeRetry: @@ -2312,7 +2311,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2321,8 +2320,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2332,27 +2331,22 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSAttributeInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { /* BB also check enough bytes returned */ + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + if ((pSMBr->ByteCount < 13) || (data_offset > 512)) { /* BB also check enough bytes returned */ rc = -EIO; /* bad smb */ } else { response_data = (FILE_SYSTEM_ATTRIBUTE_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->Attributes = le32_to_cpu(response_data->Attributes); - response_data->MaxPathNameComponentLength = - le32_to_cpu(response_data->MaxPathNameComponentLength); - response_data->FileSystemNameLen = - le32_to_cpu(response_data->FileSystemNameLen); + data_offset); memcpy(&tcon->fsAttrInfo, response_data, sizeof (FILE_SYSTEM_ATTRIBUTE_INFO)); } @@ -2376,6 +2370,7 @@ FILE_SYSTEM_DEVICE_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSDeviceInfo")); QFSDeviceRetry: @@ -2384,7 +2379,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2393,8 +2388,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2405,27 +2400,23 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QFSDeviceInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO)) - || (pSMBr->DataOffset > 512)) + || (data_offset > 512)) rc = -EIO; /* bad smb */ else { response_data = (FILE_SYSTEM_DEVICE_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->DeviceType = - le32_to_cpu(response_data->DeviceType); - response_data->DeviceCharacteristics = - le32_to_cpu(response_data->DeviceCharacteristics); + data_offset); memcpy(&tcon->fsDevInfo, response_data, sizeof (FILE_SYSTEM_DEVICE_INFO)); } @@ -2449,6 +2440,7 @@ FILE_SYSTEM_UNIX_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSUnixInfo")); QFSUnixRetry: @@ -2457,7 +2449,7 @@ if (rc) return rc; - pSMB->ParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->DataCount = 0; pSMB->DataOffset = 0; @@ -2468,8 +2460,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof(struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2477,28 +2469,22 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSUnixInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset); - if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + if ((pSMBr->ByteCount < 13) || (data_offset > 512)) { rc = -EIO; /* bad smb */ } else { response_data = (FILE_SYSTEM_UNIX_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->MajorVersionNumber = - le16_to_cpu(response_data->MajorVersionNumber); - response_data->MinorVersionNumber = - le16_to_cpu(response_data->MinorVersionNumber); - response_data->Capability = - le64_to_cpu(response_data->Capability); + data_offset); memcpy(&tcon->fsUnixInfo, response_data, sizeof (FILE_SYSTEM_UNIX_INFO)); } @@ -2529,6 +2515,7 @@ int name_len; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count, data_count, param_offset, offset; cFYI(1, ("In SetEOF")); SetEOFRetry: @@ -2549,8 +2536,8 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (struct file_end_of_file_info); + params = 6 + name_len; + data_count = sizeof (struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ pSMB->MaxSetupCount = 0; @@ -2558,9 +2545,9 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; if(SetAllocation) { if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) pSMB->InformationLevel = @@ -2579,21 +2566,21 @@ parm_data = (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + byte_count = 3 /* pad */ + params + data_count; + pSMB->DataCount = cpu_to_le16(data_count); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; parm_data->FileSize = cpu_to_le64(size); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2619,7 +2606,7 @@ struct file_end_of_file_info *parm_data; int rc = 0; int bytes_returned = 0; - __u32 tmp; + __u16 params, param_offset, offset, byte_count, count; cFYI(1, ("SetFileSize (via SetFileInfo) %lld", (long long)size)); @@ -2628,40 +2615,36 @@ if (rc) return rc; - tmp = cpu_to_le32(pid_of_opener); /* override pid of current process - so network fid will be valid */ - pSMB->hdr.Pid = tmp & 0xFFFF; - tmp >>= 16; - pSMB->hdr.PidHigh = tmp & 0xFFFF; + pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); + pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); - pSMB->ParameterCount = 6; + params = 6; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, - Fid) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; - pSMB->DataCount = sizeof(struct file_end_of_file_info); + count = sizeof(struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + count; + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); parm_data = (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); /* now safe to change to le */ + offset); + pSMB->DataOffset = cpu_to_le16(offset); parm_data->FileSize = cpu_to_le64(size); pSMB->Fid = fid; if(SetAllocation) { @@ -2680,8 +2663,8 @@ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); } pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2710,6 +2693,7 @@ int rc = 0; int bytes_returned = 0; char *data_offset; + __u16 params, param_offset, offset, byte_count, count; cFYI(1, ("In SetTimes")); @@ -2732,8 +2716,8 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_BASIC_INFO); + params = 6 + name_len; + count = sizeof (FILE_BASIC_INFO); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2741,19 +2725,19 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset = param_offset + params; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; + byte_count = 3 /* pad */ + params + count; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) @@ -2761,9 +2745,9 @@ else pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; memcpy(data_offset, data, sizeof (FILE_BASIC_INFO)); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2779,7 +2763,6 @@ return rc; } - int CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName, FILE_INFO_STANDARD * data, const struct nls_table *nls_codepage) @@ -2790,6 +2773,7 @@ int rc = 0; int bytes_returned = 0; char *data_offset; + __u16 params, param_offset, count, offset, byte_count; cFYI(1, ("In SetTimesLegacy")); @@ -2813,8 +2797,8 @@ } /* BB fixme - we have to map to FILE_STANDARD_INFO (level 1 info in parent function, from the better and ususal FILE_BASIC_INFO */ - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_INFO_STANDARD); + params = 6 + name_len; + count = sizeof (FILE_INFO_STANDARD); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2822,19 +2806,19 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset = param_offset + params; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; + byte_count = 3 /* pad */ + params + count; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; /* I doubt that passthrough levels apply to this old @@ -2844,9 +2828,9 @@ else*/ pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD)); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2873,6 +2857,7 @@ int rc = 0; int bytes_returned = 0; FILE_UNIX_BASIC_INFO *data_offset; + __u16 params, param_offset, offset, count, byte_count; cFYI(1, ("In SetUID/GID/Mode")); setPermsRetry: @@ -2894,8 +2879,8 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_UNIX_BASIC_INFO); + params = 6 + name_len; + count = sizeof (FILE_UNIX_BASIC_INFO); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2903,25 +2888,25 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; data_offset = (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol + - pSMB->DataOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); + offset); + pSMB->DataOffset = cpu_to_le16(offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + byte_count = 3 /* pad */ + params + count; + pSMB->ParameterCount = cpu_to_le16(params); + pSMB->DataCount = cpu_to_le16(count); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->TotalDataCount = pSMB->DataCount; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; data_offset->Uid = cpu_to_le64(uid); data_offset->Gid = cpu_to_le64(gid); /* better to leave device as zero when it is */ @@ -2945,7 +2930,7 @@ data_offset->Type = cpu_to_le32(UNIX_SOCKET); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2994,7 +2979,6 @@ pSMB->Fid = netfid; /* file handle always le */ pSMB->ByteCount = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -3021,6 +3005,7 @@ int name_len; struct fea * temp_fea; char * temp_ptr; + __u16 params, byte_count; cFYI(1, ("In Query All EAs path %s", searchName)); QAllEAsRetry: @@ -3042,8 +3027,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -3059,29 +3043,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QueryAllEAs = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 4) || (data_offset > 512)) rc = -EIO; /* bad smb */ /* else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, kl); + data_offset, kl); }*/ else { /* check that length of list is not more than bcc */ /* check that each entry does not go beyond length @@ -3091,14 +3075,12 @@ struct fealist * ea_response_data; rc = 0; /* validate_trans2_offsets() */ - /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/ + /* BB to check if(start of smb + data_offset > &bcc+ bcc)*/ ea_response_data = (struct fealist *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - ea_response_data->list_len = - cpu_to_le32(ea_response_data->list_len); - cFYI(1,("ea length %d",ea_response_data->list_len)); - name_len = ea_response_data->list_len; + data_offset); + name_len = le32_to_cpu(ea_response_data->list_len); + cFYI(1,("ea length %d", name_len)); if(name_len <= 8) { /* returned EA size zeroed at top of function */ cFYI(1,("empty EA list returned from server")); @@ -3108,6 +3090,7 @@ temp_fea = ea_response_data->list; temp_ptr = (char *)temp_fea; while(name_len > 0) { + __u16 value_len; name_len -= 4; temp_ptr += 4; rc += temp_fea->name_len; @@ -3133,9 +3116,9 @@ /* account for trailing null */ name_len--; temp_ptr++; - temp_fea->value_len = cpu_to_le16(temp_fea->value_len); - name_len -= temp_fea->value_len; - temp_ptr += temp_fea->value_len; + value_len = le16_to_cpu(temp_fea->value_len); + name_len -= value_len; + temp_ptr += value_len; /* BB check that temp_ptr is still within smb BB*/ /* no trailing null to account for in value len */ /* go on to next EA */ @@ -3164,6 +3147,7 @@ int name_len; struct fea * temp_fea; char * temp_ptr; + __u16 params, byte_count; cFYI(1, ("In Query EA path %s", searchName)); QEARetry: @@ -3185,8 +3169,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -3202,29 +3185,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in Query EA = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 4) || (data_offset > 512)) rc = -EIO; /* bad smb */ /* else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, kl); + data_offset, kl); }*/ else { /* check that length of list is not more than bcc */ /* check that each entry does not go beyond length @@ -3234,14 +3217,12 @@ struct fealist * ea_response_data; rc = -ENOENT; /* validate_trans2_offsets() */ - /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/ + /* BB to check if(start of smb + data_offset > &bcc+ bcc)*/ ea_response_data = (struct fealist *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - ea_response_data->list_len = - cpu_to_le32(ea_response_data->list_len); - cFYI(1,("ea length %d",ea_response_data->list_len)); - name_len = ea_response_data->list_len; + data_offset); + name_len = le32_to_cpu(ea_response_data->list_len); + cFYI(1,("ea length %d", name_len)); if(name_len <= 8) { /* returned EA size zeroed at top of function */ cFYI(1,("empty EA list returned from server")); @@ -3253,15 +3234,16 @@ /* loop through checking if we have a matching name and then return the associated value */ while(name_len > 0) { + __u16 value_len; name_len -= 4; temp_ptr += 4; - temp_fea->value_len = cpu_to_le16(temp_fea->value_len); + value_len = le16_to_cpu(temp_fea->value_len); /* BB validate that value_len falls within SMB, even though maximum for name_len is 255 */ if(memcmp(temp_fea->name,ea_name, temp_fea->name_len) == 0) { /* found a match */ - rc = temp_fea->value_len; + rc = value_len; /* account for prefix user. and trailing null */ if(rc<=(int)buf_size) { memcpy(ea_value, @@ -3282,8 +3264,8 @@ /* account for trailing null */ name_len--; temp_ptr++; - name_len -= temp_fea->value_len; - temp_ptr += temp_fea->value_len; + name_len -= value_len; + temp_ptr += value_len; /* no trailing null to account for in value len */ /* go on to next EA */ temp_fea = (struct fea *)temp_ptr; @@ -3310,6 +3292,7 @@ int name_len; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, byte_count, offset, count; cFYI(1, ("In SetEA")); SetEARetry: @@ -3331,7 +3314,7 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; /* done calculating parms using name_len of file name, now use name_len to calculate length of ea name @@ -3341,7 +3324,7 @@ else name_len = strnlen(ea_name,255); - pSMB->DataCount = sizeof(*parm_data) + ea_value_len + name_len + 1; + count = sizeof(*parm_data) + ea_value_len + name_len + 1; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ pSMB->MaxSetupCount = 0; @@ -3349,23 +3332,23 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_EA); parm_data = (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - parm_data->list_len = (__u32)(pSMB->DataCount); + byte_count = 3 /* pad */ + params + count; + pSMB->DataCount = cpu_to_le16(count); + parm_data->list_len = cpu_to_le32(count); parm_data->list[0].EA_flags = 0; /* we checked above that name len is less than 255 */ parm_data->list[0].name_len = (__u8)name_len;; @@ -3382,11 +3365,11 @@ memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { diff -Nru a/fs/cifs/connect.c b/fs/cifs/connect.c --- a/fs/cifs/connect.c 2004-09-21 20:52:52 -07:00 +++ b/fs/cifs/connect.c 2004-09-21 20:52:52 -07:00 @@ -313,7 +313,7 @@ connected to port 139 (the NACK is since we do not begin with RFC1001 session initialize frame) */ - server->addr.sockAddr.sin_port = CIFS_PORT; + server->addr.sockAddr.sin_port = htons(CIFS_PORT); cifs_reconnect(server); csocket = server->ssocket; wake_up(&server->response_q); @@ -849,7 +849,7 @@ } static struct cifsTconInfo * -find_unc(__u32 new_target_ip_addr, char *uncName, char *userName) +find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) { struct list_head *tmp; struct cifsTconInfo *tcon; @@ -968,7 +968,7 @@ { int rc = 0; int connected = 0; - unsigned short int orig_port = 0; + __be16 orig_port = 0; if(*csocket == NULL) { rc = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket); @@ -1076,7 +1076,7 @@ { int rc = 0; int connected = 0; - unsigned short int orig_port = 0; + __be16 orig_port = 0; if(*csocket == NULL) { rc = sock_create_kern(PF_INET6, SOCK_STREAM, IPPROTO_TCP, csocket); @@ -1512,6 +1512,8 @@ int remaining_words = 0; int bytes_returned = 0; int len; + __u32 capabilities; + __u16 count; cFYI(1, ("In sesssetup ")); if(ses == NULL) @@ -1536,22 +1538,20 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req_no_secext.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS; + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req_no_secext.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req_no_secext.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req_no_secext.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req_no_secext.Capabilities = - cpu_to_le32(pSMB->req_no_secext.Capabilities); + pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities); /* pSMB->req_no_secext.CaseInsensitivePasswordLength = CIFS_SESSION_KEY_SIZE; */ pSMB->req_no_secext.CaseInsensitivePasswordLength = 0; @@ -1623,9 +1623,9 @@ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req_no_secext.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -1633,8 +1633,9 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - if (pSMBr->resp.Action & GUEST_LOGIN) + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* do we want to mark SesInfo struct ? */ ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ cFYI(1, ("UID = %d ", ses->Suid)); @@ -1642,11 +1643,9 @@ bcc_ptr = pByteArea(smb_buffer_response); if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < - pSMBr->resp.ByteCount))) { + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) - bcc_ptr += - pSMBr->resp.SecurityBlobLength; + bcc_ptr += blob_len; if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { if ((long) (bcc_ptr) % 2) { @@ -1764,6 +1763,8 @@ int remaining_words = 0; int bytes_returned = 0; int len; + __u32 capabilities; + __u16 count; cFYI(1, ("In spnego sesssetup ")); if(ses == NULL) @@ -1789,22 +1790,21 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); bcc_ptr = pByteArea(smb_buffer); @@ -1865,9 +1865,9 @@ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -1875,10 +1875,10 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ if (ses) { ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ @@ -1889,14 +1889,14 @@ if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) { bcc_ptr += - pSMBr->resp.SecurityBlobLength; + blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { @@ -2029,6 +2029,8 @@ int SecurityBlobLength = sizeof (NEGOTIATE_MESSAGE); PNEGOTIATE_MESSAGE SecurityBlob; PCHALLENGE_MESSAGE SecurityBlob2; + __u32 negotiate_flags, capabilities; + __u16 count; cFYI(1, ("In NTLMSSP sesssetup (negotiate) ")); if(ses == NULL) @@ -2056,35 +2058,34 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); bcc_ptr = (char *) &pSMB->req.SecurityBlob; SecurityBlob = (PNEGOTIATE_MESSAGE) bcc_ptr; strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); SecurityBlob->MessageType = NtLmNegotiate; - SecurityBlob->NegotiateFlags = + negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 | /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128; if(sign_CIFS_PDUs) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_SIGN; + negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN; if(ntlmv2_support) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; + negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2; /* setup pointers to domain name and workstation name */ bcc_ptr += SecurityBlobLength; @@ -2097,20 +2098,20 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->NegotiateFlags |= - NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; + __u16 len; + negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; strncpy(bcc_ptr, domain, 63); - SecurityBlob->DomainName.Length = strnlen(domain, 64); + len = strnlen(domain, 64); SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32((long) &SecurityBlob-> DomainString - (long) &SecurityBlob->Signature); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); } if (ses->capabilities & CAP_UNICODE) { if ((long) bcc_ptr % 2) { @@ -2147,28 +2148,27 @@ bcc_ptr++; /* empty domain field */ *bcc_ptr = 0; } - SecurityBlob->NegotiateFlags = - cpu_to_le32(SecurityBlob->NegotiateFlags); + SecurityBlob->NegotiateFlags = cpu_to_le32(negotiate_flags); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); if (smb_buffer_response->Status.CifsError == - (NT_STATUS_MORE_PROCESSING_REQUIRED)) + cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED)) rc = 0; if (rc) { /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = - le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); + + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* Do we want to set anything in SesInfo struct when guest login? */ @@ -2185,14 +2185,14 @@ cFYI(1, ("UID = %d ", ses->Suid)); if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { + if (pSMBr->resp.hdr.WordCount == 4) { - bcc_ptr += - pSMBr->resp.SecurityBlobLength; + bcc_ptr += blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } cFYI(1, ("NTLMSSP Challenge rcvd ")); @@ -2200,16 +2200,16 @@ memcpy(ses->server->cryptKey, SecurityBlob2->Challenge, CIFS_CRYPTO_KEY_SIZE); - if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2) + if(SecurityBlob2->NegotiateFlags & cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) *pNTLMv2_flag = TRUE; if((SecurityBlob2->NegotiateFlags & - NTLMSSP_NEGOTIATE_ALWAYS_SIGN) + cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) || (sign_CIFS_PDUs > 1)) ses->server->secMode |= SECMODE_SIGN_REQUIRED; if ((SecurityBlob2->NegotiateFlags & - NTLMSSP_NEGOTIATE_SIGN) && (sign_CIFS_PDUs)) + cpu_to_le32(NTLMSSP_NEGOTIATE_SIGN)) && (sign_CIFS_PDUs)) ses->server->secMode |= SECMODE_SIGN_ENABLED; @@ -2353,7 +2353,6 @@ return rc; } - static int CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *ntlm_session_key, int ntlmv2_flag, @@ -2372,6 +2371,8 @@ int len; int SecurityBlobLength = sizeof (AUTHENTICATE_MESSAGE); PAUTHENTICATE_MESSAGE SecurityBlob; + __u32 negotiate_flags, capabilities; + __u16 count; cFYI(1, ("In NTLMSSPSessSetup (Authenticate)")); if(ses == NULL) @@ -2400,36 +2401,35 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); bcc_ptr = (char *) &pSMB->req.SecurityBlob; SecurityBlob = (PAUTHENTICATE_MESSAGE) bcc_ptr; strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); SecurityBlob->MessageType = NtLmAuthenticate; bcc_ptr += SecurityBlobLength; - SecurityBlob->NegotiateFlags = + negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO | 0x80000000 | NTLMSSP_NEGOTIATE_128; if(sign_CIFS_PDUs) - SecurityBlob->NegotiateFlags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; + negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; if(ntlmv2_flag) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; + negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2; /* setup pointers to domain name and workstation name */ @@ -2460,36 +2460,36 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->DomainName.Length = + __u16 len = cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, nls_codepage); - SecurityBlob->DomainName.Length *= 2; + len *= 2; SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); } if (user == NULL) { SecurityBlob->UserName.Buffer = 0; SecurityBlob->UserName.Length = 0; SecurityBlob->UserName.MaximumLength = 0; } else { - SecurityBlob->UserName.Length = + __u16 len = cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64, nls_codepage); - SecurityBlob->UserName.Length *= 2; + len *= 2; SecurityBlob->UserName.MaximumLength = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); SecurityBlob->UserName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->UserName.Length; - SecurityBlobLength += SecurityBlob->UserName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->UserName.Length = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); } /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage); @@ -2529,34 +2529,33 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->NegotiateFlags |= - NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; + __u16 len; + negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; strncpy(bcc_ptr, domain, 63); - SecurityBlob->DomainName.Length = strnlen(domain, 64); + len = strnlen(domain, 64); SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; - SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + bcc_ptr += len; + SecurityBlobLength += len; + SecurityBlob->DomainName.Length = cpu_to_le16(len); } if (user == NULL) { SecurityBlob->UserName.Buffer = 0; SecurityBlob->UserName.Length = 0; SecurityBlob->UserName.MaximumLength = 0; } else { + __u16 len; strncpy(bcc_ptr, user, 63); - SecurityBlob->UserName.Length = strnlen(user, 64); + len = strnlen(user, 64); SecurityBlob->UserName.MaximumLength = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); SecurityBlob->UserName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->UserName.Length; - SecurityBlobLength += SecurityBlob->UserName.Length; - SecurityBlob->UserName.Length = - cpu_to_le16(SecurityBlob->UserName.Length); + bcc_ptr += len; + SecurityBlobLength += len; + SecurityBlob->UserName.Length = cpu_to_le16(len); } /* BB fill in our workstation name if known BB */ @@ -2569,12 +2568,11 @@ bcc_ptr++; /* null domain */ *bcc_ptr = 0; } - SecurityBlob->NegotiateFlags = - cpu_to_le32(SecurityBlob->NegotiateFlags); + SecurityBlob->NegotiateFlags = cpu_to_le32(negotiate_flags); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -2582,10 +2580,10 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ /* if(SecurityBlob2->MessageType != NtLm??){ cFYI("Unexpected message type on auth response is %d ")); @@ -2599,14 +2597,14 @@ /* response can have either 3 or 4 word count - Samba sends 3 */ if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) { bcc_ptr += - pSMBr->resp.SecurityBlobLength; + blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } cFYI(1, @@ -2747,9 +2745,10 @@ struct smb_hdr *smb_buffer_response; TCONX_REQ *pSMB; TCONX_RSP *pSMBr; - char *bcc_ptr; + unsigned char *bcc_ptr; int rc = 0; int length; + __u16 count; if (ses == NULL) return -EIO; @@ -2769,7 +2768,7 @@ pSMB->AndXCommand = 0xFF; pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO); pSMB->PasswordLength = cpu_to_le16(1); /* minimum */ - bcc_ptr = &(pSMB->Password[0]); + bcc_ptr = &pSMB->Password[0]; bcc_ptr++; /* skip password */ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) @@ -2795,16 +2794,16 @@ strcpy(bcc_ptr, "?????"); bcc_ptr += strlen("?????"); bcc_ptr += 1; - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = bcc_ptr - &pSMB->Password[0]; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0); /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */ /* above now done in SendReceive */ if ((rc == 0) && (tcon != NULL)) { - tcon->tidStatus = CifsGood; + tcon->tidStatus = CifsGood; tcon->tid = smb_buffer_response->Tid; bcc_ptr = pByteArea(smb_buffer_response); length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2); @@ -2813,8 +2812,8 @@ strncpy(tcon->treeName, tree, MAX_TREE_SIZE); if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { length = UniStrnlen((wchar_t *) bcc_ptr, 512); - if (((long) bcc_ptr + (2 * length)) - - (long) pByteArea(smb_buffer_response) <= + if ((bcc_ptr + (2 * length)) - + pByteArea(smb_buffer_response) <= BCC(smb_buffer_response)) { if(tcon->nativeFileSystem) kfree(tcon->nativeFileSystem); @@ -2831,8 +2830,8 @@ /* else do not bother copying these informational fields */ } else { length = strnlen(bcc_ptr, 1024); - if (((long) bcc_ptr + length) - - (long) pByteArea(smb_buffer_response) <= + if ((bcc_ptr + length) - + pByteArea(smb_buffer_response) <= BCC(smb_buffer_response)) { if(tcon->nativeFileSystem) kfree(tcon->nativeFileSystem); diff -Nru a/fs/cifs/file.c b/fs/cifs/file.c --- a/fs/cifs/file.c 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/file.c 2004-09-21 20:52:51 -07:00 @@ -1348,12 +1348,11 @@ { struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); + __u32 attr = le32_to_cpu(pfindData->ExtFileAttributes); + __u64 allocation_size = le64_to_cpu(pfindData->AllocationSize); + __u64 end_of_file = le64_to_cpu(pfindData->EndOfFile); - pfindData->ExtFileAttributes = - le32_to_cpu(pfindData->ExtFileAttributes); - pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); - pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); - cifsInfo->cifsAttrs = pfindData->ExtFileAttributes; + cifsInfo->cifsAttrs = attr; cifsInfo->time = jiffies; /* Linux can not store file creation time unfortunately so ignore it */ @@ -1376,12 +1375,12 @@ cFYI(0, ("CIFS FFIRST: Attributes came in as 0x%x", - pfindData->ExtFileAttributes)); - if (pfindData->ExtFileAttributes & ATTR_REPARSE) { + attr)); + if (attr & ATTR_REPARSE) { *pobject_type = DT_LNK; /* BB can this and S_IFREG or S_IFDIR be set as in Windows? */ tmp_inode->i_mode |= S_IFLNK; - } else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) { + } else if (attr & ATTR_DIRECTORY) { *pobject_type = DT_DIR; /* override default perms since we do not lock dirs */ if(atomic_read(&cifsInfo->inUse) == 0) { @@ -1391,7 +1390,7 @@ } else { *pobject_type = DT_REG; tmp_inode->i_mode |= S_IFREG; - if(pfindData->ExtFileAttributes & ATTR_READONLY) + if(attr & ATTR_READONLY) tmp_inode->i_mode &= ~(S_IWUGO); }/* could add code here - to validate if device or weird share type? */ @@ -1404,14 +1403,14 @@ if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - i_size_write(tmp_inode,pfindData->EndOfFile); + i_size_write(tmp_inode,end_of_file); /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation, even though the reported blocksize is larger */ - tmp_inode->i_blocks = (512 - 1 + pfindData->AllocationSize) >> 9; + tmp_inode->i_blocks = (512 - 1 + allocation_size) >> 9; } - if (pfindData->AllocationSize < pfindData->EndOfFile) + if (allocation_size < end_of_file) cFYI(1, ("Possible sparse file: allocation size less than end of file ")); cFYI(1, ("File Size %ld and blocks %ld and blocksize %ld", @@ -1441,6 +1440,9 @@ FILE_UNIX_INFO * pfindData, int *pobject_type) { struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); + __u32 type = le32_to_cpu(pfindData->Type); + __u64 num_of_bytes = le64_to_cpu(pfindData->NumOfBytes); + __u64 end_of_file = le64_to_cpu(pfindData->EndOfFile); cifsInfo->time = jiffies; atomic_inc(&cifsInfo->inUse); @@ -1452,30 +1454,29 @@ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange)); tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); - pfindData->Type = le32_to_cpu(pfindData->Type); - if (pfindData->Type == UNIX_FILE) { + if (type == UNIX_FILE) { *pobject_type = DT_REG; tmp_inode->i_mode |= S_IFREG; - } else if (pfindData->Type == UNIX_SYMLINK) { + } else if (type == UNIX_SYMLINK) { *pobject_type = DT_LNK; tmp_inode->i_mode |= S_IFLNK; - } else if (pfindData->Type == UNIX_DIR) { + } else if (type == UNIX_DIR) { *pobject_type = DT_DIR; tmp_inode->i_mode |= S_IFDIR; - } else if (pfindData->Type == UNIX_CHARDEV) { + } else if (type == UNIX_CHARDEV) { *pobject_type = DT_CHR; tmp_inode->i_mode |= S_IFCHR; tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), le64_to_cpu(pfindData->DevMinor) & MINORMASK); - } else if (pfindData->Type == UNIX_BLOCKDEV) { + } else if (type == UNIX_BLOCKDEV) { *pobject_type = DT_BLK; tmp_inode->i_mode |= S_IFBLK; tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), le64_to_cpu(pfindData->DevMinor) & MINORMASK); - } else if (pfindData->Type == UNIX_FIFO) { + } else if (type == UNIX_FIFO) { *pobject_type = DT_FIFO; tmp_inode->i_mode |= S_IFIFO; - } else if (pfindData->Type == UNIX_SOCKET) { + } else if (type == UNIX_SOCKET) { *pobject_type = DT_SOCK; tmp_inode->i_mode |= S_IFSOCK; } @@ -1484,17 +1485,15 @@ tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); - pfindData->NumOfBytes = le64_to_cpu(pfindData->NumOfBytes); if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); - i_size_write(tmp_inode,pfindData->EndOfFile); + i_size_write(tmp_inode,end_of_file); /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation, not the real blocksize */ - tmp_inode->i_blocks = (512 - 1 + pfindData->NumOfBytes) >> 9; + tmp_inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; } if (S_ISREG(tmp_inode->i_mode)) { @@ -1608,7 +1607,7 @@ int object_type,rc; pqstring->name = pfindData->FileName; - pqstring->len = pfindData->FileNameLength; + /* pqstring->len is already set by caller */ construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry); if((tmp_inode == NULL) || (tmp_dentry == NULL)) { @@ -1746,10 +1745,12 @@ rc = CIFSFindFirst(xid, pTcon, full_path, pfindData, &findParms, cifs_sb->local_nls, &Unicode, &UnixSearch); - cFYI(1, ("Count: %d End: %d ", findParms.SearchCount, - findParms.EndofSearch)); + cFYI(1, ("Count: %d End: %d ", + le16_to_cpu(findParms.SearchCount), + le16_to_cpu(findParms.EndofSearch))); if (rc == 0) { + __u16 count = le16_to_cpu(findParms.SearchCount); searchHandle = findParms.SearchHandle; if(file->private_data == NULL) file->private_data = @@ -1770,7 +1771,7 @@ renew_parental_timestamps(file->f_dentry); lastFindData = (FILE_DIRECTORY_INFO *) ((char *) pfindData + - findParms.LastNameOffset); + le16_to_cpu(findParms.LastNameOffset)); if((char *)lastFindData > (char *)pfindData + bufsize) { cFYI(1,("last search entry past end of packet")); rc = -EIO; @@ -1833,23 +1834,21 @@ pfindDataUnix->FileName, cifsFile->resume_name_length); } - for (i = 2; i < (unsigned int)findParms.SearchCount + 2; i++) { + for (i = 2; i < count + 2; i++) { if (UnixSearch == FALSE) { - pfindData->FileNameLength = - le32_to_cpu(pfindData->FileNameLength); + __u32 len = le32_to_cpu(pfindData->FileNameLength); if (Unicode == TRUE) - pfindData->FileNameLength = + len = cifs_strfromUCS_le (pfindData->FileName, (wchar_t *) pfindData->FileName, - (pfindData-> - FileNameLength) / 2, + len / 2, cifs_sb->local_nls); - qstring.len = pfindData->FileNameLength; - if (((qstring.len != 1) + qstring.len = len; + if (((len != 1) || (pfindData->FileName[0] != '.')) - && ((qstring.len != 2) + && ((len != 2) || (pfindData-> FileName[0] != '.') || (pfindData-> @@ -1917,7 +1916,7 @@ } /* end for loop */ if ((findParms.EndofSearch != 0) && cifsFile) { cifsFile->endOfSearch = TRUE; - if(findParms.SearchCount == 2) + if(findParms.SearchCount == cpu_to_le16(2)) cifsFile->emptyDir = TRUE; } } else { @@ -1948,13 +1947,14 @@ cifsFile->resume_key, &Unicode, &UnixSearch); cFYI(1,("Count: %d End: %d ", - findNextParms.SearchCount, - findNextParms.EndofSearch)); + le16_to_cpu(findNextParms.SearchCount), + le16_to_cpu(findNextParms.EndofSearch))); if ((rc == 0) && (findNextParms.SearchCount != 0)) { /* BB save off resume key, key name and name length */ + __u16 count = le16_to_cpu(findNextParms.SearchCount); lastFindData = (FILE_DIRECTORY_INFO *) ((char *) pfindData - + findNextParms.LastNameOffset); + + le16_to_cpu(findNextParms.LastNameOffset)); if((char *)lastFindData > (char *)pfindData + bufsize) { cFYI(1,("last search entry past end of packet")); rc = -EIO; @@ -2031,24 +2031,22 @@ cifsFile->resume_name_length); } - for (i = 0; i < findNextParms.SearchCount; i++) { - pfindData->FileNameLength = - le32_to_cpu(pfindData-> + for (i = 0; i < count; i++) { + __u32 len = le32_to_cpu(pfindData-> FileNameLength); if (UnixSearch == FALSE) { if (Unicode == TRUE) - pfindData->FileNameLength = + len = cifs_strfromUCS_le (pfindData->FileName, (wchar_t *) pfindData->FileName, - (pfindData->FileNameLength)/ 2, + len / 2, cifs_sb->local_nls); - qstring.len = - pfindData->FileNameLength; - if (((qstring.len != 1) + qstring.len = len; + if (((len != 1) || (pfindData->FileName[0] != '.')) - && ((qstring.len != 2) + && ((len != 2) || (pfindData->FileName[0] != '.') || (pfindData->FileName[1] != '.'))) { diff -Nru a/fs/cifs/inode.c b/fs/cifs/inode.c --- a/fs/cifs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/inode.c 2004-09-21 20:52:51 -07:00 @@ -76,6 +76,9 @@ } else { struct cifsInodeInfo *cifsInfo; + __u32 type = le32_to_cpu(findData.Type); + __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes); + __u64 end_of_file = le64_to_cpu(findData.EndOfFile); /* get new inode */ if (*pinode == NULL) { @@ -101,37 +104,34 @@ inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); inode->i_mode = le64_to_cpu(findData.Permissions); - findData.Type = le32_to_cpu(findData.Type); - if (findData.Type == UNIX_FILE) { + if (type == UNIX_FILE) { inode->i_mode |= S_IFREG; - } else if (findData.Type == UNIX_SYMLINK) { + } else if (type == UNIX_SYMLINK) { inode->i_mode |= S_IFLNK; - } else if (findData.Type == UNIX_DIR) { + } else if (type == UNIX_DIR) { inode->i_mode |= S_IFDIR; - } else if (findData.Type == UNIX_CHARDEV) { + } else if (type == UNIX_CHARDEV) { inode->i_mode |= S_IFCHR; inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), le64_to_cpu(findData.DevMinor) & MINORMASK); - } else if (findData.Type == UNIX_BLOCKDEV) { + } else if (type == UNIX_BLOCKDEV) { inode->i_mode |= S_IFBLK; inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), le64_to_cpu(findData.DevMinor) & MINORMASK); - } else if (findData.Type == UNIX_FIFO) { + } else if (type == UNIX_FIFO) { inode->i_mode |= S_IFIFO; - } else if (findData.Type == UNIX_SOCKET) { + } else if (type == UNIX_SOCKET) { inode->i_mode |= S_IFSOCK; } inode->i_uid = le64_to_cpu(findData.Uid); inode->i_gid = le64_to_cpu(findData.Gid); inode->i_nlink = le64_to_cpu(findData.Nlinks); - findData.NumOfBytes = le64_to_cpu(findData.NumOfBytes); - findData.EndOfFile = le64_to_cpu(findData.EndOfFile); if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - i_size_write(inode,findData.EndOfFile); + i_size_write(inode, end_of_file); /* blksize needs to be multiple of two. So safer to default to blksize and blkbits set in superblock so 2**blkbits and blksize will match */ /* inode->i_blksize = @@ -143,14 +143,14 @@ /* inode->i_blocks = - (inode->i_blksize - 1 + findData.NumOfBytes) >> inode->i_blkbits;*/ + (inode->i_blksize - 1 + num_of_bytes) >> inode->i_blkbits;*/ /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation */ - inode->i_blocks = (512 - 1 + findData.NumOfBytes) >> 9; + inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; } - if (findData.NumOfBytes < findData.EndOfFile) + if (num_of_bytes < end_of_file) cFYI(1, ("Server inconsistency Error: it says allocation size less than end of file ")); cFYI(1, ("Size %ld and blocks %ld ", @@ -237,6 +237,7 @@ } } else { struct cifsInodeInfo *cifsInfo; + __u32 attr = le32_to_cpu(pfindData->Attributes); /* get new inode */ if (*pinode == NULL) { @@ -247,8 +248,7 @@ } inode = *pinode; cifsInfo = CIFS_I(inode); - pfindData->Attributes = le32_to_cpu(pfindData->Attributes); - cifsInfo->cifsAttrs = pfindData->Attributes; + cifsInfo->cifsAttrs = attr; cFYI(1, (" Old time %ld ", cifsInfo->time)); cifsInfo->time = jiffies; cFYI(1, (" New time %ld ", cifsInfo->time)); @@ -266,17 +266,17 @@ inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); cFYI(0, - (" Attributes came in as 0x%x ", pfindData->Attributes)); + (" Attributes came in as 0x%x ", attr)); /* set default mode. will override for dirs below */ if(atomic_read(&cifsInfo->inUse) == 0) /* new inode, can safely set these fields */ inode->i_mode = cifs_sb->mnt_file_mode; - if (pfindData->Attributes & ATTR_REPARSE) { + if (attr & ATTR_REPARSE) { /* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ inode->i_mode |= S_IFLNK; - } else if (pfindData->Attributes & ATTR_DIRECTORY) { + } else if (attr & ATTR_DIRECTORY) { /* override default perms since we do not do byte range locking on dirs */ inode->i_mode = cifs_sb->mnt_dir_mode; inode->i_mode |= S_IFDIR; @@ -298,7 +298,6 @@ inode->i_blocks = (512 - 1 + le64_to_cpu(pfindData->AllocationSize)) >> 9; } - pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); @@ -951,7 +950,7 @@ } else time_buf.ChangeTime = 0; - if (set_time | time_buf.Attributes) { + if (set_time || time_buf.Attributes) { /* BB what if setting one attribute fails (such as size) but time setting works */ time_buf.CreationTime = 0; /* do not change */ diff -Nru a/fs/cifs/misc.c b/fs/cifs/misc.c --- a/fs/cifs/misc.c 2004-09-21 20:52:52 -07:00 +++ b/fs/cifs/misc.c 2004-09-21 20:52:52 -07:00 @@ -189,7 +189,6 @@ ) { int i; - __u32 tmp; struct list_head* temp_item; struct cifsSesInfo * ses; char *temp = (char *) buffer; @@ -211,10 +210,8 @@ buffer->Command = smb_command; buffer->Flags = 0x00; /* case sensitive */ buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; - tmp = cpu_to_le32(current->tgid); - buffer->Pid = tmp & 0xFFFF; - tmp >>= 16; - buffer->PidHigh = tmp & 0xFFFF; + buffer->Pid = cpu_to_le16((__u16)current->tgid); + buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16)); spin_lock(&GlobalMid_Lock); GlobalMid++; buffer->Mid = GlobalMid; @@ -292,7 +289,7 @@ { /* Make sure that this really is an SMB, that it is a response, and that the message ids match */ - if ((*(unsigned int *) smb->Protocol == cpu_to_le32(0x424d53ff)) && + if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) && (mid == smb->Mid)) { if(smb->Flags & SMBFLG_RESPONSE) return 0; @@ -304,7 +301,7 @@ cERROR(1, ("Rcvd Request not response ")); } } else { /* bad signature or mid */ - if (*(unsigned int *) smb->Protocol != cpu_to_le32(0x424d53ff)) + if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) cERROR(1, ("Bad protocol string signature header %x ", *(unsigned int *) smb->Protocol)); @@ -318,12 +315,12 @@ int checkSMB(struct smb_hdr *smb, __u16 mid, int length) { + __u32 len = be32_to_cpu(smb->smb_buf_length); cFYI(0, ("Entering checkSMB with Length: %x, smb_buf_length: %x ", - length, ntohl(smb->smb_buf_length))); - if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) - || (ntohl(smb->smb_buf_length) > - CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) { + length, len)); + if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || + (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) { if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) { cERROR(1, ("Length less than 2 + sizeof smb_hdr ")); if (((unsigned int)length >= sizeof (struct smb_hdr) - 1) @@ -331,8 +328,7 @@ return 0; /* some error cases do not return wct and bcc */ } - if (ntohl(smb->smb_buf_length) > - CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) + if (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) cERROR(1, ("smb_buf_length greater than CIFS_MAX_MSGSIZE ... ")); cERROR(1, @@ -344,8 +340,8 @@ if (checkSMBhdr(smb, mid)) return 1; - if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb)) - || (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) { + if ((4 + len != smbCalcSize(smb)) + || (4 + len != (unsigned int)length)) { return 0; } else { cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb))); diff -Nru a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c --- a/fs/cifs/netmisc.c 2004-09-21 20:52:52 -07:00 +++ b/fs/cifs/netmisc.c 2004-09-21 20:52:52 -07:00 @@ -187,8 +187,8 @@ if (value > addr_class_max[end - bytes]) return 0; - address.s_addr = *((int *) bytes) | htonl(value); - *((int *)dst) = address.s_addr; + address.s_addr = *((__be32 *) bytes) | htonl(value); + *((__be32 *)dst) = address.s_addr; return 1; /* success */ } @@ -810,16 +810,13 @@ if (smb->Flags2 & SMBFLG2_ERR_STATUS) { /* translate the newer STATUS codes to old style errors and then to POSIX errors */ - smb->Status.CifsError = le32_to_cpu(smb->Status.CifsError); + __u32 err = le32_to_cpu(smb->Status.CifsError); if(cifsFYI) - cifs_print_status(smb->Status.CifsError); - ntstatus_to_dos(smb->Status.CifsError, &smberrclass, - &smberrcode); + cifs_print_status(err); + ntstatus_to_dos(err, &smberrclass, &smberrcode); } else { smberrclass = smb->Status.DosError.ErrorClass; - smb->Status.DosError.Error = - le16_to_cpu(smb->Status.DosError.Error); - smberrcode = smb->Status.DosError.Error; + smberrcode = le16_to_cpu(smb->Status.DosError.Error); } /* old style errors */ diff -Nru a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h --- a/fs/cifs/ntlmssp.h 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/ntlmssp.h 2004-09-21 20:52:51 -07:00 @@ -23,10 +23,10 @@ #define NTLMSSP_SIGNATURE "NTLMSSP" /* Message Types */ -#define NtLmNegotiate 1 -#define NtLmChallenge 2 -#define NtLmAuthenticate 3 -#define UnknownMessage 8 +#define NtLmNegotiate cpu_to_le32(1) +#define NtLmChallenge cpu_to_le32(2) +#define NtLmAuthenticate cpu_to_le32(3) +#define UnknownMessage cpu_to_le32(8) /* Negotiate Flags */ #define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode @@ -60,15 +60,15 @@ /* appearance */ typedef struct _SECURITY_BUFFER { - __u16 Length; - __u16 MaximumLength; - __u32 Buffer; /* offset to buffer */ + __le16 Length; + __le16 MaximumLength; + __le32 Buffer; /* offset to buffer */ } SECURITY_BUFFER; typedef struct _NEGOTIATE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 1 */ - __u32 NegotiateFlags; + __le32 MessageType; /* 1 */ + __le32 NegotiateFlags; SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ char DomainString[0]; @@ -77,9 +77,9 @@ typedef struct _CHALLENGE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 2 */ + __le32 MessageType; /* 2 */ SECURITY_BUFFER TargetName; - __u32 NegotiateFlags; + __le32 NegotiateFlags; __u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; __u8 Reserved[8]; SECURITY_BUFFER TargetInfoArray; @@ -87,14 +87,14 @@ typedef struct _AUTHENTICATE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 3 */ + __le32 MessageType; /* 3 */ SECURITY_BUFFER LmChallengeResponse; SECURITY_BUFFER NtChallengeResponse; SECURITY_BUFFER DomainName; SECURITY_BUFFER UserName; SECURITY_BUFFER WorkstationName; SECURITY_BUFFER SessionKey; - __u32 NegotiateFlags; + __le32 NegotiateFlags; char UserString[0]; } AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; diff -Nru a/fs/cifs/transport.c b/fs/cifs/transport.c --- a/fs/cifs/transport.c 2004-09-21 20:52:51 -07:00 +++ b/fs/cifs/transport.c 2004-09-21 20:52:51 -07:00 @@ -123,11 +123,12 @@ int i = 0; struct msghdr smb_msg; struct kvec iov; + unsigned len = smb_buf_length + 4; if(ssocket == NULL) return -ENOTSOCK; /* BB eventually add reconnect code here */ iov.iov_base = smb_buffer; - iov.iov_len = smb_buf_length + 4; + iov.iov_len = len; smb_msg.msg_name = sin; smb_msg.msg_namelen = sizeof (struct sockaddr); @@ -142,10 +143,10 @@ smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); cFYI(1, ("Sending smb of length %d ", smb_buf_length)); - dump_smb(smb_buffer, smb_buf_length + 4); + dump_smb(smb_buffer, len); - while(iov.iov_len > 0) { - rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, smb_buf_length + 4); + while (len > 0) { + rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, len); if ((rc == -ENOSPC) || (rc == -EAGAIN)) { i++; if(i > 60) { @@ -163,6 +164,7 @@ break; iov.iov_base += rc; iov.iov_len -= rc; + len -= rc; } if (rc < 0) { @@ -272,9 +274,6 @@ return -EIO; } - if (in_buf->smb_buf_length > 12) - in_buf->Flags2 = cpu_to_le16(in_buf->Flags2); - rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number); midQ->midState = MID_REQUEST_SUBMITTED; @@ -329,7 +328,7 @@ spin_lock(&GlobalMid_Lock); if (midQ->resp_buf) { spin_unlock(&GlobalMid_Lock); - receive_len = be32_to_cpu(midQ->resp_buf->smb_buf_length); + receive_len = be32_to_cpu(*(__be32 *)midQ->resp_buf); } else { cERROR(1,("No response buffer")); if(midQ->midState == MID_REQUEST_SUBMITTED) { @@ -368,28 +367,19 @@ if (midQ->resp_buf && out_buf && (midQ->midState == MID_RESPONSE_RECEIVED)) { - memcpy(out_buf, midQ->resp_buf, - receive_len + - 4 /* include 4 byte RFC1001 header */ ); + out_buf->smb_buf_length = receive_len; + memcpy((char *)out_buf + 4, + (char *)midQ->resp_buf + 4, + receive_len); dump_smb(out_buf, 92); /* convert the length into a more usable form */ - out_buf->smb_buf_length = - be32_to_cpu(out_buf->smb_buf_length); - if((out_buf->smb_buf_length > 24) && + if((receive_len > 24) && (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))) { rc = cifs_verify_signature(out_buf, ses->mac_signing_key,midQ->sequence_number); /* BB fix BB */ if(rc) cFYI(1,("Unexpected signature received from server")); } - - if (out_buf->smb_buf_length > 12) - out_buf->Flags2 = le16_to_cpu(out_buf->Flags2); - if (out_buf->smb_buf_length > 28) - out_buf->Pid = le16_to_cpu(out_buf->Pid); - if (out_buf->smb_buf_length > 28) - out_buf->PidHigh = - le16_to_cpu(out_buf->PidHigh); *pbytes_returned = out_buf->smb_buf_length; diff -Nru a/fs/compat.c b/fs/compat.c --- a/fs/compat.c 2004-09-21 20:52:51 -07:00 +++ b/fs/compat.c 2004-09-21 20:52:51 -07:00 @@ -1368,7 +1368,7 @@ compat_uptr_t __user *envp, struct pt_regs * regs) { - struct linux_binprm bprm; + struct linux_binprm *bprm; struct file *file; int retval; int i; @@ -1381,86 +1381,86 @@ sched_exec(); - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); - - bprm.file = file; - bprm.filename = filename; - bprm.interp = filename; - bprm.sh_bang = 0; - bprm.loader = 0; - bprm.exec = 0; - bprm.interp_flags = 0; - bprm.interp_data = 0; - bprm.security = NULL; - bprm.mm = mm_alloc(); retval = -ENOMEM; - if (!bprm.mm) + bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); + if (!bprm) + goto out_ret; + memset(bprm, 0, sizeof(*bprm)); + + bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); + bprm->file = file; + bprm->filename = filename; + bprm->interp = filename; + bprm->mm = mm_alloc(); + if (!bprm->mm) goto out_file; - retval = init_new_context(current, bprm.mm); + retval = init_new_context(current, bprm->mm); if (retval < 0) goto out_mm; - bprm.argc = compat_count(argv, bprm.p / sizeof(compat_uptr_t)); - if ((retval = bprm.argc) < 0) + bprm->argc = compat_count(argv, bprm->p / sizeof(compat_uptr_t)); + if ((retval = bprm->argc) < 0) goto out_mm; - bprm.envc = compat_count(envp, bprm.p / sizeof(compat_uptr_t)); - if ((retval = bprm.envc) < 0) + bprm->envc = compat_count(envp, bprm->p / sizeof(compat_uptr_t)); + if ((retval = bprm->envc) < 0) goto out_mm; - retval = security_bprm_alloc(&bprm); + retval = security_bprm_alloc(bprm); if (retval) goto out; - retval = prepare_binprm(&bprm); + retval = prepare_binprm(bprm); if (retval < 0) goto out; - retval = copy_strings_kernel(1, &bprm.filename, &bprm); + retval = copy_strings_kernel(1, &bprm->filename, bprm); if (retval < 0) goto out; - bprm.exec = bprm.p; - retval = compat_copy_strings(bprm.envc, envp, &bprm); + bprm->exec = bprm->p; + retval = compat_copy_strings(bprm->envc, envp, bprm); if (retval < 0) goto out; - retval = compat_copy_strings(bprm.argc, argv, &bprm); + retval = compat_copy_strings(bprm->argc, argv, bprm); if (retval < 0) goto out; - retval = search_binary_handler(&bprm,regs); + retval = search_binary_handler(bprm, regs); if (retval >= 0) { - free_arg_pages(&bprm); + free_arg_pages(bprm); /* execve success */ - security_bprm_free(&bprm); + security_bprm_free(bprm); + kfree(bprm); return retval; } out: /* Something went wrong, return the inode and free the argument pages*/ for (i = 0 ; i < MAX_ARG_PAGES ; i++) { - struct page * page = bprm.page[i]; + struct page * page = bprm->page[i]; if (page) __free_page(page); } - if (bprm.security) - security_bprm_free(&bprm); + if (bprm->security) + security_bprm_free(bprm); out_mm: - if (bprm.mm) - mmdrop(bprm.mm); + if (bprm->mm) + mmdrop(bprm->mm); out_file: - if (bprm.file) { - allow_write_access(bprm.file); - fput(bprm.file); + if (bprm->file) { + allow_write_access(bprm->file); + fput(bprm->file); } + kfree(bprm); +out_ret: return retval; } diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c --- a/fs/compat_ioctl.c 2004-09-21 20:52:52 -07:00 +++ b/fs/compat_ioctl.c 2004-09-21 20:52:52 -07:00 @@ -116,6 +116,8 @@ #include #include +#include + #undef INCLUDES #endif diff -Nru a/fs/dquot.c b/fs/dquot.c --- a/fs/dquot.c 2004-09-21 20:52:52 -07:00 +++ b/fs/dquot.c 2004-09-21 20:52:52 -07:00 @@ -120,7 +120,7 @@ * i_sem on quota files is special (it's below dqio_sem) */ -spinlock_t dq_list_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t dq_list_lock = SPIN_LOCK_UNLOCKED; spinlock_t dq_data_lock = SPIN_LOCK_UNLOCKED; static char *quotatypes[] = INITQFNAMES; @@ -1792,7 +1792,6 @@ EXPORT_SYMBOL(register_quota_format); EXPORT_SYMBOL(unregister_quota_format); EXPORT_SYMBOL(dqstats); -EXPORT_SYMBOL(dq_list_lock); EXPORT_SYMBOL(dq_data_lock); EXPORT_SYMBOL(vfs_quota_on); EXPORT_SYMBOL(vfs_quota_on_mount); diff -Nru a/fs/exec.c b/fs/exec.c --- a/fs/exec.c 2004-09-21 20:52:51 -07:00 +++ b/fs/exec.c 2004-09-21 20:52:51 -07:00 @@ -741,8 +741,10 @@ spin_unlock(&oldsighand->siglock); write_unlock_irq(&tasklist_lock); - if (newsig && atomic_dec_and_test(&oldsig->count)) + if (newsig && atomic_dec_and_test(&oldsig->count)) { + exit_itimers(oldsig); kmem_cache_free(signal_cachep, oldsig); + } if (atomic_dec_and_test(&oldsighand->count)) kmem_cache_free(sighand_cachep, oldsighand); @@ -1092,7 +1094,7 @@ char __user *__user *envp, struct pt_regs * regs) { - struct linux_binprm bprm; + struct linux_binprm *bprm; struct file *file; int retval; int i; @@ -1105,85 +1107,87 @@ sched_exec(); - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); - - bprm.file = file; - bprm.filename = filename; - bprm.interp = filename; - bprm.interp_flags = 0; - bprm.interp_data = 0; - bprm.sh_bang = 0; - bprm.loader = 0; - bprm.exec = 0; - bprm.security = NULL; - bprm.mm = mm_alloc(); retval = -ENOMEM; - if (!bprm.mm) + bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); + if (!bprm) + goto out_ret; + memset(bprm, 0, sizeof(*bprm)); + + bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); + + bprm->file = file; + bprm->filename = filename; + bprm->interp = filename; + bprm->mm = mm_alloc(); + if (!bprm->mm) goto out_file; - retval = init_new_context(current, bprm.mm); + retval = init_new_context(current, bprm->mm); if (retval < 0) goto out_mm; - bprm.argc = count(argv, bprm.p / sizeof(void *)); - if ((retval = bprm.argc) < 0) + bprm->argc = count(argv, bprm->p / sizeof(void *)); + if ((retval = bprm->argc) < 0) goto out_mm; - bprm.envc = count(envp, bprm.p / sizeof(void *)); - if ((retval = bprm.envc) < 0) + bprm->envc = count(envp, bprm->p / sizeof(void *)); + if ((retval = bprm->envc) < 0) goto out_mm; - retval = security_bprm_alloc(&bprm); + retval = security_bprm_alloc(bprm); if (retval) goto out; - retval = prepare_binprm(&bprm); + retval = prepare_binprm(bprm); if (retval < 0) goto out; - retval = copy_strings_kernel(1, &bprm.filename, &bprm); + retval = copy_strings_kernel(1, &bprm->filename, bprm); if (retval < 0) goto out; - bprm.exec = bprm.p; - retval = copy_strings(bprm.envc, envp, &bprm); + bprm->exec = bprm->p; + retval = copy_strings(bprm->envc, envp, bprm); if (retval < 0) goto out; - retval = copy_strings(bprm.argc, argv, &bprm); + retval = copy_strings(bprm->argc, argv, bprm); if (retval < 0) goto out; - retval = search_binary_handler(&bprm,regs); + retval = search_binary_handler(bprm,regs); if (retval >= 0) { - free_arg_pages(&bprm); + free_arg_pages(bprm); /* execve success */ - security_bprm_free(&bprm); + security_bprm_free(bprm); + kfree(bprm); return retval; } out: /* Something went wrong, return the inode and free the argument pages*/ for (i = 0 ; i < MAX_ARG_PAGES ; i++) { - struct page * page = bprm.page[i]; + struct page * page = bprm->page[i]; if (page) __free_page(page); } - if (bprm.security) - security_bprm_free(&bprm); + if (bprm->security) + security_bprm_free(bprm); out_mm: - if (bprm.mm) - mmdrop(bprm.mm); + if (bprm->mm) + mmdrop(bprm->mm); out_file: - if (bprm.file) { - allow_write_access(bprm.file); - fput(bprm.file); + if (bprm->file) { + allow_write_access(bprm->file); + fput(bprm->file); } + kfree(bprm); + +out_ret: return retval; } diff -Nru a/fs/ext2/ext2.h b/fs/ext2/ext2.h --- a/fs/ext2/ext2.h 2004-09-21 20:52:52 -07:00 +++ b/fs/ext2/ext2.h 2004-09-21 20:52:52 -07:00 @@ -115,7 +115,7 @@ /* inode.c */ extern void ext2_read_inode (struct inode *); -extern void ext2_write_inode (struct inode *, int); +extern int ext2_write_inode (struct inode *, int); extern void ext2_put_inode (struct inode *); extern void ext2_delete_inode (struct inode *); extern int ext2_sync_inode (struct inode *); diff -Nru a/fs/ext2/inode.c b/fs/ext2/inode.c --- a/fs/ext2/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/ext2/inode.c 2004-09-21 20:52:51 -07:00 @@ -1248,9 +1248,9 @@ return err; } -void ext2_write_inode(struct inode *inode, int wait) +int ext2_write_inode(struct inode *inode, int wait) { - ext2_update_inode(inode, wait); + return ext2_update_inode(inode, wait); } int ext2_sync_inode(struct inode *inode) diff -Nru a/fs/ext3/inode.c b/fs/ext3/inode.c --- a/fs/ext3/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/ext3/inode.c 2004-09-21 20:52:52 -07:00 @@ -2745,21 +2745,21 @@ * `stuff()' is running, and the new i_size will be lost. Plus the inode * will no longer be on the superblock's dirty inode list. */ -void ext3_write_inode(struct inode *inode, int wait) +int ext3_write_inode(struct inode *inode, int wait) { if (current->flags & PF_MEMALLOC) - return; + return 0; if (ext3_journal_current_handle()) { jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n"); dump_stack(); - return; + return -EIO; } if (!wait) - return; + return 0; - ext3_force_commit(inode->i_sb); + return ext3_force_commit(inode->i_sb); } /* diff -Nru a/fs/fat/inode.c b/fs/fat/inode.c --- a/fs/fat/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/fat/inode.c 2004-09-21 20:52:51 -07:00 @@ -1227,7 +1227,7 @@ return 0; } -void fat_write_inode(struct inode *inode, int wait) +int fat_write_inode(struct inode *inode, int wait) { struct super_block *sb = inode->i_sb; struct buffer_head *bh; @@ -1237,14 +1237,14 @@ retry: i_pos = MSDOS_I(inode)->i_pos; if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) { - return; + return 0; } lock_kernel(); if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) { printk(KERN_ERR "FAT: unable to read inode block " "for updating (i_pos %lld)\n", i_pos); unlock_kernel(); - return /* -EIO */; + return -EIO; } spin_lock(&fat_inode_lock); if (i_pos != MSDOS_I(inode)->i_pos) { @@ -1277,6 +1277,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } diff -Nru a/fs/fs-writeback.c b/fs/fs-writeback.c --- a/fs/fs-writeback.c 2004-09-21 20:52:52 -07:00 +++ b/fs/fs-writeback.c 2004-09-21 20:52:52 -07:00 @@ -133,10 +133,11 @@ EXPORT_SYMBOL(__mark_inode_dirty); -static void write_inode(struct inode *inode, int sync) +static int write_inode(struct inode *inode, int sync) { if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode)) - inode->i_sb->s_op->write_inode(inode, sync); + return inode->i_sb->s_op->write_inode(inode, sync); + return 0; } /* @@ -170,8 +171,11 @@ ret = do_writepages(mapping, wbc); /* Don't write the inode if only I_DIRTY_PAGES was set */ - if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) - write_inode(inode, wait); + if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { + int err = write_inode(inode, wait); + if (ret == 0) + ret = err; + } if (wait) { int err = filemap_fdatawait(mapping); diff -Nru a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h --- a/fs/hfs/hfs_fs.h 2004-09-21 20:52:52 -07:00 +++ b/fs/hfs/hfs_fs.h 2004-09-21 20:52:52 -07:00 @@ -198,7 +198,7 @@ extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, u32 *, u32 *); -extern void hfs_write_inode(struct inode *, int); +extern int hfs_write_inode(struct inode *, int); extern int hfs_inode_setattr(struct dentry *, struct iattr *); extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, u32 log_size, u32 phys_size, u32 clump_size); diff -Nru a/fs/hfs/inode.c b/fs/hfs/inode.c --- a/fs/hfs/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/hfs/inode.c 2004-09-21 20:52:52 -07:00 @@ -381,7 +381,7 @@ HFS_SB(inode->i_sb)->alloc_blksz); } -void hfs_write_inode(struct inode *inode, int unused) +int hfs_write_inode(struct inode *inode, int unused) { struct hfs_find_data fd; hfs_cat_rec rec; @@ -395,27 +395,27 @@ break; case HFS_EXT_CNID: hfs_btree_write(HFS_SB(inode->i_sb)->ext_tree); - return; + return 0; case HFS_CAT_CNID: hfs_btree_write(HFS_SB(inode->i_sb)->cat_tree); - return; + return 0; default: BUG(); - return; + return -EIO; } } if (HFS_IS_RSRC(inode)) { mark_inode_dirty(HFS_I(inode)->rsrc_inode); - return; + return 0; } if (!inode->i_nlink) - return; + return 0; if (hfs_find_init(HFS_SB(inode->i_sb)->cat_tree, &fd)) /* panic? */ - return; + return -EIO; fd.search_key->cat = HFS_I(inode)->cat_key; if (hfs_brec_find(&fd)) @@ -460,6 +460,7 @@ } out: hfs_find_exit(&fd); + return 0; } static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, diff -Nru a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h --- a/fs/hfsplus/hfsplus_fs.h 2004-09-21 20:52:52 -07:00 +++ b/fs/hfsplus/hfsplus_fs.h 2004-09-21 20:52:52 -07:00 @@ -333,7 +333,7 @@ void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); -void hfsplus_cat_write_inode(struct inode *); +int hfsplus_cat_write_inode(struct inode *); struct inode *hfsplus_new_inode(struct super_block *, int); void hfsplus_delete_inode(struct inode *); diff -Nru a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c --- a/fs/hfsplus/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/hfsplus/inode.c 2004-09-21 20:52:51 -07:00 @@ -484,22 +484,22 @@ return res; } -void hfsplus_cat_write_inode(struct inode *inode) +int hfsplus_cat_write_inode(struct inode *inode) { struct hfs_find_data fd; hfsplus_cat_entry entry; if (HFSPLUS_IS_RSRC(inode)) { mark_inode_dirty(HFSPLUS_I(inode).rsrc_inode); - return; + return 0; } if (!inode->i_nlink) - return; + return 0; if (hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd)) /* panic? */ - return; + return -EIO; if (hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd)) /* panic? */ @@ -547,4 +547,5 @@ } out: hfs_find_exit(&fd); + return 0; } diff -Nru a/fs/hfsplus/super.c b/fs/hfsplus/super.c --- a/fs/hfsplus/super.c 2004-09-21 20:52:51 -07:00 +++ b/fs/hfsplus/super.c 2004-09-21 20:52:51 -07:00 @@ -94,20 +94,20 @@ make_bad_inode(inode); } -void hfsplus_write_inode(struct inode *inode, int unused) +int hfsplus_write_inode(struct inode *inode, int unused) { struct hfsplus_vh *vhdr; + int ret = 0; dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino); hfsplus_ext_write_extent(inode); if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { - hfsplus_cat_write_inode(inode); - return; + return hfsplus_cat_write_inode(inode); } vhdr = HFSPLUS_SB(inode->i_sb).s_vhdr; switch (inode->i_ino) { case HFSPLUS_ROOT_CNID: - hfsplus_cat_write_inode(inode); + ret = hfsplus_cat_write_inode(inode); break; case HFSPLUS_EXT_CNID: if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) { @@ -148,6 +148,7 @@ hfs_btree_write(HFSPLUS_SB(inode->i_sb).attr_tree); break; } + return ret; } static void hfsplus_clear_inode(struct inode *inode) diff -Nru a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c --- a/fs/hugetlbfs/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/hugetlbfs/inode.c 2004-09-21 20:52:52 -07:00 @@ -800,8 +800,7 @@ hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache", sizeof(struct hugetlbfs_inode_info), - 0, SLAB_RECLAIM_ACCOUNT, - init_once, NULL); + 0, 0, init_once, NULL); if (hugetlbfs_inode_cachep == NULL) return -ENOMEM; diff -Nru a/fs/isofs/rock.c b/fs/isofs/rock.c --- a/fs/isofs/rock.c 2004-09-21 20:52:52 -07:00 +++ b/fs/isofs/rock.c 2004-09-21 20:52:52 -07:00 @@ -62,7 +62,7 @@ } #define MAYBE_CONTINUE(LABEL,DEV) \ - {if (buffer) kfree(buffer); \ + {if (buffer) { kfree(buffer); buffer = NULL; } \ if (cont_extent){ \ int block, offset, offset1; \ struct buffer_head * pbh; \ diff -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c --- a/fs/jfs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/jfs/inode.c 2004-09-21 20:52:51 -07:00 @@ -106,10 +106,10 @@ return rc; } -void jfs_write_inode(struct inode *inode, int wait) +int jfs_write_inode(struct inode *inode, int wait) { if (test_cflag(COMMIT_Nolink, inode)) - return; + return 0; /* * If COMMIT_DIRTY is not set, the inode isn't really dirty. * It has been committed since the last change, but was still @@ -118,12 +118,14 @@ if (!test_cflag(COMMIT_Dirty, inode)) { /* Make sure committed changes hit the disk */ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); - return; + return 0; } if (jfs_commit_inode(inode, wait)) { jfs_err("jfs_write_inode: jfs_commit_inode failed!"); - } + return -EIO; + } else + return 0; } void jfs_delete_inode(struct inode *inode) diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c --- a/fs/jfs/super.c 2004-09-21 20:52:51 -07:00 +++ b/fs/jfs/super.c 2004-09-21 20:52:51 -07:00 @@ -77,7 +77,7 @@ extern void jfs_read_inode(struct inode *inode); extern void jfs_dirty_inode(struct inode *inode); extern void jfs_delete_inode(struct inode *inode); -extern void jfs_write_inode(struct inode *inode, int wait); +extern int jfs_write_inode(struct inode *inode, int wait); extern struct dentry *jfs_get_parent(struct dentry *dentry); extern int jfs_extendfs(struct super_block *, s64, int); diff -Nru a/fs/minix/inode.c b/fs/minix/inode.c --- a/fs/minix/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/minix/inode.c 2004-09-21 20:52:52 -07:00 @@ -18,7 +18,7 @@ #include static void minix_read_inode(struct inode * inode); -static void minix_write_inode(struct inode * inode, int wait); +static int minix_write_inode(struct inode * inode, int wait); static int minix_statfs(struct super_block *sb, struct kstatfs *buf); static int minix_remount (struct super_block * sb, int * flags, char * data); @@ -505,9 +505,10 @@ return V2_minix_update_inode(inode); } -static void minix_write_inode(struct inode * inode, int wait) +static int minix_write_inode(struct inode * inode, int wait) { brelse(minix_update_inode(inode)); + return 0; } int minix_sync_inode(struct inode * inode) diff -Nru a/fs/nfs/inode.c b/fs/nfs/inode.c --- a/fs/nfs/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/nfs/inode.c 2004-09-21 20:52:52 -07:00 @@ -57,7 +57,7 @@ static struct inode *nfs_alloc_inode(struct super_block *sb); static void nfs_destroy_inode(struct inode *); -static void nfs_write_inode(struct inode *,int); +static int nfs_write_inode(struct inode *,int); static void nfs_delete_inode(struct inode *); static void nfs_clear_inode(struct inode *); static void nfs_umount_begin(struct super_block *); @@ -110,12 +110,16 @@ return nfs_fileid_to_ino_t(fattr->fileid); } -static void +static int nfs_write_inode(struct inode *inode, int sync) { int flags = sync ? FLUSH_WAIT : 0; + int ret; - nfs_commit_inode(inode, 0, 0, flags); + ret = nfs_commit_inode(inode, 0, 0, flags); + if (ret < 0) + return ret; + return 0; } static void diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c --- a/fs/ntfs/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/ntfs/inode.c 2004-09-21 20:52:52 -07:00 @@ -2453,28 +2453,4 @@ return err; } -/** - * ntfs_write_inode_vfs - write out a dirty inode - * @vi: inode to write out - * @sync: if true, write out synchronously - * - * Write out a dirty inode to disk including any extent inodes if present. - * - * If @sync is true, commit the inode to disk and wait for io completion. This - * is done using write_mft_record(). - * - * If @sync is false, just schedule the write to happen but do not wait for i/o - * completion. In 2.6 kernels, scheduling usually happens just by virtue of - * marking the page (and in this case mft record) dirty but we do not implement - * this yet as write_mft_record() largely ignores the @sync parameter and - * always performs synchronous writes. - * - * This functions does not have a return value which is the required behaviour - * for the VFS super_operations ->dirty_inode function. - */ -void ntfs_write_inode_vfs(struct inode *vi, int sync) -{ - ntfs_write_inode(vi, sync); -} - #endif /* NTFS_RW */ diff -Nru a/fs/ntfs/inode.h b/fs/ntfs/inode.h --- a/fs/ntfs/inode.h 2004-09-21 20:52:52 -07:00 +++ b/fs/ntfs/inode.h 2004-09-21 20:52:52 -07:00 @@ -286,7 +286,6 @@ extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr); extern int ntfs_write_inode(struct inode *vi, int sync); -extern void ntfs_write_inode_vfs(struct inode *vi, int sync); static inline void ntfs_commit_inode(struct inode *vi) { diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c --- a/fs/ntfs/super.c 2004-09-21 20:52:52 -07:00 +++ b/fs/ntfs/super.c 2004-09-21 20:52:52 -07:00 @@ -2157,7 +2157,7 @@ #ifdef NTFS_RW //.dirty_inode = NULL, /* VFS: Called from // __mark_inode_dirty(). */ - .write_inode = ntfs_write_inode_vfs, /* VFS: Write dirty inode to + .write_inode = ntfs_write_inode, /* VFS: Write dirty inode to disk. */ //.drop_inode = NULL, /* VFS: Called just after the // inode reference count has diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c --- a/fs/partitions/msdos.c 2004-09-21 20:52:52 -07:00 +++ b/fs/partitions/msdos.c 2004-09-21 20:52:52 -07:00 @@ -246,6 +246,9 @@ put_partition(state, state->next++, bsd_start, bsd_size); } put_dev_sector(sect); + if (le16_to_cpu(l->d_npartitions) > max_partitions) + printk(" (ignored %d more)", + le16_to_cpu(l->d_npartitions) - max_partitions); printk(" >\n"); } #endif diff -Nru a/fs/qnx4/inode.c b/fs/qnx4/inode.c --- a/fs/qnx4/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/qnx4/inode.c 2004-09-21 20:52:52 -07:00 @@ -78,7 +78,7 @@ unlock_kernel(); } -static void qnx4_write_inode(struct inode *inode, int unused) +static int qnx4_write_inode(struct inode *inode, int unused) { struct qnx4_inode_entry *raw_inode; int block, ino; @@ -87,12 +87,12 @@ QNX4DEBUG(("qnx4: write inode 1.\n")); if (inode->i_nlink == 0) { - return; + return 0; } if (!ino) { printk("qnx4: bad inode number on dev %s: %d is out of range\n", inode->i_sb->s_id, ino); - return; + return -EIO; } QNX4DEBUG(("qnx4: write inode 2.\n")); block = ino / QNX4_INODES_PER_BLOCK; @@ -101,7 +101,7 @@ printk("qnx4: major problem: unable to read inode from dev " "%s\n", inode->i_sb->s_id); unlock_kernel(); - return; + return -EIO; } raw_inode = ((struct qnx4_inode_entry *) bh->b_data) + (ino % QNX4_INODES_PER_BLOCK); @@ -117,6 +117,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } #endif diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c --- a/fs/reiserfs/file.c 2004-09-21 20:52:51 -07:00 +++ b/fs/reiserfs/file.c 2004-09-21 20:52:51 -07:00 @@ -1099,7 +1099,7 @@ { size_t already_written = 0; // Number of bytes already written to the file. loff_t pos; // Current position in the file. - size_t res; // return value of various functions that we call. + ssize_t res; // return value of various functions that we call. struct inode *inode = file->f_dentry->d_inode; // Inode of the file that we are writing to. /* To simplify coding at this time, we store locked pages in array for now */ @@ -1108,7 +1108,7 @@ th.t_trans_id = 0; if ( file->f_flags & O_DIRECT) { // Direct IO needs treatment - int result, after_file_end = 0; + ssize_t result, after_file_end = 0; if ( (*ppos + count >= inode->i_size) || (file->f_flags & O_APPEND) ) { /* If we are appending a file, we need to put this savelink in here. If we will crash while doing direct io, finish_unfinished will diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c --- a/fs/reiserfs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/reiserfs/inode.c 2004-09-21 20:52:51 -07:00 @@ -1504,7 +1504,7 @@ ** to properly mark inodes for datasync and such, but only actually ** does something when called for a synchronous update. */ -void reiserfs_write_inode (struct inode * inode, int do_sync) { +int reiserfs_write_inode (struct inode * inode, int do_sync) { struct reiserfs_transaction_handle th ; int jbegin_count = 1 ; @@ -1512,7 +1512,7 @@ reiserfs_warning (inode->i_sb, "clm-6005: writing inode %lu on readonly FS", inode->i_ino) ; - return ; + return -EROFS; } /* memory pressure can sometimes initiate write_inode calls with sync == 1, ** these cases are just when the system needs ram, not when the @@ -1526,6 +1526,7 @@ journal_end_sync(&th, inode->i_sb, jbegin_count) ; reiserfs_write_unlock(inode->i_sb); } + return 0; } /* FIXME: no need any more. right? */ diff -Nru a/fs/sysv/inode.c b/fs/sysv/inode.c --- a/fs/sysv/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/sysv/inode.c 2004-09-21 20:52:51 -07:00 @@ -260,13 +260,14 @@ return bh; } -void sysv_write_inode(struct inode * inode, int wait) +int sysv_write_inode(struct inode * inode, int wait) { struct buffer_head *bh; lock_kernel(); bh = sysv_update_inode(inode); brelse(bh); unlock_kernel(); + return 0; } int sysv_sync_inode(struct inode * inode) diff -Nru a/fs/sysv/sysv.h b/fs/sysv/sysv.h --- a/fs/sysv/sysv.h 2004-09-21 20:52:52 -07:00 +++ b/fs/sysv/sysv.h 2004-09-21 20:52:52 -07:00 @@ -134,7 +134,7 @@ extern void sysv_truncate(struct inode *); /* inode.c */ -extern void sysv_write_inode(struct inode *, int); +extern int sysv_write_inode(struct inode *, int); extern int sysv_sync_inode(struct inode *); extern int sysv_sync_file(struct file *, struct dentry *, int); extern void sysv_set_inode(struct inode *, dev_t); diff -Nru a/fs/udf/inode.c b/fs/udf/inode.c --- a/fs/udf/inode.c 2004-09-21 20:52:52 -07:00 +++ b/fs/udf/inode.c 2004-09-21 20:52:52 -07:00 @@ -1316,11 +1316,13 @@ * Written, tested, and released. */ -void udf_write_inode(struct inode * inode, int sync) +int udf_write_inode(struct inode * inode, int sync) { + int ret; lock_kernel(); - udf_update_inode(inode, sync); + ret = udf_update_inode(inode, sync); unlock_kernel(); + return ret; } int udf_sync_inode(struct inode * inode) diff -Nru a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h --- a/fs/udf/udfdecl.h 2004-09-21 20:52:51 -07:00 +++ b/fs/udf/udfdecl.h 2004-09-21 20:52:51 -07:00 @@ -99,7 +99,7 @@ extern void udf_put_inode(struct inode *); extern void udf_delete_inode(struct inode *); extern void udf_clear_inode(struct inode *); -extern void udf_write_inode(struct inode *, int); +extern int udf_write_inode(struct inode *, int); extern long udf_block_map(struct inode *, long); extern int8_t inode_bmap(struct inode *, int, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); extern int8_t udf_add_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr, uint32_t, struct buffer_head **, int); diff -Nru a/fs/ufs/inode.c b/fs/ufs/inode.c --- a/fs/ufs/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/ufs/inode.c 2004-09-21 20:52:51 -07:00 @@ -788,11 +788,13 @@ return 0; } -void ufs_write_inode (struct inode * inode, int wait) +int ufs_write_inode (struct inode * inode, int wait) { + int ret; lock_kernel(); - ufs_update_inode (inode, wait); + ret = ufs_update_inode (inode, wait); unlock_kernel(); + return ret; } int ufs_sync_inode (struct inode *inode) diff -Nru a/fs/umsdos/inode.c b/fs/umsdos/inode.c --- a/fs/umsdos/inode.c 2004-09-21 20:52:51 -07:00 +++ b/fs/umsdos/inode.c 2004-09-21 20:52:51 -07:00 @@ -312,11 +312,12 @@ /* * Update the disk with the inode content */ -void UMSDOS_write_inode (struct inode *inode, int wait) +int UMSDOS_write_inode (struct inode *inode, int wait) { struct iattr newattrs; + int ret; - fat_write_inode (inode, wait); + ret = fat_write_inode (inode, wait); newattrs.ia_mtime = inode->i_mtime; newattrs.ia_atime = inode->i_atime; newattrs.ia_ctime = inode->i_ctime; @@ -330,6 +331,7 @@ * UMSDOS_notify_change (inode, &newattrs); * inode->i_state &= ~I_DIRTY; / * FIXME: this doesn't work. We need to remove ourselves from list on dirty inodes. /mn/ */ + return ret; } diff -Nru a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c --- a/fs/xfs/linux-2.6/xfs_super.c 2004-09-21 20:52:52 -07:00 +++ b/fs/xfs/linux-2.6/xfs_super.c 2004-09-21 20:52:52 -07:00 @@ -356,7 +356,7 @@ * at the point when it is unpinned after a log write, * since this is when the inode itself becomes flushable. */ -STATIC void +STATIC int linvfs_write_inode( struct inode *inode, int sync) @@ -364,12 +364,14 @@ vnode_t *vp = LINVFS_GET_VP(inode); int error, flags = FLUSH_INODE; + error = 0; if (vp) { vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); if (sync) flags |= FLUSH_SYNC; VOP_IFLUSH(vp, flags, error); } + return error; } STATIC void diff -Nru a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h --- a/include/asm-alpha/bitops.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-alpha/bitops.h 2004-09-21 20:52:52 -07:00 @@ -324,7 +324,7 @@ #endif /* Compute powers of two for the given integer. */ -static inline int floor_log2(unsigned long word) +static inline long floor_log2(unsigned long word) { #if defined(__alpha_cix__) && defined(__alpha_fix__) return 63 - __kernel_ctlz(word); @@ -336,7 +336,7 @@ #endif } -static inline int ceil_log2(unsigned int word) +static inline long ceil_log2(unsigned long word) { long bit = floor_log2(word); return bit + (word > (1UL << bit)); diff -Nru a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h --- a/include/asm-alpha/compiler.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-alpha/compiler.h 2004-09-21 20:52:52 -07:00 @@ -17,9 +17,9 @@ # define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) # define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) # define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) -# define __kernel_cttz(x) __builtin_ctz(x) -# define __kernel_ctlz(x) __builtin_clz(x) -# define __kernel_ctpop(x) __builtin_popcount(x) +# define __kernel_cttz(x) __builtin_ctzl(x) +# define __kernel_ctlz(x) __builtin_clzl(x) +# define __kernel_ctpop(x) __builtin_popcountl(x) #else # define __kernel_insbl(val, shift) \ ({ unsigned long __kir; \ diff -Nru a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h --- a/include/asm-alpha/spinlock.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-alpha/spinlock.h 2004-09-21 20:52:52 -07:00 @@ -148,6 +148,29 @@ } #endif /* CONFIG_DEBUG_RWLOCK */ +static inline int _raw_write_trylock(rwlock_t * lock) +{ + long regx; + int success; + + __asm__ __volatile__( + "1: ldl_l %1,%0\n" + " lda %2,0\n" + " bne %1,2f\n" + " or $31,1,%1\n" + " stl_c %1,%0\n" + " beq %1,6f\n" + " lda %2,1\n" + "2: mb\n" + ".subsection 2\n" + "6: br 1b\n" + ".previous" + : "=m" (*lock), "=&r" (regx), "=&r" (success) + : "m" (*lock) : "memory"); + + return success; +} + static inline void _raw_write_unlock(rwlock_t * lock) { mb(); diff -Nru a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h --- a/include/asm-alpha/tlbflush.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-alpha/tlbflush.h 2004-09-21 20:52:51 -07:00 @@ -86,7 +86,7 @@ static inline void flush_tlb_other(struct mm_struct *mm) { - long *mmc = &mm->context[smp_processor_id()]; + unsigned long *mmc = &mm->context[smp_processor_id()]; /* Check it's not zero first to avoid cacheline ping pong when possible. */ if (*mmc) *mmc = 0; diff -Nru a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h --- a/include/asm-alpha/unistd.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-alpha/unistd.h 2004-09-21 20:52:51 -07:00 @@ -373,8 +373,9 @@ #define __NR_mq_timedreceive 435 #define __NR_mq_notify 436 #define __NR_mq_getsetattr 437 +#define __NR_waitid 438 -#define NR_SYSCALLS 438 +#define NR_SYSCALLS 439 #if defined(__GNUC__) @@ -617,7 +618,7 @@ return sys_read(fd, buf, nr); } -extern long execve(char *, char **, char **); +extern int execve(char *, char **, char **); static inline long setsid(void) { diff -Nru a/include/asm-arm/apm.h b/include/asm-arm/apm.h --- a/include/asm-arm/apm.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-arm/apm.h 2004-09-21 20:52:52 -07:00 @@ -14,24 +14,7 @@ #define ARM_ASM_SA1100_APM_H #include - -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) - - -#define APM_AC_OFFLINE 0 -#define APM_AC_ONLINE 1 -#define APM_AC_BACKUP 2 -#define APM_AC_UNKNOWN 0xFF - -#define APM_BATTERY_STATUS_HIGH 0 -#define APM_BATTERY_STATUS_LOW 1 -#define APM_BATTERY_STATUS_CRITICAL 2 -#define APM_BATTERY_STATUS_CHARGING 3 -#define APM_BATTERY_STATUS_UNKNOWN 0xFF - -#define APM_BATTERY_LIFE_UNKNOWN 0xFFFF -#define APM_BATTERY_LIFE_MINUTES 0x8000 -#define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF +#include /* * This structure gets filled in by the machine specific 'get_power_status' @@ -39,18 +22,44 @@ */ struct apm_power_info { unsigned char ac_line_status; +#define APM_AC_OFFLINE 0 +#define APM_AC_ONLINE 1 +#define APM_AC_BACKUP 2 +#define APM_AC_UNKNOWN 0xff + unsigned char battery_status; +#define APM_BATTERY_STATUS_HIGH 0 +#define APM_BATTERY_STATUS_LOW 1 +#define APM_BATTERY_STATUS_CRITICAL 2 +#define APM_BATTERY_STATUS_CHARGING 3 +#define APM_BATTERY_STATUS_NOT_PRESENT 4 +#define APM_BATTERY_STATUS_UNKNOWN 0xff + unsigned char battery_flag; - unsigned char battery_life; +#define APM_BATTERY_FLAG_HIGH (1 << 0) +#define APM_BATTERY_FLAG_LOW (1 << 1) +#define APM_BATTERY_FLAG_CRITICAL (1 << 2) +#define APM_BATTERY_FLAG_CHARGING (1 << 3) +#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7) +#define APM_BATTERY_FLAG_UNKNOWN 0xff + + int battery_life; int time; int units; +#define APM_UNITS_MINS 0 +#define APM_UNITS_SECS 1 +#define APM_UNITS_UNKNOWN -1 + }; /* * This allows machines to provide their own "apm get power status" function. */ extern void (*apm_get_power_status)(struct apm_power_info *); -#endif +/* + * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND) + */ +void apm_queue_event(apm_event_t event); #endif diff -Nru a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-arm/arch-pxa/mmc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,19 @@ +#ifndef ASMARM_ARCH_MMC_H +#define ASMARM_ARCH_MMC_H + +#include +#include + +struct device; +struct mmc_host; + +struct pxamci_platform_data { + unsigned int ocr_mask; /* available voltages */ + int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *); + void (*setpower)(struct device *, unsigned int); + void (*exit)(struct device *, void *); +}; + +extern void pxa_set_mci_info(struct pxamci_platform_data *info); + +#endif diff -Nru a/include/asm-arm/arch-s3c2410/hardware.h b/include/asm-arm/arch-s3c2410/hardware.h --- a/include/asm-arm/arch-s3c2410/hardware.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-arm/arch-s3c2410/hardware.h 2004-09-21 20:52:51 -07:00 @@ -14,6 +14,7 @@ * 06-Jun-2003 BJD Added CPU frequency settings * 03-Sep-2003 BJD Linux v2.6 support * 12-Mar-2004 BJD Fixed include protection, fixed type of clock vars + * 14-Sep-2004 BJD Added misccr and getpin to gpio */ #ifndef __ASM_ARCH_HARDWARE_H @@ -60,6 +61,10 @@ extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); + +extern unsigned int s3c2410_gpio_getpin(unsigned int pin); + +extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); #endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-arm/arch-s3c2410/regs-udc.h b/include/asm-arm/arch-s3c2410/regs-udc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-arm/arch-s3c2410/regs-udc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,162 @@ +/* linux/include/asm/arch-s3c2410/regs-udc.h + * + * Copyright (C) 2004 Herbert Poetzl + * + * This include file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Changelog: + * 01-08-2004 initial creation + * 12-09-2004 cleanup for submission + */ + +#ifndef __ASM_ARCH_REGS_UDC_H +#define __ASM_ARCH_REGS_UDC_H + + +#define S3C2410_USBDREG(x) ((x) + S3C2410_VA_USBDEV) + +#define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140) +#define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144) +#define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148) + +#define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158) +#define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c) + +#define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c) + +#define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170) +#define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174) + +#define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0) +#define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4) +#define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8) +#define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc) +#define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0) + +#define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200) +#define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204) +#define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208) +#define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c) +#define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210) +#define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214) + +#define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218) +#define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c) +#define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220) +#define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224) +#define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228) +#define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c) + +#define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240) +#define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244) +#define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248) +#define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c) +#define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250) +#define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254) + +#define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258) +#define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c) +#define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260) +#define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264) +#define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268) +#define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c) + +#define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178) + +/* indexed registers */ + +#define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x018c) + +#define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184) + +#define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184) +#define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188) + +#define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190) +#define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194) +#define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198) +#define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c) + + + +#define S3C2410_UDC_PWR_ISOUP (1<<7) // R/W +#define S3C2410_UDC_PWR_RESET (1<<3) // R +#define S3C2410_UDC_PWR_RESUME (1<<2) // R/W +#define S3C2410_UDC_PWR_SUSPEND (1<<1) // R +#define S3C2410_UDC_PWR_ENSUSPEND (1<<0) // R/W + +#define S3C2410_UDC_PWR_DEFAULT 0x00 + +#define S3C2410_UDC_INT_EP4 (1<<4) // R/W (clear only) +#define S3C2410_UDC_INT_EP3 (1<<3) // R/W (clear only) +#define S3C2410_UDC_INT_EP2 (1<<2) // R/W (clear only) +#define S3C2410_UDC_INT_EP1 (1<<1) // R/W (clear only) +#define S3C2410_UDC_INT_EP0 (1<<0) // R/W (clear only) + +#define S3C2410_UDC_USBINT_RESET (1<<2) // R/W (clear only) +#define S3C2410_UDC_USBINT_RESUME (1<<1) // R/W (clear only) +#define S3C2410_UDC_USBINT_SUSPEND (1<<0) // R/W (clear only) + +#define S3C2410_UDC_INTE_EP4 (1<<4) // R/W +#define S3C2410_UDC_INTE_EP3 (1<<3) // R/W +#define S3C2410_UDC_INTE_EP2 (1<<2) // R/W +#define S3C2410_UDC_INTE_EP1 (1<<1) // R/W +#define S3C2410_UDC_INTE_EP0 (1<<0) // R/W + +#define S3C2410_UDC_USBINTE_RESET (1<<2) // R/W +#define S3C2410_UDC_USBINTE_SUSPEND (1<<0) // R/W + + +#define S3C2410_UDC_INDEX_EP0 (0x00) +#define S3C2410_UDC_INDEX_EP1 (0x01) // ?? +#define S3C2410_UDC_INDEX_EP2 (0x02) // ?? +#define S3C2410_UDC_INDEX_EP3 (0x03) // ?? +#define S3C2410_UDC_INDEX_EP4 (0x04) // ?? + +#define S3C2410_UDC_ICSR1_CLRDT (1<<6) // R/W +#define S3C2410_UDC_ICSR1_SENTSTL (1<<5) // R/W (clear only) +#define S3C2410_UDC_ICSR1_SENDSTL (1<<4) // R/W +#define S3C2410_UDC_ICSR1_FFLUSH (1<<3) // W (set only) +#define S3C2410_UDC_ICSR1_UNDRUN (1<<2) // R/W (clear only) +#define S3C2410_UDC_ICSR1_PKTRDY (1<<0) // R/W (set only) + +#define S3C2410_UDC_ICSR2_AUTOSET (1<<7) // R/W +#define S3C2410_UDC_ICSR2_ISO (1<<6) // R/W +#define S3C2410_UDC_ICSR2_MODEIN (1<<5) // R/W +#define S3C2410_UDC_ICSR2_DMAIEN (1<<4) // R/W + +#define S3C2410_UDC_OCSR1_CLRDT (1<<7) // R/W +#define S3C2410_UDC_OCSR1_SENTSTL (1<<6) // R/W (clear only) +#define S3C2410_UDC_OCSR1_SENDSTL (1<<5) // R/W +#define S3C2410_UDC_OCSR1_FFLUSH (1<<4) // R/W +#define S3C2410_UDC_OCSR1_DERROR (1<<3) // R +#define S3C2410_UDC_OCSR1_OVRRUN (1<<2) // R/W (clear only) +#define S3C2410_UDC_OCSR1_PKTRDY (1<<0) // R/W (clear only) + +#define S3C2410_UDC_OCSR2_AUTOCLR (1<<7) // R/W +#define S3C2410_UDC_OCSR2_ISO (1<<6) // R/W +#define S3C2410_UDC_OCSR2_DMAIEN (1<<5) // R/W + +#define S3C2410_UDC_SETIX(x) \ + __raw_writel(S3C2410_UDC_INDEX_ ## x, S3C2410_UDC_INDEX_REG); + + +#define S3C2410_UDC_EP0_CSR_OPKRDY (1<<0) +#define S3C2410_UDC_EP0_CSR_IPKRDY (1<<1) +#define S3C2410_UDC_EP0_CSR_SENTSTL (1<<2) +#define S3C2410_UDC_EP0_CSR_DE (1<<3) +#define S3C2410_UDC_EP0_CSR_SE (1<<4) +#define S3C2410_UDC_EP0_CSR_SENDSTL (1<<5) +#define S3C2410_UDC_EP0_CSR_SOPKTRDY (1<<6) +#define S3C2410_UDC_EP0_CSR_SSE (1<<7) + +#define S3C2410_UDC_MAXP_8 (1<<0) +#define S3C2410_UDC_MAXP_16 (1<<1) +#define S3C2410_UDC_MAXP_32 (1<<2) +#define S3C2410_UDC_MAXP_64 (1<<3) + + +#endif diff -Nru a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-generic/iomap.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,63 @@ +#ifndef __GENERIC_IO_H +#define __GENERIC_IO_H + +#include + +/* + * These are the "generic" interfaces for doing new-style + * memory-mapped or PIO accesses. Architectures may do + * their own arch-optimized versions, these just act as + * wrappers around the old-style IO register access functions: + * read[bwl]/write[bwl]/in[bwl]/out[bwl] + * + * Don't include this directly, include it from . + */ + +/* + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO + * access or a MMIO access, these functions don't care. The info is + * encoded in the hardware mapping set up by the mapping functions + * (or the cookie itself, depending on implementation and hw). + * + * The generic routines just encode the PIO/MMIO as part of the + * cookie, and coldly assume that the MMIO IO mappings are not + * in the low address range. Architectures for which this is not + * true can't use this generic implementation. + */ +extern unsigned int fastcall ioread8(void __iomem *); +extern unsigned int fastcall ioread16(void __iomem *); +extern unsigned int fastcall ioread32(void __iomem *); + +extern void fastcall iowrite8(u8, void __iomem *); +extern void fastcall iowrite16(u16, void __iomem *); +extern void fastcall iowrite32(u32, void __iomem *); + +/* + * "string" versions of the above. Note that they + * use native byte ordering for the accesses (on + * the assumption that IO and memory agree on a + * byte order, and CPU byteorder is irrelevant). + * + * They do _not_ update the port address. If you + * want MMIO that copies stuff laid out in MMIO + * memory across multiple ports, use "memcpy_toio()" + * and friends. + */ +extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count); +extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count); +extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count); + +extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); + +/* Create a virtual mapping cookie for an IO port range */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); + +#endif diff -Nru a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h --- a/include/asm-generic/siginfo.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-generic/siginfo.h 2004-09-21 20:52:51 -07:00 @@ -75,7 +75,6 @@ int _status; /* exit code */ clock_t _utime; clock_t _stime; - struct rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ @@ -107,7 +106,6 @@ #define si_status _sifields._sigchld._status #define si_utime _sifields._sigchld._utime #define si_stime _sifields._sigchld._stime -#define si_rusage _sifields._sigchld._rusage #define si_value _sifields._rt._sigval #define si_int _sifields._rt._sigval.sival_int #define si_ptr _sifields._rt._sigval.sival_ptr diff -Nru a/include/asm-h8300/softirq.h b/include/asm-h8300/softirq.h --- a/include/asm-h8300/softirq.h 2004-09-21 20:52:52 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -Nru a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h --- a/include/asm-i386/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-i386/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -1,7 +1,6 @@ #ifndef _ASM_I386_DMA_MAPPING_H #define _ASM_I386_DMA_MAPPING_H -#include #include #include diff -Nru a/include/asm-i386/elf.h b/include/asm-i386/elf.h --- a/include/asm-i386/elf.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-i386/elf.h 2004-09-21 20:52:52 -07:00 @@ -123,7 +123,7 @@ * An executable for which elf_read_implies_exec() returns TRUE will * have the READ_IMPLIES_EXEC personality flag set automatically. */ -#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack)) +#define elf_read_implies_exec(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack)) extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); diff -Nru a/include/asm-i386/io.h b/include/asm-i386/io.h --- a/include/asm-i386/io.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-i386/io.h 2004-09-21 20:52:52 -07:00 @@ -45,6 +45,8 @@ #ifdef __KERNEL__ +#include + #include /** diff -Nru a/include/asm-i386/page.h b/include/asm-i386/page.h --- a/include/asm-i386/page.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-i386/page.h 2004-09-21 20:52:51 -07:00 @@ -94,13 +94,13 @@ * and CONFIG_HIGHMEM64G options in the kernel configuration. */ +#ifndef __ASSEMBLY__ + /* * This much address space is reserved for vmalloc() and iomap() * as well as fixmap mappings. */ -#define __VMALLOC_RESERVE (128 << 20) - -#ifndef __ASSEMBLY__ +extern unsigned int __VMALLOC_RESERVE; /* Pure 2^n version of get_order */ static __inline__ int get_order(unsigned long size) diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h --- a/include/asm-i386/processor.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-i386/processor.h 2004-09-21 20:52:51 -07:00 @@ -307,6 +307,7 @@ #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long)) #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap) #define INVALID_IO_BITMAP_OFFSET 0x8000 +#define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000 struct i387_fsave_struct { long cwd; @@ -360,6 +361,8 @@ unsigned long seg; } mm_segment_t; +struct thread_struct; + struct tss_struct { unsigned short back_link,__blh; unsigned long esp0; @@ -392,9 +395,14 @@ */ unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; /* + * Cache the current maximum and the last task that used the bitmap: + */ + unsigned long io_bitmap_max; + struct thread_struct *io_bitmap_owner; + /* * pads the TSS to be cacheline-aligned (size is 0x100) */ - unsigned long __cacheline_filler[37]; + unsigned long __cacheline_filler[35]; /* * .. and then another 0x100 bytes for emergency kernel stack */ @@ -426,7 +434,7 @@ /* IO permissions */ unsigned long *io_bitmap_ptr; /* max allowed port in the bitmap, in bytes: */ - unsigned int io_bitmap_max; + unsigned long io_bitmap_max; }; #define INIT_THREAD { \ @@ -446,7 +454,7 @@ .ss0 = __KERNEL_DS, \ .ss1 = __KERNEL_CS, \ .ldt = GDT_ENTRY_LDT, \ - .io_bitmap_base = offsetof(struct tss_struct,io_bitmap), \ + .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ } diff -Nru a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h --- a/include/asm-ia64/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ia64/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -6,7 +6,6 @@ * David Mosberger-Tang */ #include -#include #include #define dma_alloc_coherent platform_dma_alloc_coherent diff -Nru a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h --- a/include/asm-ia64/ia32.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ia64/ia32.h 2004-09-21 20:52:52 -07:00 @@ -14,7 +14,7 @@ # ifdef CONFIG_IA32_SUPPORT extern void ia32_cpu_init (void); -extern void ia32_boot_gdt_init (void); +extern void ia32_mem_init (void); extern void ia32_gdt_init (void); extern int ia32_exception (struct pt_regs *regs, unsigned long isr); extern int ia32_intercept (struct pt_regs *regs, unsigned long isr); diff -Nru a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h --- a/include/asm-ia64/mca_asm.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ia64/mca_asm.h 2004-09-21 20:52:52 -07:00 @@ -162,9 +162,6 @@ ;; \ srlz.d; \ mov r13 = ar.k6; \ - ;; \ - DATA_PA_TO_VA(r13,temp1); \ - ;; \ mov temp2 = ar.bspstore; \ ;; \ DATA_PA_TO_VA(temp2,temp1); \ diff -Nru a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h --- a/include/asm-ia64/siginfo.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ia64/siginfo.h 2004-09-21 20:52:52 -07:00 @@ -56,7 +56,6 @@ int _status; /* exit code */ clock_t _utime; clock_t _stime; - struct rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ diff -Nru a/include/asm-ia64/sn/sn2/sn_hwperf.h b/include/asm-ia64/sn/sn2/sn_hwperf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ia64/sn/sn2/sn_hwperf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,218 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. + * + * Data types used by the SN_SAL_HWPERF_OP SAL call for monitoring + * SGI Altix node and router hardware + * + * Mark Goodwin Mon Aug 30 12:23:46 EST 2004 + */ + +#ifndef SN_HWPERF_H +#define SN_HWPERF_H + +/* + * object structure. SN_HWPERF_ENUM_OBJECTS and SN_HWPERF_GET_CPU_INFO + * return an array of these. Do not change this without also + * changing the corresponding SAL code. + */ +#define SN_HWPERF_MAXSTRING 128 +struct sn_hwperf_object_info { + u32 id; + union { + struct { + u64 this_part:1; + u64 is_shared:1; + } fields; + struct { + u64 flags; + u64 reserved; + } b; + } f; + char name[SN_HWPERF_MAXSTRING]; + char location[SN_HWPERF_MAXSTRING]; + u32 ports; +}; + +#define sn_hwp_this_part f.fields.this_part +#define sn_hwp_is_shared f.fields.is_shared +#define sn_hwp_flags f.b.flags + +#define SN_HWPERF_FOREIGN(x) (!(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared) + +/* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */ +struct sn_hwperf_port_info { + u32 port; + u32 conn_id; + u32 conn_port; +}; + +/* for HWPERF_{GET,SET}_MMRS */ +struct sn_hwperf_data { + u64 addr; + u64 data; +}; + +/* user ioctl() argument, see below */ +struct sn_hwperf_ioctl_args { + u64 arg; /* argument, usually an object id */ + u64 sz; /* size of transfer */ + void *ptr; /* pointer to source/target */ + u32 v0; /* second return value */ +}; + +/* + * For SN_HWPERF_{GET,SET}_MMRS and SN_HWPERF_OBJECT_DISTANCE, + * sn_hwperf_ioctl_args.arg can be used to specify a CPU on which + * to call SAL, and whether to use an interprocessor interrupt + * or task migration in order to do so. If the CPU specified is + * SN_HWPERF_ARG_ANY_CPU, then the current CPU will be used. + */ +#define SN_HWPERF_ARG_ANY_CPU 0x7fffffffUL +#define SN_HWPERF_ARG_CPU_MASK 0x7fffffff00000000ULL +#define SN_HWPERF_ARG_USE_IPI_MASK 0x8000000000000000ULL +#define SN_HWPERF_ARG_OBJID_MASK 0x00000000ffffffffULL + +/* + * ioctl requests on the "sn_hwperf" misc device that call SAL. + */ +#define SN_HWPERF_OP_MEM_COPYIN 0x1000 +#define SN_HWPERF_OP_MEM_COPYOUT 0x2000 +#define SN_HWPERF_OP_MASK 0x0fff + +/* + * Determine mem requirement. + * arg don't care + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_HEAPSIZE 1 + +/* + * Install mem for SAL drvr + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to buffer for scratch area + */ +#define SN_HWPERF_INSTALL_HEAP 2 + +/* + * Determine number of objects + * arg don't care + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_OBJECT_COUNT (10|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Determine object "distance", relative to a cpu. This operation can + * execute on a designated logical cpu number, using either an IPI or + * via task migration. If the cpu number is SN_HWPERF_ANY_CPU, then + * the current CPU is used. See the SN_HWPERF_ARG_* macros above. + * + * arg bitmap of IPI flag, cpu number and object id + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_OBJECT_DISTANCE (11|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Enumerate objects. Special case if sz == 8, returns the required + * buffer size. + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_object_info + */ +#define SN_HWPERF_ENUM_OBJECTS (12|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Enumerate NumaLink ports for an object. Special case if sz == 8, + * returns the required buffer size. + * arg object id + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_port_info + */ +#define SN_HWPERF_ENUM_PORTS (13|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * SET/GET memory mapped registers. These operations can execute + * on a designated logical cpu number, using either an IPI or via + * task migration. If the cpu number is SN_HWPERF_ANY_CPU, then + * the current CPU is used. See the SN_HWPERF_ARG_* macros above. + * + * arg bitmap of ipi flag, cpu number and object id + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_data + */ +#define SN_HWPERF_SET_MMRS (14|SN_HWPERF_OP_MEM_COPYIN) +#define SN_HWPERF_GET_MMRS (15|SN_HWPERF_OP_MEM_COPYOUT| \ + SN_HWPERF_OP_MEM_COPYIN) +/* + * Lock a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_ACQUIRE 16 + +/* + * Unlock a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_RELEASE 17 + +/* + * Break a lock on a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_FORCE_RELEASE 18 + +/* + * ioctl requests on "sn_hwperf" that do not call SAL + */ + +/* + * get cpu info as an array of hwperf_object_info_t. + * id is logical CPU number, name is description, location + * is geoid (e.g. 001c04#1c). Special case if sz == 8, + * returns the required buffer size. + * + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_object_info + */ +#define SN_HWPERF_GET_CPU_INFO (100|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Given an object id, return it's node number (aka cnode). + * arg object id + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_OBJ_NODE (101|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Given a node number (cnode), return it's nasid. + * arg ordinal node number (aka cnodeid) + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT) + +/* return codes */ +#define SN_HWPERF_OP_OK 0 +#define SN_HWPERF_OP_NOMEM 1 +#define SN_HWPERF_OP_NO_PERM 2 +#define SN_HWPERF_OP_IO_ERROR 3 +#define SN_HWPERF_OP_BUSY 4 +#define SN_HWPERF_OP_RECONFIGURE 253 +#define SN_HWPERF_OP_INVAL 254 + +#endif /* SN_HWPERF_H */ diff -Nru a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h --- a/include/asm-ia64/sn/sn_sal.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ia64/sn/sn_sal.h 2004-09-21 20:52:52 -07:00 @@ -61,6 +61,7 @@ #define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant #define SN_SAL_IROUTER_OP 0x02000043 +#define SN_SAL_HWPERF_OP 0x02000050 // lock /* * Service-specific constants @@ -841,6 +842,23 @@ struct ia64_sal_retval rv; SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INIT, (u64) nasid, (u64) buf, (u64) len, 0, 0, 0); + return (int) rv.status; +} + +/* + * This is the access point to the Altix PROM hardware performance + * and status monitoring interface. For info on using this, see + * include/asm-ia64/sn/sn2/sn_hwperf.h + */ +static inline int +ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2, + u64 a3, u64 a4, int *v0) +{ + struct ia64_sal_retval rv; + SAL_CALL_NOLOCK(rv, SN_SAL_HWPERF_OP, (u64)nasid, + opcode, a0, a1, a2, a3, a4); + if (v0) + *v0 = (int) rv.v0; return (int) rv.status; } diff -Nru a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/a.out.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,28 @@ +#ifndef _ASM_M32R_A_OUT_H +#define _ASM_M32R_A_OUT_H + +/* orig : i386 2.4.18 */ + +struct exec +{ + unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; + +#define N_TRSIZE(a) ((a).a_trsize) +#define N_DRSIZE(a) ((a).a_drsize) +#define N_SYMSIZE(a) ((a).a_syms) + +#ifdef __KERNEL__ + +#define STACK_TOP TASK_SIZE + +#endif + +#endif /* _ASM_M32R_A_OUT_H */ diff -Nru a/include/asm-m32r/addrspace.h b/include/asm-m32r/addrspace.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/addrspace.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,58 @@ +/* $Id$ */ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo + * + * Defitions for the address spaces of the M32R CPUs. + */ +#ifndef __ASM_M32R_ADDRSPACE_H +#define __ASM_M32R_ADDRSPACE_H + +/* + * Memory segments (32bit kernel mode addresses) + */ +#define KUSEG 0x00000000 +#define KSEG0 0x80000000 +#define KSEG1 0xa0000000 +#define KSEG2 0xc0000000 +#define KSEG3 0xe0000000 + +#define K0BASE KSEG0 + +/* + * Returns the kernel segment base of a given address + */ +#ifndef __ASSEMBLY__ +#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000) +#else +#define KSEGX(a) ((a) & 0xe0000000) +#endif + +/* + * Returns the physical address of a KSEG0/KSEG1 address + */ +#ifndef __ASSEMBLY__ +#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) +#else +#define PHYSADDR(a) ((a) & 0x1fffffff) +#endif + +/* + * Map an address to a certain kernel segment + */ +#ifndef __ASSEMBLY__ +#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0)) +#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1)) +#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2)) +#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3)) +#else +#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0) +#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1) +#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2) +#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3) +#endif + +#endif /* __ASM_M32R_ADDRSPACE_H */ diff -Nru a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/assembler.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,212 @@ +#ifndef _ASM_M32R_ASSEMBLER_H +#define _ASM_M32R_ASSEMBLER_H + +/* $Id$ */ + +/* + * linux/asm-m32r/assembler.h + * + * This file contains M32R architecture specific defines. + * + * Do not include any C declarations in this file - it is included by + * assembler source. + */ + +#include + + +#undef ENTRY +#define ENTRY(name) ENTRY_M name + .macro ENTRY_M name + .global \name + ALIGN +\name: + .endm + +/* + * LDIMM: load immediate value + * + * STI: enable interruption + * CLI: disable interruption + */ + +#ifdef __ASSEMBLY__ + +#define LDIMM(reg,x) LDIMM reg x + .macro LDIMM reg x + seth \reg, #high(\x) + or3 \reg, \reg, #low(\x) + .endm + +#if !defined(CONFIG_CHIP_M32102) +#define STI(reg) STI_M reg + .macro STI_M reg + setpsw #0x40 -> nop + ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). + .endm + +#define CLI(reg) CLI_M reg + .macro CLI_M reg + clrpsw #0x40 -> nop + ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). + .endm +#else /* CONFIG_CHIP_M32102 */ +#define STI(reg) STI_M reg + .macro STI_M reg + mvfc \reg, psw + or3 \reg, \reg, #0x0040 + mvtc \reg, psw + .endm + +#define CLI(reg) CLI_M reg + .macro CLI_M reg + mvfc \reg, psw + and3 \reg, \reg, #0xffbf + mvtc \reg, psw + .endm +#endif /* CONFIG_CHIP_M32102 */ + + .macro SAVE_ALL + push r0 ; orig_r0 + push sp ; spi (r15) + push lr ; r14 + push r13 + mvfc r13, cr3 ; spu + push r13 + mvfc r13, bbpc + push r13 + mvfc r13, bbpsw + push r13 + mvfc r13, bpc + push r13 + mvfc r13, psw + push r13 +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + mvfaclo r13, a1 + push r13 + mvfachi r13, a1 + push r13 + mvfaclo r13, a0 + push r13 + mvfachi r13, a0 + push r13 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + mvfaclo r13 + push r13 + mvfachi r13 + push r13 +#else +#error unknown isa configuration +#endif + ldi r13, #-1 + push r13 ; syscall_nr (default: -1) + push r12 + push r11 + push r10 + push r9 + push r8 + push r7 + push r3 + push r2 + push r1 + push r0 + addi sp, #-4 ; room for implicit pt_regs parameter + push r6 + push r5 + push r4 + .endm + + .macro RESTORE_ALL + pop r4 + pop r5 + pop r6 + addi sp, #4 + pop r0 + pop r1 + pop r2 + pop r3 + pop r7 + pop r8 + pop r9 + pop r10 + pop r11 + pop r12 + addi r15, #4 ; Skip syscall number +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + pop r13 + mvtachi r13, a0 + pop r13 + mvtaclo r13, a0 + pop r13 + mvtachi r13, a1 + pop r13 + mvtaclo r13, a1 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + pop r13 + mvtachi r13 + pop r13 + mvtaclo r13 +#else +#error unknown isa configuration +#endif + pop r14 + mvtc r14, psw + pop r14 + mvtc r14, bpc + addi sp, #8 ; Skip bbpsw, bbpc + pop r14 + mvtc r14, cr3 ; spu + pop r13 + pop lr ; r14 + pop sp ; spi (r15) + addi sp, #4 ; Skip orig_r0 + .fillinsn +1: rte + .section .fixup,"ax" +2: bl do_exit + .previous + .section __ex_table,"a" + ALIGN + .long 1b, 2b + .previous + .endm + +#define GET_CURRENT(reg) get_current reg + .macro get_current reg + ldi \reg, #-8192 + and \reg, sp + .endm + +#if !defined(CONFIG_CHIP_M32102) + .macro SWITCH_TO_KERNEL_STACK + ; switch to kernel stack (spi) + clrpsw #0x80 -> nop + .endm +#else /* CONFIG_CHIP_M32102 */ + .macro SWITCH_TO_KERNEL_STACK + push r0 ; save r0 for working + mvfc r0, psw + and3 r0, r0, #0x00ff7f + mvtc r0, psw + slli r0, #16 + bltz r0, 1f ; check BSM-bit +; + ;; called from kernel context: previous stack = spi + pop r0 ; retrieve r0 + bra 2f + .fillinsn +1: + ;; called from user context: previous stack = spu + mvfc r0, cr3 ; spu + addi r0, #4 + mvtc r0, cr3 ; spu + ld r0, @(-4,r0) ; retrieve r0 + .fillinsn +2: + .endm +#endif /* CONFIG_CHIP_M32102 */ + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_M32R_ASSEMBLER_H */ + diff -Nru a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/atomic.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,305 @@ +#ifndef _ASM_M32R_ATOMIC_H +#define _ASM_M32R_ATOMIC_H + +/* + * linux/include/asm-m32r/atomic.h + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + * Copyright (C) 2004 Hirokazu Takata + */ + +#include +#include + +/* + * Atomic operations that C can't guarantee us. Useful for + * resource counting etc.. + */ + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +/* + * Make sure gcc doesn't try to be clever and move things around + * on us. We need to use _exactly_ the address the user gave us, + * not some alias that contains the same information. + */ +typedef struct { volatile int counter; } atomic_t; + +#define ATOMIC_INIT(i) { (i) } + +/** + * atomic_read - read atomic variable + * @v: pointer of type atomic_t + * + * Atomically reads the value of @v. + */ +#define atomic_read(v) ((v)->counter) + +/** + * atomic_set - set atomic variable + * @v: pointer of type atomic_t + * @i: required value + * + * Atomically sets the value of @v to @i. + */ +#define atomic_set(v,i) (((v)->counter) = (i)) + +/** + * atomic_add_return - add integer to atomic variable and return it + * @i: integer value to add + * @v: pointer of type atomic_t + * + * Atomically adds @i to @v and return (@i + @v). + */ +static inline int atomic_add_return(int i, atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_add_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "add %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter), "r" (i) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_sub_return - subtract integer from atomic variable and return it + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v and return (@v - @i). + */ +static inline int atomic_sub_return(int i, atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_sub_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "sub %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter), "r" (i) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_add - add integer to atomic variable + * @i: integer value to add + * @v: pointer of type atomic_t + * + * Atomically adds @i to @v. + */ +#define atomic_add(i,v) ((void) atomic_add_return((i), (v))) + +/** + * atomic_sub - subtract the atomic variable + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v. + */ +#define atomic_sub(i,v) ((void) atomic_sub_return((i), (v))) + +/** + * atomic_sub_and_test - subtract value from variable and test result + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v and returns + * true if the result is zero, or false for all + * other cases. + */ +#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) + +/** + * atomic_inc_return - increment atomic variable and return it + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1 and returns the result. + */ +static inline int atomic_inc_return(atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_inc_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_dec_return - decrement atomic variable and return it + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and returns the result. + */ +static inline int atomic_dec_return(atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_dec_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_inc - increment atomic variable + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1. + */ +#define atomic_inc(v) ((void)atomic_inc_return(v)) + +/** + * atomic_dec - decrement atomic variable + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1. + */ +#define atomic_dec(v) ((void)atomic_dec_return(v)) + +/** + * atomic_inc_and_test - increment and test + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1 + * and returns true if the result is zero, or false for all + * other cases. + */ +#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) + +/** + * atomic_dec_and_test - decrement and test + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and + * returns true if the result is 0, or false for all + * other cases. + */ +#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) + +/** + * atomic_add_negative - add and test if negative + * @v: pointer of type atomic_t + * @i: integer value to add + * + * Atomically adds @i to @v and returns true + * if the result is negative, or false when + * result is greater than or equal to zero. + */ +#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0) + +static inline void atomic_clear_mask(unsigned long mask, atomic_t *addr) +{ + unsigned long flags; + unsigned long tmp; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_clear_mask \n\t" + DCACHE_CLEAR("%0", "r5", "%1") + LOAD" %0, @%1; \n\t" + "and %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (tmp) + : "r" (addr), "r" (~mask) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +static inline void atomic_set_mask(unsigned long mask, atomic_t *addr) +{ + unsigned long flags; + unsigned long tmp; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_set_mask \n\t" + DCACHE_CLEAR("%0", "r5", "%1") + LOAD" %0, @%1; \n\t" + "or %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (tmp) + : "r" (addr), "r" (mask) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/* Atomic operations are already serializing on m32r */ +#define smp_mb__before_atomic_dec() barrier() +#define smp_mb__after_atomic_dec() barrier() +#define smp_mb__before_atomic_inc() barrier() +#define smp_mb__after_atomic_inc() barrier() + +#endif /* _ASM_M32R_ATOMIC_H */ + diff -Nru a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bitops.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,712 @@ +#ifndef _ASM_M32R_BITOPS_H +#define _ASM_M32R_BITOPS_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/bitops.h + * orig : i386 2.4.10 + * + * Copyright 1992, Linus Torvalds. + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + * Copyright (C) 2004 Hirokazu Takata + */ + +#include +#include +#include +#include +#include + +/* + * These have to be done with inline assembly: that way the bit-setting + * is guaranteed to be atomic. All bit operations return 0 if the bit + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +/* #define ADDR (*(volatile long *) addr) */ + +/** + * set_bit - Atomically set a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * This function is atomic and may not be reordered. See __set_bit() + * if you do not require the atomic guarantees. + * Note that @nr may be almost arbitrarily large; this function is not + * restricted to acting on a single-word quantity. + */ +static __inline__ void set_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "or r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/** + * __set_bit - Set a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * Unlike set_bit(), this function is non-atomic and may be reordered. + * If it's called on the same region of memory simultaneously, the effect + * may be that only one operation succeeds. + */ +static __inline__ void __set_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a |= mask; +} + +/** + * clear_bit - Clears a bit in memory + * @nr: Bit to clear + * @addr: Address to start counting from + * + * clear_bit() is atomic and may not be reordered. However, it does + * not contain a memory barrier, so if it is used for locking purposes, + * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() + * in order to ensure changes are visible on other processors. + */ +static __inline__ void clear_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "and r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (~mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +static __inline__ void __clear_bit(int nr, volatile unsigned long * addr) +{ + unsigned long mask; + volatile unsigned long *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a &= ~mask; +} + +#define smp_mb__before_clear_bit() barrier() +#define smp_mb__after_clear_bit() barrier() + +/** + * __change_bit - Toggle a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * Unlike change_bit(), this function is non-atomic and may be reordered. + * If it's called on the same region of memory simultaneously, the effect + * may be that only one operation succeeds. + */ +static __inline__ void __change_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a ^= mask; +} + +/** + * change_bit - Toggle a bit in memory + * @nr: Bit to clear + * @addr: Address to start counting from + * + * change_bit() is atomic and may not be reordered. + * Note that @nr may be almost arbitrarily large; this function is not + * restricted to acting on a single-word quantity. + */ +static __inline__ void change_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "xor r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/** + * test_and_set_bit - Set a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_set_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "mv r4, %0; \n\t" + "and %0, %2; \n\t" + "or r4, %2; \n\t" + STORE" r4, @%1; \n\t" + : "=&r" (oldbit) + : "r" (a), "r" (mask) + : "memory", "r4" + ); + local_irq_restore(flags); + return (oldbit != 0); +} + +/** + * __test_and_set_bit - Set a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is non-atomic and can be reordered. + * If two examples of this operation race, one can appear to succeed + * but actually fail. You must protect multiple accesses with a lock. + */ +static __inline__ int __test_and_set_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a |= mask; + + return (oldbit != 0); +} + +/** + * test_and_clear_bit - Clear a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_clear_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%2") + LOAD" %0, @%2; \n\t" + "mv r4, %0; \n\t" + "and %0, %1; \n\t" + "not %1, %1; \n\t" + "and r4, %1; \n\t" + STORE" r4, @%2; \n\t" + : "=&r" (oldbit), "+r" (mask) + : "r" (a) + : "memory", "r4" + ); + local_irq_restore(flags); + + return (oldbit != 0); +} + +/** + * __test_and_clear_bit - Clear a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is non-atomic and can be reordered. + * If two examples of this operation race, one can appear to succeed + * but actually fail. You must protect multiple accesses with a lock. + */ +static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a &= ~mask; + + return (oldbit != 0); +} + +/* WARNING: non atomic and it can be reordered! */ +static __inline__ int __test_and_change_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a ^= mask; + + return (oldbit != 0); +} + +/** + * test_and_change_bit - Change a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_change_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "mv r4, %0; \n\t" + "and %0, %2; \n\t" + "xor r4, %2; \n\t" + STORE" r4, @%1; \n\t" + : "=&r" (oldbit) + : "r" (a), "r" (mask) + : "memory", "r4" + ); + local_irq_restore(flags); + return (oldbit != 0); +} + +#if 0 /* Fool kernel-doc since it doesn't do macros yet */ +/** + * test_bit - Determine whether a bit is set + * @nr: bit number to test + * @addr: Address to start counting from + */ +static int test_bit(int nr, const volatile void * addr); +#endif + +static __inline__ int test_bit(int nr, const volatile void * addr) +{ + __u32 mask; + const volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + return ((*a & mask) != 0); +} + +/** + * ffz - find first zero in word. + * @word: The word to search + * + * Undefined if no zero exists, so code should check against ~0UL first. + */ +static __inline__ unsigned long ffz(unsigned long word) +{ + int k; + + word = ~word; + k = 0; + if (!(word & 0x0000ffff)) { k += 16; word >>= 16; } + if (!(word & 0x000000ff)) { k += 8; word >>= 8; } + if (!(word & 0x0000000f)) { k += 4; word >>= 4; } + if (!(word & 0x00000003)) { k += 2; word >>= 2; } + if (!(word & 0x00000001)) { k += 1; } + + return k; +} + +/** + * find_first_zero_bit - find the first zero bit in a memory region + * @addr: The address to start the search at + * @size: The maximum size to search + * + * Returns the bit-number of the first zero bit, not the number of the byte + * containing a bit. + */ + +#define find_first_zero_bit(addr, size) \ + find_next_zero_bit((addr), (size), 0) + +/** + * find_next_zero_bit - find the first zero bit in a memory region + * @addr: The address to base the search on + * @offset: The bitnumber to start searching at + * @size: The maximum size to search + */ +static __inline__ int find_next_zero_bit(void *addr, int size, int offset) +{ + unsigned long *p = ((unsigned long *) addr) + (offset >> 5); + unsigned long result = offset & ~31UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 31UL; + if (offset) { + tmp = *(p++); + tmp |= ~0UL >> (32-offset); + if (size < 32) + goto found_first; + if (~tmp) + goto found_middle; + size -= 32; + result += 32; + } + while (size & ~31UL) { + if (~(tmp = *(p++))) + goto found_middle; + result += 32; + size -= 32; + } + if (!size) + return result; + tmp = *p; + +found_first: + tmp |= ~0UL << size; +found_middle: + return result + ffz(tmp); +} + +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + */ +static __inline__ unsigned long __ffs(unsigned long word) +{ + int k = 0; + + if (!(word & 0x0000ffff)) { k += 16; word >>= 16; } + if (!(word & 0x000000ff)) { k += 8; word >>= 8; } + if (!(word & 0x0000000f)) { k += 4; word >>= 4; } + if (!(word & 0x00000003)) { k += 2; word >>= 2; } + if (!(word & 0x00000001)) { k += 1;} + + return k; +} + +/* + * fls: find last bit set. + */ +#define fls(x) generic_fls(x) + +#ifdef __KERNEL__ + +/* + * Every architecture must define this function. It's the fastest + * way of searching a 140-bit bitmap where the first 100 bits are + * unlikely to be set. It's guaranteed that at least one of the 140 + * bits is cleared. + */ +static __inline__ int sched_find_first_bit(unsigned long *b) +{ + if (unlikely(b[0])) + return __ffs(b[0]); + if (unlikely(b[1])) + return __ffs(b[1]) + 32; + if (unlikely(b[2])) + return __ffs(b[2]) + 64; + if (b[3]) + return __ffs(b[3]) + 96; + return __ffs(b[4]) + 128; +} + +/** + * find_next_bit - find the first set bit in a memory region + * @addr: The address to base the search on + * @offset: The bitnumber to start searching at + * @size: The maximum size to search + */ +static __inline__ unsigned long find_next_bit(const unsigned long *addr, + unsigned long size, unsigned long offset) +{ + unsigned int *p = ((unsigned int *) addr) + (offset >> 5); + unsigned int result = offset & ~31UL; + unsigned int tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 31UL; + if (offset) { + tmp = *p++; + tmp &= ~0UL << offset; + if (size < 32) + goto found_first; + if (tmp) + goto found_middle; + size -= 32; + result += 32; + } + while (size >= 32) { + if ((tmp = *p++) != 0) + goto found_middle; + result += 32; + size -= 32; + } + if (!size) + return result; + tmp = *p; + +found_first: + tmp &= ~0UL >> (32 - size); + if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ +found_middle: + return result + __ffs(tmp); +} + +/** + * find_first_bit - find the first set bit in a memory region + * @addr: The address to start the search at + * @size: The maximum size to search + * + * Returns the bit-number of the first set bit, not the number of the byte + * containing a bit. + */ +#define find_first_bit(addr, size) \ + find_next_bit((addr), (size), 0) + +/** + * ffs - find first bit set + * @x: the word to search + * + * This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from the above ffz (man ffs). + */ +#define ffs(x) generic_ffs(x) + +/** + * hweightN - returns the hamming weight of a N-bit word + * @x: the word to weigh + * + * The Hamming Weight of a number is the total number of bits set in it. + */ + +#define hweight32(x) generic_hweight32(x) +#define hweight16(x) generic_hweight16(x) +#define hweight8(x) generic_hweight8(x) + +#endif /* __KERNEL__ */ + +#ifdef __KERNEL__ + +/* + * ext2_XXXX function + * orig: include/asm-sh/bitops.h + */ + +#ifdef __LITTLE_ENDIAN__ +#define ext2_set_bit test_and_set_bit +#define ext2_clear_bit __test_and_clear_bit +#define ext2_test_bit test_bit +#define ext2_find_first_zero_bit find_first_zero_bit +#define ext2_find_next_zero_bit find_next_zero_bit +#else +static __inline__ int ext2_set_bit(int nr, volatile void * addr) +{ + __u8 mask, oldbit; + volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + oldbit = (*a & mask); + *a |= mask; + + return (oldbit != 0); +} + +static __inline__ int ext2_clear_bit(int nr, volatile void * addr) +{ + __u8 mask, oldbit; + volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + oldbit = (*a & mask); + *a &= ~mask; + + return (oldbit != 0); +} + +static __inline__ int ext2_test_bit(int nr, const volatile void * addr) +{ + __u32 mask; + const volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + + return ((mask & *a) != 0); +} + +#define ext2_find_first_zero_bit(addr, size) \ + ext2_find_next_zero_bit((addr), (size), 0) + +static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, + unsigned long size, unsigned long offset) +{ + unsigned long *p = ((unsigned long *) addr) + (offset >> 5); + unsigned long result = offset & ~31UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 31UL; + if(offset) { + /* We hold the little endian value in tmp, but then the + * shift is illegal. So we could keep a big endian value + * in tmp, like this: + * + * tmp = __swab32(*(p++)); + * tmp |= ~0UL >> (32-offset); + * + * but this would decrease preformance, so we change the + * shift: + */ + tmp = *(p++); + tmp |= __swab32(~0UL >> (32-offset)); + if(size < 32) + goto found_first; + if(~tmp) + goto found_middle; + size -= 32; + result += 32; + } + while(size & ~31UL) { + if(~(tmp = *(p++))) + goto found_middle; + result += 32; + size -= 32; + } + if(!size) + return result; + tmp = *p; + +found_first: + /* tmp is little endian, so we would have to swab the shift, + * see above. But then we have to swab tmp below for ffz, so + * we might as well do this here. + */ + return result + ffz(__swab32(tmp) | (~0UL << size)); +found_middle: + return result + ffz(__swab32(tmp)); +} +#endif + +#define ext2_set_bit_atomic(lock, nr, addr) \ + ({ \ + int ret; \ + spin_lock(lock); \ + ret = ext2_set_bit((nr), (addr)); \ + spin_unlock(lock); \ + ret; \ + }) + +#define ext2_clear_bit_atomic(lock, nr, addr) \ + ({ \ + int ret; \ + spin_lock(lock); \ + ret = ext2_clear_bit((nr), (addr)); \ + spin_unlock(lock); \ + ret; \ + }) + +/* Bitmap functions for the minix filesystem. */ +#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr) +#define minix_set_bit(nr,addr) __set_bit(nr,addr) +#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr) +#define minix_test_bit(nr,addr) test_bit(nr,addr) +#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_BITOPS_H */ + diff -Nru a/include/asm-m32r/bug.h b/include/asm-m32r/bug.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bug.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,22 @@ +#ifndef _M32R_BUG_H +#define _M32R_BUG_H + +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ +} while (0) + +#define PAGE_BUG(page) do { BUG(); } while (0) + +#define BUG_ON(condition) \ + do { if (unlikely((condition)!=0)) BUG(); } while(0) + +#define WARN_ON(condition) do { \ + if (unlikely((condition)!=0)) { \ + printk("Badness in %s at %s:%d\n", __FUNCTION__, \ + __FILE__, __LINE__); \ + dump_stack(); \ + } \ +} while (0) + +#endif /* _M32R_BUG_H */ + diff -Nru a/include/asm-m32r/bugs.h b/include/asm-m32r/bugs.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bugs.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,21 @@ +#ifndef _ASM_M32R_BUGS_H +#define _ASM_M32R_BUGS_H + +/* $Id$ */ + +/* + * This is included by init/main.c to check for architecture-dependent bugs. + * + * Needs: + * void check_bugs(void); + */ +#include + +static void __init check_bugs(void) +{ + extern unsigned long loops_per_jiffy; + + current_cpu_data.loops_per_jiffy = loops_per_jiffy; +} + +#endif /* _ASM_M32R_BUGS_H */ diff -Nru a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/byteorder.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,19 @@ +#ifndef _ASM_M32R_BYTEORDER_H +#define _ASM_M32R_BYTEORDER_H + +/* $Id$ */ + +#include + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ +#endif + +#if defined(__LITTLE_ENDIAN__) +# include +#else +# include +#endif + +#endif /* _ASM_M32R_BYTEORDER_H */ diff -Nru a/include/asm-m32r/cache.h b/include/asm-m32r/cache.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cache.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,12 @@ +#ifndef _ASM_M32R_CACHE_H +#define _ASM_M32R_CACHE_H + +/* $Id$ */ + +/* L1 cache line size */ +#define L1_CACHE_SHIFT 4 +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#define L1_CACHE_SHIFT_MAX 4 + +#endif /* _ASM_M32R_CACHE_H */ diff -Nru a/include/asm-m32r/cachectl.h b/include/asm-m32r/cachectl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cachectl.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,26 @@ +/* + * cachectl.h -- defines for M32R cache control system calls + * + * Copyright (C) 2003 by Kazuhiro Inaoka + */ +#ifndef __ASM_M32R_CACHECTL +#define __ASM_M32R_CACHECTL + +/* + * Options for cacheflush system call + * + * cacheflush() is currently fluch_cache_all(). + */ +#define ICACHE (1<<0) /* flush instruction cache */ +#define DCACHE (1<<1) /* writeback and flush data cache */ +#define BCACHE (ICACHE|DCACHE) /* flush both caches */ + +/* + * Caching modes for the cachectl(2) call + * + * cachectl(2) is currently not supported and returns ENOSYS. + */ +#define CACHEABLE 0 /* make pages cacheable */ +#define UNCACHEABLE 1 /* make pages uncacheable */ + +#endif /* __ASM_M32R_CACHECTL */ diff -Nru a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cacheflush.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,68 @@ +#ifndef _ASM_M32R_CACHEFLUSH_H +#define _ASM_M32R_CACHEFLUSH_H + +#include +#include + +extern void _flush_cache_all(void); +extern void _flush_cache_copyback_all(void); + +#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#ifndef CONFIG_SMP +#define flush_icache_range(start, end) _flush_cache_copyback_all() +#define flush_icache_page(vma,pg) _flush_cache_copyback_all() +#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_copyback_all() +#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() +#else /* CONFIG_SMP */ +extern void smp_flush_cache_all(void); +#define flush_icache_range(start, end) smp_flush_cache_all() +#define flush_icache_page(vma,pg) smp_flush_cache_all() +#define flush_icache_user_range(vma,pg,adr,len) smp_flush_cache_all() +#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() +#endif /* CONFIG_SMP */ +#elif defined(CONFIG_CHIP_M32102) +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) _flush_cache_all() +#define flush_icache_page(vma,pg) _flush_cache_all() +#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_all() +#define flush_cache_sigtramp(addr) _flush_cache_all() +#else +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) +#define flush_icache_page(vma,pg) do { } while (0) +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_sigtramp(addr) do { } while (0) +#endif /* CONFIG_CHIP_* */ + +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { \ + memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + +#endif /* _ASM_M32R_CACHEFLUSH_H */ + diff -Nru a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/checksum.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,206 @@ +#ifdef __KERNEL__ +#ifndef _ASM_M32R_CHECKSUM_H +#define _ASM_M32R_CHECKSUM_H + +/* + * include/asm-m32r/checksum.h + * + * IP/TCP/UDP checksum routines + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Some code taken from mips and parisc architecture. + * + * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + */ + +#include + +/* + * computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); + +/* + * The same as csum_partial, but copies from src while it checksums. + * + * Here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ +extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, + int len, unsigned int sum); + +/* + * This is a new version of the above that records errors it finds in *errp, + * but continues and zeros thre rest of the buffer. + */ +extern unsigned int csum_partial_copy_from_user(const char __user *src, + char *dst, + int len, unsigned int sum, + int *err_ptr); + +/* + * Fold a partial checksum + */ + +static inline unsigned int csum_fold(unsigned int sum) +{ + unsigned long tmpreg; + __asm__( + " sll3 %1, %0, #16 \n" + " cmp %0, %0 \n" + " addx %0, %1 \n" + " ldi %1, #0 \n" + " srli %0, #16 \n" + " addx %0, %1 \n" + " xor3 %0, %0, #0x0000ffff \n" + : "=r" (sum), "=&r" (tmpreg) + : "0" (sum) + : "cbit" + ); + return sum; +} + +/* + * This is a version of ip_compute_csum() optimized for IP headers, + * which always checksum on 4 octet boundaries. + */ +static inline unsigned short ip_fast_csum(unsigned char * iph, + unsigned int ihl) { + unsigned long sum, tmpreg0, tmpreg1; + + __asm__ __volatile__( + " ld %0, @%1+ \n" + " addi %2, #-4 \n" + "# bgez %2, 2f \n" + " cmp %0, %0 \n" + " ld %3, @%1+ \n" + " ld %4, @%1+ \n" + " addx %0, %3 \n" + " ld %3, @%1+ \n" + " addx %0, %4 \n" + " addx %0, %3 \n" + " .fillinsn\n" + "1: \n" + " ld %4, @%1+ \n" + " addi %2, #-1 \n" + " addx %0, %4 \n" + " bgtz %2, 1b \n" + "\n" + " ldi %3, #0 \n" + " addx %0, %3 \n" + " .fillinsn\n" + "2: \n" + /* Since the input registers which are loaded with iph and ipl + are modified, we must also specify them as outputs, or gcc + will assume they contain their original values. */ + : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1) + : "1" (iph), "2" (ihl) + : "cbit", "memory"); + + return csum_fold(sum); +} + +static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ +#if defined(__LITTLE_ENDIAN) + unsigned long len_proto = (ntohs(len)<<16)+proto*256; +#else + unsigned long len_proto = (proto<<16)+len; +#endif + unsigned long tmpreg; + + __asm__( + " cmp %0, %0 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " ldi %1, #0 \n" + " addx %0, %1 \n" + : "=r" (sum), "=&r" (tmpreg) + : "r" (daddr), "r" (saddr), "r" (len_proto), "0" (sum) + : "cbit" + ); + + return sum; +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); +} + +/* + * this routine is used for miscellaneous IP-like checksums, mainly + * in icmp.c + */ + +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { + return csum_fold (csum_partial(buff, len, 0)); +} + +#define _HAVE_ARCH_IPV6_CSUM +static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, + struct in6_addr *daddr, + __u16 len, + unsigned short proto, + unsigned int sum) +{ + unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3; + __asm__( + " ld %1, @(%5) \n" + " ld %2, @(4,%5) \n" + " ld %3, @(8,%5) \n" + " ld %4, @(12,%5) \n" + " add %0, %1 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " ld %1, @(%6) \n" + " ld %2, @(4,%6) \n" + " ld %3, @(8,%6) \n" + " ld %4, @(12,%6) \n" + " addx %0, %1 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " addx %0, %7 \n" + " addx %0, %8 \n" + " ldi %1, #0 \n" + " addx %0, %1 \n" + : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1), + "=&r" (tmpreg2), "=&r" (tmpreg3) + : "r" (saddr), "r" (daddr), + "r" (htonl((__u32) (len))), "r" (htonl(proto)), "0" (sum) + : "cbit" + ); + + return csum_fold(sum); +} + +#endif /* _ASM_M32R_CHECKSUM_H */ +#endif /* __KERNEL__ */ diff -Nru a/include/asm-m32r/current.h b/include/asm-m32r/current.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/current.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,18 @@ +#ifndef _ASM_M32R_CURRENT_H +#define _ASM_M32R_CURRENT_H + +/* $Id$ */ + +#include + +struct task_struct; + +static __inline__ struct task_struct *get_current(void) +{ + return current_thread_info()->task; +} + +#define current (get_current()) + +#endif /* _ASM_M32R_CURRENT_H */ + diff -Nru a/include/asm-m32r/delay.h b/include/asm-m32r/delay.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/delay.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,28 @@ +#ifndef _ASM_M32R_DELAY_H +#define _ASM_M32R_DELAY_H + +/* $Id$ */ + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines calling functions in arch/m32r/lib/delay.c + */ + +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + +extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long usecs); +extern void __delay(unsigned long loops); + +#define udelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ + __udelay(n)) + +#define ndelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ + __ndelay(n)) + +#endif /* _ASM_M32R_DELAY_H */ diff -Nru a/include/asm-m32r/div64.h b/include/asm-m32r/div64.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/div64.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,38 @@ +#ifndef _ASM_M32R_DIV64 +#define _ASM_M32R_DIV64 + +/* $Id$ */ + +/* unsigned long long division. + * Input: + * unsigned long long n + * unsigned long base + * Output: + * n = n / base; + * return value = n % base; + */ +#define do_div(n, base) \ +({ \ + unsigned long _res, _high, _mid, _low; \ + \ + _low = (n) & 0xffffffffUL; \ + _high = (n) >> 32; \ + if (_high) { \ + _mid = (_high % (unsigned long)(base)) << 16; \ + _high = _high / (unsigned long)(base); \ + _mid += _low >> 16; \ + _low &= 0x0000ffffUL; \ + _low += (_mid % (unsigned long)(base)) << 16; \ + _mid = _mid / (unsigned long)(base); \ + _res = _low % (unsigned long)(base); \ + _low = _low / (unsigned long)(base); \ + n = _low + ((long long)_mid << 16) + \ + ((long long)_high << 32); \ + } else { \ + _res = _low % (unsigned long)(base); \ + n = (_low / (unsigned long)(base)); \ + } \ + _res; \ +}) + +#endif /* _ASM_M32R_DIV64 */ diff -Nru a/include/asm-m32r/dma-mapping.h b/include/asm-m32r/dma-mapping.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,23 @@ +#ifndef _ASM_M32R_DMA_MAPPING_H +#define _ASM_M32R_DMA_MAPPING_H + +/* + * NOTE: Do not include + * Because it requires PCI stuffs, but current M32R don't provide these. + */ + +static inline void * +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, + int flag) +{ + return (void *)NULL; +} + +static inline void +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t dma_handle) +{ + return; +} + +#endif /* _ASM_M32R_DMA_MAPPING_H */ diff -Nru a/include/asm-m32r/dma.h b/include/asm-m32r/dma.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/dma.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_DMA_H +#define _ASM_M32R_DMA_H + +/* $Id$ */ + +#include + +/* + * The maximum address that we can perform a DMA transfer + * to on this platform + */ +#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x20000000) + +#endif /* _ASM_M32R_DMA_H */ diff -Nru a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/elf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,172 @@ +#ifndef _ASM_M32R__ELF_H +#define _ASM_M32R__ELF_H + +/* + * ELF-specific definitions. + * + * Copyright (C) 1999-2004, Renesas Technology Corp. + * Hirokazu Takata + */ + +#include +#include +#include + +/* M32R relocation types */ +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#ifdef OLD_TYPE +#define R_M32R_GOT24 11 +#define R_M32R_26_PLTREL 12 +#define R_M32R_GOT16_HI_ULO 13 +#define R_M32R_GOT16_HI_SLO 14 +#define R_M32R_GOT16_LO 15 +#define R_M32R_GOTPC24 16 +#define R_M32R_COPY 17 +#define R_M32R_GLOB_DAT 18 +#define R_M32R_JMP_SLOT 19 +#define R_M32R_RELATIVE 20 +#define R_M32R_GNU_VTINHERIT 21 +#define R_M32R_GNU_VTENTRY 22 + +#define R_M32R_16_RELA R_M32R_16 +#define R_M32R_32_RELA R_M32R_32 +#define R_M32R_24_RELA R_M32R_24 +#define R_M32R_10_PCREL_RELA R_M32R_10_PCREL +#define R_M32R_18_PCREL_RELA R_M32R_18_PCREL +#define R_M32R_26_PCREL_RELA R_M32R_26_PCREL +#define R_M32R_HI16_ULO_RELA R_M32R_HI16_ULO +#define R_M32R_HI16_SLO_RELA R_M32R_HI16_SLO +#define R_M32R_LO16_RELA R_M32R_LO16 +#define R_M32R_SDA16_RELA R_M32R_SDA16 +#else /* not OLD_TYPE */ +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_GOT24_SAMPLE 11 /* comflict */ +#define R_M32R_26_PLTREL_SAMPLE 12 /* comflict */ +#define R_M32R_GOT16_HI_ULO_SAMPLE 13 +#define R_M32R_GOT16_HI_SLO_SAMPLE 14 +#define R_M32R_GOT16_LO_SAMPLE 15 +#define R_M32R_GOTPC24_SAMPLE 16 +#define R_M32R_COPY_SAMPLE 17 +#define R_M32R_GLOB_DAT_SAMPLE 18 +#define R_M32R_JMP_SLOT_SAMPLE 19 +#define R_M32R_RELATIVE_SAMPLE 20 +#define R_M32R_GNU_VTINHERIT_SAMPLE 21 +#define R_M32R_GNU_VTENTRY_SAMPLE 22 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 +#define R_M32R_GOT16_HI_SLO 57 +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 +#define R_M32R_GOTPC_HI_SLO 60 +#define R_M32R_GOTPC_LO 61 +#endif /* not OLD_TYPE */ + +#define R_M32R_NUM 256 + +/* + * ELF register definitions.. + */ +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* We have no FP mumumu. */ +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t; + +/* + * This is used to ensure we don't load something for the wrong architecture. + */ +#define elf_check_arch(x) \ + (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R)) + +/* + * These are used to set parameters in the core dumps. + */ +#define ELF_CLASS ELFCLASS32 +#if defined(__LITTLE_ENDIAN) +#define ELF_DATA ELFDATA2LSB +#elif defined(__BIG_ENDIAN) +#define ELF_DATA ELFDATA2MSB +#else +#error no endian defined +#endif +#define ELF_ARCH EM_M32R + +/* r0 is set by ld.so to a pointer to a function which might be + * registered using 'atexit'. This provides a mean for the dynamic + * linker to call DT_FINI functions for shared libraries that have + * been loaded before the code runs. + * + * So that we can use the same startup file with static executables, + * we start programs with a value of 0 to indicate that there is no + * such function. + */ +#define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0 + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE PAGE_SIZE + +/* + * This is the location that an ET_DYN program is loaded if exec'ed. + * Typical use of this is to invoke "./ld.so someprog" to test out a + * new version of the loader. We need to make sure that it is out of + * the way of the program that it will "exec", and that there is + * sufficient room for the brk. + */ +#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) + +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is + now struct_user_regs, they are different) */ + +#define ELF_CORE_COPY_REGS(pr_reg, regs) \ + memcpy((char *)&pr_reg, (char *)®s, sizeof (struct pt_regs)); + +/* This yields a mask that user programs can use to figure out what + instruction set this CPU supports. */ +#define ELF_HWCAP (0) + +/* This yields a string that ld.so will use to load implementation + specific libraries for optimization. This is more specific in + intent than poking at uname or /proc/cpuinfo. */ +#define ELF_PLATFORM (NULL) + +#ifdef __KERNEL__ +#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) +#endif + +#endif /* _ASM_M32R__ELF_H */ diff -Nru a/include/asm-m32r/errno.h b/include/asm-m32r/errno.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/errno.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,9 @@ +#ifndef _ASM_M32R_ERRNO_H +#define _ASM_M32R_ERRNO_H + +/* $Id$ */ + +#include + +#endif /* _ASM_M32R_ERRNO_H */ + diff -Nru a/include/asm-m32r/fcntl.h b/include/asm-m32r/fcntl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/fcntl.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,92 @@ +#ifndef _ASM_M32R_FCNTL_H +#define _ASM_M32R_FCNTL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_NOATIME 01000000 + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get close_on_exec */ +#define F_SETFD 2 /* set/clear close_on_exec */ +#define F_GETFL 3 /* get file->f_flags */ +#define F_SETFL 4 /* set file->f_flags */ +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 8 /* for sockets. */ +#define F_GETOWN 9 /* for sockets. */ +#define F_SETSIG 10 /* for sockets. */ +#define F_GETSIG 11 /* for sockets. */ + +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +/* for leases */ +#define F_INPROGRESS 16 + +/* operations for bsd flock(), also used by the kernel implementation */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +#define LOCK_UN 8 /* remove lock */ + +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + +#define F_LINUX_SPECIFIC_BASE 1024 + +#endif /* _ASM_M32R_FCNTL_H */ diff -Nru a/include/asm-m32r/flat.h b/include/asm-m32r/flat.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/flat.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,145 @@ +/* + * include/asm-m32r/flat.h + * + * uClinux flat-format executables + * + * Copyright (C) 2004 Kazuhiro Inaoka + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive for + * more details. + */ +#ifndef __ASM_M32R_FLAT_H +#define __ASM_M32R_FLAT_H + +#define flat_stack_align(sp) (*sp += (*sp & 3 ? (4 - (*sp & 3)): 0)) +#define flat_argvp_envp_on_stack() 0 +#define flat_old_ram_flag(flags) (flags) +#define flat_reloc_valid(reloc, size) \ + (((reloc) - textlen_for_m32r_lo16_data) <= (size)) +#define flat_get_addr_from_rp(rp, relval, flags) \ + m32r_flat_get_addr_from_rp(rp, relval, (text_len) ) + +#define flat_put_addr_at_rp(rp, addr, relval) \ + m32r_flat_put_addr_at_rp(rp, addr, relval) + +/* Convert a relocation entry into an address. */ +static inline unsigned long +flat_get_relocate_addr (unsigned long relval) +{ + return relval & 0x00ffffff; /* Mask out top 8-bits */ +} + +#define flat_m32r_get_reloc_type(relval) ((relval) >> 24) + +#define M32R_SETH_OPCODE 0xd0c00000 /* SETH instruction code */ + +#define FLAT_M32R_32 0x00 /* 32bits reloc */ +#define FLAT_M32R_24 0x01 /* unsigned 24bits reloc */ +#define FLAT_M32R_16 0x02 /* 16bits reloc */ +#define FLAT_M32R_LO16 0x03 /* signed low 16bits reloc (low()) */ +#define FLAT_M32R_LO16_DATA 0x04 /* signed low 16bits reloc (low()) + for a symbol in .data section */ + /* High 16bits of an address used + when the lower 16bbits are treated + as unsigned. + To create SETH instruction only. + 0x1X: X means a number of register. + 0x10 - 0x3F are reserved. */ +#define FLAT_M32R_HI16_ULO 0x10 /* reloc for SETH Rn,#high(imm16) */ + /* High 16bits of an address used + when the lower 16bbits are treated + as signed. + To create SETH instruction only. + 0x2X: X means a number of register. + 0x20 - 0x4F are reserved. */ +#define FLAT_M32R_HI16_SLO 0x20 /* reloc for SETH Rn,#shigh(imm16) */ + +static unsigned long textlen_for_m32r_lo16_data = 0; + +static inline unsigned long m32r_flat_get_addr_from_rp (unsigned long *rp, + unsigned long relval, + unsigned long textlen) +{ + unsigned int reloc = flat_m32r_get_reloc_type (relval); + textlen_for_m32r_lo16_data = 0; + if (reloc & 0xf0) { + unsigned long addr = htonl(*rp); + switch (reloc & 0xf0) + { + case FLAT_M32R_HI16_ULO: + case FLAT_M32R_HI16_SLO: + if (addr == 0) { + /* put "seth Rn,#0x0" instead of 0 (addr). */ + *rp = (M32R_SETH_OPCODE | ((reloc & 0x0f)<<24)); + } + return addr; + default: + break; + } + } else { + switch (reloc) + { + case FLAT_M32R_LO16: + return htonl(*rp) & 0xFFFF; + case FLAT_M32R_LO16_DATA: + /* FIXME: The return value will decrease by textlen + at m32r_flat_put_addr_at_rp () */ + textlen_for_m32r_lo16_data = textlen; + return (htonl(*rp) & 0xFFFF) + textlen; + case FLAT_M32R_16: + return htons(*(unsigned short *)rp) & 0xFFFF; + case FLAT_M32R_24: + return htonl(*rp) & 0xFFFFFF; + case FLAT_M32R_32: + return htonl(*rp); + default: + break; + } + } + return ~0; /* bogus value */ +} + +static inline void m32r_flat_put_addr_at_rp (unsigned long *rp, + unsigned long addr, + unsigned long relval) +{ + unsigned int reloc = flat_m32r_get_reloc_type (relval); + if (reloc & 0xf0) { + unsigned long Rn = reloc & 0x0f; /* get a number of register */ + Rn <<= 24; /* 0x0R000000 */ + reloc &= 0xf0; + switch (reloc) + { + case FLAT_M32R_HI16_ULO: /* To create SETH Rn,#high(imm16) */ + *rp = (M32R_SETH_OPCODE | Rn + | ((addr >> 16) & 0xFFFF)); + break; + case FLAT_M32R_HI16_SLO: /* To create SETH Rn,#shigh(imm16) */ + *rp = (M32R_SETH_OPCODE | Rn + | (((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) + & 0xFFFF)); + break; + } + } else { + switch (reloc) { + case FLAT_M32R_LO16_DATA: + addr -= textlen_for_m32r_lo16_data; + textlen_for_m32r_lo16_data = 0; + case FLAT_M32R_LO16: + *rp = (htonl(*rp) & 0xFFFF0000) | (addr & 0xFFFF); + break; + case FLAT_M32R_16: + *(unsigned short *)rp = addr & 0xFFFF; + break; + case FLAT_M32R_24: + *rp = (htonl(*rp) & 0xFF000000) | (addr & 0xFFFFFF); + break; + case FLAT_M32R_32: + *rp = addr; + break; + } + } +} + +#endif /* __ASM_M32R_FLAT_H */ diff -Nru a/include/asm-m32r/hardirq.h b/include/asm-m32r/hardirq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hardirq.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,85 @@ +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H + +#include +#include +#include + +typedef struct { + unsigned int __softirq_pending; + unsigned int __syscall_count; + struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ +} ____cacheline_aligned irq_cpustat_t; + +#include /* Standard mappings for irq_cpustat_t above */ + +/* + * We put the hardirq and softirq counter into the preemption + * counter. The bitmask has the following meaning: + * + * - bits 0-7 are the preemption count (max preemption depth: 256) + * - bits 8-15 are the softirq count (max # of softirqs: 256) + * - bits 16-23 are the hardirq count (max # of hardirqs: 256) + * + * - ( bit 26 is the PREEMPT_ACTIVE flag. ) + * + * PREEMPT_MASK: 0x000000ff + * SOFTIRQ_MASK: 0x0000ff00 + * HARDIRQ_MASK: 0x00ff0000 + */ + +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +#define HARDIRQ_BITS 8 + +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) + +/* + * The hardirq mask has to be large enough to have + * space for potentially all IRQ sources in the system + * nesting on a single CPU: + */ +#if (1 << HARDIRQ_BITS) < NR_IRQS +# error HARDIRQ_BITS is too low! +#endif + +/* + * Are we doing bottom half or hardware interrupt processing? + * Are we in a softirq context? Interrupt context? + */ +#define in_irq() (hardirq_count()) +#define in_softirq() (softirq_count()) +#define in_interrupt() (irq_count()) + + +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) + +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) +#define nmi_enter() (irq_enter()) +#define nmi_exit() (preempt_count() -= HARDIRQ_OFFSET) + +#ifdef CONFIG_PREEMPT +# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) +# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) +#else +# define in_atomic() (preempt_count() != 0) +# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET +#endif +#define irq_exit() \ +do { \ + preempt_count() -= IRQ_EXIT_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + do_softirq(); \ + preempt_enable_no_resched(); \ +} while (0) + +#ifndef CONFIG_SMP +# define synchronize_irq(irq) barrier() +#else + extern void synchronize_irq(unsigned int irq); +#endif /* CONFIG_SMP */ + +#endif /* __ASM_HARDIRQ_H */ diff -Nru a/include/asm-m32r/hdreg.h b/include/asm-m32r/hdreg.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hdreg.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1 @@ +#include diff -Nru a/include/asm-m32r/hw_irq.h b/include/asm-m32r/hw_irq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hw_irq.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,9 @@ +#ifndef _ASM_M32R_HW_IRQ_H +#define _ASM_M32R_HW_IRQ_H + +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) +{ + /* Nothing to do */ +} + +#endif /* _ASM_M32R_HW_IRQ_H */ diff -Nru a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ide.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,82 @@ +#ifndef _ASM_M32R_IDE_H +#define _ASM_M32R_IDE_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/ide.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +/* + * This file contains the i386 architecture specific IDE code. + */ + +#ifdef __KERNEL__ + +#include + +#ifndef MAX_HWIFS +# ifdef CONFIG_BLK_DEV_IDEPCI +#define MAX_HWIFS 10 +# else +#define MAX_HWIFS 2 +# endif +#endif + +#if defined(CONFIG_PLAT_M32700UT) +#include +#include +#endif + +#define IDE_ARCH_OBSOLETE_DEFAULTS + +static __inline__ int ide_default_irq(unsigned long base) +{ + switch (base) { +#if defined(CONFIG_PLAT_M32700UT) + case 0x1f0: return PLD_IRQ_CFIREQ; + default: + return 0; +#else + case 0x1f0: return 14; + case 0x170: return 15; + case 0x1e8: return 11; + case 0x168: return 10; + case 0x1e0: return 8; + case 0x160: return 12; + default: + return 0; +#endif + } +} + +static __inline__ unsigned long ide_default_io_base(int index) +{ + switch (index) { + case 0: return 0x1f0; + case 1: return 0x170; + case 2: return 0x1e8; + case 3: return 0x168; + case 4: return 0x1e0; + case 5: return 0x160; + default: + return 0; + } +} + +#define IDE_ARCH_OBSOLETE_INIT +#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ + +#ifdef CONFIG_BLK_DEV_IDEPCI +#define ide_init_default_irq(base) (0) +#else +#define ide_init_default_irq(base) ide_default_irq(base) +#endif + +#include + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_IDE_H */ diff -Nru a/include/asm-m32r/io.h b/include/asm-m32r/io.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/io.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,201 @@ +#ifndef _ASM_M32R_IO_H +#define _ASM_M32R_IO_H + +/* $Id$ */ + +#include /* __va */ + +#ifdef __KERNEL__ + +#define IO_SPACE_LIMIT 0xFFFFFFFF + +/** + * virt_to_phys - map virtual addresses to physical + * @address: address to remap + * + * The returned physical address is the physical (CPU) mapping for + * the memory address given. It is only valid to use this function on + * addresses directly mapped or allocated via kmalloc. + * + * This function does not give bus mappings for DMA transfers. In + * almost all conceivable cases a device driver should not be using + * this function + */ + +static __inline__ unsigned long virt_to_phys(volatile void * address) +{ + return __pa(address); +} + +/** + * phys_to_virt - map physical address to virtual + * @address: address to remap + * + * The returned virtual address is a current CPU mapping for + * the memory address given. It is only valid to use this function on + * addresses that have a kernel mapping + * + * This function does not handle bus mappings for DMA transfers. In + * almost all conceivable cases a device driver should not be using + * this function + */ + +static __inline__ void *phys_to_virt(unsigned long address) +{ + return __va(address); +} + +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); + +/** + * ioremap - map bus memory into CPU space + * @offset: bus address of the memory + * @size: size of the resource to map + * + * ioremap performs a platform specific sequence of operations to + * make bus memory CPU accessible via the readb/readw/readl/writeb/ + * writew/writel functions and the other mmio helpers. The returned + * address is not guaranteed to be usable directly as a virtual + * address. + */ + +static __inline__ void * ioremap(unsigned long offset, unsigned long size) +{ + return __ioremap(offset, size, 0); +} + +extern void iounmap(void *addr); +#define ioremap_nocache(off,size) ioremap(off,size) + +/* + * IO bus memory addresses are also 1:1 with the physical address + */ +#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) +#define page_to_bus page_to_phys +#define virt_to_bus virt_to_phys + +extern unsigned char _inb(unsigned long); +extern unsigned short _inw(unsigned long); +extern unsigned long _inl(unsigned long); +extern unsigned char _inb_p(unsigned long); +extern unsigned short _inw_p(unsigned long); +extern unsigned long _inl_p(unsigned long); +extern void _outb(unsigned char, unsigned long); +extern void _outw(unsigned short, unsigned long); +extern void _outl(unsigned long, unsigned long); +extern void _outb_p(unsigned char, unsigned long); +extern void _outw_p(unsigned short, unsigned long); +extern void _outl_p(unsigned long, unsigned long); +extern void _insb(unsigned int, void *, unsigned long); +extern void _insw(unsigned int, void *, unsigned long); +extern void _insl(unsigned int, void *, unsigned long); +extern void _outsb(unsigned int, const void *, unsigned long); +extern void _outsw(unsigned int, const void *, unsigned long); +extern void _outsl(unsigned int, const void *, unsigned long); + +static inline unsigned char _readb(unsigned long addr) +{ + return *(volatile unsigned char *)addr; +} + +static inline unsigned short _readw(unsigned long addr) +{ + return *(volatile unsigned short *)addr; +} + +static inline unsigned long _readl(unsigned long addr) +{ + return *(volatile unsigned long *)addr; +} + +static inline void _writeb(unsigned char b, unsigned long addr) +{ + *(volatile unsigned char *)addr = b; +} + +static inline void _writew(unsigned short w, unsigned long addr) +{ + *(volatile unsigned short *)addr = w; +} + +static inline void _writel(unsigned long l, unsigned long addr) +{ + *(volatile unsigned long *)addr = l; +} + +#define inb _inb +#define inw _inw +#define inl _inl +#define outb _outb +#define outw _outw +#define outl _outl + +#define inb_p _inb_p +#define inw_p _inw_p +#define inl_p _inl_p +#define outb_p _outb_p +#define outw_p _outw_p +#define outl_p _outl_p + +#define insb _insb +#define insw _insw +#define insl _insl +#define outsb _outsb +#define outsw _outsw +#define outsl _outsl + +#define readb(addr) _readb((unsigned long)(addr)) +#define readw(addr) _readw((unsigned long)(addr)) +#define readl(addr) _readl((unsigned long)(addr)) +#define __raw_readb readb +#define __raw_readw readw +#define __raw_readl readl + +#define writeb(val, addr) _writeb((val), (unsigned long)(addr)) +#define writew(val, addr) _writew((val), (unsigned long)(addr)) +#define writel(val, addr) _writel((val), (unsigned long)(addr)) +#define __raw_writeb writeb +#define __raw_writew writew +#define __raw_writel writel + +#define flush_write_buffers() do { } while (0) /* M32R_FIXME */ + +/** + * isa_check_signature - find BIOS signatures + * @io_addr: mmio address to check + * @signature: signature block + * @length: length of signature + * + * Perform a signature comparison with the ISA mmio address io_addr. + * Returns 1 on a match. + * + * This function is deprecated. New drivers should use ioremap and + * check_signature. + */ + +static inline int isa_check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; +#if 0 +printk("isa_check_signature\n"); + do { + if (isa_readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: +#endif + return retval; +} + +#define memset_io(a, b, c) memset((void *)(a), (b), (c)) +#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c)) +#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_IO_H */ diff -Nru a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ioctl.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,78 @@ +#ifndef _ASM_M32R_IOCTL_H +#define _ASM_M32R_IOCTL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * linux/ioctl.h for Linux by H.H. Bergman. + */ + +/* ioctl command encoding: 32 bits total, command in lower 16 bits, + * size of the parameter structure in the lower 14 bits of the + * upper 16 bits. + * Encoding the size of the parameter structure in the ioctl request + * is useful for catching programs compiled with old versions + * and to avoid overwriting user space outside the user buffer area. + * The highest 2 bits are reserved for indicating the ``access mode''. + * NOTE: This limits the max parameter size to 16kB -1 ! + */ + +/* + * The following is for compatibility across the various Linux + * platforms. The i386 ioctl numbering scheme doesn't really enforce + * a type field. De facto, however, the top 8 bits of the lower 16 + * bits are indeed used as a type field, so we might just as well make + * this explicit here. Please be sure to use the decoding macros + * below from now on. + */ +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits. + */ +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IOC(dir,type,nr,size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* used to create numbers */ +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) + +/* used to decode ioctl numbers.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* ...and for the drivers/sound files... */ + +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_M32R_IOCTL_H */ diff -Nru a/include/asm-m32r/ioctls.h b/include/asm-m32r/ioctls.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ioctls.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,88 @@ +#ifndef __ARCH_M32R_IOCTLS_H__ +#define __ARCH_M32R_IOCTLS_H__ + +/* $Id$ */ + +/* orig : i386 2.5.67 */ + +#include + +/* 0x54 is just a magic number to make these relatively unique ('T') */ + +#define TCGETS 0x5401 +#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ +#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ +#define FIOQSIZE 0x5460 + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#endif /* __ARCH_M32R_IOCTLS_H__ */ + diff -Nru a/include/asm-m32r/ipc.h b/include/asm-m32r/ipc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ipc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,35 @@ +#ifndef __M32R_IPC_H__ +#define __M32R_IPC_H__ + +/* orig : i386/ipc.h 2.6.0-test3 */ + +/* + * These are used to wrap system calls on x86. + * + * See arch/i386/kernel/sys_i386.c for ugly details.. + */ +struct ipc_kludge { + struct msgbuf __user *msgp; + long msgtyp; +}; + +#define SEMOP 1 +#define SEMGET 2 +#define SEMCTL 3 +#define SEMTIMEDOP 4 +#define MSGSND 11 +#define MSGRCV 12 +#define MSGGET 13 +#define MSGCTL 14 +#define SHMAT 21 +#define SHMDT 22 +#define SHMGET 23 +#define SHMCTL 24 + +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + +#define IPCCALL(version,op) ((version)<<16 | (op)) + +#endif /* __M32R_IPC_H__ */ + diff -Nru a/include/asm-m32r/ipcbuf.h b/include/asm-m32r/ipcbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ipcbuf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,33 @@ +#ifndef _ASM_M32R_IPCBUF_H +#define _ASM_M32R_IPCBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The ipc64_perm structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; + unsigned short __pad2; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* _ASM_M32R_IPCBUF_H */ diff -Nru a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/irq.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,86 @@ +#ifndef _ASM_M32R_IRQ_H +#define _ASM_M32R_IRQ_H + +/* $Id$ */ + +#include + +#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_USRV) +/* + * IRQ definitions for M32700UT + * M32700 Chip: 64 interrupts + * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + */ +#define M32700UT_NUM_CPU_IRQ (64) +#define M32700UT_NUM_PLD_IRQ (32) +#define M32700UT_IRQ_BASE 0 +#define M32700UT_CPU_IRQ_BASE M32700UT_IRQ_BASE +#define M32700UT_PLD_IRQ_BASE (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) + +#define NR_IRQS (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ) +#elif defined(CONFIG_PLAT_M32700UT) +/* + * IRQ definitions for M32700UT(Rev.C) + M32R-LAN + * M32700 Chip: 64 interrupts + * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin + * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin + */ +#define M32700UT_NUM_CPU_IRQ (64) +#define M32700UT_NUM_PLD_IRQ (32) +#define M32700UT_NUM_LCD_PLD_IRQ (32) +#define M32700UT_NUM_LAN_PLD_IRQ (32) +#define M32700UT_IRQ_BASE 0 +#define M32700UT_CPU_IRQ_BASE (M32700UT_IRQ_BASE) +#define M32700UT_PLD_IRQ_BASE \ + (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) +#define M32700UT_LCD_PLD_IRQ_BASE \ + (M32700UT_PLD_IRQ_BASE + M32700UT_NUM_PLD_IRQ) +#define M32700UT_LAN_PLD_IRQ_BASE \ + (M32700UT_LCD_PLD_IRQ_BASE + M32700UT_NUM_LCD_PLD_IRQ) + +#define NR_IRQS \ + (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ \ + + M32700UT_NUM_LCD_PLD_IRQ + M32700UT_NUM_LAN_PLD_IRQ) +#elif defined(CONFIG_PLAT_OPSPUT) +/* + * IRQ definitions for OPSPUT + M32R-LAN + * OPSP Chip: 64 interrupts + * ICU of OPSPUT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin + * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin + */ +#define OPSPUT_NUM_CPU_IRQ (64) +#define OPSPUT_NUM_PLD_IRQ (32) +#define OPSPUT_NUM_LCD_PLD_IRQ (32) +#define OPSPUT_NUM_LAN_PLD_IRQ (32) +#define OPSPUT_IRQ_BASE 0 +#define OPSPUT_CPU_IRQ_BASE (OPSPUT_IRQ_BASE) +#define OPSPUT_PLD_IRQ_BASE \ + (OPSPUT_CPU_IRQ_BASE + OPSPUT_NUM_CPU_IRQ) +#define OPSPUT_LCD_PLD_IRQ_BASE \ + (OPSPUT_PLD_IRQ_BASE + OPSPUT_NUM_PLD_IRQ) +#define OPSPUT_LAN_PLD_IRQ_BASE \ + (OPSPUT_LCD_PLD_IRQ_BASE + OPSPUT_NUM_LCD_PLD_IRQ) + +#define NR_IRQS \ + (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \ + + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ) +#else +#define NR_IRQS 64 +#endif + +#define irq_canonicalize(irq) (irq) + +#ifndef __ASSEMBLY__ +extern void disable_irq(unsigned int); +extern void disable_irq_nosync(unsigned int); +extern void enable_irq(unsigned int); + +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); +#endif + +#endif /* _ASM_M32R_IRQ_H */ + diff -Nru a/include/asm-m32r/kmap_types.h b/include/asm-m32r/kmap_types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/kmap_types.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,34 @@ +#ifndef __M32R_KMAP_TYPES_H +#define __M32R_KMAP_TYPES_H + +/* Dummy header just to define km_type. */ + +#include + +#ifdef CONFIG_DEBUG_HIGHMEM +# define D(n) __KM_FENCE_##n , +#else +# define D(n) +#endif + +enum km_type { +D(0) KM_BOUNCE_READ, +D(1) KM_SKB_SUNRPC_DATA, +D(2) KM_SKB_DATA_SOFTIRQ, +D(3) KM_USER0, +D(4) KM_USER1, +D(5) KM_BIO_SRC_IRQ, +D(6) KM_BIO_DST_IRQ, +D(7) KM_PTE0, +D(8) KM_PTE1, +D(9) KM_IRQ0, +D(10) KM_IRQ1, +D(11) KM_SOFTIRQ0, +D(12) KM_SOFTIRQ1, +D(13) KM_TYPE_NR +}; + +#undef D + +#endif /* __M32R_KMAP_TYPES_H */ + diff -Nru a/include/asm-m32r/linkage.h b/include/asm-m32r/linkage.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/linkage.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,7 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define __ALIGN .balign 4 +#define __ALIGN_STR ".balign 4" + +#endif /* __ASM_LINKAGE_H */ diff -Nru a/include/asm-m32r/local.h b/include/asm-m32r/local.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/local.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,6 @@ +#ifndef __M32R_LOCAL_H +#define __M32R_LOCAL_H + +#include + +#endif /* __M32R_LOCAL_H */ diff -Nru a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32102.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,265 @@ +#ifndef _M32102_H_ +#define _M32102_H_ + +/* + * Mitsubishi M32R 32102 group + * Copyright (c) 2001 [Hitoshi Yamamoto] All rights reserved. + */ +/* $Id$ */ + +/*======================================================================* + * Special Function Register + *======================================================================*/ +#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */ + +/* + * Clock and Power Management registers. + */ +#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) + +#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) +#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) +#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) + +/* + * Multi Function Timer registers. + */ +#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) + +#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ +#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ + +#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) +#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ +#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ +#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ +#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ +#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ + +#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) +#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ +#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ +#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ +#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ +#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ + +#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) +#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ +#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ +#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ +#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ +#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ + +#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) +#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ +#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ +#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ +#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ +#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ + +#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) +#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ +#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ +#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ +#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) +#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ +#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ +#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ +#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ + +#ifdef CONFIG_CHIP_M32700 +#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */ +#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */ +#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */ +#define M32R_MFTCR_MFT3MSK (1UL<<28) /* b3 */ +#define M32R_MFTCR_MFT4MSK (1UL<<27) /* b4 */ +#define M32R_MFTCR_MFT5MSK (1UL<<26) /* b5 */ +#define M32R_MFTCR_MFT0EN (1UL<<23) /* b8 */ +#define M32R_MFTCR_MFT1EN (1UL<<22) /* b9 */ +#define M32R_MFTCR_MFT2EN (1UL<<21) /* b10 */ +#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */ +#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */ +#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */ +#else /* not CONFIG_CHIP_M32700 */ +#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ +#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ +#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ +#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ +#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ +#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ +#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ +#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ +#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ +#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ +#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ +#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ +#endif /* not CONFIG_CHIP_M32700 */ + +#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ +#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ +#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ +#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ +#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ +#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ +#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ +#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ +#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ +#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ +#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ +#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ +#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ +#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ +#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ + +/* + * Serial I/O registers. + */ +#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) + +#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) +#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) +#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) +#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) +#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) +#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) +#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) + +/* + * Interrupt Control Unit registers. + */ +#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) +#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) +#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) +#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) +#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ +#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ +#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ +#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ +#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ +#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ +#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ +#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ +#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ +#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ +#define M32R_ICU_CR19_PORTL (0x248+M32R_ICU_OFFSET) /* MFT3 */ +#define M32R_ICU_CR20_PORTL (0x24C+M32R_ICU_OFFSET) /* MFT4 */ +#define M32R_ICU_CR21_PORTL (0x250+M32R_ICU_OFFSET) /* MFT5 */ +#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* DMA0 */ +#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* DMA1 */ +#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* SIO0 */ +#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* SIO0 */ +#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* SIO1 */ +#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* SIO1 */ +#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* SIO2 */ +#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* SIO2 */ +#define M32R_ICU_CR54_PORTL (0x2D4+M32R_ICU_OFFSET) /* SIO3 */ +#define M32R_ICU_CR55_PORTL (0x2D8+M32R_ICU_OFFSET) /* SIO3 */ +#define M32R_ICU_CR56_PORTL (0x2DC+M32R_ICU_OFFSET) /* SIO4 */ +#define M32R_ICU_CR57_PORTL (0x2E0+M32R_ICU_OFFSET) /* SIO4 */ + +#ifdef CONFIG_SMP +#define M32R_ICU_IPICR0_PORTL (0x2dc+M32R_ICU_OFFSET) /* IPI0 */ +#define M32R_ICU_IPICR1_PORTL (0x2e0+M32R_ICU_OFFSET) /* IPI1 */ +#define M32R_ICU_IPICR2_PORTL (0x2e4+M32R_ICU_OFFSET) /* IPI2 */ +#define M32R_ICU_IPICR3_PORTL (0x2e8+M32R_ICU_OFFSET) /* IPI3 */ +#define M32R_ICU_IPICR4_PORTL (0x2ec+M32R_ICU_OFFSET) /* IPI4 */ +#define M32R_ICU_IPICR5_PORTL (0x2f0+M32R_ICU_OFFSET) /* IPI5 */ +#define M32R_ICU_IPICR6_PORTL (0x2f4+M32R_ICU_OFFSET) /* IPI6 */ +#define M32R_ICU_IPICR7_PORTL (0x2f8+M32R_ICU_OFFSET) /* IPI7 */ +#endif /* CONFIG_SMP */ + +#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ +#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ +#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ +#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ +#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ +#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ +#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ +#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ + +#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ +#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ +#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ +#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ +#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ +#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ +#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ +#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ +#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ +#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ +#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ +#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ +#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ +#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ + +#define M32R_IRQ_INT0 (1) /* INT0 */ +#define M32R_IRQ_INT1 (2) /* INT1 */ +#define M32R_IRQ_INT2 (3) /* INT2 */ +#define M32R_IRQ_INT3 (4) /* INT3 */ +#define M32R_IRQ_INT4 (5) /* INT4 */ +#define M32R_IRQ_INT5 (6) /* INT5 */ +#define M32R_IRQ_INT6 (7) /* INT6 */ +#define M32R_IRQ_MFT0 (16) /* MFT0 */ +#define M32R_IRQ_MFT1 (17) /* MFT1 */ +#define M32R_IRQ_MFT2 (18) /* MFT2 */ +#define M32R_IRQ_MFT3 (19) /* MFT3 */ +#define M32R_IRQ_MFT4 (20) /* MFT4 */ +#define M32R_IRQ_MFT5 (21) /* MFT5 */ +#define M32R_IRQ_DMA0 (32) /* DMA0 */ +#define M32R_IRQ_DMA1 (33) /* DMA1 */ +#define M32R_IRQ_SIO0_R (48) /* SIO0 send */ +#define M32R_IRQ_SIO0_S (49) /* SIO0 receive */ +#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ +#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ +#define M32R_IRQ_SIO2_R (52) /* SIO2 send */ +#define M32R_IRQ_SIO2_S (53) /* SIO2 receive */ +#define M32R_IRQ_SIO3_R (54) /* SIO3 send */ +#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */ +#define M32R_IRQ_SIO4_R (56) /* SIO4 send */ +#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */ + +#ifdef CONFIG_SMP +#define M32R_IRQ_IPI0 (56) +#define M32R_IRQ_IPI1 (57) +#define M32R_IRQ_IPI2 (58) +#define M32R_IRQ_IPI3 (59) +#define M32R_IRQ_IPI4 (60) +#define M32R_IRQ_IPI5 (61) +#define M32R_IRQ_IPI6 (62) +#define M32R_IRQ_IPI7 (63) +#define M32R_CPUID_PORTL (0xffffffe0) + +#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) + +#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME3_PORTL (0x1c+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID3_PORTL (0x2c+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) + +#ifndef __ASSEMBLY__ +/* For NETDEV WATCHDOG */ +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; + +extern icu_data_t icu_data[]; +#endif + +#endif /* CONFIG_SMP */ + +#endif /* _M32102_H_ */ diff -Nru a/include/asm-m32r/m32102peri.h b/include/asm-m32r/m32102peri.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32102peri.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,468 @@ +/* $Id$ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000,2001 by Hiroyuki Kondo + */ + +#ifndef __ASSEMBLY__ + +typedef void V; +typedef char B; +typedef short S; +typedef int W; +typedef long L; +typedef float F; +typedef double D; +typedef unsigned char UB; +typedef unsigned short US; +typedef unsigned int UW; +typedef unsigned long UL; +typedef const unsigned int CUW; + +/********************************* + +M32102 ICU + +*********************************/ +#define ICUISTS (UW *)0xa0EFF004 +#define ICUIREQ0 (UW *)0xa0EFF008 +#define ICUIREQ1 (UW *)0xa0EFF00C + +#define ICUSBICR (UW *)0xa0EFF018 +#define ICUIMASK (UW *)0xa0EFF01C + +#define ICUCR1 (UW *)0xa0EFF200 /* INT0 */ +#define ICUCR2 (UW *)0xa0EFF204 /* INT1 */ +#define ICUCR3 (UW *)0xa0EFF208 /* INT2 */ +#define ICUCR4 (UW *)0xa0EFF20C /* INT3 */ +#define ICUCR5 (UW *)0xa0EFF210 /* INT4 */ +#define ICUCR6 (UW *)0xa0EFF214 /* INT5 */ +#define ICUCR7 (UW *)0xa0EFF218 /* INT6 */ + +#define ICUCR16 (UW *)0xa0EFF23C /* MFT0 */ +#define ICUCR17 (UW *)0xa0EFF240 /* MFT1 */ +#define ICUCR18 (UW *)0xa0EFF244 /* MFT2 */ +#define ICUCR19 (UW *)0xa0EFF248 /* MFT3 */ +#define ICUCR20 (UW *)0xa0EFF24C /* MFT4 */ +#define ICUCR21 (UW *)0xa0EFF250 /* MFT5 */ + +#define ICUCR32 (UW *)0xa0EFF27C /* DMA0 */ +#define ICUCR33 (UW *)0xa0EFF280 /* DMA1 */ + +#define ICUCR48 (UW *)0xa0EFF2BC /* SIO0R */ +#define ICUCR49 (UW *)0xa0EFF2C0 /* SIO0S */ +#define ICUCR50 (UW *)0xa0EFF2C4 /* SIO1R */ +#define ICUCR51 (UW *)0xa0EFF2C8 /* SIO1S */ +#define ICUCR52 (UW *)0xa0EFF2CC /* SIO2R */ +#define ICUCR53 (UW *)0xa0EFF2D0 /* SIO2S */ +#define ICUCR54 (UW *)0xa0EFF2D4 /* SIO3R */ +#define ICUCR55 (UW *)0xa0EFF2D8 /* SIO3S */ +#define ICUCR56 (UW *)0xa0EFF2DC /* SIO4R */ +#define ICUCR57 (UW *)0xa0EFF2E0 /* SIO4S */ + +/********************************* + +M32102 MFT + +*********************************/ +#define MFTCR (US *)0xa0EFC002 +#define MFTRPR (UB *)0xa0EFC006 + +#define MFT0MOD (US *)0xa0EFC102 +#define MFT0BOS (US *)0xa0EFC106 +#define MFT0CUT (US *)0xa0EFC10A +#define MFT0RLD (US *)0xa0EFC10E +#define MFT0CRLD (US *)0xa0EFC112 + +#define MFT1MOD (US *)0xa0EFC202 +#define MFT1BOS (US *)0xa0EFC206 +#define MFT1CUT (US *)0xa0EFC20A +#define MFT1RLD (US *)0xa0EFC20E +#define MFT1CRLD (US *)0xa0EFC212 + +#define MFT2MOD (US *)0xa0EFC302 +#define MFT2BOS (US *)0xa0EFC306 +#define MFT2CUT (US *)0xa0EFC30A +#define MFT2RLD (US *)0xa0EFC30E +#define MFT2CRLD (US *)0xa0EFC312 + +#define MFT3MOD (US *)0xa0EFC402 +#define MFT3CUT (US *)0xa0EFC40A +#define MFT3RLD (US *)0xa0EFC40E +#define MFT3CRLD (US *)0xa0EFC412 + +#define MFT4MOD (US *)0xa0EFC502 +#define MFT4CUT (US *)0xa0EFC50A +#define MFT4RLD (US *)0xa0EFC50E +#define MFT4CRLD (US *)0xa0EFC512 + +#define MFT5MOD (US *)0xa0EFC602 +#define MFT5CUT (US *)0xa0EFC60A +#define MFT5RLD (US *)0xa0EFC60E +#define MFT5CRLD (US *)0xa0EFC612 + +/********************************* + +M32102 SIO + +*********************************/ + +#define SIO0CR (volatile int *)0xa0efd000 +#define SIO0MOD0 (volatile int *)0xa0efd004 +#define SIO0MOD1 (volatile int *)0xa0efd008 +#define SIO0STS (volatile int *)0xa0efd00c +#define SIO0IMASK (volatile int *)0xa0efd010 +#define SIO0BAUR (volatile int *)0xa0efd014 +#define SIO0RBAUR (volatile int *)0xa0efd018 +#define SIO0TXB (volatile int *)0xa0efd01c +#define SIO0RXB (volatile int *)0xa0efd020 + +#define SIO1CR (volatile int *)0xa0efd100 +#define SIO1MOD0 (volatile int *)0xa0efd104 +#define SIO1MOD1 (volatile int *)0xa0efd108 +#define SIO1STS (volatile int *)0xa0efd10c +#define SIO1IMASK (volatile int *)0xa0efd110 +#define SIO1BAUR (volatile int *)0xa0efd114 +#define SIO1RBAUR (volatile int *)0xa0efd118 +#define SIO1TXB (volatile int *)0xa0efd11c +#define SIO1RXB (volatile int *)0xa0efd120 +/********************************* + +M32102 PORT + +*********************************/ +#define PIEN (UB *)0xa0EF1003 /* input enable */ + +#define P0DATA (UB *)0xa0EF1020 /* data */ +#define P1DATA (UB *)0xa0EF1021 +#define P2DATA (UB *)0xa0EF1022 +#define P3DATA (UB *)0xa0EF1023 +#define P4DATA (UB *)0xa0EF1024 +#define P5DATA (UB *)0xa0EF1025 +#define P6DATA (UB *)0xa0EF1026 +#define P7DATA (UB *)0xa0EF1027 + +#define P0DIR (UB *)0xa0EF1040 /* direction */ +#define P1DIR (UB *)0xa0EF1041 +#define P2DIR (UB *)0xa0EF1042 +#define P3DIR (UB *)0xa0EF1043 +#define P4DIR (UB *)0xa0EF1044 +#define P5DIR (UB *)0xa0EF1045 +#define P6DIR (UB *)0xa0EF1046 +#define P7DIR (UB *)0xa0EF1047 + +#define P0MOD (US *)0xa0EF1060 /* mode control */ +#define P1MOD (US *)0xa0EF1062 +#define P2MOD (US *)0xa0EF1064 +#define P3MOD (US *)0xa0EF1066 +#define P4MOD (US *)0xa0EF1068 +#define P5MOD (US *)0xa0EF106A +#define P6MOD (US *)0xa0EF106C +#define P7MOD (US *)0xa0EF106E + +#define P0ODCR (UB *)0xa0EF1080 /* open-drain control */ +#define P1ODCR (UB *)0xa0EF1081 +#define P2ODCR (UB *)0xa0EF1082 +#define P3ODCR (UB *)0xa0EF1083 +#define P4ODCR (UB *)0xa0EF1084 +#define P5ODCR (UB *)0xa0EF1085 +#define P6ODCR (UB *)0xa0EF1086 +#define P7ODCR (UB *)0xa0EF1087 + +/********************************* + +M32102 Cache + +********************************/ + +#define MCCR (US *)0xFFFFFFFE + + +#else /* __ASSEMBLY__ */ + +;; +;; PIO 0x80ef1000 +;; + +#define PIEN 0xa0ef1000 + +#define P0DATA 0xa0ef1020 +#define P1DATA 0xa0ef1021 +#define P2DATA 0xa0ef1022 +#define P3DATA 0xa0ef1023 +#define P4DATA 0xa0ef1024 +#define P5DATA 0xa0ef1025 +#define P6DATA 0xa0ef1026 +#define P7DATA 0xa0ef1027 + +#define P0DIR 0xa0ef1040 +#define P1DIR 0xa0ef1041 +#define P2DIR 0xa0ef1042 +#define P3DIR 0xa0ef1043 +#define P4DIR 0xa0ef1044 +#define P5DIR 0xa0ef1045 +#define P6DIR 0xa0ef1046 +#define P7DIR 0xa0ef1047 + +#define P0MOD 0xa0ef1060 +#define P1MOD 0xa0ef1062 +#define P2MOD 0xa0ef1064 +#define P3MOD 0xa0ef1066 +#define P4MOD 0xa0ef1068 +#define P5MOD 0xa0ef106a +#define P6MOD 0xa0ef106c +#define P7MOD 0xa0ef106e +; +#define P0ODCR 0xa0ef1080 +#define P1ODCR 0xa0ef1081 +#define P2ODCR 0xa0ef1082 +#define P3ODCR 0xa0ef1083 +#define P4ODCR 0xa0ef1084 +#define P5ODCR 0xa0ef1085 +#define P6ODCR 0xa0ef1086 +#define P7ODCR 0xa0ef1087 + +;; +;; WDT 0xa0ef2000 +;; + +#define WDTCR 0xa0ef2000 + + +;; +;; CLK 0xa0ef4000 +;; + +#define CPUCLKCR 0xa0ef4000 +#define CLKMOD 0xa0ef4004 +#define PLLCR 0xa0ef4008 + + +;; +;; BSEL 0xa0ef5000 +;; + +#define BSEL0CR 0xa0ef5000 +#define BSEL1CR 0xa0ef5004 +#define BSEL2CR 0xa0ef5008 +#define BSEL3CR 0xa0ef500c +#define BSEL4CR 0xa0ef5010 +#define BSEL5CR 0xa0ef5014 + + +;; +;; SDRAMC 0xa0ef6000 +;; + +#define SDRF0 0xa0ef6000 +#define SDRF1 0xa0ef6004 +#define SDIR0 0xa0ef6008 +#define SDIR1 0xa0ef600c +#define SDBR 0xa0ef6010 + +;; CH0 +#define SD0ADR 0xa0ef6020 +#define SD0SZ 0xa0ef6022 +#define SD0ER 0xa0ef6024 +#define SD0TR 0xa0ef6028 +#define SD0MOD 0xa0ef602c + +;; CH1 +#define SD1ADR 0xa0ef6040 +#define SD1SZ 0xa0ef6042 +#define SD1ER 0xa0ef6044 +#define SD1TR 0xa0ef6048 +#define SD1MOD 0xa0ef604c + + +;; +;; DMAC 0xa0ef8000 +;; + +#define DMAEN 0xa0ef8000 +#define DMAISTS 0xa0ef8004 +#define DMAEDET 0xa0ef8008 +#define DMAASTS 0xa0ef800c + +;; CH0 +#define DMA0CR0 0xa0ef8100 +#define DMA0CR1 0xa0ef8104 +#define DMA0CSA 0xa0ef8108 +#define DMA0RSA 0xa0ef810c +#define DMA0CDA 0xa0ef8110 +#define DMA0RDA 0xa0ef8114 +#define DMA0CBCUT 0xa0ef8118 +#define DMA0RBCUT 0xa0ef811c + +;; CH1 +#define DMA1CR0 0xa0ef8200 +#define DMA1CR1 0xa0ef8204 +#define DMA1CSA 0xa0ef8208 +#define DMA1RSA 0xa0ef820c +#define DMA1CDA 0xa0ef8210 +#define DMA1RDA 0xa0ef8214 +#define DMA1CBCUT 0xa0ef8218 +#define DMA1RBCUT 0xa0ef821c + + +;; +;; MFT 0xa0efc000 +;; + +#define MFTCR 0xa0efc000 +#define MFTRPR 0xa0efc004 + +;; CH0 +#define MFT0MOD 0xa0efc100 +#define MFT0BOS 0xa0efc104 +#define MFT0CUT 0xa0efc108 +#define MFT0RLD 0xa0efc10c +#define MFT0CMPRLD 0xa0efc110 + +;; CH1 +#define MFT1MOD 0xa0efc200 +#define MFT1BOS 0xa0efc204 +#define MFT1CUT 0xa0efc208 +#define MFT1RLD 0xa0efc20c +#define MFT1CMPRLD 0xa0efc210 + +;; CH2 +#define MFT2MOD 0xa0efc300 +#define MFT2BOS 0xa0efc304 +#define MFT2CUT 0xa0efc308 +#define MFT2RLD 0xa0efc30c +#define MFT2CMPRLD 0xa0efc310 + +;; CH3 +#define MFT3MOD 0xa0efc400 +#define MFT3BOS 0xa0efc404 +#define MFT3CUT 0xa0efc408 +#define MFT3RLD 0xa0efc40c +#define MFT3CMPRLD 0xa0efc410 + +;; CH4 +#define MFT4MOD 0xa0efc500 +#define MFT4BOS 0xa0efc504 +#define MFT4CUT 0xa0efc508 +#define MFT4RLD 0xa0efc50c +#define MFT4CMPRLD 0xa0efc510 + +;; CH5 +#define MFT5MOD 0xa0efc600 +#define MFT5BOS 0xa0efc604 +#define MFT5CUT 0xa0efc608 +#define MFT5RLD 0xa0efc60c +#define MFT5CMPRLD 0xa0efc610 + + +;; +;; SIO 0xa0efd000 +;; + +;; CH0 +#define SIO0CR 0xa0efd000 +#define SIO0MOD0 0xa0efd004 +#define SIO0MOD1 0xa0efd008 +#define SIO0STS 0xa0efd00c +#define SIO0IMASK 0xa0efd010 +#define SIO0BAUR 0xa0efd014 +#define SIO0RBAUR 0xa0efd018 +#define SIO0TXB 0xa0efd01c +#define SIO0RXB 0xa0efd020 + +;; CH1 +#define SIO1CR 0xa0efd100 +#define SIO1MOD0 0xa0efd104 +#define SIO1MOD1 0xa0efd108 +#define SIO1STS 0xa0efd10c +#define SIO1IMASK 0xa0efd110 +#define SIO1BAUR 0xa0efd114 +#define SIO1RBAUR 0xa0efd118 +#define SIO1TXB 0xa0efd11c +#define SIO1RXB 0xa0efd120 + +;; CH2 +#define SIO2CR 0xa0efd200 +#define SIO2MOD0 0xa0efd204 +#define SIO2MOD1 0xa0efd208 +#define SIO2STS 0xa0efd20c +#define SIO2IMASK 0xa0efd210 +#define SIO2BAUR 0xa0efd214 +#define SIO2RBAUR 0xa0efd218 +#define SIO2TXB 0xa0efd21c +#define SIO2RXB 0xa0efd220 + +;; CH3 +#define SIO3CR 0xa0efd300 +#define SIO3MOD0 0xa0efd304 +#define SIO3MOD1 0xa0efd308 +#define SIO3STS 0xa0efd30c +#define SIO3IMASK 0xa0efd310 +#define SIO3BAUR 0xa0efd314 +#define SIO3RBAUR 0xa0efd318 +#define SIO3TXB 0xa0efd31c +#define SIO3RXB 0xa0efd320 + +;; CH4 +#define SIO4CR 0xa0efd400 +#define SIO4MOD0 0xa0efd404 +#define SIO4MOD1 0xa0efd408 +#define SIO4STS 0xa0efd40c +#define SIO4IMASK 0xa0efd410 +#define SIO4BAUR 0xa0efd414 +#define SIO4RBAUR 0xa0efd418 +#define SIO4TXB 0xa0efd41c +#define SIO4RXB 0xa0efd420 + + +;; +;; ICU 0xa0eff000 +;; + +#define ICUISTS 0xa0eff004 +#define ICUIREQ0 0xa0eff008 +#define ICUIREQ1 0xa0eff00c + +#define ICUSBICR 0xa0eff018 +#define ICUIMASK 0xa0eff01c + +#define ICUCR1 0xa0eff200 +#define ICUCR2 0xa0eff204 +#define ICUCR3 0xa0eff208 +#define ICUCR4 0xa0eff20c +#define ICUCR5 0xa0eff210 +#define ICUCR6 0xa0eff214 +#define ICUCR7 0xa0eff218 + +#define ICUCR16 0xa0eff23c +#define ICUCR17 0xa0eff240 +#define ICUCR18 0xa0eff244 +#define ICUCR19 0xa0eff248 +#define ICUCR20 0xa0eff24c +#define ICUCR21 0xa0eff250 + +#define ICUCR32 0xa0eff27c +#define ICUCR33 0xa0eff280 + +#define ICUCR48 0xa0eff2bc +#define ICUCR49 0xa0eff2c0 +#define ICUCR50 0xa0eff2c4 +#define ICUCR51 0xa0eff2c8 +#define ICUCR52 0xa0eff2cc +#define ICUCR53 0xa0eff2d0 +#define ICUCR54 0xa0eff2d4 +#define ICUCR55 0xa0eff2d8 +#define ICUCR56 0xa0eff2dc +#define ICUCR57 0xa0eff2e0 + +;; +;; CACHE +;; + +#define MCCR 0xfffffffc + + +#endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_lan.h b/include/asm-m32r/m32700ut/m32700ut_lan.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_lan.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,107 @@ +/* + * include/asm/m32700ut_lan.h + * + * M32700UT-LAN board + * + * Copyright (c) 2002 Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_LAN_H +#define _M32700UT_M32700UT_LAN_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#define M32700UT_LAN_IRQ_LAN (M32700UT_LAN_PLD_IRQ_BASE + 1) /* LAN */ +#define M32700UT_LAN_IRQ_I2C (M32700UT_LAN_PLD_IRQ_BASE + 3) /* I2C */ + +#define M32700UT_LAN_ICUISTS __reg16(M32700UT_LAN_BASE + 0xc0002) +#define M32700UT_LAN_ICUISTS_VECB_MASK (0xf000) +#define M32700UT_LAN_VECB(x) ((x) & M32700UT_LAN_ICUISTS_VECB_MASK) +#define M32700UT_LAN_ICUISTS_ISN_MASK (0x07c0) +#define M32700UT_LAN_ICUISTS_ISN(x) ((x) & M32700UT_LAN_ICUISTS_ISN_MASK) +#define M32700UT_LAN_ICUIREQ0 __reg16(M32700UT_LAN_BASE + 0xc0004) +#define M32700UT_LAN_ICUCR1 __reg16(M32700UT_LAN_BASE + 0xc0010) +#define M32700UT_LAN_ICUCR3 __reg16(M32700UT_LAN_BASE + 0xc0014) + +/* + * AR register on PLD + */ +#define ARVCR0 __reg32(M32700UT_LAN_BASE + 0x40000) +#define ARVCR0_VDS 0x00080000 +#define ARVCR0_RST 0x00010000 +#define ARVCR1 __reg32(M32700UT_LAN_BASE + 0x40004) +#define ARVCR1_QVGA 0x02000000 +#define ARVCR1_NORMAL 0x01000000 +#define ARVCR1_HIEN 0x00010000 +#define ARVHCOUNT __reg32(M32700UT_LAN_BASE + 0x40008) +#define ARDATA __reg32(M32700UT_LAN_BASE + 0x40010) +#define ARINTSEL __reg32(M32700UT_LAN_BASE + 0x40014) +#define ARINTSEL_INT3 0x10000000 /* CPU INT3 */ +#define ARDATA32 __reg32(M32700UT_LAN_BASE + 0x04040010) // Block 5 +/* +#define ARINTSEL_SEL2 0x00002000 +#define ARINTSEL_SEL3 0x00001000 +#define ARINTSEL_SEL6 0x00000200 +#define ARINTSEL_SEL7 0x00000100 +#define ARINTSEL_SEL9 0x00000040 +#define ARINTSEL_SEL10 0x00000020 +#define ARINTSEL_SEL11 0x00000010 +#define ARINTSEL_SEL12 0x00000008 +*/ + +/* + * I2C register on PLD + */ +#define PLDI2CCR __reg32(M32700UT_LAN_BASE + 0x40040) +#define PLDI2CCR_ES0 0x00000001 /* enable I2C interface */ +#define PLDI2CMOD __reg32(M32700UT_LAN_BASE + 0x40044) +#define PLDI2CMOD_ACKCLK 0x00000200 +#define PLDI2CMOD_DTWD 0x00000100 +#define PLDI2CMOD_10BT 0x00000004 +#define PLDI2CMOD_ATM_NORMAL 0x00000000 +#define PLDI2CMOD_ATM_AUTO 0x00000003 +#define PLDI2CACK __reg32(M32700UT_LAN_BASE + 0x40048) +#define PLDI2CACK_ACK 0x00000001 +#define PLDI2CFREQ __reg32(M32700UT_LAN_BASE + 0x4004c) +#define PLDI2CCND __reg32(M32700UT_LAN_BASE + 0x40050) +#define PLDI2CCND_START 0x00000001 +#define PLDI2CCND_STOP 0x00000002 +#define PLDI2CSTEN __reg32(M32700UT_LAN_BASE + 0x40054) +#define PLDI2CSTEN_STEN 0x00000001 +#define PLDI2CDATA __reg32(M32700UT_LAN_BASE + 0x40060) +#define PLDI2CSTS __reg32(M32700UT_LAN_BASE + 0x40064) +#define PLDI2CSTS_TRX 0x00000020 +#define PLDI2CSTS_BB 0x00000010 +#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */ + +#endif /* _M32700UT_M32700UT_LAN_H */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_lcd.h b/include/asm-m32r/m32700ut/m32700ut_lcd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_lcd.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,59 @@ +/* + * include/asm/m32700ut_lcd.h + * + * M32700UT-LCD board + * + * Copyright (c) 2002 Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_LCD_H +#define _M32700UT_M32700UT_LCD_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* + * ICU + */ +#define M32700UT_LCD_IRQ_BAT_INT (M32700UT_LCD_PLD_IRQ_BASE + 1) +#define M32700UT_LCD_IRQ_USB_INT1 (M32700UT_LCD_PLD_IRQ_BASE + 2) +#define M32700UT_LCD_IRQ_AUDT0 (M32700UT_LCD_PLD_IRQ_BASE + 3) +#define M32700UT_LCD_IRQ_AUDT2 (M32700UT_LCD_PLD_IRQ_BASE + 4) +#define M32700UT_LCD_IRQ_BATSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 16) +#define M32700UT_LCD_IRQ_BATSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 17) +#define M32700UT_LCD_IRQ_ASNDSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 18) +#define M32700UT_LCD_IRQ_ASNDSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 19) +#define M32700UT_LCD_IRQ_ACNLSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 21) + +#define M32700UT_LCD_ICUISTS __reg16(M32700UT_LCD_BASE + 0x300002) +#define M32700UT_LCD_ICUISTS_VECB_MASK (0xf000) +#define M32700UT_LCD_VECB(x) ((x) & M32700UT_LCD_ICUISTS_VECB_MASK) +#define M32700UT_LCD_ICUISTS_ISN_MASK (0x07c0) +#define M32700UT_LCD_ICUISTS_ISN(x) ((x) & M32700UT_LCD_ICUISTS_ISN_MASK) +#define M32700UT_LCD_ICUIREQ0 __reg16(M32700UT_LCD_BASE + 0x300004) +#define M32700UT_LCD_ICUIREQ1 __reg16(M32700UT_LCD_BASE + 0x300006) +#define M32700UT_LCD_ICUCR1 __reg16(M32700UT_LCD_BASE + 0x300020) +#define M32700UT_LCD_ICUCR2 __reg16(M32700UT_LCD_BASE + 0x300022) +#define M32700UT_LCD_ICUCR3 __reg16(M32700UT_LCD_BASE + 0x300024) +#define M32700UT_LCD_ICUCR4 __reg16(M32700UT_LCD_BASE + 0x300026) +#define M32700UT_LCD_ICUCR16 __reg16(M32700UT_LCD_BASE + 0x300030) +#define M32700UT_LCD_ICUCR17 __reg16(M32700UT_LCD_BASE + 0x300032) +#define M32700UT_LCD_ICUCR18 __reg16(M32700UT_LCD_BASE + 0x300034) +#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036) +#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a) + +#endif /* _M32700UT_M32700UT_LCD_H */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_pld.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,265 @@ +/* + * include/asm/m32700ut/m32700ut_pld.h + * + * Definitions for Programable Logic Device(PLD) on M32700UT board. + * + * Copyright (c) 2002 Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_PLD_H +#define _M32700UT_M32700UT_PLD_H + +#include + +#if defined(CONFIG_PLAT_M32700UT_Alpha) +#define PLD_PLAT_BASE 0x08c00000 +#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) +#define PLD_PLAT_BASE 0x04c00000 +#else +#error "no platform configuration" +#endif + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) +#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#if !defined(CONFIG_PLAT_USRV) +#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CFIREQ (M32700UT_PLD_IRQ_BASE + 3) /* CF IREQ */ +#define PLD_IRQ_CFC_INSERT (M32700UT_PLD_IRQ_BASE + 4) /* CF Insert */ +#define PLD_IRQ_CFC_EJECT (M32700UT_PLD_IRQ_BASE + 5) /* CF Eject */ +#define PLD_IRQ_EXINT (M32700UT_PLD_IRQ_BASE + 6) /* EXINT */ +#define PLD_IRQ_INT7 (M32700UT_PLD_IRQ_BASE + 7) /* reserved */ +#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_MMCCARD (M32700UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ +#define PLD_IRQ_INT12 (M32700UT_PLD_IRQ_BASE + 12) /* reserved */ +#define PLD_IRQ_SC_ERROR (M32700UT_PLD_IRQ_BASE + 13) /* SC error */ +#define PLD_IRQ_SC_RCV (M32700UT_PLD_IRQ_BASE + 14) /* SC receive */ +#define PLD_IRQ_SC_SND (M32700UT_PLD_IRQ_BASE + 15) /* SC send */ +#define PLD_IRQ_SIO0_RCV (M32700UT_PLD_IRQ_BASE + 16) /* SIO receive */ +#define PLD_IRQ_SIO0_SND (M32700UT_PLD_IRQ_BASE + 17) /* SIO send */ +#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ +#define PLD_IRQ_INT31 (M32700UT_PLD_IRQ_BASE + 31) /* reserved */ + +#else /* CONFIG_PLAT_USRV */ + +#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CF0 (M32700UT_PLD_IRQ_BASE + 3) /* CF0# */ +#define PLD_IRQ_CF1 (M32700UT_PLD_IRQ_BASE + 4) /* CF1# */ +#define PLD_IRQ_CF2 (M32700UT_PLD_IRQ_BASE + 5) /* CF2# */ +#define PLD_IRQ_CF3 (M32700UT_PLD_IRQ_BASE + 6) /* CF3# */ +#define PLD_IRQ_CF4 (M32700UT_PLD_IRQ_BASE + 7) /* CF4# */ +#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_INT11 (M32700UT_PLD_IRQ_BASE + 11) /* reserved */ +#define PLD_IRQ_UART0 (M32700UT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ +#define PLD_IRQ_UART1 (M32700UT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ +#define PLD_IRQ_INT14 (M32700UT_PLD_IRQ_BASE + 14) /* reserved */ +#define PLD_IRQ_INT15 (M32700UT_PLD_IRQ_BASE + 15) /* reserved */ +#define PLD_IRQ_SNDINT (M32700UT_PLD_IRQ_BASE + 16) /* SNDINT# */ +#define PLD_IRQ_INT17 (M32700UT_PLD_IRQ_BASE + 17) /* reserved */ +#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ + +#endif /* CONFIG_PLAT_USRV */ + +#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) +#define PLD_ICUISTS_VECB_MASK (0xf000) +#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) +#define PLD_ICUISTS_ISN_MASK (0x07c0) +#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) +#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) +#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) +#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) +#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) +#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) +#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) +#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) +#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) +#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) +#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) +#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) +#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) +#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) +#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) +#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) +#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) +#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) +#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) +#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) +#define PLD_ICUCR_IEN (0x1000) +#define PLD_ICUCR_IREQ (0x0100) +#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ +#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ +#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ +#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ +#define PLD_ICUCR_ILEVEL0 (0x0000) +#define PLD_ICUCR_ILEVEL1 (0x0001) +#define PLD_ICUCR_ILEVEL2 (0x0002) +#define PLD_ICUCR_ILEVEL3 (0x0003) +#define PLD_ICUCR_ILEVEL4 (0x0004) +#define PLD_ICUCR_ILEVEL5 (0x0005) +#define PLD_ICUCR_ILEVEL6 (0x0006) +#define PLD_ICUCR_ILEVEL7 (0x0007) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) +#define PLD_CPCR_CF 0x0001 +#define PLD_CPCR_MMC 0x0002 + +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif /* _M32700UT_M32700UT_PLD.H */ diff -Nru a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32r.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,135 @@ +#ifndef _ASM_M32R_M32R_H_ +#define _ASM_M32R_M32R_H_ + +/* + * Mitsubishi M32R processor + * Copyright (C) 1997-2002, Mitsubishi Electric Corporation + */ + +/* $Id$ */ + +#include + +/* Chip type */ +#if defined(CONFIG_CHIP_XNUX_MP) || defined(CONFIG_CHIP_XNUX2_MP) +#include +#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) +#include +#include +#endif + +/* Platform type */ +#if defined(CONFIG_PLAT_M32700UT) +#include +#include +#include +#endif /* CONFIG_PLAT_M32700UT */ + +#if defined(CONFIG_PLAT_OPSPUT) +#include +#include +#include +#endif /* CONFIG_PLAT_OPSPUT */ + +#if defined(CONFIG_PLAT_MAPPI2) +#include +#endif /* CONFIG_PLAT_MAPPI2 */ + +#if defined(CONFIG_PLAT_USRV) +#include +#endif + +/* + * M32R Register + */ + +/* + * MMU Register + */ + +#define MMU_REG_BASE (0xffff0000) +#define ITLB_BASE (0xfe000000) +#define DTLB_BASE (0xfe000800) + +#define NR_TLB_ENTRIES CONFIG_TLB_ENTRIES + +#define MATM MMU_REG_BASE /* MMU Address Translation Mode + Register */ +#define MPSZ (0x04 + MMU_REG_BASE) /* MMU Page Size Designation Register */ +#define MASID (0x08 + MMU_REG_BASE) /* MMU Address Space ID Register */ +#define MESTS (0x0c + MMU_REG_BASE) /* MMU Exception Status Register */ +#define MDEVA (0x10 + MMU_REG_BASE) /* MMU Operand Exception Virtual + Address Register */ +#define MDEVP (0x14 + MMU_REG_BASE) /* MMU Operand Exception Virtual Page + Number Register */ +#define MPTB (0x18 + MMU_REG_BASE) /* MMU Page Table Base Register */ +#define MSVA (0x20 + MMU_REG_BASE) /* MMU Search Virtual Address + Register */ +#define MTOP (0x24 + MMU_REG_BASE) /* MMU TLB Operation Register */ +#define MIDXI (0x28 + MMU_REG_BASE) /* MMU Index Register for + Instruciton */ +#define MIDXD (0x2c + MMU_REG_BASE) /* MMU Index Register for Operand */ + +#define MATM_offset (MATM - MMU_REG_BASE) +#define MPSZ_offset (MPSZ - MMU_REG_BASE) +#define MASID_offset (MASID - MMU_REG_BASE) +#define MESTS_offset (MESTS - MMU_REG_BASE) +#define MDEVA_offset (MDEVA - MMU_REG_BASE) +#define MDEVP_offset (MDEVP - MMU_REG_BASE) +#define MPTB_offset (MPTB - MMU_REG_BASE) +#define MSVA_offset (MSVA - MMU_REG_BASE) +#define MTOP_offset (MTOP - MMU_REG_BASE) +#define MIDXI_offset (MIDXI - MMU_REG_BASE) +#define MIDXD_offset (MIDXD - MMU_REG_BASE) + +#define MESTS_IT (1 << 0) /* Instruction TLB miss */ +#define MESTS_IA (1 << 1) /* Instruction Access Exception */ +#define MESTS_DT (1 << 4) /* Operand TLB miss */ +#define MESTS_DA (1 << 5) /* Operand Access Exception */ +#define MESTS_DRW (1 << 6) /* Operand Write Exception Flag */ + +/* + * PSW (Processor Status Word) + */ + +/* PSW bit */ +#define M32R_PSW_BIT_SM (7) /* Stack Mode */ +#define M32R_PSW_BIT_IE (6) /* Interrupt Enable */ +#define M32R_PSW_BIT_PM (3) /* Processor Mode [0:Supervisor,1:User] */ +#define M32R_PSW_BIT_C (0) /* Condition */ +#define M32R_PSW_BIT_BSM (7+8) /* Backup Stack Mode */ +#define M32R_PSW_BIT_BIE (6+8) /* Backup Interrupt Enable */ +#define M32R_PSW_BIT_BPM (3+8) /* Backup Processor Mode */ +#define M32R_PSW_BIT_BC (0+8) /* Backup Condition */ + +/* PSW bit map */ +#define M32R_PSW_SM (1UL<< M32R_PSW_BIT_SM) /* Stack Mode */ +#define M32R_PSW_IE (1UL<< M32R_PSW_BIT_IE) /* Interrupt Enable */ +#define M32R_PSW_PM (1UL<< M32R_PSW_BIT_PM) /* Processor Mode */ +#define M32R_PSW_C (1UL<< M32R_PSW_BIT_C) /* Condition */ +#define M32R_PSW_BSM (1UL<< M32R_PSW_BIT_BSM) /* Backup Stack Mode */ +#define M32R_PSW_BIE (1UL<< M32R_PSW_BIT_BIE) /* Backup Interrupt Enable */ +#define M32R_PSW_BPM (1UL<< M32R_PSW_BIT_BPM) /* Backup Processor Mode */ +#define M32R_PSW_BC (1UL<< M32R_PSW_BIT_BC) /* Backup Condition */ + +/* + * Direct address to SFR + */ + +#include +#ifdef CONFIG_MMU +#define NONCACHE_OFFSET __PAGE_OFFSET+0x20000000 +#else +#define NONCACHE_OFFSET __PAGE_OFFSET +#endif /* CONFIG_MMU */ + +#define M32R_ICU_ISTS_ADDR M32R_ICU_ISTS_PORTL+NONCACHE_OFFSET +#define M32R_ICU_IPICR_ADDR M32R_ICU_IPICR0_PORTL+NONCACHE_OFFSET +#define M32R_ICU_IMASK_ADDR M32R_ICU_IMASK_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_CPU_NAME_ADDR M32R_FPGA_CPU_NAME0_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_MODEL_ID_ADDR M32R_FPGA_MODEL_ID0_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_VERSION_ADDR M32R_FPGA_VERSION0_PORTL+NONCACHE_OFFSET + +#endif /* _ASM_M32R_M32R_H_ */ diff -Nru a/include/asm-m32r/m32r_mp_fpga.h b/include/asm-m32r/m32r_mp_fpga.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32r_mp_fpga.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,313 @@ +#ifndef _ASM_M32R_M32R_MP_FPGA_ +#define _ASM_M32R_M32R_MP_FPGA_ + +/* + * Mitsubishi M32R-MP-FPGA + * Copyright (c) 2002 [Hitoshi Yamamoto] All rights reserved. + */ + +/* $Id$ */ + +/* + * ======================================================== + * M32R-MP-FPGA Memory Map + * ======================================================== + * 0x00000000 : Block#0 : 64[MB] + * 0x03E00000 : SFR + * 0x03E00000 : reserved + * 0x03EF0000 : FPGA + * 0x03EF1000 : reserved + * 0x03EF4000 : CKM + * 0x03EF4000 : BSELC + * 0x03EF5000 : reserved + * 0x03EFC000 : MFT + * 0x03EFD000 : SIO + * 0x03EFE000 : reserved + * 0x03EFF000 : ICU + * 0x03F00000 : Internal SRAM 64[KB] + * 0x03F10000 : reserved + * -------------------------------------------------------- + * 0x04000000 : Block#1 : 64[MB] + * 0x04000000 : Debug board SRAM 4[MB] + * 0x04400000 : reserved + * -------------------------------------------------------- + * 0x08000000 : Block#2 : 64[MB] + * -------------------------------------------------------- + * 0x0C000000 : Block#3 : 64[MB] + * -------------------------------------------------------- + * 0x10000000 : Block#4 : 64[MB] + * -------------------------------------------------------- + * 0x14000000 : Block#5 : 64[MB] + * -------------------------------------------------------- + * 0x18000000 : Block#6 : 64[MB] + * -------------------------------------------------------- + * 0x1C000000 : Block#7 : 64[MB] + * -------------------------------------------------------- + * 0xFE000000 : TLB + * 0xFE000000 : ITLB + * 0xFE000080 : reserved + * 0xFE000800 : DTLB + * 0xFE000880 : reserved + * -------------------------------------------------------- + * 0xFF000000 : System area + * 0xFFFF0000 : MMU + * 0xFFFF0030 : reserved + * 0xFFFF8000 : Debug function + * 0xFFFFA000 : reserved + * 0xFFFFC000 : CPU control + * 0xFFFFFFFF + * ======================================================== + */ + +/*======================================================================* + * Special Function Register + *======================================================================*/ +#define M32R_SFR_OFFSET (0x00E00000) /* 0x03E00000-0x03EFFFFF 1[MB] */ + +/* + * FPGA registers. + */ +#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) + +#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME3_PORTL (0x1C+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID3_PORTL (0x2C+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) + +/* + * Clock and Power Manager registers. + */ +#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) + +#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) +#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) +#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) + +/* + * Block SELect Controller registers. + */ +#define M32R_BSELC_OFFSET (0x000F5000+M32R_SFR_OFFSET) + +#define M32R_BSEL0_CR0_PORTL (0x000+M32R_BSELC_OFFSET) +#define M32R_BSEL0_CR1_PORTL (0x004+M32R_BSELC_OFFSET) +#define M32R_BSEL1_CR0_PORTL (0x100+M32R_BSELC_OFFSET) +#define M32R_BSEL1_CR1_PORTL (0x104+M32R_BSELC_OFFSET) +#define M32R_BSEL2_CR0_PORTL (0x200+M32R_BSELC_OFFSET) +#define M32R_BSEL2_CR1_PORTL (0x204+M32R_BSELC_OFFSET) +#define M32R_BSEL3_CR0_PORTL (0x300+M32R_BSELC_OFFSET) +#define M32R_BSEL3_CR1_PORTL (0x304+M32R_BSELC_OFFSET) +#define M32R_BSEL4_CR0_PORTL (0x400+M32R_BSELC_OFFSET) +#define M32R_BSEL4_CR1_PORTL (0x404+M32R_BSELC_OFFSET) +#define M32R_BSEL5_CR0_PORTL (0x500+M32R_BSELC_OFFSET) +#define M32R_BSEL5_CR1_PORTL (0x504+M32R_BSELC_OFFSET) +#define M32R_BSEL6_CR0_PORTL (0x600+M32R_BSELC_OFFSET) +#define M32R_BSEL6_CR1_PORTL (0x604+M32R_BSELC_OFFSET) +#define M32R_BSEL7_CR0_PORTL (0x700+M32R_BSELC_OFFSET) +#define M32R_BSEL7_CR1_PORTL (0x704+M32R_BSELC_OFFSET) + +/* + * Multi Function Timer registers. + */ +#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) + +#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ +#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ + +#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) +#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ +#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ +#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ +#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ +#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ + +#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) +#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ +#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ +#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ +#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ +#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ + +#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) +#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ +#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ +#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ +#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ +#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ + +#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) +#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ +#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ +#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ +#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ +#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ + +#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) +#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ +#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ +#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ +#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) +#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ +#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ +#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ +#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ +#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ +#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ +#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ +#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ +#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ +#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ +#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ +#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ +#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ +#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ +#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ + +#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ +#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ +#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ +#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ +#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ +#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ +#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ +#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ +#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ +#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ +#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ +#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ +#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ +#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ +#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ + +/* + * Serial I/O registers. + */ +#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) + +#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) +#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) +#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) +#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) +#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) +#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) +#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) + +/* + * Interrupt Control Unit registers. + */ +#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) + +#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) +#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) +#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) +#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ +#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ +#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ +#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ +#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ +#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ +#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ +#define M32R_ICU_CR8_PORTL (0x218+M32R_ICU_OFFSET) /* INT7 */ +#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* SIO0 RX */ +#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* SIO0 TX */ +#define M32R_ICU_CR40_PORTL (0x29C+M32R_ICU_OFFSET) /* DMAC0 */ +#define M32R_ICU_CR41_PORTL (0x2A0+M32R_ICU_OFFSET) /* DMAC1 */ +#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* MFT0 */ +#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* MFT1 */ +#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* MFT2 */ +#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* MFT3 */ +#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* MFT4 */ +#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* MFT5 */ +#define M32R_ICU_IPICR0_PORTL (0x2DC+M32R_ICU_OFFSET) /* IPI0 */ +#define M32R_ICU_IPICR1_PORTL (0x2E0+M32R_ICU_OFFSET) /* IPI1 */ +#define M32R_ICU_IPICR2_PORTL (0x2E4+M32R_ICU_OFFSET) /* IPI2 */ +#define M32R_ICU_IPICR3_PORTL (0x2E8+M32R_ICU_OFFSET) /* IPI3 */ +#define M32R_ICU_IPICR4_PORTL (0x2EC+M32R_ICU_OFFSET) /* IPI4 */ +#define M32R_ICU_IPICR5_PORTL (0x2F0+M32R_ICU_OFFSET) /* IPI5 */ +#define M32R_ICU_IPICR6_PORTL (0x2F4+M32R_ICU_OFFSET) /* IPI6 */ +#define M32R_ICU_IPICR7_PORTL (0x2FC+M32R_ICU_OFFSET) /* IPI7 */ + +#define M32R_ICUISTS_VECB(val) ((val>>28) & 0xF) +#define M32R_ICUISTS_ISN(val) ((val>>22) & 0x3F) +#define M32R_ICUISTS_PIML(val) ((val>>16) & 0x7) + +#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ +#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ +#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ +#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ +#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ +#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ +#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ +#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ + +#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ +#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ +#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ +#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ +#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ +#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ +#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ +#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ +#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ +#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ +#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ +#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ +#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ +#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ +#define M32R_ICUCR_ILEVEL_MASK (7UL) + +#define M32R_IRQ_INT0 (1) /* INT0 */ +#define M32R_IRQ_INT1 (2) /* INT1 */ +#define M32R_IRQ_INT2 (3) /* INT2 */ +#define M32R_IRQ_INT3 (4) /* INT3 */ +#define M32R_IRQ_INT4 (5) /* INT4 */ +#define M32R_IRQ_INT5 (6) /* INT5 */ +#define M32R_IRQ_INT6 (7) /* INT6 */ +#define M32R_IRQ_INT7 (8) /* INT7 */ +#define M32R_IRQ_MFT0 (16) /* MFT0 */ +#define M32R_IRQ_MFT1 (17) /* MFT1 */ +#define M32R_IRQ_MFT2 (18) /* MFT2 */ +#define M32R_IRQ_MFT3 (19) /* MFT3 */ +#define M32R_IRQ_MFT4 (20) /* MFT4 */ +#define M32R_IRQ_MFT5 (21) /* MFT5 */ +#define M32R_IRQ_DMAC0 (32) /* DMAC0 */ +#define M32R_IRQ_DMAC1 (33) /* DMAC1 */ +#define M32R_IRQ_SIO0_R (48) /* SIO0 receive */ +#define M32R_IRQ_SIO0_S (49) /* SIO0 send */ +#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ +#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ +#define M32R_IRQ_IPI0 (56) /* IPI0 */ +#define M32R_IRQ_IPI1 (57) /* IPI1 */ +#define M32R_IRQ_IPI2 (58) /* IPI2 */ +#define M32R_IRQ_IPI3 (59) /* IPI3 */ +#define M32R_IRQ_IPI4 (60) /* IPI4 */ +#define M32R_IRQ_IPI5 (61) /* IPI5 */ +#define M32R_IRQ_IPI6 (62) /* IPI6 */ +#define M32R_IRQ_IPI7 (63) /* IPI7 */ + +/*======================================================================* + * CPU + *======================================================================*/ + +#define M32R_CPUID_PORTL (0xFFFFFFE0) +#define M32R_MCICAR_PORTL (0xFFFFFFF0) +#define M32R_MCDCAR_PORTL (0xFFFFFFF4) +#define M32R_MCCR_PORTL (0xFFFFFFFC) + +#endif /* _ASM_M32R_M32R_MP_FPGA_ */ diff -Nru a/include/asm-m32r/mappi2/mappi2_pld.h b/include/asm-m32r/mappi2/mappi2_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mappi2/mappi2_pld.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,151 @@ +/* + * include/asm/mappi2/mappi2_pld.h + * + * Definitions for Extended IO Logic on MAPPI2 board. + * based on m32700ut_pld.h by + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + */ + +#ifndef _MAPPI2_PLD_H +#define _MAPPI2_PLD_H + +#ifndef __ASSEMBLY__ +/* FIXME: + * Some C functions use non-cache address, so can't define non-cache address. + */ +#define PLD_BASE (0x10c00000 /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (0x10c00000 + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) + + +/*==== ICU ====*/ +#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ +#define M32R_IRQ_I2C (28) /* I2C-BUS */ +#if 1 +#define PLD_IRQ_CFIREQ (40) /* CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (41) /* CFC Card Insert */ +#define PLD_IRQ_CFC_EJECT (42) /* CFC Card Eject */ +#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ +#else +#define PLD_IRQ_CFIREQ (34) /* CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (35) /* CFC Card Insert */ +#define PLD_IRQ_CFC_EJECT (36) /* CFC Card Eject */ +#define PLD_IRQ_MMCCARD (37) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (38) /* MMC Transfer Done */ +#endif + + +#if 0 +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +#endif + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + + +#if 0 +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif + +#endif /* _MAPPI2_PLD.H */ diff -Nru a/include/asm-m32r/mc146818rtc.h b/include/asm-m32r/mc146818rtc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mc146818rtc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,32 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef _ASM_MC146818RTC_H +#define _ASM_MC146818RTC_H + +#include + +#ifndef RTC_PORT +// #define RTC_PORT(x) (0x70 + (x)) +#define RTC_PORT(x) ((x)) +#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ +#endif + +/* + * The yet supported machines all access the RTC index register via + * an ISA port access but the way to access the date register differs ... + */ +#define CMOS_READ(addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +inb_p(RTC_PORT(1)); \ +}) +#define CMOS_WRITE(val, addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +outb_p((val),RTC_PORT(1)); \ +}) + +#define RTC_IRQ 8 +#if 0 +#endif + +#endif /* _ASM_MC146818RTC_H */ diff -Nru a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mman.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,45 @@ +#ifndef __M32R_MMAN_H__ +#define __M32R_MMAN_H__ + +/* orig : i386 2.6.0-test6 */ + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ +#define PROT_NONE 0x0 /* page can not be accessed */ +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ + +#define MS_ASYNC 1 /* sync memory asynchronously */ +#define MS_INVALIDATE 2 /* invalidate the caches */ +#define MS_SYNC 4 /* synchronous memory sync */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + +/* compatibility flags */ +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FILE 0 + +#endif /* __M32R_MMAN_H__ */ diff -Nru a/include/asm-m32r/mmu.h b/include/asm-m32r/mmu.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmu.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,35 @@ +#ifndef _ASM_M32R_MMU_H +#define _ASM_M32R_MMU_H + +/* $Id$ */ + +#include + +#if !defined(CONFIG_MMU) +struct mm_rblock_struct { + int size; + int refcount; + void *kblock; +}; + +struct mm_tblock_struct { + struct mm_rblock_struct *rblock; + struct mm_tblock_struct *next; +}; + +typedef struct { + struct mm_tblock_struct tblock; + unsigned long end_brk; +} mm_context_t; +#else + +/* Default "unsigned long" context */ +#ifndef CONFIG_SMP +typedef unsigned long mm_context_t; +#else +typedef unsigned long mm_context_t[NR_CPUS]; +#endif + +#endif /* CONFIG_MMU */ +#endif /* _ASM_M32R_MMU_H */ + diff -Nru a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmu_context.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,169 @@ +#ifndef _ASM_M32R_MMU_CONTEXT_H +#define _ASM_M32R_MMU_CONTEXT_H + +/* $Id */ + +#include + +#include + +#define MMU_CONTEXT_ASID_MASK (0x000000FF) +#define MMU_CONTEXT_VERSION_MASK (0xFFFFFF00) +#define MMU_CONTEXT_FIRST_VERSION (0x00000100) +#define NO_CONTEXT (0x00000000) + + +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include +#include + +/* + * Cache of MMU context last used. + */ +#ifndef CONFIG_SMP +extern unsigned long mmu_context_cache_dat; +#define mmu_context_cache mmu_context_cache_dat +#define mm_context(mm) mm->context +#else /* not CONFIG_SMP */ +extern unsigned long mmu_context_cache_dat[]; +#define mmu_context_cache mmu_context_cache_dat[smp_processor_id()] +#define mm_context(mm) mm->context[smp_processor_id()] +#endif /* not CONFIG_SMP */ + +#define set_tlb_tag(entry, tag) (*entry = (tag & PAGE_MASK)|get_asid()) +#define set_tlb_data(entry, data) (*entry = (data | _PAGE_PRESENT)) + +#ifdef CONFIG_MMU +#define enter_lazy_tlb(mm, tsk) do { } while (0) + +static __inline__ void get_new_mmu_context(struct mm_struct *mm) +{ + unsigned long mc = ++mmu_context_cache; + + if (!(mc & MMU_CONTEXT_ASID_MASK)) { + /* We exhaust ASID of this version. + Flush all TLB and start new cycle. */ + local_flush_tlb_all(); + /* Fix version if needed. + Note that we avoid version #0 to distingush NO_CONTEXT. */ + if (!mc) + mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; + } + mm_context(mm) = mc; +} + +/* + * Get MMU context if needed. + */ +static __inline__ void get_mmu_context(struct mm_struct *mm) +{ + if (mm) { + unsigned long mc = mmu_context_cache; + + /* Check if we have old version of context. + If it's old, we need to get new context with new version. */ + if ((mm_context(mm) ^ mc) & MMU_CONTEXT_VERSION_MASK) + get_new_mmu_context(mm); + } +} + +/* + * Initialize the context related info for a new mm_struct + * instance. + */ +static __inline__ int init_new_context(struct task_struct *tsk, + struct mm_struct *mm) +{ +#ifndef CONFIG_SMP + mm->context = NO_CONTEXT; +#else /* CONFIG_SMP */ + int num_cpus = num_online_cpus(); + int i; + + for (i = 0 ; i < num_cpus ; i++) + mm->context[i] = NO_CONTEXT; +#endif /* CONFIG_SMP */ + + return 0; +} + +/* + * Destroy context related info for an mm_struct that is about + * to be put to rest. + */ +#define destroy_context(mm) do { } while (0) + +static __inline__ void set_asid(unsigned long asid) +{ + *(volatile unsigned long *)MASID = (asid & MMU_CONTEXT_ASID_MASK); +} + +static __inline__ unsigned long get_asid(void) +{ + unsigned long asid; + + asid = *(volatile long *)MASID; + asid &= MMU_CONTEXT_ASID_MASK; + + return asid; +} + +/* + * After we have set current->mm to a new value, this activates + * the context for the new mm so we see the new mappings. + */ +static __inline__ void activate_context(struct mm_struct *mm) +{ + get_mmu_context(mm); + set_asid(mm_context(mm) & MMU_CONTEXT_ASID_MASK); +} + +static __inline__ void switch_mm(struct mm_struct *prev, + struct mm_struct *next, struct task_struct *tsk) +{ +#ifdef CONFIG_SMP + int cpu = smp_processor_id(); +#endif /* CONFIG_SMP */ + + if (prev != next) { +#ifdef CONFIG_SMP + cpu_set(cpu, next->cpu_vm_mask); +#endif /* CONFIG_SMP */ + /* Set MPTB = next->pgd */ + *(volatile unsigned long *)MPTB = (unsigned long)next->pgd; + activate_context(next); + } +#ifdef CONFIG_SMP + else + if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) + activate_context(next); +#endif /* CONFIG_SMP */ +} + +#define deactivate_mm(tsk, mm) do { } while (0) + +#define activate_mm(prev, next) \ + switch_mm((prev), (next), NULL) + +#else +#define get_mmu_context(mm) do { } while (0) +#define init_new_context(tsk,mm) (0) +#define destroy_context(mm) do { } while (0) +#define set_asid(asid) do { } while (0) +#define get_asid() (0) +#define activate_context(mm) do { } while (0) +#define switch_mm(prev,next,tsk) do { } while (0) +#define deactivate_mm(mm,tsk) do { } while (0) +#define activate_mm(prev,next) do { } while (0) +#define enter_lazy_tlb(mm,tsk) do { } while (0) +#endif /* CONFIG_MMU */ + + +#endif /* not __ASSEMBLY__ */ + +#endif /* _ASM_M32R_MMU_CONTEXT_H */ + diff -Nru a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmzone.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,80 @@ +/* + * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002 + * + */ + +#ifndef _ASM_MMZONE_H_ +#define _ASM_MMZONE_H_ + +#include + +#ifdef CONFIG_DISCONTIGMEM + +extern struct pglist_data *node_data[]; +#define NODE_DATA(nid) (node_data[nid]) + +#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) +#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) +#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) +#define node_end_pfn(nid) \ +({ \ + pg_data_t *__pgdat = NODE_DATA(nid); \ + __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \ +}) + +#define local_mapnr(kvaddr) \ +({ \ + unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \ + (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \ +}) + +#define pfn_to_page(pfn) \ +({ \ + unsigned long __pfn = pfn; \ + int __node = pfn_to_nid(__pfn); \ + &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ +}) + +#define page_to_pfn(pg) \ +({ \ + struct page *__page = pg; \ + struct zone *__zone = page_zone(__page); \ + (unsigned long)(__page - __zone->zone_mem_map) \ + + __zone->zone_start_pfn; \ +}) +#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) +/* + * pfn_valid should be made as fast as possible, and the current definition + * is valid for machines that are NUMA, but still contiguous, which is what + * is currently supported. A more generalised, but slower definition would + * be something like this - mbligh: + * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) ) + */ +#if 1 /* M32R_FIXME */ +#define pfn_valid(pfn) (1) +#else +#define pfn_valid(pfn) ((pfn) < num_physpages) +#endif + +/* + * generic node memory support, the following assumptions apply: + */ + +static __inline__ int pfn_to_nid(unsigned long pfn) +{ + int node; + + for (node = 0 ; node < MAX_NUMNODES ; node++) + if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node)) + break; + + return node; +} + +static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn) +{ + return(NODE_DATA(pfn_to_nid(pfn))); +} + +#endif /* CONFIG_DISCONTIGMEM */ +#endif /* _ASM_MMZONE_H_ */ diff -Nru a/include/asm-m32r/module.h b/include/asm-m32r/module.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/module.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,13 @@ +#ifndef _ASM_M32R_MODULE_H +#define _ASM_M32R_MODULE_H + +/* $Id$ */ + +struct mod_arch_specific { }; + +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr + +#endif /* _ASM_M32R_MODULE_H */ + diff -Nru a/include/asm-m32r/msgbuf.h b/include/asm-m32r/msgbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/msgbuf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,35 @@ +#ifndef _ASM_M32R_MSGBUF_H +#define _ASM_M32R_MSGBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The msqid64_ds structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + __kernel_time_t msg_stime; /* last msgsnd time */ + unsigned long __unused1; + __kernel_time_t msg_rtime; /* last msgrcv time */ + unsigned long __unused2; + __kernel_time_t msg_ctime; /* last change time */ + unsigned long __unused3; + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* _ASM_M32R_MSGBUF_H */ diff -Nru a/include/asm-m32r/namei.h b/include/asm-m32r/namei.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/namei.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,21 @@ +#ifndef _ASM_M32R_NAMEI_H +#define _ASM_M32R_NAMEI_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * linux/include/asm-m32r/namei.h + * + * Included from linux/fs/namei.c + */ + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __emul_prefix() NULL + +#endif /* _ASM_M32R_NAMEI_H */ diff -Nru a/include/asm-m32r/numnodes.h b/include/asm-m32r/numnodes.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/numnodes.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,15 @@ +#ifndef _ASM_NUMNODES_H_ +#define _ASM_NUMNODES_H_ + +#include + +#ifdef CONFIG_DISCONTIGMEM + +#if defined(CONFIG_CHIP_M32700) +#define NODES_SHIFT 1 /* Max 2 Nodes */ +#endif /* CONFIG_CHIP_M32700 */ + +#endif /* CONFIG_DISCONTIGMEM */ + +#endif /* _ASM_NUMNODES_H_ */ + diff -Nru a/include/asm-m32r/opsput/opsput_lan.h b/include/asm-m32r/opsput/opsput_lan.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_lan.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,56 @@ +/* + * include/asm/opsput_lan.h + * + * OPSPUT-LAN board + * + * Copyright (c) 2002-2004 Takeo Takahashi, Mamoru Sakugawa + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id: opsput_lan.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_LAN_H +#define _OPSPUT_OPSPUT_LAN_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#define OPSPUT_LAN_IRQ_LAN (OPSPUT_LAN_PLD_IRQ_BASE + 1) /* LAN */ +#define OPSPUT_LAN_IRQ_I2C (OPSPUT_LAN_PLD_IRQ_BASE + 3) /* I2C */ + +#define OPSPUT_LAN_ICUISTS __reg16(OPSPUT_LAN_BASE + 0xc0002) +#define OPSPUT_LAN_ICUISTS_VECB_MASK (0xf000) +#define OPSPUT_LAN_VECB(x) ((x) & OPSPUT_LAN_ICUISTS_VECB_MASK) +#define OPSPUT_LAN_ICUISTS_ISN_MASK (0x07c0) +#define OPSPUT_LAN_ICUISTS_ISN(x) ((x) & OPSPUT_LAN_ICUISTS_ISN_MASK) +#define OPSPUT_LAN_ICUIREQ0 __reg16(OPSPUT_LAN_BASE + 0xc0004) +#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010) +#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014) + +#endif /* _OPSPUT_OPSPUT_LAN_H */ diff -Nru a/include/asm-m32r/opsput/opsput_lcd.h b/include/asm-m32r/opsput/opsput_lcd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_lcd.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,59 @@ +/* + * include/asm/opsput_lcd.h + * + * OPSPUT-LCD board + * + * Copyright (c) 2002 Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id: opsput_lcd.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_LCD_H +#define _OPSPUT_OPSPUT_LCD_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* + * ICU + */ +#define OPSPUT_LCD_IRQ_BAT_INT (OPSPUT_LCD_PLD_IRQ_BASE + 1) +#define OPSPUT_LCD_IRQ_USB_INT1 (OPSPUT_LCD_PLD_IRQ_BASE + 2) +#define OPSPUT_LCD_IRQ_AUDT0 (OPSPUT_LCD_PLD_IRQ_BASE + 3) +#define OPSPUT_LCD_IRQ_AUDT2 (OPSPUT_LCD_PLD_IRQ_BASE + 4) +#define OPSPUT_LCD_IRQ_BATSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 16) +#define OPSPUT_LCD_IRQ_BATSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 17) +#define OPSPUT_LCD_IRQ_ASNDSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 18) +#define OPSPUT_LCD_IRQ_ASNDSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 19) +#define OPSPUT_LCD_IRQ_ACNLSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 21) + +#define OPSPUT_LCD_ICUISTS __reg16(OPSPUT_LCD_BASE + 0x300002) +#define OPSPUT_LCD_ICUISTS_VECB_MASK (0xf000) +#define OPSPUT_LCD_VECB(x) ((x) & OPSPUT_LCD_ICUISTS_VECB_MASK) +#define OPSPUT_LCD_ICUISTS_ISN_MASK (0x07c0) +#define OPSPUT_LCD_ICUISTS_ISN(x) ((x) & OPSPUT_LCD_ICUISTS_ISN_MASK) +#define OPSPUT_LCD_ICUIREQ0 __reg16(OPSPUT_LCD_BASE + 0x300004) +#define OPSPUT_LCD_ICUIREQ1 __reg16(OPSPUT_LCD_BASE + 0x300006) +#define OPSPUT_LCD_ICUCR1 __reg16(OPSPUT_LCD_BASE + 0x300020) +#define OPSPUT_LCD_ICUCR2 __reg16(OPSPUT_LCD_BASE + 0x300022) +#define OPSPUT_LCD_ICUCR3 __reg16(OPSPUT_LCD_BASE + 0x300024) +#define OPSPUT_LCD_ICUCR4 __reg16(OPSPUT_LCD_BASE + 0x300026) +#define OPSPUT_LCD_ICUCR16 __reg16(OPSPUT_LCD_BASE + 0x300030) +#define OPSPUT_LCD_ICUCR17 __reg16(OPSPUT_LCD_BASE + 0x300032) +#define OPSPUT_LCD_ICUCR18 __reg16(OPSPUT_LCD_BASE + 0x300034) +#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036) +#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a) + +#endif /* _OPSPUT_OPSPUT_LCD_H */ diff -Nru a/include/asm-m32r/opsput/opsput_pld.h b/include/asm-m32r/opsput/opsput_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_pld.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,259 @@ +/* + * include/asm/opsput/opsput_pld.h + * + * Definitions for Programable Logic Device(PLD) on OPSPUT board. + * + * Copyright (c) 2002 Takeo Takahashi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + * + * $Id: opsput_pld.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_PLD_H +#define _OPSPUT_OPSPUT_PLD_H + +#include + +#define PLD_PLAT_BASE 0x1cc00000 + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) +#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#if !defined(CONFIG_PLAT_USRV) +#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CFIREQ (OPSPUT_PLD_IRQ_BASE + 3) /* CF IREQ */ +#define PLD_IRQ_CFC_INSERT (OPSPUT_PLD_IRQ_BASE + 4) /* CF Insert */ +#define PLD_IRQ_CFC_EJECT (OPSPUT_PLD_IRQ_BASE + 5) /* CF Eject */ +#define PLD_IRQ_EXINT (OPSPUT_PLD_IRQ_BASE + 6) /* EXINT */ +#define PLD_IRQ_INT7 (OPSPUT_PLD_IRQ_BASE + 7) /* reserved */ +#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_MMCCARD (OPSPUT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ +#define PLD_IRQ_INT12 (OPSPUT_PLD_IRQ_BASE + 12) /* reserved */ +#define PLD_IRQ_SC_ERROR (OPSPUT_PLD_IRQ_BASE + 13) /* SC error */ +#define PLD_IRQ_SC_RCV (OPSPUT_PLD_IRQ_BASE + 14) /* SC receive */ +#define PLD_IRQ_SC_SND (OPSPUT_PLD_IRQ_BASE + 15) /* SC send */ +#define PLD_IRQ_SIO0_RCV (OPSPUT_PLD_IRQ_BASE + 16) /* SIO receive */ +#define PLD_IRQ_SIO0_SND (OPSPUT_PLD_IRQ_BASE + 17) /* SIO send */ +#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ +#define PLD_IRQ_INT31 (OPSPUT_PLD_IRQ_BASE + 31) /* reserved */ + +#else /* CONFIG_PLAT_USRV */ + +#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CF0 (OPSPUT_PLD_IRQ_BASE + 3) /* CF0# */ +#define PLD_IRQ_CF1 (OPSPUT_PLD_IRQ_BASE + 4) /* CF1# */ +#define PLD_IRQ_CF2 (OPSPUT_PLD_IRQ_BASE + 5) /* CF2# */ +#define PLD_IRQ_CF3 (OPSPUT_PLD_IRQ_BASE + 6) /* CF3# */ +#define PLD_IRQ_CF4 (OPSPUT_PLD_IRQ_BASE + 7) /* CF4# */ +#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_INT11 (OPSPUT_PLD_IRQ_BASE + 11) /* reserved */ +#define PLD_IRQ_UART0 (OPSPUT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ +#define PLD_IRQ_UART1 (OPSPUT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ +#define PLD_IRQ_INT14 (OPSPUT_PLD_IRQ_BASE + 14) /* reserved */ +#define PLD_IRQ_INT15 (OPSPUT_PLD_IRQ_BASE + 15) /* reserved */ +#define PLD_IRQ_SNDINT (OPSPUT_PLD_IRQ_BASE + 16) /* SNDINT# */ +#define PLD_IRQ_INT17 (OPSPUT_PLD_IRQ_BASE + 17) /* reserved */ +#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ + +#endif /* CONFIG_PLAT_USRV */ + +#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) +#define PLD_ICUISTS_VECB_MASK (0xf000) +#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) +#define PLD_ICUISTS_ISN_MASK (0x07c0) +#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) +#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) +#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) +#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) +#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) +#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) +#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) +#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) +#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) +#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) +#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) +#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) +#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) +#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) +#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) +#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) +#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) +#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) +#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) +#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) +#define PLD_ICUCR_IEN (0x1000) +#define PLD_ICUCR_IREQ (0x0100) +#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ +#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ +#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ +#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ +#define PLD_ICUCR_ILEVEL0 (0x0000) +#define PLD_ICUCR_ILEVEL1 (0x0001) +#define PLD_ICUCR_ILEVEL2 (0x0002) +#define PLD_ICUCR_ILEVEL3 (0x0003) +#define PLD_ICUCR_ILEVEL4 (0x0004) +#define PLD_ICUCR_ILEVEL5 (0x0005) +#define PLD_ICUCR_ILEVEL6 (0x0006) +#define PLD_ICUCR_ILEVEL7 (0x0007) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) +#define PLD_CPCR_CF 0x0001 +#define PLD_CPCR_MMC 0x0002 + +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif /* _OPSPUT_OPSPUT_PLD.H */ diff -Nru a/include/asm-m32r/page.h b/include/asm-m32r/page.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/page.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,112 @@ +#ifndef _ASM_M32R_PAGE_H +#define _ASM_M32R_PAGE_H + +#include + +/* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +extern void clear_page(void *to); +extern void copy_page(void *to, void *from); + +#define clear_user_page(page, vaddr, pg) clear_page(page) +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) + +/* + * These are used to make use of C type-checking.. + */ +typedef struct { unsigned long pte; } pte_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pgd; } pgd_t; +#define pte_val(x) ((x).pte) +#define PTE_MASK PAGE_MASK + +typedef struct { unsigned long pgprot; } pgprot_t; + +#define pmd_val(x) ((x).pmd) +#define pgd_val(x) ((x).pgd) +#define pgprot_val(x) ((x).pgprot) + +#define __pte(x) ((pte_t) { (x) } ) +#define __pmd(x) ((pmd_t) { (x) } ) +#define __pgd(x) ((pgd_t) { (x) } ) +#define __pgprot(x) ((pgprot_t) { (x) } ) + +#endif /* !__ASSEMBLY__ */ + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) + +/* + * This handles the memory map.. We could make this a config + * option, but too many people screw it up, and too few need + * it. + * + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has + * a virtual address space of one gigabyte, which limits the + * amount of physical memory you can use to about 950MB. + * + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G + * and CONFIG_HIGHMEM64G options in the kernel configuration. + */ + + +/* This handles the memory map.. */ + +#ifndef __ASSEMBLY__ + +/* Pure 2^n version of get_order */ +static __inline__ int get_order(unsigned long size) +{ + int order; + + size = (size - 1) >> (PAGE_SHIFT - 1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + + return order; +} + +#endif /* __ASSEMBLY__ */ + +#define __MEMORY_START CONFIG_MEMORY_START +#define __MEMORY_SIZE CONFIG_MEMORY_SIZE + +#ifdef CONFIG_MMU +#define __PAGE_OFFSET (0x80000000) +#else +#define __PAGE_OFFSET (0x00000000) +#endif + +#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) +#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) +#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) + +#ifndef CONFIG_DISCONTIGMEM +#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT) +#define pfn_to_page(pfn) (mem_map + ((pfn) - PFN_BASE)) +#define page_to_pfn(page) \ + ((unsigned long)((page) - mem_map) + PFN_BASE) +#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr) +#endif /* !CONFIG_DISCONTIGMEM */ + +#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) + +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC ) + +#define devmem_is_allowed(x) 1 + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_PAGE_H */ + diff -Nru a/include/asm-m32r/param.h b/include/asm-m32r/param.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/param.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,27 @@ +#ifndef _ASM_M32R_PARAM_H +#define _ASM_M32R_PARAM_H + +/* $Id$ */ + +/* orig : i386 2.5.67 */ + +#ifdef __KERNEL__ +# define HZ 100 /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif /* _ASM_M32R_PARAM_H */ + diff -Nru a/include/asm-m32r/pci.h b/include/asm-m32r/pci.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pci.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,10 @@ +#ifndef _ASM_M32R_PCI_H +#define _ASM_M32R_PCI_H + +/* $Id$ */ + +#include + +#define PCI_DMA_BUS_IS_PHYS (1) + +#endif /* _ASM_M32R_PCI_H */ diff -Nru a/include/asm-m32r/percpu.h b/include/asm-m32r/percpu.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/percpu.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,6 @@ +#ifndef __ARCH_M32R_PERCPU__ +#define __ARCH_M32R_PERCPU__ + +#include + +#endif /* __ARCH_M32R_PERCPU__ */ diff -Nru a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgalloc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,87 @@ +#ifndef _ASM_M32R_PGALLOC_H +#define _ASM_M32R_PGALLOC_H + +/* $Id$ */ + +#include +#include + +#include +#include + +#define pmd_populate_kernel(mm, pmd, pte) \ + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) + +static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, + struct page *pte) +{ + set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); +} + +/* + * Allocate and free page tables. + */ +static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) +{ + pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL); + + if (pgd) + clear_page(pgd); + + return pgd; +} + +static __inline__ void pgd_free(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, + unsigned long address) +{ + pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL); + + if (pte) + clear_page(pte); + + return pte; +} + +static __inline__ struct page *pte_alloc_one(struct mm_struct *mm, + unsigned long address) +{ + struct page *pte = alloc_page(GFP_KERNEL); + + if (pte) + clear_page(page_address(pte)); + + return pte; +} + +static __inline__ void pte_free_kernel(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +static __inline__ void pte_free(struct page *pte) +{ + __free_page(pte); +} + +#define __pte_free_tlb(tlb, pte) pte_free((pte)) + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + * (In the PAE case we free the pmds as part of the pgd.) + */ + +#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) +#define pmd_free(x) do { } while (0) +#define __pmd_free_tlb(tlb, x) do { } while (0) +#define pgd_populate(mm, pmd, pte) BUG() + +#define check_pgt_cache() do { } while (0) + +#endif /* _ASM_M32R_PGALLOC_H */ + diff -Nru a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgtable-2level.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,77 @@ +#ifndef _ASM_M32R_PGTABLE_2LEVEL_H +#define _ASM_M32R_PGTABLE_2LEVEL_H + +/* $Id$ */ + +#include + +/* + * traditional M32R two-level paging structure: + */ + +#define PGDIR_SHIFT 22 +#define PTRS_PER_PGD 1024 + +/* + * the M32R is two-level, so we don't really have any + * PMD directory physically. + */ +#define PMD_SHIFT 22 +#define PTRS_PER_PMD 1 + +#define PTRS_PER_PTE 1024 + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + +/* + * The "pgd_xxx()" functions here are trivial for a folded two-level + * setup: the pgd is never bad, and a pmd always exists (as it's folded + * into the pgd entry) + */ +static __inline__ int pgd_none(pgd_t pgd) { return 0; } +static __inline__ int pgd_bad(pgd_t pgd) { return 0; } +static __inline__ int pgd_present(pgd_t pgd) { return 1; } +#define pgd_clear(xp) do { } while (0) + +/* + * Certain architectures need to do special things when PTEs + * within a page table are directly modified. Thus, the following + * hook is made available. + */ +#define set_pte(pteptr, pteval) (*(pteptr) = pteval) +#define set_pte_atomic(pteptr, pteval) set_pte(pteptr, pteval) +/* + * (pmds are folded into pgds so this doesnt get actually called, + * but the define is needed for a generic inline function.) + */ +#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) +#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) + +#define pgd_page(pgd) \ +((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) + +static __inline__ pmd_t *pmd_offset(pgd_t * dir, unsigned long address) +{ + return (pmd_t *) dir; +} + +#define ptep_get_and_clear(xp) __pte(xchg(&(xp)->pte, 0)) +#define pte_same(a, b) (pte_val(a) == pte_val(b)) +#define pte_page(x) pfn_to_page(pte_pfn(x)) +#define pte_none(x) (!pte_val(x)) +#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) +#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) + +/* M32R_FIXME : PTE_FILE_MAX_BITS, pte_to_pgoff, pgoff_to_pte */ +#define PTE_FILE_MAX_BITS 31 +#define pte_to_pgoff(pte) (pte_val(pte) >> 1) +#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE }) + +#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ + diff -Nru a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgtable.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,422 @@ +#ifndef _ASM_M32R_PGTABLE_H +#define _ASM_M32R_PGTABLE_H + +/* $Id$ */ + +/* + * The Linux memory management assumes a three-level page table setup. On + * the M32R, we use that, but "fold" the mid level into the top-level page + * table, so that we physically have the same two-level page table as the + * M32R mmu expects. + * + * This file contains the functions and defines necessary to modify and use + * the M32R page table tree. + */ + +/* CAUTION!: If you change macro definitions in this file, you might have to + * change arch/m32r/mmu.S manually. + */ + +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include +#include +#include + +extern pgd_t swapper_pg_dir[1024]; +extern void paging_init(void); + +/* + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +extern unsigned long empty_zero_page[1024]; +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + +#endif /* !__ASSEMBLY__ */ + +/* + * The Linux x86 paging architecture is 'compile-time dual-mode', it + * implements both the traditional 2-level x86 page tables and the + * newer 3-level PAE-mode page tables. + */ +#ifndef __ASSEMBLY__ +#include +#endif + +#define pgtable_cache_init() do { } while (0) + +#define PMD_SIZE (1UL << PMD_SHIFT) +#define PMD_MASK (~(PMD_SIZE - 1)) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) +#define PGDIR_MASK (~(PGDIR_SIZE - 1)) + +#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) +#define FIRST_USER_PGD_NR 0 + +#ifndef __ASSEMBLY__ +/* Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_START KSEG2 +#define VMALLOC_END KSEG3 + +/* + * The 4MB page is guessing.. Detailed in the infamous "Chapter H" + * of the Pentium details, but assuming intel did the straightforward + * thing, this bit set in the page directory entry just means that + * the page directory entry points directly to a 4MB-aligned block of + * memory. + */ + +/* + * M32R TLB format + * + * [0] [1:19] [20:23] [24:31] + * +-----------------------+----+-------------+ + * | VPN |0000| ASID | + * +-----------------------+----+-------------+ + * +-+---------------------+----+-+---+-+-+-+-+ + * |0 PPN |0000|N|AC |L|G|V| | + * +-+---------------------+----+-+---+-+-+-+-+ + * RWX + */ + +#define _PAGE_BIT_DIRTY 0 /* software */ +#define _PAGE_BIT_FILE 0 /* when !present: nonlinear file + mapping */ +#define _PAGE_BIT_PRESENT 1 /* Valid */ +#define _PAGE_BIT_GLOBAL 2 /* Global */ +#define _PAGE_BIT_LARGE 3 /* Large */ +#define _PAGE_BIT_EXEC 4 /* Execute */ +#define _PAGE_BIT_WRITE 5 /* Write */ +#define _PAGE_BIT_READ 6 /* Read */ +#define _PAGE_BIT_NONCACHABLE 7 /* Non cachable */ +#define _PAGE_BIT_USER 8 /* software */ +#define _PAGE_BIT_ACCESSED 9 /* software */ + +#define _PAGE_DIRTY \ + (1UL << _PAGE_BIT_DIRTY) /* software : page changed */ +#define _PAGE_FILE \ + (1UL << _PAGE_BIT_FILE) /* when !present: nonlinear file + mapping */ +#define _PAGE_PRESENT \ + (1UL << _PAGE_BIT_PRESENT) /* Valid : Page is Valid */ +#define _PAGE_GLOBAL \ + (1UL << _PAGE_BIT_GLOBAL) /* Global */ +#define _PAGE_LARGE \ + (1UL << _PAGE_BIT_LARGE) /* Large */ +#define _PAGE_EXEC \ + (1UL << _PAGE_BIT_EXEC) /* Execute */ +#define _PAGE_WRITE \ + (1UL << _PAGE_BIT_WRITE) /* Write */ +#define _PAGE_READ \ + (1UL << _PAGE_BIT_READ) /* Read */ +#define _PAGE_NONCACHABLE \ + (1UL<<_PAGE_BIT_NONCACHABLE) /* Non cachable */ +#define _PAGE_USER \ + (1UL << _PAGE_BIT_USER) /* software : user space access + allowed */ +#define _PAGE_ACCESSED \ + (1UL << _PAGE_BIT_ACCESSED) /* software : page referenced */ + +#define _PAGE_TABLE \ + ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED | _PAGE_DIRTY ) +#define _KERNPG_TABLE \ + ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \ + | _PAGE_DIRTY ) +#define _PAGE_CHG_MASK \ + ( PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY ) + +#ifdef CONFIG_MMU +#define PAGE_NONE \ + __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) +#define PAGE_SHARED \ + __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_SHARED_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ \ + | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_COPY \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_COPY_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_READONLY \ + __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_READONLY_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) + +#define __PAGE_KERNEL \ + ( _PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ | _PAGE_DIRTY \ + | _PAGE_ACCESSED ) +#define __PAGE_KERNEL_RO ( __PAGE_KERNEL & ~_PAGE_WRITE ) +#define __PAGE_KERNEL_NOCACHE ( __PAGE_KERNEL | _PAGE_NONCACHABLE) + +#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) + +#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL) +#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO) +#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE) + +#else +#define PAGE_NONE __pgprot(0) +#define PAGE_SHARED __pgprot(0) +#define PAGE_SHARED_X __pgprot(0) +#define PAGE_COPY __pgprot(0) +#define PAGE_COPY_X __pgprot(0) +#define PAGE_READONLY __pgprot(0) +#define PAGE_READONLY_X __pgprot(0) + +#define PAGE_KERNEL __pgprot(0) +#define PAGE_KERNEL_RO __pgprot(0) +#define PAGE_KERNEL_NOCACHE __pgprot(0) +#endif /* CONFIG_MMU */ + +/* + * The i386 can't do page protection for execute, and considers that + * the same are read. Also, write permissions imply read permissions. + * This is the closest we can get.. + */ + /* rwx */ +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY_X +#define __P010 PAGE_COPY_X +#define __P011 PAGE_COPY_X +#define __P100 PAGE_READONLY +#define __P101 PAGE_READONLY_X +#define __P110 PAGE_COPY_X +#define __P111 PAGE_COPY_X + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY_X +#define __S010 PAGE_SHARED +#define __S011 PAGE_SHARED_X +#define __S100 PAGE_READONLY +#define __S101 PAGE_READONLY_X +#define __S110 PAGE_SHARED +#define __S111 PAGE_SHARED_X + +/* page table for 0-4MB for everybody */ + +#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) +#define pte_clear(xp) do { set_pte(xp, __pte(0)); } while (0) + +#define pmd_none(x) (!pmd_val(x)) +#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) +#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) +#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \ + != _KERNPG_TABLE) + +#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +static __inline__ int pte_user(pte_t pte) +{ + return pte_val(pte) & _PAGE_USER; +} + +static __inline__ int pte_read(pte_t pte) +{ + return pte_val(pte) & _PAGE_READ; +} + +static __inline__ int pte_exec(pte_t pte) +{ + return pte_val(pte) & _PAGE_EXEC; +} + +static __inline__ int pte_dirty(pte_t pte) +{ + return pte_val(pte) & _PAGE_DIRTY; +} + +static __inline__ int pte_young(pte_t pte) +{ + return pte_val(pte) & _PAGE_ACCESSED; +} + +static __inline__ int pte_write(pte_t pte) +{ + return pte_val(pte) & _PAGE_WRITE; +} + +/* + * The following only works if pte_present() is not true. + */ +static __inline__ int pte_file(pte_t pte) +{ + return pte_val(pte) & _PAGE_FILE; +} + +static __inline__ pte_t pte_rdprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_READ; + return pte; +} + +static __inline__ pte_t pte_exprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_EXEC; + return pte; +} + +static __inline__ pte_t pte_mkclean(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_DIRTY; + return pte; +} + +static __inline__ pte_t pte_mkold(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_ACCESSED;return pte;} + +static __inline__ pte_t pte_wrprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_WRITE; + return pte; +} + +static __inline__ pte_t pte_mkread(pte_t pte) +{ + pte_val(pte) |= _PAGE_READ; + return pte; +} + +static __inline__ pte_t pte_mkexec(pte_t pte) +{ + pte_val(pte) |= _PAGE_EXEC; + return pte; +} + +static __inline__ pte_t pte_mkdirty(pte_t pte) +{ + pte_val(pte) |= _PAGE_DIRTY; + return pte; +} + +static __inline__ pte_t pte_mkyoung(pte_t pte) +{ + pte_val(pte) |= _PAGE_ACCESSED; + return pte; +} + +static __inline__ pte_t pte_mkwrite(pte_t pte) +{ + pte_val(pte) |= _PAGE_WRITE; + return pte; +} + +static __inline__ int ptep_test_and_clear_dirty(pte_t *ptep) +{ + return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); +} + +static __inline__ int ptep_test_and_clear_young(pte_t *ptep) +{ + return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); +} + +static __inline__ void ptep_set_wrprotect(pte_t *ptep) +{ + clear_bit(_PAGE_BIT_WRITE, ptep); +} + +static __inline__ void ptep_mkdirty(pte_t *ptep) +{ + set_bit(_PAGE_BIT_DIRTY, ptep); +} + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ +#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), pgprot) + +static __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) +{ + set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) \ + | pgprot_val(newprot))); + + return pte; +} + +#define page_pte(page) page_pte_prot(page, __pgprot(0)) + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ + +static __inline__ void pmd_set(pmd_t * pmdp, pte_t * ptep) +{ + pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); +} + +#define pmd_page_kernel(pmd) \ + ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) + +#ifndef CONFIG_DISCONTIGMEM +#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) >> PAGE_SHIFT) - PFN_BASE)) +#endif /* !CONFIG_DISCONTIGMEM */ + +/* to find an entry in a page-table-directory. */ +#define pgd_index(address) \ + (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) + +#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) + +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +#define pmd_index(address) \ + (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) + +#define pte_index(address) \ + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel(dir, address) \ + ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) +#define pte_offset_map(dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) +#define pte_unmap(pte) do { } while (0) +#define pte_unmap_nested(pte) do { } while (0) + +/* Encode and de-code a swap entry */ +#define __swp_type(x) (((x).val >> 1) & 0x3f) +#define __swp_offset(x) ((x).val >> 8) +#define __swp_entry(type, offset) \ + ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) +#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) + +#endif /* !__ASSEMBLY__ */ + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +#define kern_addr_valid(addr) (1) + +#define io_remap_page_range remap_page_range + +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR +#define __HAVE_ARCH_PTEP_SET_WRPROTECT +#define __HAVE_ARCH_PTEP_MKDIRTY +#define __HAVE_ARCH_PTE_SAME +#include + +#endif /* _ASM_M32R_PGTABLE_H */ + diff -Nru a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/poll.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,31 @@ +#ifndef _ASM_M32R_POLL_H +#define _ASM_M32R_POLL_H + +/* + * poll(2) bit definitions. Based on . + * + * Modified 2004 + * Hirokazu Takata + */ + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 + +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 +#define POLLREMOVE 0x1000 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif /* _ASM_M32R_POLL_H */ diff -Nru a/include/asm-m32r/posix_types.h b/include/asm-m32r/posix_types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/posix_types.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,126 @@ +#ifndef _ASM_M32R_POSIX_TYPES_H +#define _ASM_M32R_POSIX_TYPES_H + +/* $Id$ */ + +/* orig : i386, sh 2.4.18 */ + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +typedef unsigned short __kernel_old_dev_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif + +typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) + int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +} __kernel_fsid_t; + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#undef __FD_SET +static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] |= (1UL<<__rem); +} + +#undef __FD_CLR +static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); +} + + +#undef __FD_ISSET +static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; +} + +/* + * This will unroll the loop for the normal constant case (8 ints, + * for a 256-bit fd_set) + */ +#undef __FD_ZERO +static __inline__ void __FD_ZERO(__kernel_fd_set *__p) +{ + unsigned long *__tmp = __p->fds_bits; + int __i; + + if (__builtin_constant_p(__FDSET_LONGS)) { + switch (__FDSET_LONGS) { + case 16: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + __tmp[ 8] = 0; __tmp[ 9] = 0; + __tmp[10] = 0; __tmp[11] = 0; + __tmp[12] = 0; __tmp[13] = 0; + __tmp[14] = 0; __tmp[15] = 0; + return; + + case 8: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + return; + + case 4: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + return; + } + } + __i = __FDSET_LONGS; + while (__i) { + __i--; + *__tmp = 0; + __tmp++; + } +} + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + +#endif /* _ASM_M32R_POSIX_TYPES_H */ diff -Nru a/include/asm-m32r/processor.h b/include/asm-m32r/processor.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/processor.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,157 @@ +#ifndef _ASM_M32R_PROCESSOR_H +#define _ASM_M32R_PROCESSOR_H + +/* $Id$ */ + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + */ + +/* + * include/asm-m32r/processor.h + * + * Copyright (C) 1994 Linus Torvalds + */ +#include +#include +#include +#include /* pt_regs */ + +#include + +/* + * Default implementation of macro that returns current + * instruction pointer ("program counter"). + */ +#define current_text_addr() ({ __label__ _l; _l: &&_l; }) + +/* + * CPU type and hardware bug flags. Kept separately for each CPU. + * Members of this structure are referenced in head.S, so think twice + * before touching them. [mj] + */ + +struct cpuinfo_m32r { + unsigned long pgtable_cache_sz; + unsigned long cpu_clock; + unsigned long bus_clock; + unsigned long timer_divide; + unsigned long loops_per_jiffy; +}; + +/* + * capabilities of CPUs + */ + +extern struct cpuinfo_m32r boot_cpu_data; + +#ifdef CONFIG_SMP +extern struct cpuinfo_m32r cpu_data[]; +#define current_cpu_data cpu_data[smp_processor_id()] +#else +#define cpu_data &boot_cpu_data +#define current_cpu_data boot_cpu_data +#endif + +/* + * User space process size: 2GB (default). + */ +#ifdef CONFIG_MMU +#define TASK_SIZE (0x80000000UL) +#else +#define TASK_SIZE (0x00400000UL) +#endif + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) + +typedef struct { + unsigned long seg; +} mm_segment_t; + +struct debug_trap { + int nr_trap; + unsigned long addr; + unsigned long insn; +}; + +struct thread_struct { + unsigned long address; + unsigned long trap_no; /* Trap number */ + unsigned long error_code; /* Error code of trap */ + unsigned long lr; /* saved pc */ + unsigned long sp; /* user stack pointer */ + struct debug_trap debug_trap; +}; + +#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) + +#define INIT_THREAD { \ + .sp = INIT_SP, \ +} + +/* + * Do necessary setup to start up a newly executed thread. + */ + +/* User process Backup PSW */ +#define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM) + +#define start_thread(regs, new_pc, new_spu) \ + do { \ + set_fs(USER_DS); \ + regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \ + regs->bpc = new_pc; \ + regs->spu = new_spu; \ + } while (0) + +/* Forward declaration, a strange C thing */ +struct task_struct; +struct mm_struct; + +/* Free all resources held by a thread. */ +extern void release_thread(struct task_struct *); + +#define prepare_to_copy(tsk) do { } while (0) + +/* + * create a kernel thread without removing it from tasklists + */ +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); + +/* Copy and release all segment info associated with a VM */ +extern void copy_segments(struct task_struct *p, struct mm_struct * mm); +extern void release_segments(struct mm_struct * mm); + +extern unsigned long thread_saved_pc(struct task_struct *); + +/* Copy and release all segment info associated with a VM */ +#define copy_segments(p, mm) do { } while (0) +#define release_segments(mm) do { } while (0) + +unsigned long get_wchan(struct task_struct *p); +#define KSTK_EIP(tsk) ((tsk)->thread.lr) +#define KSTK_ESP(tsk) ((tsk)->thread.sp) + +#define THREAD_SIZE (2*PAGE_SIZE) + +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +static __inline__ void rep_nop(void) +{ + __asm__ __volatile__( + "nop \n\t" + "nop \n\t" + : + : + : "memory"); +} + +#define cpu_relax() rep_nop() + +#endif /* _ASM_M32R_PROCESSOR_H */ diff -Nru a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ptrace.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,165 @@ +#ifndef _ASM_M32R_PTRACE_H +#define _ASM_M32R_PTRACE_H + +/* + * linux/include/asm-m32r/ptrace.h + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * M32R version: + * Copyright (C) 2001-2002, 2004 Hirokazu Takata + */ + +#include +#include /* M32R_PSW_BSM, M32R_PSW_BPM */ + +/* 0 - 13 are integer registers (general purpose registers). */ +#define PT_R4 0 +#define PT_R5 1 +#define PT_R6 2 +#define PT_REGS 3 +#define PT_R0 4 +#define PT_R1 5 +#define PT_R2 6 +#define PT_R3 7 +#define PT_R7 8 +#define PT_R8 9 +#define PT_R9 10 +#define PT_R10 11 +#define PT_R11 12 +#define PT_R12 13 +#define PT_SYSCNR 14 +#define PT_R13 PT_FP +#define PT_R14 PT_LR +#define PT_R15 PT_SP + +/* processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) +#define PT_ACC0H 15 +#define PT_ACC0L 16 +#define PT_ACC1H 17 +#define PT_ACC1L 18 +#define PT_ACCH PT_ACC0H +#define PT_ACCL PT_ACC0L +#define PT_PSW 19 +#define PT_BPC 20 +#define PT_BBPSW 21 +#define PT_BBPC 22 +#define PT_SPU 23 +#define PT_FP 24 +#define PT_LR 25 +#define PT_SPI 26 +#define PT_ORIGR0 27 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define PT_ACCH 15 +#define PT_ACCL 16 +#define PT_PSW 17 +#define PT_BPC 18 +#define PT_BBPSW 19 +#define PT_BBPC 20 +#define PT_SPU 21 +#define PT_FP 22 +#define PT_LR 23 +#define PT_SPI 24 +#define PT_ORIGR0 25 +#else +#error unknown isa conifiguration +#endif + +/* virtual pt_reg entry for gdb */ +#define PT_PC 30 +#define PT_CBR 31 +#define PT_EVB 32 + + +/* Control registers. */ +#define SPR_CR0 PT_PSW +#define SPR_CR1 PT_CBR /* read only */ +#define SPR_CR2 PT_SPI +#define SPR_CR3 PT_SPU +#define SPR_CR4 +#define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */ +#define SPR_CR6 PT_BPC +#define SPR_CR7 +#define SPR_CR8 PT_BBPSW +#define SPR_CR9 +#define SPR_CR10 +#define SPR_CR11 +#define SPR_CR12 +#define SPR_CR13 PT_WR +#define SPR_CR14 PT_BBPC +#define SPR_CR15 + +/* this struct defines the way the registers are stored on the + stack during a system call. */ +struct pt_regs { + /* Saved main processor registers. */ + unsigned long r4; + unsigned long r5; + unsigned long r6; + struct pt_regs *pt_regs; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + long syscall_nr; + + /* Saved main processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + unsigned long acc0h; + unsigned long acc0l; + unsigned long acc1h; + unsigned long acc1l; +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + unsigned long acch; + unsigned long accl; +#else +#error unknown isa configuration +#endif + unsigned long psw; + unsigned long bpc; /* saved PC for TRAP syscalls */ + unsigned long bbpsw; + unsigned long bbpc; + unsigned long spu; /* saved user stack */ + unsigned long fp; + unsigned long lr; /* saved PC for JL syscalls */ + unsigned long spi; /* saved kernel stack */ + unsigned long orig_r0; +}; + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 + +#define PTRACE_OLDSETOPTIONS 21 + +/* options set using PTRACE_SETOPTIONS */ +#define PTRACE_O_TRACESYSGOOD 0x00000001 + +#ifdef __KERNEL__ +#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) +#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) +#elif defined(CONFIG_ISA_M32R) +#define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0) +#else +#error unknown isa configuration +#endif + +#define instruction_pointer(regs) ((regs)->bpc) +#define profile_pc(regs) instruction_pointer(regs) + +extern void show_regs(struct pt_regs *); + +extern void withdraw_debug_trap(struct pt_regs *regs); + +#endif /* __KERNEL */ + +#endif /* _ASM_M32R_PTRACE_H */ diff -Nru a/include/asm-m32r/resource.h b/include/asm-m32r/resource.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/resource.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,55 @@ +#ifndef _ASM_M32R_RESOURCE_H +#define _ASM_M32R_RESOURCE_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * Resource limits + */ + +#define RLIMIT_CPU 0 /* CPU time in ms */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ +#define RLIMIT_RSS 5 /* max resident set size */ +#define RLIMIT_NPROC 6 /* max number of processes */ +#define RLIMIT_NOFILE 7 /* max number of open files */ +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#define RLIMIT_AS 9 /* address space limit */ +#define RLIMIT_LOCKS 10 /* maximum file locks held */ +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */ +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ + +#define RLIM_NLIMITS 13 + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + +#ifdef __KERNEL__ + +#define INIT_RLIMITS \ +{ \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { _STK_LIM, RLIM_INFINITY }, \ + { 0, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { 0, 0 }, \ + { INR_OPEN, INR_OPEN }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { MAX_SIGPENDING, MAX_SIGPENDING }, \ + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \ +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_RESOURCE_H */ diff -Nru a/include/asm-m32r/rtc.h b/include/asm-m32r/rtc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/rtc.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,70 @@ +/* $Id: rtc.h,v 1.1.1.1 2004/03/25 04:29:22 hitoshiy Exp $ */ + +#ifndef __RTC_H__ +#define __RTC_H__ + + +#include + + /* Dallas DS1302 clock/calendar register numbers. */ +# define RTC_SECONDS 0 +# define RTC_MINUTES 1 +# define RTC_HOURS 2 +# define RTC_DAY_OF_MONTH 3 +# define RTC_MONTH 4 +# define RTC_WEEKDAY 5 +# define RTC_YEAR 6 +# define RTC_CONTROL 7 + + /* Bits in CONTROL register. */ +# define RTC_CONTROL_WRITEPROTECT 0x80 +# define RTC_TRICKLECHARGER 8 + + /* Bits in TRICKLECHARGER register TCS TCS TCS TCS DS DS RS RS. */ +# define RTC_TCR_PATTERN 0xA0 /* 1010xxxx */ +# define RTC_TCR_1DIOD 0x04 /* xxxx01xx */ +# define RTC_TCR_2DIOD 0x08 /* xxxx10xx */ +# define RTC_TCR_DISABLED 0x00 /* xxxxxx00 Disabled */ +# define RTC_TCR_2KOHM 0x01 /* xxxxxx01 2KOhm */ +# define RTC_TCR_4KOHM 0x02 /* xxxxxx10 4kOhm */ +# define RTC_TCR_8KOHM 0x03 /* xxxxxx11 8kOhm */ + +#ifdef CONFIG_M32700UT_DS1302 +extern unsigned char ds1302_readreg(int reg); +extern void ds1302_writereg(int reg, unsigned char val); +extern int ds1302_init(void); +# define CMOS_READ(x) ds1302_readreg(x) +# define CMOS_WRITE(val,reg) ds1302_writereg(reg,val) +# define RTC_INIT() ds1302_init() +#else + /* No RTC configured so we shouldn't try to access any. */ +# define CMOS_READ(x) 42 +# define CMOS_WRITE(x,y) +# define RTC_INIT() (-1) +#endif + +/* + * The struct used to pass data via the following ioctl. Similar to the + * struct tm in , but it needs to be here so that the kernel + * source is self contained, allowing cross-compiles, etc. etc. + */ +struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +/* ioctl() calls that are permitted to the /dev/rtc interface. */ +#define RTC_MAGIC 'p' +#define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time) /* Read RTC time. */ +#define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time) /* Set RTC time. */ +#define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int) +#define RTC_MAX_IOCTL 0x0b + +#endif /* __RTC_H__ */ diff -Nru a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/scatterlist.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,18 @@ +#ifndef _ASM_M32R_SCATTERLIST_H +#define _ASM_M32R_SCATTERLIST_H + +/* $Id$ */ + +struct scatterlist { + char * address; /* Location data is to be transferred to, NULL for + * highmem page */ + struct page * page; /* Location for highmem page, if any */ + unsigned int offset;/* for highmem, page offset */ + + dma_addr_t dma_address; + unsigned int length; +}; + +#define ISA_DMA_THRESHOLD (0x1fffffff) + +#endif /* _ASM_M32R_SCATTERLIST_H */ diff -Nru a/include/asm-m32r/sections.h b/include/asm-m32r/sections.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sections.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,8 @@ +#ifndef _M32R_SECTIONS_H +#define _M32R_SECTIONS_H + +/* nothing to see, move along */ +#include + +#endif /* _M32R_SECTIONS_H */ + diff -Nru a/include/asm-m32r/segment.h b/include/asm-m32r/segment.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/segment.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_SEGMENT_H +#define _ASM_M32R_SEGMENT_H + +/* $Id$ */ + +/* orig : i386 (2.4.18) */ + +#define __KERNEL_CS 0x10 +#define __KERNEL_DS 0x18 + +#define __USER_CS 0x23 +#define __USER_DS 0x2B + +#endif /* _ASM_M32R_SEGMENT_H */ diff -Nru a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/semaphore.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,266 @@ +#ifndef _ASM_M32R_SEMAPHORE_H +#define _ASM_M32R_SEMAPHORE_H + +/* $Id$ */ + +#include + +#ifdef __KERNEL__ + +/* + * SMP- and interrupt-safe semaphores.. + * + * (C) Copyright 1996 Linus Torvalds + * + * Modified 1996-12-23 by Dave Grothe to fix bugs in + * the original code and to make semaphore waits + * interruptible so that processes waiting on + * semaphores can be killed. + * Modified 1999-02-14 by Andrea Arcangeli, split the sched.c helper + * functions in asm/sempahore-helper.h while fixing a + * potential and subtle race discovered by Ulrich Schmid + * in down_interruptible(). Since I started to play here I + * also implemented the `trylock' semaphore operation. + * 1999-07-02 Artur Skawina + * Optimized "0(ecx)" -> "(ecx)" (the assembler does not + * do this). Changed calling sequences from push/jmp to + * traditional call/ret. + * Modified 2001-01-01 Andreas Franck + * Some hacks to ensure compatibility with recent + * GCC snapshots, to avoid stack corruption when compiling + * with -fomit-frame-pointer. It's not sure if this will + * be fixed in GCC, as our previous implementation was a + * bit dubious. + * + * If you would like to see an analysis of this implementation, please + * ftp to gcom.com and download the file + * /pub/linux/src/semaphore/semaphore-2.0.24.tar.gz. + * + */ + +#include +#include +#include +#include +#include + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +struct semaphore { + atomic_t count; + int sleepers; + wait_queue_head_t wait; +#ifdef WAITQUEUE_DEBUG + long __magic; +#endif +}; + +#ifdef WAITQUEUE_DEBUG +# define __SEM_DEBUG_INIT(name) \ + , (int)&(name).__magic +#else +# define __SEM_DEBUG_INIT(name) +#endif + +#define __SEMAPHORE_INITIALIZER(name,count) \ +{ ATOMIC_INIT(count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ + __SEM_DEBUG_INIT(name) } + +#define __MUTEX_INITIALIZER(name) \ + __SEMAPHORE_INITIALIZER(name,1) + +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ + struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) + +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) + +static __inline__ void sema_init (struct semaphore *sem, int val) +{ +/* + * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); + * + * i'd rather use the more flexible initialization above, but sadly + * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. + */ + atomic_set(&sem->count, val); + sem->sleepers = 0; + init_waitqueue_head(&sem->wait); +#ifdef WAITQUEUE_DEBUG + sem->__magic = (int)&sem->__magic; +#endif +} + +static __inline__ void init_MUTEX (struct semaphore *sem) +{ + sema_init(sem, 1); +} + +static __inline__ void init_MUTEX_LOCKED (struct semaphore *sem) +{ + sema_init(sem, 0); +} + +asmlinkage void __down_failed(void /* special register calling convention */); +asmlinkage int __down_failed_interruptible(void /* params in registers */); +asmlinkage int __down_failed_trylock(void /* params in registers */); +asmlinkage void __up_wakeup(void /* special register calling convention */); + +asmlinkage void __down(struct semaphore * sem); +asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); +asmlinkage void __up(struct semaphore * sem); + +/* + * This is ugly, but we want the default case to fall through. + * "__down_failed" is a special asm handler that calls the C + * routine that actually waits. See arch/i386/kernel/semaphore.c + */ +static __inline__ void down(struct semaphore * sem) +{ + unsigned long flags; + int temp; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + __down(sem); +} + +/* + * Interruptible try to acquire a semaphore. If we obtained + * it, return zero. If we were interrupted, returns -EINTR + */ +static __inline__ int down_interruptible(struct semaphore * sem) +{ + unsigned long flags; + int temp; + int result = 0; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down_interruptible \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + result = __down_interruptible(sem); + + return result; +} + +/* + * Non-blockingly attempt to down() a semaphore. + * Returns zero if we acquired it + */ +static __inline__ int down_trylock(struct semaphore * sem) +{ + unsigned long flags; + int temp; + int result = 0; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down_trylock \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + result = __down_trylock(sem); + + return result; +} + +/* + * Note! This is subtle. We jump to wake people up only if + * the semaphore was negative (== somebody was waiting on it). + * The default case (no contention) will result in NO + * jumps for both down() and up(). + */ +static __inline__ void up(struct semaphore * sem) +{ + unsigned long flags; + int temp; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# up \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp <= 0) + __up(sem); +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_SEMAPHORE_H */ + diff -Nru a/include/asm-m32r/sembuf.h b/include/asm-m32r/sembuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sembuf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,29 @@ +#ifndef _ASM_M32R_SEMBUF_H +#define _ASM_M32R_SEMBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The semid64_ds structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + unsigned long __unused1; + __kernel_time_t sem_ctime; /* last change time */ + unsigned long __unused2; + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _ASM_M32R_SEMBUF_H */ diff -Nru a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/serial.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,151 @@ +#ifndef _ASM_M32R_SERIAL_H +#define _ASM_M32R_SERIAL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * include/asm-m32r/serial.h + */ + +#include +#include + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD ( 1843200 / 16 ) + +/* Standard COM flags (except for COM4, because of the 8514 problem) */ +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +#endif + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define FOURPORT_FLAGS ASYNC_FOURPORT +#define ACCENT_FLAGS 0 +#define BOCA_FLAGS 0 +#define HUB6_FLAGS 0 +#define RS_TABLE_SIZE 64 +#else +#define RS_TABLE_SIZE +#endif + +#define MCA_COM_FLAGS (STD_COM_FLAGS|ASYNC_BOOT_ONLYMCA) + +/* + * The following define the access methods for the HUB6 card. All + * access is through two ports for all 24 possible chips. The card is + * selected through the high 2 bits, the port on that card with the + * "middle" 3 bits, and the register on that port with the bottom + * 3 bits. + * + * While the access port and interrupt is configurable, the default + * port locations are 0x302 for the port control register, and 0x303 + * for the data read/write register. Normally, the interrupt is at irq3 + * but can be anything from 3 to 7 inclusive. Note that using 3 will + * require disabling com2. + */ + +#define C_P(card,port) (((card)<<6|(port)<<3) + 1) + +#define STD_SERIAL_PORT_DEFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ + + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define EXTRA_SERIAL_PORT_DEFNS \ + { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ + { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ + { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ + { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ + { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ + { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ + { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ + { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ + { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ + { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ + { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ + { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ + { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ + { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ + { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ + { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ + { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ +#else +#define EXTRA_SERIAL_PORT_DEFNS +#endif + +/* You can have up to four HUB6's in the system, but I've only + * included two cards here for a total of twelve ports. + */ +#if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) +#define HUB6_SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ +#else +#define HUB6_SERIAL_PORT_DFNS +#endif + +#ifdef CONFIG_MCA +#define MCA_SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x3220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x3228, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x4220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x4228, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x5220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x5228, 3, MCA_COM_FLAGS }, +#else +#define MCA_SERIAL_PORT_DFNS +#endif + +#ifndef CONFIG_PLAT_USRV +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS \ + EXTRA_SERIAL_PORT_DEFNS \ + HUB6_SERIAL_PORT_DFNS \ + MCA_SERIAL_PORT_DFNS + +#else /* CONFIG_PLAT_USRV */ + +#define SERIAL_PORT_DFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, PLD_IRQ_UART0, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, PLD_IRQ_UART1, STD_COM_FLAGS }, /* ttyS1 */ +#endif /* CONFIG_PLAT_USRV */ + +#endif /* _ASM_M32R_SERIAL_H */ diff -Nru a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/setup.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,33 @@ +/* + * This is set up by the setup-routine at boot-time + */ +#define PARAM ((unsigned char *)empty_zero_page) + +#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) +#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) +#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) +#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) +#define INITRD_START (*(unsigned long *) (PARAM+0x010)) +#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) + +#define M32R_CPUCLK (*(unsigned long *) (PARAM+0x018)) +#define M32R_BUSCLK (*(unsigned long *) (PARAM+0x01c)) +#define M32R_TIMER_DIVIDE (*(unsigned long *) (PARAM+0x020)) + +#define COMMAND_LINE ((char *) (PARAM+0x100)) + +#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200)) + +#define COMMAND_LINE_SIZE (512) + +#define RAMDISK_IMAGE_START_MASK (0x07FF) +#define RAMDISK_PROMPT_FLAG (0x8000) +#define RAMDISK_LOAD_FLAG (0x4000) + +#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) +#define PFN_PHYS(x) ((x) << PAGE_SHIFT) + +extern unsigned long memory_start; +extern unsigned long memory_end; + diff -Nru a/include/asm-m32r/shmbuf.h b/include/asm-m32r/shmbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/shmbuf.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,46 @@ +#ifndef _ASM_M32R_SHMBUF_H +#define _ASM_M32R_SHMBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The shmid64_ds structure for M32R architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + unsigned long __unused1; + __kernel_time_t shm_dtime; /* last detach time */ + unsigned long __unused2; + __kernel_time_t shm_ctime; /* last change time */ + unsigned long __unused3; + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused4; + unsigned long __unused5; +}; + +struct shminfo64 { + unsigned long shmmax; + unsigned long shmmin; + unsigned long shmmni; + unsigned long shmseg; + unsigned long shmall; + unsigned long __unused1; + unsigned long __unused2; + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _ASM_M32R_SHMBUF_H */ diff -Nru a/include/asm-m32r/shmparam.h b/include/asm-m32r/shmparam.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/shmparam.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,8 @@ +#ifndef _ASM_M32R_SHMPARAM_H +#define _ASM_M32R_SHMPARAM_H + +/* $Id$ */ + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASM_M32R_SHMPARAM_H */ diff -Nru a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sigcontext.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,50 @@ +#ifndef _ASM_M32R_SIGCONTEXT_H +#define _ASM_M32R_SIGCONTEXT_H + +/* $Id$ */ + +#include + +struct sigcontext { + /* CPU registers */ + /* Saved main processor registers. */ + unsigned long sc_r4; + unsigned long sc_r5; + unsigned long sc_r6; + struct pt_regs *sc_pt_regs; + unsigned long sc_r0; + unsigned long sc_r1; + unsigned long sc_r2; + unsigned long sc_r3; + unsigned long sc_r7; + unsigned long sc_r8; + unsigned long sc_r9; + unsigned long sc_r10; + unsigned long sc_r11; + unsigned long sc_r12; + + /* Saved main processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + unsigned long sc_acc0h; + unsigned long sc_acc0l; + unsigned long sc_acc1h; + unsigned long sc_acc1l; +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + unsigned long sc_acch; + unsigned long sc_accl; +#else +#error unknown isa configuration +#endif + unsigned long sc_psw; + unsigned long sc_bpc; /* saved PC for TRAP syscalls */ + unsigned long sc_bbpsw; + unsigned long sc_bbpc; + unsigned long sc_spu; /* saved user stack */ + unsigned long sc_fp; + unsigned long sc_lr; /* saved PC for JL syscalls */ + unsigned long sc_spi; /* saved kernel stack */ + + unsigned long oldmask; +}; + +#endif /* _ASM_M32R_SIGCONTEXT_H */ diff -Nru a/include/asm-m32r/siginfo.h b/include/asm-m32r/siginfo.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/siginfo.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,8 @@ +#ifndef _M32R_SIGINFO_H +#define _M32R_SIGINFO_H + +/* $Id$ */ + +#include + +#endif /* _M32R_SIGINFO_H */ diff -Nru a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/signal.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,200 @@ +#ifndef _ASM_M32R_SIGNAL_H +#define _ASM_M32R_SIGNAL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +#include +#include +#include +#include + +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ +/* Most things should be clean enough to redefine this at will, if care + is taken to make libc match. */ + +#define _NSIG 64 +#define _NSIG_BPW 32 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG + +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001u +#define SA_NOCLDWAIT 0x00000002u +#define SA_SIGINFO 0x00000004u +#define SA_ONSTACK 0x08000000u +#define SA_RESTART 0x10000000u +#define SA_NODEFER 0x40000000u +#define SA_RESETHAND 0x80000000u + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ + +#define SA_RESTORER 0x04000000 + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#ifdef __KERNEL__ + +/* + * These values of sa_flags are used only by the kernel as part of the + * irq handling routines. + * + * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. + */ +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x04000000 +#endif + +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ + +#ifdef __KERNEL__ +struct old_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + unsigned long sa_flags; + __sigrestore_t sa_restorer; +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + __sigrestore_t sa_restorer; + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ +#include + +#undef __HAVE_ARCH_SIG_BITOPS + +struct pt_regs; +extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); + +#define ptrace_signal_deliver(regs, cookie) do { } while (0) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_SIGNAL_H */ diff -Nru a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/smp.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,119 @@ +#ifndef _ASM_M32R_SMP_H +#define _ASM_M32R_SMP_H + +/* $Id$ */ + +#include + +#ifdef CONFIG_SMP +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include + +#define PHYSID_ARRAY_SIZE 1 + +struct physid_mask +{ + unsigned long mask[PHYSID_ARRAY_SIZE]; +}; + +typedef struct physid_mask physid_mask_t; + +#define physid_set(physid, map) set_bit(physid, (map).mask) +#define physid_clear(physid, map) clear_bit(physid, (map).mask) +#define physid_isset(physid, map) test_bit(physid, (map).mask) +#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask) + +#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) +#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) +#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS) +#define physids_complement(dst, src) bitmap_complement((dst).mask,(src).mask, MAX_APICS) +#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) +#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) +#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS) +#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS) +#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS) +#define physids_coerce(map) ((map).mask[0]) + +#define physids_promote(physids) \ + ({ \ + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ + __physid_mask.mask[0] = physids; \ + __physid_mask; \ + }) + +#define physid_mask_of_physid(physid) \ + ({ \ + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ + physid_set(physid, __physid_mask); \ + __physid_mask; \ + }) + +#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} } +#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} } + +extern physid_mask_t phys_cpu_present_map; + +/* + * Some lowlevel functions might want to know about + * the real CPU ID <-> CPU # mapping. + */ +extern volatile int physid_2_cpu[NR_CPUS]; +extern volatile int cpu_2_physid[NR_CPUS]; +#define physid_to_cpu(physid) physid_2_cpu[physid] +#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] + +#define smp_processor_id() (current_thread_info()->cpu) + +extern cpumask_t cpu_callout_map; +#define cpu_possible_map cpu_callout_map + +static __inline__ int hard_smp_processor_id(void) +{ + return (int)*(volatile long *)M32R_CPUID_PORTL; +} + +static __inline__ int cpu_logical_map(int cpu) +{ + return cpu; +} + +static __inline__ int cpu_number_map(int cpu) +{ + return cpu; +} + +static __inline__ unsigned int num_booting_cpus(void) +{ + return cpus_weight(cpu_callout_map); +} + +extern void smp_send_timer(void); +extern void calibrate_delay(void); +extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); + +#endif /* not __ASSEMBLY__ */ + +#define NO_PROC_ID (0xff) /* No processor magic marker */ + +#define PROC_CHANGE_PENALTY (15) /* Schedule penalty */ + +/* + * M32R-mp IPI + */ +#define RESCHEDULE_IPI (M32R_IRQ_IPI0-M32R_IRQ_IPI0) +#define INVALIDATE_TLB_IPI (M32R_IRQ_IPI1-M32R_IRQ_IPI0) +#define CALL_FUNCTION_IPI (M32R_IRQ_IPI2-M32R_IRQ_IPI0) +#define LOCAL_TIMER_IPI (M32R_IRQ_IPI3-M32R_IRQ_IPI0) +#define INVALIDATE_CACHE_IPI (M32R_IRQ_IPI4-M32R_IRQ_IPI0) +#define CPU_BOOT_IPI (M32R_IRQ_IPI5-M32R_IRQ_IPI0) + +#define IPI_SHIFT (0) +#define NR_IPIS (8) + +#endif /* CONFIG_SMP */ + +#endif /* _ASM_M32R_SMP_H */ diff -Nru a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/socket.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,70 @@ +#ifndef _ASM_M32R_SOCKET_H +#define _ASM_M32R_SOCKET_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +#include + +/* For setsockoptions(2) */ +#define SOL_SOCKET 1 + +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +/* To add :#define SO_REUSEPORT 15 */ +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 + +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +/* Socket filtering */ +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 + +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP SO_TIMESTAMP + +#define SO_ACCEPTCONN 30 + +#define SO_PEERSEC 31 + +/* Nasty libc5 fixup - bletch */ +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ +#define SOCK_MAX (SOCK_PACKET+1) +#endif + +#endif /* _ASM_M32R_SOCKET_H */ diff -Nru a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sockios.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_SOCKIOS_H +#define _ASM_M32R_SOCKIOS_H + +/* $Id$ */ + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 /* Get stamp */ + +#endif /* _ASM_M32R_SOCKIOS_H */ diff -Nru a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/spinlock.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,371 @@ +#ifndef _ASM_M32R_SPINLOCK_H +#define _ASM_M32R_SPINLOCK_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/spinlock.h + * orig : i386 2.4.10 + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + */ + +#include /* CONFIG_DEBUG_SPINLOCK, CONFIG_SMP */ +#include +#include +#include + +extern int printk(const char * fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +/* It seems that people are forgetting to + * initialize their spinlocks properly, tsk tsk. + * Remember to turn this off in 2.4. -ben + */ +#if defined(CONFIG_DEBUG_SPINLOCK) +#define SPINLOCK_DEBUG 1 +#else +#define SPINLOCK_DEBUG 0 +#endif + +/* + * Your basic SMP spinlocks, allowing only a single CPU anywhere + */ + +typedef struct { + volatile int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif +} spinlock_t; + +#define SPINLOCK_MAGIC 0xdead4ead + +#if SPINLOCK_DEBUG +#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC +#else +#define SPINLOCK_MAGIC_INIT /* */ +#endif + +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } + +#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) + +/* + * Simple spin lock operations. There are two variants, one clears IRQ's + * on the local processor, one does not. + * + * We make no fairness assumptions. They have a cost. + */ + +#define spin_is_locked(x) (*(volatile int *)(&(x)->lock) <= 0) +#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) +#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) + +/* + * This works. Despite all the confusion. + */ + +/*======================================================================* + * Try spin lock + *======================================================================* + * Argument: + * arg0: lock + * Return value: + * =1: Success + * =0: Failure + *======================================================================*/ +static __inline__ int _raw_spin_trylock(spinlock_t *lock) +{ + int oldval; + + /* + * lock->lock : =1 : unlock + * : <=0 : lock + * { + * oldval = lock->lock; <--+ need atomic operation + * lock->lock = 0; <--+ + * } + */ + __asm__ __volatile__ ( + "# spin_trylock \n\t" + "ldi r4, #0; \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("%0", "r6", "%1") + "lock %0, @%1; \n\t" + "unlock r4, @%1; \n\t" + "mvtc r5, psw; \n\t" + : "=&r" (oldval) + : "r" (&lock->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + + return (oldval > 0); +} + +static __inline__ void _raw_spin_lock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + __label__ here; +here: + if (lock->magic != SPINLOCK_MAGIC) { + printk("eip: %p\n", &&here); + BUG(); + } +#endif + /* + * lock->lock : =1 : unlock + * : <=0 : lock + * + * for ( ; ; ) { + * lock->lock -= 1; <-- need atomic operation + * if (lock->lock == 0) break; + * for ( ; lock->lock <= 0 ; ); + * } + */ + __asm__ __volatile__ ( + "# spin_lock \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #-1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + "bltz r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "ld r4, @%0; \n\t" + "bgtz r4, 1b; \n\t" + "bra 2b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&lock->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_spin_unlock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + BUG_ON(lock->magic != SPINLOCK_MAGIC); + BUG_ON(!spin_is_locked(lock)); +#endif + mb(); + lock->lock = 1; +} + +/* + * Read-write spinlocks, allowing multiple readers + * but only one writer. + * + * NOTE! it is quite common to have readers in interrupts + * but no interrupt writers. For those circumstances we + * can "mix" irq-safe locks - any writer needs to get a + * irq-safe write-lock, but readers can get non-irqsafe + * read-locks. + */ +typedef struct { + volatile int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif +} rwlock_t; + +#define RWLOCK_MAGIC 0xdeaf1eed + +#if SPINLOCK_DEBUG +#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC +#else +#define RWLOCK_MAGIC_INIT /* */ +#endif + +#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } + +#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) + +#define rwlock_is_locked(x) ((x)->lock != RW_LOCK_BIAS) + +/* + * On x86, we implement read-write locks as a 32-bit counter + * with the high bit (sign) being the "contended" bit. + * + * The inline assembly is non-obvious. Think about it. + * + * Changed to use the same technique as rw semaphores. See + * semaphore.h for details. -ben + */ +/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ + +static __inline__ void _raw_read_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + BUG_ON(rw->magic != RWLOCK_MAGIC); +#endif + /* + * rw->lock : >0 : unlock + * : <=0 : lock + * + * for ( ; ; ) { + * rw->lock -= 1; <-- need atomic operation + * if (rw->lock >= 0) break; + * rw->lock += 1; <-- need atomic operation + * for ( ; rw->lock <= 0 ; ); + * } + */ + __asm__ __volatile__ ( + "# read_lock \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #-1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + "bltz r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + ".fillinsn \n" + "3: \n\t" + "ld r4, @%0; \n\t" + "bgtz r4, 1b; \n\t" + "bra 3b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_write_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + BUG_ON(rw->magic != RWLOCK_MAGIC); +#endif + /* + * rw->lock : =RW_LOCK_BIAS_STR : unlock + * : !=RW_LOCK_BIAS_STR : lock + * + * for ( ; ; ) { + * rw->lock -= RW_LOCK_BIAS_STR; <-- need atomic operation + * if (rw->lock == 0) break; + * rw->lock += RW_LOCK_BIAS_STR; <-- need atomic operation + * for ( ; rw->lock != RW_LOCK_BIAS_STR ; ) ; + * } + */ + __asm__ __volatile__ ( + "# write_lock \n\t" + "seth r5, #high(" RW_LOCK_BIAS_STR "); \n\t" + "or3 r5, r5, #low(" RW_LOCK_BIAS_STR "); \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r6, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "sub r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + "bnez r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "add r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + ".fillinsn \n" + "3: \n\t" + "ld r4, @%0; \n\t" + "beq r4, r5, 1b; \n\t" + "bra 3b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5", "r6" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r7" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_read_unlock(rwlock_t *rw) +{ + __asm__ __volatile__ ( + "# read_unlock \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_write_unlock(rwlock_t *rw) +{ + __asm__ __volatile__ ( + "# write_unlock \n\t" + "seth r5, #high(" RW_LOCK_BIAS_STR "); \n\t" + "or3 r5, r5, #low(" RW_LOCK_BIAS_STR "); \n\t" + "mvfc r6, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "add r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5", "r6" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r7" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ int _raw_write_trylock(rwlock_t *lock) +{ + atomic_t *count = (atomic_t *)lock; + if (atomic_sub_and_test(RW_LOCK_BIAS, count)) + return 1; + atomic_add(RW_LOCK_BIAS, count); + return 0; +} + +#endif /* _ASM_M32R_SPINLOCK_H */ diff -Nru a/include/asm-m32r/stat.h b/include/asm-m32r/stat.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/stat.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,91 @@ +#ifndef _ASM_M32R_STAT_H +#define _ASM_M32R_STAT_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +#include + +struct __old_kernel_stat { + unsigned short st_dev; + unsigned short st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned long st_size; + unsigned long st_atime; + unsigned long st_mtime; + unsigned long st_ctime; +}; + +#define STAT_HAVE_NSEC 1 + +struct stat { + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + unsigned long st_atime; + unsigned long st_atime_nsec; + unsigned long st_mtime; + unsigned long st_mtime_nsec; + unsigned long st_ctime; + unsigned long st_ctime_nsec; + unsigned long __unused4; + unsigned long __unused5; +}; + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat64 { + unsigned long long st_dev; + unsigned char __pad0[4]; +#define STAT64_HAS_BROKEN_ST_INO + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + +#if defined(__BIG_ENDIAN) + unsigned long __pad4; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ +#elif defined(__LITTLE_ENDIAN) + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ +#else +#error no endian defined +#endif + unsigned long st_atime; + unsigned long st_atime_nsec; + + unsigned long st_mtime; + unsigned long st_mtime_nsec; + + unsigned long st_ctime; + unsigned long st_ctime_nsec; + + unsigned long long st_ino; +}; + +#endif /* _ASM_M32R_STAT_H */ diff -Nru a/include/asm-m32r/statfs.h b/include/asm-m32r/statfs.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/statfs.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,6 @@ +#ifndef _ASM_M32R_STATFS_H +#define _ASM_M32R_STATFS_H + +#include + +#endif /* _ASM_M32R_STATFS_H */ diff -Nru a/include/asm-m32r/string.h b/include/asm-m32r/string.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/string.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,15 @@ +#ifndef _ASM_M32R_STRING_H +#define _ASM_M32R_STRING_H + +/* $Id$ */ + +#define __HAVE_ARCH_STRLEN +extern size_t strlen(const char * s); + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy(void *__to, __const__ void *__from, size_t __n); + +#define __HAVE_ARCH_MEMSET +extern void *memset(void *__s, int __c, size_t __count); + +#endif /* _ASM_M32R_STRING_H */ diff -Nru a/include/asm-m32r/syscall.h b/include/asm-m32r/syscall.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/syscall.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,11 @@ +#ifndef _ASM_M32R_SYSCALL_H +#define _ASM_M32R_SYSCALL_H + +/* $Id$ */ + +/* Definitions for the system call vector. */ +#define SYSCALL_VECTOR "2" +#define SYSCALL_VECTOR_ADDRESS "0xa0" + +#endif /* _ASM_M32R_SYSCALL_H */ + diff -Nru a/include/asm-m32r/system.h b/include/asm-m32r/system.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/system.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,301 @@ +#ifndef _ASM_M32R_SYSTEM_H +#define _ASM_M32R_SYSTEM_H + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + */ + +#include + +#ifdef __KERNEL__ + +/* + * switch_to(prev, next) should switch from task `prev' to `next' + * `prev' will never be the same as `next'. + * + * `next' and `prev' should be struct task_struct, but it isn't always defined + */ + +#ifndef CONFIG_SMP +#define prepare_to_switch() do { } while(0) +#endif /* not CONFIG_SMP */ + +#define switch_to(prev, next, last) do { \ + register unsigned long arg0 __asm__ ("r0") = (unsigned long)prev; \ + register unsigned long arg1 __asm__ ("r1") = (unsigned long)next; \ + register unsigned long *oldsp __asm__ ("r2") = &(prev->thread.sp); \ + register unsigned long *newsp __asm__ ("r3") = &(next->thread.sp); \ + register unsigned long *oldlr __asm__ ("r4") = &(prev->thread.lr); \ + register unsigned long *newlr __asm__ ("r5") = &(next->thread.lr); \ + register struct task_struct *__last __asm__ ("r6"); \ + __asm__ __volatile__ ( \ + "st r8, @-r15 \n\t" \ + "st r9, @-r15 \n\t" \ + "st r10, @-r15 \n\t" \ + "st r11, @-r15 \n\t" \ + "st r12, @-r15 \n\t" \ + "st r13, @-r15 \n\t" \ + "st r14, @-r15 \n\t" \ + "seth r14, #high(1f) \n\t" \ + "or3 r14, r14, #low(1f) \n\t" \ + "st r14, @r4 ; store old LR \n\t" \ + "st r15, @r2 ; store old SP \n\t" \ + "ld r15, @r3 ; load new SP \n\t" \ + "st r0, @-r15 ; store 'prev' onto new stack \n\t" \ + "ld r14, @r5 ; load new LR \n\t" \ + "jmp r14 \n\t" \ + ".fillinsn \n " \ + "1: \n\t" \ + "ld r6, @r15+ ; load 'prev' from new stack \n\t" \ + "ld r14, @r15+ \n\t" \ + "ld r13, @r15+ \n\t" \ + "ld r12, @r15+ \n\t" \ + "ld r11, @r15+ \n\t" \ + "ld r10, @r15+ \n\t" \ + "ld r9, @r15+ \n\t" \ + "ld r8, @r15+ \n\t" \ + : "=&r" (__last) \ + : "r" (arg0), "r" (arg1), "r" (oldsp), "r" (newsp), \ + "r" (oldlr), "r" (newlr) \ + : "memory" \ + ); \ + last = __last; \ +} while(0) + +/* Interrupt Control */ +#if !defined(CONFIG_CHIP_M32102) +#define local_irq_enable() \ + __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory") +#define local_irq_disable() \ + __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory") +#else /* CONFIG_CHIP_M32102 */ +static __inline__ void local_irq_enable(void) +{ + unsigned long tmpreg; + __asm__ __volatile__( + "mvfc %0, psw; \n\t" + "or3 %0, %0, #0x0040; \n\t" + "mvtc %0, psw; \n\t" + : "=&r" (tmpreg) : : "cbit", "memory"); +} + +static __inline__ void local_irq_disable(void) +{ + unsigned long tmpreg0, tmpreg1; + __asm__ __volatile__( + "ld24 %0, #0 ; Use 32-bit insn. \n\t" + "mvfc %1, psw ; No interrupt can be accepted here. \n\t" + "mvtc %0, psw \n\t" + "and3 %0, %1, #0xffbf \n\t" + "mvtc %0, psw \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory"); +} +#endif /* CONFIG_CHIP_M32102 */ + +#define local_save_flags(x) \ + __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */) + +#define local_irq_restore(x) \ + __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \ + : "r" (x) : "cbit", "memory") + +#if !defined(CONFIG_CHIP_M32102) +#define local_irq_save(x) \ + __asm__ __volatile__( \ + "mvfc %0, psw; \n\t" \ + "clrpsw #0x40 -> nop; \n\t" \ + : "=r" (x) : /* no input */ : "memory") +#else /* CONFIG_CHIP_M32102 */ +#define local_irq_save(x) \ + ({ \ + unsigned long tmpreg; \ + __asm__ __volatile__( \ + "ld24 %1, #0 \n\t" \ + "mvfc %0, psw \n\t" \ + "mvtc %1, psw \n\t" \ + "and3 %1, %0, #0xffbf \n\t" \ + "mvtc %1, psw \n\t" \ + : "=r" (x), "=&r" (tmpreg) \ + : : "cbit", "memory"); \ + }) +#endif /* CONFIG_CHIP_M32102 */ + +#define irqs_disabled() \ + ({ \ + unsigned long flags; \ + local_save_flags(flags); \ + !(flags & 0x40); \ + }) + +#endif /* __KERNEL__ */ + +#define nop() __asm__ __volatile__ ("nop" : : ) + +#define xchg(ptr,x) \ + ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) + +#define tas(ptr) (xchg((ptr),1)) + +#ifdef CONFIG_SMP +extern void __xchg_called_with_bad_pointer(void); +#endif + +#ifdef CONFIG_CHIP_M32700_TS1 +#define DCACHE_CLEAR(reg0, reg1, addr) \ + "seth "reg1", #high(dcache_dummy); \n\t" \ + "or3 "reg1", "reg1", #low(dcache_dummy); \n\t" \ + "lock "reg0", @"reg1"; \n\t" \ + "add3 "reg0", "addr", #0x1000; \n\t" \ + "ld "reg0", @"reg0"; \n\t" \ + "add3 "reg0", "addr", #0x2000; \n\t" \ + "ld "reg0", @"reg0"; \n\t" \ + "unlock "reg0", @"reg1"; \n\t" + /* FIXME: This workaround code cannot handle kenrel modules + * correctly under SMP environment. + */ +#else /* CONFIG_CHIP_M32700_TS1 */ +#define DCACHE_CLEAR(reg0, reg1, addr) +#endif /* CONFIG_CHIP_M32700_TS1 */ + +static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, + int size) +{ + unsigned long flags; + unsigned long tmp = 0; + + local_irq_save(flags); + + switch (size) { +#ifndef CONFIG_SMP + case 1: + __asm__ __volatile__ ( + "ldb %0, @%2 \n\t" + "stb %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; + case 2: + __asm__ __volatile__ ( + "ldh %0, @%2 \n\t" + "sth %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; + case 4: + __asm__ __volatile__ ( + "ld %0, @%2 \n\t" + "st %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; +#else /* CONFIG_SMP */ + case 4: + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%2") + "lock %0, @%2; \n\t" + "unlock %1, @%2; \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + break; + default: + __xchg_called_with_bad_pointer(); +#endif /* CONFIG_SMP */ + } + + local_irq_restore(flags); + + return (tmp); +} + +/* + * Memory barrier. + * + * mb() prevents loads and stores being reordered across this point. + * rmb() prevents loads being reordered across this point. + * wmb() prevents stores being reordered across this point. + */ +#if 0 +#define mb() __asm__ __volatile__ ("push r0; \n\t pop r0;" : : : "memory") +#else +#define mb() __asm__ __volatile__ ("" : : : "memory") +#endif +#define rmb() mb() +#define wmb() mb() + +/** + * read_barrier_depends - Flush all pending reads that subsequents reads + * depend on. + * + * No data-dependent reads from memory-like regions are ever reordered + * over this barrier. All reads preceding this primitive are guaranteed + * to access memory (but not necessarily other CPUs' caches) before any + * reads following this primitive that depend on the data return by + * any of the preceding reads. This primitive is much lighter weight than + * rmb() on most CPUs, and is never heavier weight than is + * rmb(). + * + * These ordering constraints are respected by both the local CPU + * and the compiler. + * + * Ordering is not guaranteed by anything other than these primitives, + * not even by data dependencies. See the documentation for + * memory_barrier() for examples and URLs to more information. + * + * For example, the following code would force ordering (the initial + * value of "a" is zero, "b" is one, and "p" is "&a"): + * + * + * CPU 0 CPU 1 + * + * b = 2; + * memory_barrier(); + * p = &b; q = p; + * read_barrier_depends(); + * d = *q; + * + * + * + * because the read of "*q" depends on the read of "p" and these + * two reads are separated by a read_barrier_depends(). However, + * the following code, with the same initial values for "a" and "b": + * + * + * CPU 0 CPU 1 + * + * a = 2; + * memory_barrier(); + * b = 3; y = b; + * read_barrier_depends(); + * x = a; + * + * + * does not enforce ordering, since there is no data dependency between + * the read of "a" and the read of "b". Therefore, on some CPUs, such + * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() + * in cases like thiswhere there are no data dependencies. + **/ + +#define read_barrier_depends() do { } while (0) + +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#define smp_read_barrier_depends() read_barrier_depends() +#else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() +#define smp_read_barrier_depends() do { } while (0) +#endif + +#define set_mb(var, value) do { xchg(&var, value); } while (0) +#define set_wmb(var, value) do { var = value; wmb(); } while (0) + +#endif /* _ASM_M32R_SYSTEM_H */ + diff -Nru a/include/asm-m32r/termbits.h b/include/asm-m32r/termbits.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/termbits.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,175 @@ +#ifndef _ASM_M32R_TERMBITS_H +#define _ASM_M32R_TERMBITS_H + +/* $Id$ */ + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000 /* input baud rate (not used) */ +#define CMSPAR 010000000000 /* mark or space (stick) parity */ +#define CRTSCTS 020000000000 /* flow control */ + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif /* _ASM_M32R_TERMBITS_H */ diff -Nru a/include/asm-m32r/termios.h b/include/asm-m32r/termios.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/termios.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,109 @@ +#ifndef _M32R_TERMIOS_H +#define _M32R_TERMIOS_H + +/* orig : i386 2.6.0-test5 */ + +#include +#include + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Reserved for Mobitex module */ +#define N_R3964 9 /* Reserved for Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ +#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ + +#ifdef __KERNEL__ +#include + +/* intr=^C quit=^\ erase=del kill=^U + eof=^D vtime=\0 vmin=\1 sxtc=\0 + start=^Q stop=^S susp=^Z eol=\0 + reprint=^R discard=^U werase=^W lnext=^V + eol2=\0 +*/ +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _M32R_TERMIOS_H */ diff -Nru a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/thread_info.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,149 @@ +/* thread_info.h: i386 low-level thread information + * + * Copyright (C) 2002 David Howells (dhowells@redhat.com) + * - Incorporating suggestions made by Linus Torvalds and Dave Miller + */ + +#ifndef _ASM_THREAD_INFO_H +#define _ASM_THREAD_INFO_H + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ +#include +#endif + +/* + * low level task data that entry.S needs immediate access to + * - this struct should fit entirely inside of one cache line + * - this struct shares the supervisor stack pages + * - if the contents of this structure are changed, the assembly constants must also be changed + */ +#ifndef __ASSEMBLY__ + +struct thread_info { + struct task_struct *task; /* main task structure */ + struct exec_domain *exec_domain; /* execution domain */ + unsigned long flags; /* low level flags */ + unsigned long status; /* thread-synchronous flags */ + __u32 cpu; /* current CPU */ + __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ + + mm_segment_t addr_limit; /* thread address space: + 0-0xBFFFFFFF for user-thead + 0-0xFFFFFFFF for kernel-thread + */ + struct restart_block restart_block; + + __u8 supervisor_stack[0]; +}; + +#else /* !__ASSEMBLY__ */ + +/* offsets into the thread_info struct for assembly code access */ +#define TI_TASK 0x00000000 +#define TI_EXEC_DOMAIN 0x00000004 +#define TI_FLAGS 0x00000008 +#define TI_STATUS 0x0000000C +#define TI_CPU 0x00000010 +#define TI_PRE_COUNT 0x00000014 +#define TI_ADDR_LIMIT 0x00000018 +#define TI_RESTART_BLOCK 0x000001C + +#endif + +#define PREEMPT_ACTIVE 0x4000000 + +/* + * macros/functions for gaining access to the thread information structure + * + * preempt_count needs to be 1 initially, until the scheduler is functional. + */ +#ifndef __ASSEMBLY__ + +#define INIT_THREAD_INFO(tsk) \ +{ \ + .task = &tsk, \ + .exec_domain = &default_exec_domain, \ + .flags = 0, \ + .cpu = 0, \ + .preempt_count = 1, \ + .addr_limit = KERNEL_DS, \ + .restart_block = { \ + .fn = do_no_restart_syscall, \ + }, \ +} + +#define init_thread_info (init_thread_union.thread_info) +#define init_stack (init_thread_union.stack) + +/* how to get the thread information struct from C */ +static inline struct thread_info *current_thread_info(void) +{ + struct thread_info *ti; + + __asm__ __volatile__ ( + "ldi %0, #0xffffe000; \n\t" + "and %0, sp; \n\t" + : "=r" (ti) + ); + + return ti; +} + +/* thread information allocation */ +#define THREAD_SIZE (2*PAGE_SIZE) +#define alloc_thread_info(task) \ + ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) +#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) +#define get_thread_info(ti) get_task_struct((ti)->task) +#define put_thread_info(ti) put_task_struct((ti)->task) + +#else /* !__ASSEMBLY__ */ + +/* how to get the thread information struct from ASM */ +#define GET_THREAD_INFO(reg) GET_THREAD_INFO reg + .macro GET_THREAD_INFO reg + ldi \reg, #0xffffe000 + and \reg, sp + .endm + +#endif + +/* + * thread information flags + * - these are process state flags that various assembly files may need to access + * - pending work-to-be-done flags are in LSW + * - other flags in MSW + */ +#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ +#define TIF_SIGPENDING 2 /* signal pending */ +#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ +#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ +#define TIF_IRET 5 /* return with iret */ +#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ + +#define _TIF_SYSCALL_TRACE (1< + +#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE) +#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ +#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ + (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ + << (SHIFT_SCALE-SHIFT_HZ)) / HZ) + +#ifdef __KERNEL__ +/* + * Standard way to access the cycle counter. + * Currently only used on SMP. + */ + +typedef unsigned long long cycles_t; + +extern cycles_t cacheflush_time; + +static __inline__ cycles_t get_cycles (void) +{ + return 0; +} +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_TIMEX_H */ diff -Nru a/include/asm-m32r/tlb.h b/include/asm-m32r/tlb.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/tlb.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,20 @@ +#ifndef _M32R_TLB_H +#define _M32R_TLB_H + +/* + * x86 doesn't need any special per-pte or + * per-vma handling.. + */ +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) +#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) + +/* + * .. because we flush the whole mm when it + * fills up. + */ +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + +#include + +#endif /* _M32R_TLB_H */ diff -Nru a/include/asm-m32r/tlbflush.h b/include/asm-m32r/tlbflush.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/tlbflush.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,102 @@ +#ifndef _ASM_M32R_TLBFLUSH_H +#define _ASM_M32R_TLBFLUSH_H + +#include +#include + +/* + * TLB flushing: + * + * - flush_tlb() flushes the current mm struct TLBs + * - flush_tlb_all() flushes all processes TLBs + * - flush_tlb_mm(mm) flushes the specified mm context TLB's + * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_range(vma, start, end) flushes a range of pages + * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages + * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables + */ + +extern void local_flush_tlb_all(void); +extern void local_flush_tlb_mm(struct mm_struct *); +extern void local_flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void local_flush_tlb_range(struct vm_area_struct *, unsigned long, + unsigned long); + +#ifndef CONFIG_SMP +#ifdef CONFIG_MMU +#define flush_tlb_all() local_flush_tlb_all() +#define flush_tlb_mm(mm) local_flush_tlb_mm(mm) +#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) +#define flush_tlb_range(vma, start, end) \ + local_flush_tlb_range(vma, start, end) +#define flush_tlb_kernel_range(start, end) local_flush_tlb_all() +#else /* CONFIG_MMU */ +#define flush_tlb_all() do { } while (0) +#define flush_tlb_mm(mm) do { } while (0) +#define flush_tlb_page(vma, vmaddr) do { } while (0) +#define flush_tlb_range(vma, start, end) do { } while (0) +#endif /* CONFIG_MMU */ +#else /* CONFIG_SMP */ +extern void smp_flush_tlb_all(void); +extern void smp_flush_tlb_mm(struct mm_struct *); +extern void smp_flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, + unsigned long); + +#define flush_tlb_all() smp_flush_tlb_all() +#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm) +#define flush_tlb_page(vma, page) smp_flush_tlb_page(vma, page) +#define flush_tlb_range(vma, start, end) \ + smp_flush_tlb_range(vma, start, end) +#define flush_tlb_kernel_range(start, end) smp_flush_tlb_all() +#endif /* CONFIG_SMP */ + +static __inline__ void __flush_tlb_page(unsigned long page) +{ + unsigned int tmpreg0, tmpreg1, tmpreg2; + + __asm__ __volatile__ ( + "seth %0, #high(%4) \n\t" + "st %3, @(%5, %0) \n\t" + "ldi %1, #1 \n\t" + "st %1, @(%6, %0) \n\t" + "add3 %1, %0, %7 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %2, @(%6, %0) \n\t" + "bnez %2, 1b \n\t" + "ld %0, @%1+ \n\t" + "ld %1, @%1 \n\t" + "st %2, @+%0 \n\t" + "st %2, @+%1 \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1), "=&r" (tmpreg2) + : "r" (page), "i" (MMU_REG_BASE), "i" (MSVA_offset), + "i" (MTOP_offset), "i" (MIDXI_offset) + : "memory" + ); +} + +static __inline__ void __flush_tlb_all(void) +{ + unsigned int tmpreg0, tmpreg1; + + __asm__ __volatile__ ( + "seth %0, #high(%2) \n\t" + "or3 %0, %0, #low(%2) \n\t" + "ldi %1, #0xc \n\t" + "st %1, @%0 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %1, @%0 \n\t" + "bnez %1, 1b \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1) + : "i" (MTOP) : "memory" + ); +} + +#define flush_tlb_pgtables(mm, start, end) do { } while (0) + +extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); + +#endif /* _ASM_M32R_TLBFLUSH_H */ + diff -Nru a/include/asm-m32r/topology.h b/include/asm-m32r/topology.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/topology.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,53 @@ +/* + * linux/include/asm-generic/topology.h + * + * Written by: Matthew Dobson, IBM Corporation + * + * Copyright (C) 2002, IBM Corp. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to + */ +#ifndef _ASM_M32R_TOPOLOGY_H +#define _ASM_M32R_TOPOLOGY_H + +/* Other architectures wishing to use this simple topology API should fill + in the below functions as appropriate in their own file. */ + +#define cpu_to_node(cpu) (0) + +#ifndef parent_node +#define parent_node(node) (0) +#endif +#ifndef node_to_cpumask +#define node_to_cpumask(node) (cpu_online_map) +#endif +#ifndef node_to_first_cpu +#define node_to_first_cpu(node) (0) +#endif +#ifndef pcibus_to_cpumask +#define pcibus_to_cpumask(bus) (cpu_online_map) +#endif + +/* Cross-node load balancing interval. */ +#ifndef NODE_BALANCE_RATE +#define NODE_BALANCE_RATE 10 +#endif + +#endif /* _ASM_M32R_TOPOLOGY_H */ diff -Nru a/include/asm-m32r/types.h b/include/asm-m32r/types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/types.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,64 @@ +#ifndef _ASM_M32R_TYPES_H +#define _ASM_M32R_TYPES_H + +#ifndef __ASSEMBLY__ + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif +#endif /* __ASSEMBLY__ */ + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +#define BITS_PER_LONG 32 + +#ifndef __ASSEMBLY__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +/* DMA addresses are 32-bits wide. */ + +typedef u32 dma_addr_t; +typedef u64 dma64_addr_t; + +typedef unsigned short kmem_bufctl_t; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_TYPES_H */ diff -Nru a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/uaccess.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,752 @@ +#ifndef _ASM_M32R_UACCESS_H +#define _ASM_M32R_UACCESS_H + +/* + * linux/include/asm-m32r/uaccess.h + * + * M32R version. + * Copyright (C) 2004 Hirokazu Takata + */ + +#undef UACCESS_DEBUG + +#ifdef UACCESS_DEBUG +#define UAPRINTK(args...) printk(args) +#else +#define UAPRINTK(args...) +#endif /* UACCESS_DEBUG */ + +/* + * User space memory access functions + */ +#include +#include +#include +#include + +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 + +/* + * The fs value determines whether argument validity checking should be + * performed or not. If get_fs() == USER_DS, checking is performed, with + * get_fs() == KERNEL_DS, checking is bypassed. + * + * For historical reasons, these macros are grossly misnamed. + */ + +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) + +#ifdef CONFIG_MMU +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) +#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) +#else +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) +#define USER_DS MAKE_MM_SEG(0xFFFFFFFF) +#endif /* CONFIG_MMU */ + +#define get_ds() (KERNEL_DS) +#ifdef CONFIG_MMU +#define get_fs() (current_thread_info()->addr_limit) +#define set_fs(x) (current_thread_info()->addr_limit = (x)) +#else +static inline mm_segment_t get_fs(void) +{ + return USER_DS; +} + +static inline void set_fs(mm_segment_t s) +{ +} +#endif /* CONFIG_MMU */ + +#define segment_eq(a,b) ((a).seg == (b).seg) + +#define __addr_ok(addr) \ + ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) + +/* + * Test whether a block of memory is a valid user space address. + * Returns 0 if the range is valid, nonzero otherwise. + * + * This is equivalent to the following test: + * (u33)addr + (u33)size >= (u33)current->addr_limit.seg + * + * This needs 33-bit arithmetic. We have a carry... + */ +#define __range_ok(addr,size) ({ \ + unsigned long flag, sum; \ + __chk_user_ptr(addr); \ + asm ( \ + " cmpu %1, %1 ; clear cbit\n" \ + " addx %1, %3 ; set cbit if overflow\n" \ + " subx %0, %0\n" \ + " cmpu %4, %1\n" \ + " subx %0, %5\n" \ + : "=&r"(flag), "=r"(sum) \ + : "1"(addr), "r"((int)(size)), \ + "r"(current_thread_info()->addr_limit.seg), "r"(0) \ + : "cbit" ); \ + flag; }) + +/** + * access_ok: - Checks if a user space pointer is valid + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that + * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe + * to write to a block, it is always safe to read from it. + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns true (nonzero) if the memory block may be valid, false (zero) + * if it is definitely invalid. + * + * Note that, depending on architecture, this function probably just + * checks that the pointer is in the user space range - after calling + * this function, memory access functions may still return -EFAULT. + */ +#ifdef CONFIG_MMU +#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0)) +#else +static inline int access_ok(int type, const void *addr, unsigned long size) +{ + extern unsigned long memory_start, memory_end; + unsigned long val = (unsigned long)addr; + + return ((val >= memory_start) && ((val + size) < memory_end)); +} +#endif /* CONFIG_MMU */ + +/** + * verify_area: - Obsolete, use access_ok() + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * This function has been replaced by access_ok(). + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns zero if the memory block may be valid, -EFAULT + * if it is definitely invalid. + * + * See access_ok() for more details. + */ +static inline int verify_area(int type, const void __user *addr, + unsigned long size) +{ + return access_ok(type, addr, size) ? 0 : -EFAULT; +} + + +/* + * The exception table consists of pairs of addresses: the first is the + * address of an instruction that is allowed to fault, and the second is + * the address at which the program should continue. No registers are + * modified, so it is entirely up to the continuation code to figure out + * what to do. + * + * All the routines below use bits of fixup code that are out of line + * with the main instruction path. This means when everything is well, + * we don't even have to jump over them. Further, they do not intrude + * on our cache or tlb entries. + */ + +struct exception_table_entry +{ + unsigned long insn, fixup; +}; + +extern int fixup_exception(struct pt_regs *regs); + +/* + * These are the main single-value transfer routines. They automatically + * use the right size if we just have the right pointer type. + * + * This gets kind of ugly. We want to return _two_ values in "get_user()" + * and yet we don't want to do any pointers, because that is too much + * of a performance impact. Thus we have a few rather ugly macros here, + * and hide all the uglyness from the user. + * + * The "__xxx" versions of the user access functions are versions that + * do not verify the address space, that must have been done previously + * with a separate "access_ok()" call (this is used when we do multiple + * accesses to the same area of user memory). + */ + +extern void __get_user_1(void); +extern void __get_user_2(void); +extern void __get_user_4(void); + +#ifndef MODULE +#define __get_user_x(size,ret,x,ptr) \ + __asm__ __volatile__( \ + " mv r0, %0\n" \ + " mv r1, %1\n" \ + " bl __get_user_" #size "\n" \ + " mv %0, r0\n" \ + " mv %1, r1\n" \ + : "=r"(ret), "=r"(x) \ + : "0"(ptr) \ + : "r0", "r1", "r14" ) +#else /* MODULE */ +/* + * Use "jl" instead of "bl" for MODULE + */ +#define __get_user_x(size,ret,x,ptr) \ + __asm__ __volatile__( \ + " mv r0, %0\n" \ + " mv r1, %1\n" \ + " seth lr, #high(__get_user_" #size ")\n" \ + " or3 lr, lr, #low(__get_user_" #size ")\n" \ + " jl lr\n" \ + " mv %0, r0\n" \ + " mv %1, r1\n" \ + : "=r"(ret), "=r"(x) \ + : "0"(ptr) \ + : "r0", "r1", "r14" ) +#endif + +/* Careful: we have to cast the result to the type of the pointer for sign + reasons */ +/** + * get_user: - Get a simple variable from user space. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ +#define get_user(x,ptr) \ +({ int __ret_gu,__val_gu; \ + __chk_user_ptr(ptr); \ + switch(sizeof (*(ptr))) { \ + case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ + case 2: __get_user_x(2,__ret_gu,__val_gu,ptr); break; \ + case 4: __get_user_x(4,__ret_gu,__val_gu,ptr); break; \ + default: __get_user_x(X,__ret_gu,__val_gu,ptr); break; \ + } \ + (x) = (__typeof__(*(ptr)))__val_gu; \ + __ret_gu; \ +}) + +extern void __put_user_bad(void); + +/** + * put_user: - Write a simple value into user space. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Returns zero on success, or -EFAULT on error. + */ +#define put_user(x,ptr) \ + __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) + + +/** + * __get_user: - Get a simple variable from user space, with less checking. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ +#define __get_user(x,ptr) \ + __get_user_nocheck((x),(ptr),sizeof(*(ptr))) + + +/** + * __put_user: - Write a simple value into user space, with less checking. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + */ +#define __put_user(x,ptr) \ + __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) + +#define __put_user_nocheck(x,ptr,size) \ +({ \ + long __pu_err; \ + __put_user_size((x),(ptr),(size),__pu_err); \ + __pu_err; \ +}) + + +#define __put_user_check(x,ptr,size) \ +({ \ + long __pu_err = -EFAULT; \ + __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ + might_sleep(); \ + if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ + __put_user_size((x),__pu_addr,(size),__pu_err); \ + __pu_err; \ +}) + +#if defined(__LITTLE_ENDIAN__) +#define __put_user_u64(x, addr, err) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st %L1,@%2\n" \ + " .fillinsn\n" \ + "2: st %H1,@(4,%2)\n" \ + " .fillinsn\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: ldi %0,%3\n" \ + " seth r14,#high(3b)\n" \ + " or3 r14,r14,#low(3b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,4b\n" \ + " .long 2b,4b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +#elif defined(__BIG_ENDIAN__) +#define __put_user_u64(x, addr, err) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st %H1,@%2\n" \ + " .fillinsn\n" \ + "2: st %L1,@(4,%2)\n" \ + " .fillinsn\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: ldi %0,%3\n" \ + " seth r14,#high(3b)\n" \ + " or3 r14,r14,#low(3b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,4b\n" \ + " .long 2b,4b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") +#else +#error no endian defined +#endif + +#define __put_user_size(x,ptr,size,retval) \ +do { \ + retval = 0; \ + __chk_user_ptr(ptr); \ + switch (size) { \ + case 1: __put_user_asm(x,ptr,retval,"b"); break; \ + case 2: __put_user_asm(x,ptr,retval,"h"); break; \ + case 4: __put_user_asm(x,ptr,retval,""); break; \ + case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\ + default: __put_user_bad(); \ + } \ +} while (0) + +struct __large_struct { unsigned long buf[100]; }; +#define __m(x) (*(struct __large_struct *)(x)) + +/* + * Tell gcc we read from memory instead of writing: this is because + * we do not write to any memory gcc knows about, so there are no + * aliasing issues. + */ +#define __put_user_asm(x, addr, err, itype) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st"itype" %1,@%2\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0,%3\n" \ + " seth r14,#high(2b)\n" \ + " or3 r14,r14,#low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,3b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +#define __get_user_nocheck(x,ptr,size) \ +({ \ + long __gu_err, __gu_val; \ + __get_user_size(__gu_val,(ptr),(size),__gu_err); \ + (x) = (__typeof__(*(ptr)))__gu_val; \ + __gu_err; \ +}) + +extern long __get_user_bad(void); + +#define __get_user_size(x,ptr,size,retval) \ +do { \ + retval = 0; \ + __chk_user_ptr(ptr); \ + switch (size) { \ + case 1: __get_user_asm(x,ptr,retval,"ub"); break; \ + case 2: __get_user_asm(x,ptr,retval,"uh"); break; \ + case 4: __get_user_asm(x,ptr,retval,""); break; \ + default: (x) = __get_user_bad(); \ + } \ +} while (0) + +#define __get_user_asm(x, addr, err, itype) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: ld"itype" %1,@%2\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0,%3\n" \ + " seth r14,#high(2b)\n" \ + " or3 r14,r14,#low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,3b\n" \ + ".previous" \ + : "=r"(err), "=&r"(x) \ + : "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +/* + * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault + * we return the initial request size (1, 2 or 4), as copy_*_user should do. + * If a store crosses a page boundary and gets a fault, the m32r will not write + * anything, so this is accurate. + */ + + +/* + * Copy To/From Userspace + */ + +/* Generic arbitrary sized copy. */ +/* Return the number of bytes NOT copied. */ +#define __copy_user(to,from,size) \ +do { \ + unsigned long __dst, __src, __c; \ + __asm__ __volatile__ ( \ + " mv r14, %0\n" \ + " or r14, %1\n" \ + " beq %0, %1, 9f\n" \ + " beqz %2, 9f\n" \ + " and3 r14, r14, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %2, %2, #3\n" \ + " beqz %3, 2f\n" \ + " addi %0, #-4 ; word_copy \n" \ + " .fillinsn\n" \ + "0: ld r14, @%1+\n" \ + " addi %3, #-1\n" \ + " .fillinsn\n" \ + "1: st r14, @+%0\n" \ + " bnez %3, 0b\n" \ + " beqz %2, 9f\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "2: ldb r14, @%1 ; byte_copy \n" \ + " .fillinsn\n" \ + "3: stb r14, @%0\n" \ + " addi %1, #1\n" \ + " addi %2, #-1\n" \ + " addi %0, #1\n" \ + " bnez %2, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "5: addi %3, #1\n" \ + " addi %1, #-4\n" \ + " .fillinsn\n" \ + "6: slli %3, #2\n" \ + " add %2, %3\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "7: seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,6b\n" \ + " .long 1b,5b\n" \ + " .long 2b,9b\n" \ + " .long 3b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ + : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ + : "r14", "memory"); \ +} while (0) + +#define __copy_user_zeroing(to,from,size) \ +do { \ + unsigned long __dst, __src, __c; \ + __asm__ __volatile__ ( \ + " mv r14, %0\n" \ + " or r14, %1\n" \ + " beq %0, %1, 9f\n" \ + " beqz %2, 9f\n" \ + " and3 r14, r14, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %2, %2, #3\n" \ + " beqz %3, 2f\n" \ + " addi %0, #-4 ; word_copy \n" \ + " .fillinsn\n" \ + "0: ld r14, @%1+\n" \ + " addi %3, #-1\n" \ + " .fillinsn\n" \ + "1: st r14, @+%0\n" \ + " bnez %3, 0b\n" \ + " beqz %2, 9f\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "2: ldb r14, @%1 ; byte_copy \n" \ + " .fillinsn\n" \ + "3: stb r14, @%0\n" \ + " addi %1, #1\n" \ + " addi %2, #-1\n" \ + " addi %0, #1\n" \ + " bnez %2, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "5: addi %3, #1\n" \ + " addi %1, #-4\n" \ + " .fillinsn\n" \ + "6: slli %3, #2\n" \ + " add %2, %3\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "7: ldi r14, #0 ; store zero \n" \ + " .fillinsn\n" \ + "8: addi %2, #-1\n" \ + " stb r14, @%0 ; ACE? \n" \ + " addi %0, #1\n" \ + " bnez %2, 8b\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,6b\n" \ + " .long 1b,5b\n" \ + " .long 2b,7b\n" \ + " .long 3b,7b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ + : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ + : "r14", "memory"); \ +} while (0) + + +/* We let the __ versions of copy_from/to_user inline, because they're often + * used in fast paths and have only a small space overhead. + */ +static inline unsigned long __generic_copy_from_user_nocheck(void *to, + const void __user *from, unsigned long n) +{ + __copy_user_zeroing(to,from,n); + return n; +} + +static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, + const void *from, unsigned long n) +{ + __copy_user(to,from,n); + return n; +} + +unsigned long __generic_copy_to_user(void *, const void *, unsigned long); +unsigned long __generic_copy_from_user(void *, const void *, unsigned long); + +/** + * __copy_to_user: - Copy a block of data into user space, with less checking. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ +#define __copy_to_user(to,from,n) \ + __generic_copy_to_user_nocheck((to),(from),(n)) + +#define __copy_to_user_inatomic __copy_to_user +#define __copy_from_user_inatomic __copy_from_user + +/** + * copy_to_user: - Copy a block of data into user space. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ +#define copy_to_user(to,from,n) \ +({ \ + might_sleep(); \ + __generic_copy_to_user((to),(from),(n)); \ +}) + +/** + * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ +#define __copy_from_user(to,from,n) \ + __generic_copy_from_user_nocheck((to),(from),(n)) + +/** + * copy_from_user: - Copy a block of data from user space. + * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ +#define copy_from_user(to,from,n) \ +({ \ + might_sleep(); \ +__generic_copy_from_user((to),(from),(n)); \ +}) + +long __must_check strncpy_from_user(char *dst, const char __user *src, + long count); +long __must_check __strncpy_from_user(char *dst, + const char __user *src, long count); + +/** + * __clear_user: - Zero a block of memory in user space, with less checking. + * @to: Destination address, in user space. + * @n: Number of bytes to zero. + * + * Zero a block of memory in user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be cleared. + * On success, this will be zero. + */ +unsigned long __clear_user(void __user *mem, unsigned long len); + +/** + * clear_user: - Zero a block of memory in user space. + * @to: Destination address, in user space. + * @n: Number of bytes to zero. + * + * Zero a block of memory in user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be cleared. + * On success, this will be zero. + */ +unsigned long clear_user(void __user *mem, unsigned long len); + +/** + * strlen_user: - Get the size of a string in user space. + * @str: The string to measure. + * + * Context: User context only. This function may sleep. + * + * Get the size of a NUL-terminated string in user space. + * + * Returns the size of the string INCLUDING the terminating NUL. + * On exception, returns 0. + * + * If there is a limit on the length of a valid string, you may wish to + * consider using strnlen_user() instead. + */ +#define strlen_user(str) strnlen_user(str, ~0UL >> 1) +long strnlen_user(const char __user *str, long n); + +#endif /* _ASM_M32R_UACCESS_H */ diff -Nru a/include/asm-m32r/ucontext.h b/include/asm-m32r/ucontext.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ucontext.h 2004-09-21 20:52:52 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_UCONTEXT_H +#define _ASM_M32R_UCONTEXT_H + +/* orig : i386 2.4.18 */ + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* _ASM_M32R_UCONTEXT_H */ diff -Nru a/include/asm-m32r/unaligned.h b/include/asm-m32r/unaligned.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/unaligned.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,25 @@ +#ifndef _ASM_M32R_UNALIGNED_H +#define _ASM_M32R_UNALIGNED_H + +/* $Id$ */ + +/* orig : generic 2.4.18 */ + +/* + * For the benefit of those who are trying to port Linux to another + * architecture, here are some C-language equivalents. + */ + +#include + + +#define get_unaligned(ptr) \ + ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) + +#define put_unaligned(val, ptr) \ + ({ __typeof__(*(ptr)) __tmp = (val); \ + memmove((ptr), &__tmp, sizeof(*(ptr))); \ + (void)0; }) + + +#endif /* _ASM_M32R_UNALIGNED_H */ diff -Nru a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/unistd.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,480 @@ +#ifndef _ASM_M32R_UNISTD_H +#define _ASM_M32R_UNISTD_H + +/* $Id$ */ + +#include /* SYSCALL_* */ + +/* + * This file contains the system call numbers. + */ + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_cacheflush 31 /* old #define __NR_stty 31*/ +#define __NR_cachectl 32 /* old #define __NR_gtty 32*/ +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +#define __NR_oldolduname 59 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_profil 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_ioperm 101 +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_olduname 109 +#define __NR_iopl 110 +#define __NR_vhangup 111 +#define __NR_idle 112 +#define __NR_vm86old 113 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_modify_ldt 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_tas 166 +#define __NR_query_module 167 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_getpmsg 188 /* some people actually want streams */ +#define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 +#define __NR_madvise1 219 /* delete when C lib stub is removed */ +#define __NR_getdents64 220 +#define __NR_fcntl64 221 +#define __NR_security 223 /* syscall for security modules */ +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_set_thread_area 243 +#define __NR_get_thread_area 244 +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 +#define __NR_fadvise64 250 + +#define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 +#define __NR_epoll_create 254 +#define __NR_epoll_ctl 255 +#define __NR_epoll_wait 256 +#define __NR_remap_file_pages 257 +#define __NR_set_tid_address 258 +#define __NR_timer_create 259 +#define __NR_timer_settime (__NR_timer_create+1) +#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_getoverrun (__NR_timer_create+3) +#define __NR_timer_delete (__NR_timer_create+4) +#define __NR_clock_settime (__NR_timer_create+5) +#define __NR_clock_gettime (__NR_timer_create+6) +#define __NR_clock_getres (__NR_timer_create+7) +#define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_statfs64 268 +#define __NR_fstatfs64 269 +#define __NR_tgkill 270 +#define __NR_utimes 271 +#define __NR_fadvise64_64 272 +#define __NR_vserver 273 +#define __NR_mbind 274 +#define __NR_get_mempolicy 275 +#define __NR_set_mempolicy 276 +#define __NR_mq_open 277 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) +#define __NR_kexec_load 283 + +#define NR_syscalls 284 + +/* user-visible error numbers are in the range -1 - -124: see */ + +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-125)) { \ + /* Avoid using "res" which is declared to be in register r0; \ + errno might expand to a function call and clobber it. */ \ + int __err = -(res); \ + errno = __err; \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) + +#define _syscall0(type,name) \ +type name(void) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __res __asm__("r0"); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg4 __asm__ ("r3") = (long)(arg4); \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3), "r" (__arg4) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg5 __asm__ ("r4") = (long)(arg5); \ +register long __arg4 __asm__ ("r3") = (long)(arg4); \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3), "r" (__arg4), "r" (__arg5) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#define __ARCH_WANT_SYS_RT_SIGACTION +#endif + +#ifdef __KERNEL_SYSCALLS__ + +#include +#include +#include +#include + +/* + * we need this inline - forking from kernel space will result + * in NO COPY ON WRITE (!!!), until an execve is executed. This + * is no problem, but for the stack. This is handled by not letting + * main() use the stack at all after fork(). Thus, no function + * calls - which means inline code for fork too, as otherwise we + * would use the stack upon exit from 'fork()'. + * + * Actually only pause and fork are needed inline, so that there + * won't be any messing with the stack from main(), but we define + * some others too. + */ +static __inline__ _syscall3(int,execve,const char *,file,char **,argv,char **,envp) + +asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount); +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff); +asmlinkage int sys_execve(struct pt_regs regs); +asmlinkage int sys_clone(struct pt_regs regs); +asmlinkage int sys_fork(struct pt_regs regs); +asmlinkage int sys_vfork(struct pt_regs regs); +asmlinkage int sys_pipe(unsigned long __user *fildes); +asmlinkage int sys_ptrace(long request, long pid, long addr, long data); +asmlinkage long sys_iopl(unsigned long unused); +struct sigaction; +asmlinkage long sys_rt_sigaction(int sig, + const struct sigaction __user *act, + struct sigaction __user *oact, + size_t sigsetsize); + +#endif /* __KERNEL_SYSCALLS__ */ + +/* + * "Conditional" syscalls + * + * What we want is __attribute__((weak,alias("sys_ni_syscall"))), + * but it doesn't work on all toolchains, so we just do it by hand + */ +#ifndef cond_syscall +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); +#endif + +#endif /* _ASM_M32R_UNISTD_H */ diff -Nru a/include/asm-m32r/user.h b/include/asm-m32r/user.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/user.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,59 @@ +#ifndef _ASM_M32R_USER_H +#define _ASM_M32R_USER_H + +/* $Id$ */ + +/* orig : sh 2.4.18 + * mod : remove fpu registers + */ + +#include +#include +#include +#include + +/* + * Core file format: The core file is written in such a way that gdb + * can understand it and provide useful information to the user (under + * linux we use the `trad-core' bfd). + * + * The actual file contents are as follows: + * UPAGE: 1 page consisting of a user struct that tells gdb + * what is present in the file. Directly after this is a + * copy of the task_struct, which is currently not used by gdb, + * but it may come in handy at some point. All of the registers + * are stored as part of the upage. The upage should always be + * only one page. + * DATA: The data area is stored. We use current->end_text to + * current->brk to pick up all of the user variables, plus any memory + * that may have been sbrk'ed. No attempt is made to determine if a + * page is demand-zero or if a page is totally unused, we just cover + * the entire range. All of the addresses are rounded in such a way + * that an integral number of pages is written. + * STACK: We need the stack information in order to get a meaningful + * backtrace. We need to write the data from usp to + * current->start_stack, so we round each of these off in order to be + * able to write an integer number of pages. + */ + +struct user { + struct pt_regs regs; /* entire machine state */ + size_t u_tsize; /* text size (pages) */ + size_t u_dsize; /* data size (pages) */ + size_t u_ssize; /* stack size (pages) */ + unsigned long start_code; /* text starting address */ + unsigned long start_data; /* data starting address */ + unsigned long start_stack; /* stack starting address */ + long int signal; /* signal causing core dump */ + struct regs * u_ar0; /* help gdb find registers */ + unsigned long magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_DATA_START_ADDR (u.start_data) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _ASM_M32R_USER_H */ diff -Nru a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/vga.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,22 @@ +#ifndef _ASM_M32R_VGA_H +#define _ASM_M32R_VGA_H + +/* $Id$ */ + +/* + * Access to VGA videoram + * + * (c) 1998 Martin Mares + */ + +/* + * On the PC, we can just recalculate addresses and then + * access the videoram directly without any black magic. + */ + +#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) + +#define vga_readb(x) (*(x)) +#define vga_writeb(x,y) (*(y) = (x)) + +#endif /* _ASM_M32R_VGA_H */ diff -Nru a/include/asm-m32r/xor.h b/include/asm-m32r/xor.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/xor.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,8 @@ +#ifndef _ASM_M32R_XOR_H +#define _ASM_M32R_XOR_H + +/* $Id$ */ + +#include + +#endif /* _ASM_M32R_XOR_H */ diff -Nru a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h --- a/include/asm-mips/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-mips/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -1,7 +1,6 @@ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H -#include #include #include diff -Nru a/include/asm-mips/socket.h b/include/asm-mips/socket.h --- a/include/asm-mips/socket.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-mips/socket.h 2004-09-21 20:52:52 -07:00 @@ -68,4 +68,31 @@ #define SO_PEERSEC 30 +/** sock_type - Socket types + * + * Please notice that for binary compat reasons MIPS has to + * override the enum sock_type in include/linux/net.h, so + * we define ARCH_HAS_SOCKET_TYPES here. + * + * @SOCK_DGRAM - datagram (conn.less) socket + * @SOCK_STREAM - stream (connection) socket + * @SOCK_RAW - raw socket + * @SOCK_RDM - reliably-delivered message + * @SOCK_SEQPACKET - sequential packet socket + * @SOCK_PACKET - linux specific way of getting packets at the dev level. + * For writing rarp and other similar things on the user level. + */ +enum sock_type { + SOCK_DGRAM = 1, + SOCK_STREAM = 2, + SOCK_RAW = 3, + SOCK_RDM = 4, + SOCK_SEQPACKET = 5, + SOCK_PACKET = 10, +}; + +#define SOCK_MAX (SOCK_PACKET + 1) + +#define ARCH_HAS_SOCKET_TYPES + #endif /* _ASM_SOCKET_H */ diff -Nru a/include/asm-ppc/8253pit.h b/include/asm-ppc/8253pit.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ppc/8253pit.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,10 @@ +/* + * 8253/8254 Programmable Interval Timer + */ + +#ifndef _8253PIT_H +#define _8253PIT_H + +#define PIT_TICK_RATE 1193182UL + +#endif diff -Nru a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h --- a/include/asm-ppc/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -8,7 +8,6 @@ #include /* need struct page definitions */ #include -#include #include #include diff -Nru a/include/asm-ppc64/8253pit.h b/include/asm-ppc64/8253pit.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ppc64/8253pit.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,10 @@ +/* + * 8253/8254 Programmable Interval Timer + */ + +#ifndef _8253PIT_H +#define _8253PIT_H + +#define PIT_TICK_RATE 1193182UL + +#endif diff -Nru a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h --- a/include/asm-ppc64/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -8,7 +8,6 @@ #define _ASM_DMA_MAPPING_H #include -#include #include /* need struct page definitions */ #include diff -Nru a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h --- a/include/asm-ppc64/io.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/io.h 2004-09-21 20:52:52 -07:00 @@ -18,6 +18,8 @@ #include #include +#include + #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) @@ -69,35 +71,35 @@ static inline unsigned char __raw_readb(const volatile void __iomem *addr) { - return *(unsigned char __force *)addr; + return *(volatile unsigned char __force *)addr; } static inline unsigned short __raw_readw(const volatile void __iomem *addr) { - return *(unsigned short __force *)addr; + return *(volatile unsigned short __force *)addr; } static inline unsigned int __raw_readl(const volatile void __iomem *addr) { - return *(unsigned int __force *)addr; + return *(volatile unsigned int __force *)addr; } static inline unsigned long __raw_readq(const volatile void __iomem *addr) { - return *(unsigned long __force *)addr; + return *(volatile unsigned long __force *)addr; } static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) { - *(unsigned char __force *)addr = v; + *(volatile unsigned char __force *)addr = v; } static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) { - *(unsigned short __force *)addr = v; + *(volatile unsigned short __force *)addr = v; } static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) { - *(unsigned int __force *)addr = v; + *(volatile unsigned int __force *)addr = v; } static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) { - *(unsigned long __force *)addr = v; + *(volatile unsigned long __force *)addr = v; } #define readb(addr) eeh_readb(addr) #define readw(addr) eeh_readw(addr) diff -Nru a/include/asm-ppc64/memory.h b/include/asm-ppc64/memory.h --- a/include/asm-ppc64/memory.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/memory.h 2004-09-21 20:52:52 -07:00 @@ -56,14 +56,4 @@ #define HMT_MEDIUM_HIGH "\tor 5,5,5 # medium high priority\n" #define HMT_HIGH "\tor 3,3,3 # high priority\n" -/* - * Various operational modes for SMT - * Off : never run threaded - * On : always run threaded - * Dynamic: Allow the system to switch modes as needed - */ -#define SMT_OFF 0 -#define SMT_ON 1 -#define SMT_DYNAMIC 2 - #endif diff -Nru a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h --- a/include/asm-ppc64/mmu.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/mmu.h 2004-09-21 20:52:52 -07:00 @@ -15,6 +15,7 @@ #include #include +#include #ifndef __ASSEMBLY__ @@ -106,20 +107,6 @@ extern HTAB htab_data; -void invalidate_hpte( unsigned long slot ); -long select_hpte_slot( unsigned long vpn ); -void create_valid_hpte( unsigned long slot, unsigned long vpn, - unsigned long prpn, unsigned hash, - void * ptep, unsigned hpteflags, - unsigned bolted ); - -#define PD_SHIFT (10+12) /* Page directory */ -#define PD_MASK 0x02FF -#define PT_SHIFT (12) /* Page Table */ -#define PT_MASK 0x02FF - -#define LARGE_PAGE_SHIFT 24 - static inline unsigned long hpt_hash(unsigned long vpn, int large) { unsigned long vsid; @@ -215,156 +202,43 @@ #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) -#define VSID_RANDOMIZER ASM_CONST(42470972311) -#define VSID_MASK 0xfffffffffUL -/* Because we never access addresses below KERNELBASE as kernel - * addresses, this VSID is never used for anything real, and will - * never have pages hashed into it */ -#define BAD_VSID ASM_CONST(0) - -/* Block size masks */ -#define BL_128K 0x000 -#define BL_256K 0x001 -#define BL_512K 0x003 -#define BL_1M 0x007 -#define BL_2M 0x00F -#define BL_4M 0x01F -#define BL_8M 0x03F -#define BL_16M 0x07F -#define BL_32M 0x0FF -#define BL_64M 0x1FF -#define BL_128M 0x3FF -#define BL_256M 0x7FF - -/* Used to set up SDR1 register */ -#define HASH_TABLE_SIZE_64K 0x00010000 -#define HASH_TABLE_SIZE_128K 0x00020000 -#define HASH_TABLE_SIZE_256K 0x00040000 -#define HASH_TABLE_SIZE_512K 0x00080000 -#define HASH_TABLE_SIZE_1M 0x00100000 -#define HASH_TABLE_SIZE_2M 0x00200000 -#define HASH_TABLE_SIZE_4M 0x00400000 -#define HASH_TABLE_MASK_64K 0x000 -#define HASH_TABLE_MASK_128K 0x001 -#define HASH_TABLE_MASK_256K 0x003 -#define HASH_TABLE_MASK_512K 0x007 -#define HASH_TABLE_MASK_1M 0x00F -#define HASH_TABLE_MASK_2M 0x01F -#define HASH_TABLE_MASK_4M 0x03F - -/* These are the Ks and Kp from the PowerPC books. For proper operation, - * Ks = 0, Kp = 1. - */ -#define MI_AP 786 -#define MI_Ks 0x80000000 /* Should not be set */ -#define MI_Kp 0x40000000 /* Should always be set */ - -/* The effective page number register. When read, contains the information - * about the last instruction TLB miss. When MI_RPN is written, bits in - * this register are used to create the TLB entry. - */ -#define MI_EPN 787 -#define MI_EPNMASK 0xfffff000 /* Effective page number for entry */ -#define MI_EVALID 0x00000200 /* Entry is valid */ -#define MI_ASIDMASK 0x0000000f /* ASID match value */ - /* Reset value is undefined */ - -/* A "level 1" or "segment" or whatever you want to call it register. - * For the instruction TLB, it contains bits that get loaded into the - * TLB entry when the MI_RPN is written. - */ -#define MI_TWC 789 -#define MI_APG 0x000001e0 /* Access protection group (0) */ -#define MI_GUARDED 0x00000010 /* Guarded storage */ -#define MI_PSMASK 0x0000000c /* Mask of page size bits */ -#define MI_PS8MEG 0x0000000c /* 8M page size */ -#define MI_PS512K 0x00000004 /* 512K page size */ -#define MI_PS4K_16K 0x00000000 /* 4K or 16K page size */ -#define MI_SVALID 0x00000001 /* Segment entry is valid */ - /* Reset value is undefined */ - -/* Real page number. Defined by the pte. Writing this register - * causes a TLB entry to be created for the instruction TLB, using - * additional information from the MI_EPN, and MI_TWC registers. - */ -#define MI_RPN 790 - -/* Define an RPN value for mapping kernel memory to large virtual - * pages for boot initialization. This has real page number of 0, - * large page size, shared page, cache enabled, and valid. - * Also mark all subpages valid and write access. - */ -#define MI_BOOTINIT 0x000001fd - -#define MD_CTR 792 /* Data TLB control register */ -#define MD_GPM 0x80000000 /* Set domain manager mode */ -#define MD_PPM 0x40000000 /* Set subpage protection */ -#define MD_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */ -#define MD_WTDEF 0x10000000 /* Set writethrough when MMU dis */ -#define MD_RSV4I 0x08000000 /* Reserve 4 TLB entries */ -#define MD_TWAM 0x04000000 /* Use 4K page hardware assist */ -#define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ -#define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */ -#define MD_RESETVAL 0x04000000 /* Value of register at reset */ +#define VSID_MULTIPLIER ASM_CONST(268435399) /* largest 28-bit prime */ +#define VSID_BITS 36 +#define VSID_MODULUS ((1UL<= \ + * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ + * the bit clear, r3 already has the answer we want, if it \ + * doesn't, the answer is the low 36 bits of r3+1. So in all \ + * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\ + addi rx,rt,1; \ + srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \ + add rt,rt,rx #endif /* _PPC64_MMU_H_ */ diff -Nru a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h --- a/include/asm-ppc64/mmu_context.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-ppc64/mmu_context.h 2004-09-21 20:52:51 -07:00 @@ -2,11 +2,9 @@ #define __PPC64_MMU_CONTEXT_H #include -#include #include #include #include -#include #include /* @@ -33,107 +31,15 @@ return __ffs(b[2]) + 128; } -#define NO_CONTEXT 0 -#define FIRST_USER_CONTEXT 0x10 /* First 16 reserved for kernel */ -#define LAST_USER_CONTEXT 0x8000 /* Same as PID_MAX for now... */ -#define NUM_USER_CONTEXT (LAST_USER_CONTEXT-FIRST_USER_CONTEXT) - -/* Choose whether we want to implement our context - * number allocator as a LIFO or FIFO queue. - */ -#if 1 -#define MMU_CONTEXT_LIFO -#else -#define MMU_CONTEXT_FIFO -#endif - -struct mmu_context_queue_t { - spinlock_t lock; - long head; - long tail; - long size; - mm_context_id_t elements[LAST_USER_CONTEXT]; -}; - -extern struct mmu_context_queue_t mmu_context_queue; - -static inline void -enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) -{ -} - -/* - * The context number queue has underflowed. - * Meaning: we tried to push a context number that was freed - * back onto the context queue and the queue was already full. - */ -static inline void -mmu_context_underflow(void) -{ - printk(KERN_DEBUG "mmu_context_underflow\n"); - panic("mmu_context_underflow"); -} - -/* - * Set up the context for a new address space. - */ -static inline int -init_new_context(struct task_struct *tsk, struct mm_struct *mm) +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { - long head; - unsigned long flags; - /* This does the right thing across a fork (I hope) */ - - spin_lock_irqsave(&mmu_context_queue.lock, flags); - - if (mmu_context_queue.size <= 0) { - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - return -ENOMEM; - } - - head = mmu_context_queue.head; - mm->context.id = mmu_context_queue.elements[head]; - - head = (head < LAST_USER_CONTEXT-1) ? head+1 : 0; - mmu_context_queue.head = head; - mmu_context_queue.size--; - - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - - return 0; } -/* - * We're finished using the context for an address space. - */ -static inline void -destroy_context(struct mm_struct *mm) -{ - long index; - unsigned long flags; - - spin_lock_irqsave(&mmu_context_queue.lock, flags); +#define NO_CONTEXT 0 +#define MAX_CONTEXT (0x100000-1) - if (mmu_context_queue.size >= NUM_USER_CONTEXT) { - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - mmu_context_underflow(); - } - -#ifdef MMU_CONTEXT_LIFO - index = mmu_context_queue.head; - index = (index > 0) ? index-1 : LAST_USER_CONTEXT-1; - mmu_context_queue.head = index; -#else - index = mmu_context_queue.tail; - index = (index < LAST_USER_CONTEXT-1) ? index+1 : 0; - mmu_context_queue.tail = index; -#endif - - mmu_context_queue.size++; - mmu_context_queue.elements[index] = mm->context.id; - - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); -} +extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); +extern void destroy_context(struct mm_struct *mm); extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm); extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); @@ -181,46 +87,87 @@ local_irq_restore(flags); } -/* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's +/* VSID allocation + * =============== + * + * We first generate a 36-bit "proto-VSID". For kernel addresses this + * is equal to the ESID, for user addresses it is: + * (context << 15) | (esid & 0x7fff) + * + * The two forms are distinguishable because the top bit is 0 for user + * addresses, whereas the top two bits are 1 for kernel addresses. + * Proto-VSIDs with the top two bits equal to 0b10 are reserved for + * now. + * + * The proto-VSIDs are then scrambled into real VSIDs with the + * multiplicative hash: + * + * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS + * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 + * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF + * + * This scramble is only well defined for proto-VSIDs below + * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are + * reserved. VSID_MULTIPLIER is prime (the largest 28-bit prime, in + * fact), so in particular it is co-prime to VSID_MODULUS, making this + * a 1:1 scrambling function. Because the modulus is 2^n-1 we can + * compute it efficiently without a divide or extra multiply (see + * below). + * + * This scheme has several advantages over older methods: + * + * - We have VSIDs allocated for every kernel address + * (i.e. everything above 0xC000000000000000), except the very top + * segment, which simplifies several things. + * + * - We allow for 15 significant bits of ESID and 20 bits of + * context for user addresses. i.e. 8T (43 bits) of address space for + * up to 1M contexts (although the page table structure and context + * allocation will need changes to take advantage of this). + * + * - The scramble function gives robust scattering in the hash + * table (at least based on some initial results). The previous + * method was more susceptible to pathological cases giving excessive + * hash collisions. */ -static inline unsigned long -get_kernel_vsid( unsigned long ea ) + +/* + * WARNING - If you change these you must make sure the asm + * implementations in slb_allocate(), do_stab_bolted and mmu.h + * (ASM_VSID_SCRAMBLE macro) are changed accordingly. + * + * You'll also need to change the precomputed VSID values in head.S + * which are used by the iSeries firmware. + */ + +static inline unsigned long vsid_scramble(unsigned long protovsid) { - unsigned long ordinal, vsid; - - ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | (ea >> 60); - vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK; - -#ifdef HTABSTRESS - /* For debug, this path creates a very poor vsid distribuition. - * A user program can access virtual addresses in the form - * 0x0yyyyxxxx000 where yyyy = xxxx to cause multiple mappings - * to hash to the same page table group. - */ - ordinal = ((ea >> 28) & 0x1fff) | (ea >> 44); - vsid = ordinal & VSID_MASK; -#endif /* HTABSTRESS */ - - return vsid; -} - -/* This is only valid for user EA's (user EA's do not exceed 2^41 (EADDR_SIZE)) - */ -static inline unsigned long -get_vsid( unsigned long context, unsigned long ea ) -{ - unsigned long ordinal, vsid; - - ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | context; - vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK; - -#ifdef HTABSTRESS - /* See comment above. */ - ordinal = ((ea >> 28) & 0x1fff) | (context << 16); - vsid = ordinal & VSID_MASK; -#endif /* HTABSTRESS */ +#if 0 + /* The code below is equivalent to this function for arguments + * < 2^VSID_BITS, which is all this should ever be called + * with. However gcc is not clever enough to compute the + * modulus (2^n-1) without a second multiply. */ + return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS); +#else /* 1 */ + unsigned long x; - return vsid; + x = protovsid * VSID_MULTIPLIER; + x = (x >> VSID_BITS) + (x & VSID_MODULUS); + return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS; +#endif /* 1 */ +} + +/* This is only valid for addresses >= KERNELBASE */ +static inline unsigned long get_kernel_vsid(unsigned long ea) +{ + return vsid_scramble(ea >> SID_SHIFT); +} + +/* This is only valid for user addresses (which are below 2^41) */ +static inline unsigned long get_vsid(unsigned long context, unsigned long ea) +{ + return vsid_scramble((context << USER_ESID_BITS) + | (ea >> SID_SHIFT)); } #endif /* __PPC64_MMU_CONTEXT_H */ diff -Nru a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h --- a/include/asm-ppc64/naca.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/naca.h 2004-09-21 20:52:52 -07:00 @@ -37,9 +37,6 @@ u32 dCacheL1LinesPerPage; /* L1 d-cache lines / page 0x64 */ u32 iCacheL1LogLineSize; /* L1 i-cache line size Log2 0x68 */ u32 iCacheL1LinesPerPage; /* L1 i-cache lines / page 0x6c */ - u8 smt_state; /* 0 = SMT off 0x70 */ - /* 1 = SMT on */ - /* 2 = SMT dynamic */ u8 resv0[15]; /* Reserved 0x71 - 0x7F */ }; diff -Nru a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h --- a/include/asm-ppc64/page.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-ppc64/page.h 2004-09-21 20:52:51 -07:00 @@ -30,11 +30,12 @@ #define ESID_MASK 0xfffffffff0000000UL #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) -#ifdef CONFIG_HUGETLB_PAGE - #define HPAGE_SHIFT 24 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) #define HPAGE_MASK (~(HPAGE_SIZE - 1)) + +#ifdef CONFIG_HUGETLB_PAGE + #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) /* For 64-bit processes the hugepage range is 1T-1.5T */ @@ -201,9 +202,9 @@ /* to change! */ #define PAGE_OFFSET ASM_CONST(0xC000000000000000) #define KERNELBASE PAGE_OFFSET -#define VMALLOCBASE 0xD000000000000000UL -#define IOREGIONBASE 0xE000000000000000UL -#define EEHREGIONBASE 0xA000000000000000UL +#define VMALLOCBASE ASM_CONST(0xD000000000000000) +#define IOREGIONBASE ASM_CONST(0xE000000000000000) +#define EEHREGIONBASE ASM_CONST(0xA000000000000000) #define IO_REGION_ID (IOREGIONBASE>>REGION_SHIFT) #define EEH_REGION_ID (EEHREGIONBASE>>REGION_SHIFT) @@ -211,17 +212,6 @@ #define KERNEL_REGION_ID (KERNELBASE>>REGION_SHIFT) #define USER_REGION_ID (0UL) #define REGION_ID(X) (((unsigned long)(X))>>REGION_SHIFT) - -/* - * Define valid/invalid EA bits (for all ranges) - */ -#define VALID_EA_BITS (0x000001ffffffffffUL) -#define INVALID_EA_BITS (~(REGION_MASK|VALID_EA_BITS)) - -#define IS_VALID_REGION_ID(x) \ - (((x) == USER_REGION_ID) || ((x) >= KERNEL_REGION_ID)) -#define IS_VALID_EA(x) \ - ((!((x) & INVALID_EA_BITS)) && IS_VALID_REGION_ID(REGION_ID(x))) #define __bpn_to_ba(x) ((((unsigned long)(x))<> PAGE_SHIFT) diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h --- a/include/asm-ppc64/pgtable.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-ppc64/pgtable.h 2004-09-21 20:52:52 -07:00 @@ -45,10 +45,16 @@ PGD_INDEX_SIZE + PAGE_SHIFT) /* + * Size of EA range mapped by our pagetables. + */ +#define PGTABLE_EA_BITS 41 +#define PGTABLE_EA_MASK ((1UL< physical */ #define KRANGE_START KERNELBASE -#define KRANGE_END (KRANGE_START + VALID_EA_BITS) +#define KRANGE_END (KRANGE_START + PGTABLE_EA_MASK) /* * Define the user address range */ #define USER_START (0UL) -#define USER_END (USER_START + VALID_EA_BITS) +#define USER_END (USER_START + PGTABLE_EA_MASK) /* diff -Nru a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h --- a/include/asm-ppc64/ppc32.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-ppc64/ppc32.h 2004-09-21 20:52:51 -07:00 @@ -14,30 +14,6 @@ * 2 of the License, or (at your option) any later version. */ -/* Use this to get at 32-bit user passed pointers. */ -/* Things to consider: the low-level assembly stub does - srl x, 0, x for first four arguments, so if you have - pointer to something in the first four arguments, just - declare it as a pointer, not u32. On the other side, - arguments from 5th onwards should be declared as u32 - for pointers, and need AA() around each usage. - A() macro should be used for places where you e.g. - have some internal variable u32 and just want to get - rid of a compiler warning. AA() has to be used in - places where you want to convert a function argument - to 32bit pointer or when you e.g. access pt_regs - structure and want to consider 32bit registers only. - - - */ -#define A(__x) ((unsigned long)(__x)) -#define AA(__x) \ -({ unsigned long __ret; \ - __asm__ ("clrldi %0, %0, 32" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - /* These are here to support 32-bit syscalls on a 64-bit kernel. */ typedef struct compat_siginfo { diff -Nru a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h --- a/include/asm-ppc64/smp.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-ppc64/smp.h 2004-09-21 20:52:51 -07:00 @@ -65,6 +65,8 @@ #define set_hard_smp_processor_id(CPU, VAL) \ do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) +extern int smt_enabled_at_boot; + #endif /* __ASSEMBLY__ */ #endif /* !(_PPC64_SMP_H) */ diff -Nru a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h --- a/include/asm-ppc64/unistd.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-ppc64/unistd.h 2004-09-21 20:52:51 -07:00 @@ -269,9 +269,9 @@ /* Number 256 is reserved for sys_debug_setcontext */ /* Number 257 is reserved for vserver */ /* Number 258 is reserved for new sys_remap_file_pages */ -/* Number 259 is reserved for new sys_mbind */ -/* Number 260 is reserved for new sys_get_mempolicy */ -/* Number 261 is reserved for new sys_set_mempolicy */ +#define __NR_mbind 259 +#define __NR_get_mempolicy 260 +#define __NR_set_mempolicy 261 #define __NR_mq_open 262 #define __NR_mq_unlink 263 #define __NR_mq_timedsend 264 diff -Nru a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h --- a/include/asm-sh/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sh/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -3,7 +3,6 @@ #include #include -#include #include #include diff -Nru a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h --- a/include/asm-sh64/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sh64/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -3,7 +3,6 @@ #include #include -#include #include #include diff -Nru a/include/asm-sh64/smplock.h b/include/asm-sh64/smplock.h --- a/include/asm-sh64/smplock.h 2004-09-21 20:52:51 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,77 +0,0 @@ -#ifndef __ASM_SH64_SMPLOCK_H -#define __ASM_SH64_SMPLOCK_H - -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * include/asm-sh64/smplock.h - * - * Copyright (C) 2000, 2001 Paolo Alberelli - * - */ - -#include - -#ifndef CONFIG_SMP - -#define lock_kernel() do { } while(0) -#define unlock_kernel() do { } while(0) -#define release_kernel_lock(task, cpu, depth) ((depth) = 1) -#define reacquire_kernel_lock(task, cpu, depth) do { } while(0) - -#else - -#error "We do not support SMP on SH64 yet" -/* - * Default SMP lock implementation - */ - -#include -#include - -extern spinlock_t kernel_flag; - -/* - * Getting the big kernel lock. - * - * This cannot happen asynchronously, - * so we only need to worry about other - * CPU's. - */ -extern __inline__ void lock_kernel(void) -{ - if (!++current->lock_depth) - spin_lock(&kernel_flag); -} - -extern __inline__ void unlock_kernel(void) -{ - if (--current->lock_depth < 0) - spin_unlock(&kernel_flag); -} - -/* - * Release global kernel lock and global interrupt lock - */ -#define release_kernel_lock(task, cpu) \ -do { \ - if (task->lock_depth >= 0) \ - spin_unlock(&kernel_flag); \ - release_irqlock(cpu); \ - __sti(); \ -} while (0) - -/* - * Re-acquire the kernel lock - */ -#define reacquire_kernel_lock(task) \ -do { \ - if (task->lock_depth >= 0) \ - spin_lock(&kernel_flag); \ -} while (0) - -#endif /* CONFIG_SMP */ - -#endif /* __ASM_SH64_SMPLOCK_H */ diff -Nru a/include/asm-sh64/softirq.h b/include/asm-sh64/softirq.h --- a/include/asm-sh64/softirq.h 2004-09-21 20:52:51 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,30 +0,0 @@ -#ifndef __ASM_SH_SOFTIRQ_H -#define __ASM_SH_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ -do { \ - local_bh_count(smp_processor_id())++; \ - barrier(); \ -} while (0) - -#define __local_bh_enable() \ -do { \ - barrier(); \ - local_bh_count(smp_processor_id())--; \ -} while (0) - -#define local_bh_enable() \ -do { \ - barrier(); \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#endif /* __ASM_SH_SOFTIRQ_H */ diff -Nru a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h --- a/include/asm-sparc/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sparc/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -2,7 +2,6 @@ #define _ASM_SPARC_DMA_MAPPING_H #include -#include #ifdef CONFIG_PCI #include diff -Nru a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h --- a/include/asm-sparc/vaddrs.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-sparc/vaddrs.h 2004-09-21 20:52:51 -07:00 @@ -33,9 +33,9 @@ #define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */ #define IOBASE_VADDR 0xfe000000 -#define IOBASE_END 0xfe300000 +#define IOBASE_END 0xfe600000 -#define VMALLOC_START 0xfe300000 +#define VMALLOC_START 0xfe600000 /* XXX Alter this when I get around to fixing sun4c - Anton */ #define VMALLOC_END 0xffc00000 diff -Nru a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h --- a/include/asm-sparc64/dma.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-sparc64/dma.h 2004-09-21 20:52:51 -07:00 @@ -62,7 +62,7 @@ struct sbus_dma { struct sbus_dma *next; struct sbus_dev *sdev; - unsigned long regs; + void __iomem *regs; /* Status, misc info */ int node; /* Prom node for this DMA device */ diff -Nru a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h --- a/include/asm-sparc64/ebus.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sparc64/ebus.h 2004-09-21 20:52:52 -07:00 @@ -53,7 +53,7 @@ struct ebus_dma_info { spinlock_t lock; - unsigned long regs; + void __iomem *regs; unsigned int flags; #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001 diff -Nru a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h --- a/include/asm-sparc64/ide.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-sparc64/ide.h 2004-09-21 20:52:51 -07:00 @@ -38,7 +38,7 @@ #define __ide_mm_outsw __ide_outsw #define __ide_mm_outsl __ide_outsl -static __inline__ unsigned int inw_be(unsigned long addr) +static inline unsigned int inw_be(void __iomem *addr) { unsigned int ret; @@ -49,9 +49,7 @@ return ret; } -static __inline__ void __ide_insw(unsigned long port, - void *dst, - u32 count) +static inline void __ide_insw(void __iomem *port, void *dst, u32 count) { #if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ unsigned long end = (unsigned long)dst + (count << 1); @@ -81,16 +79,14 @@ #endif } -static __inline__ void outw_be(unsigned short w, unsigned long addr) +static inline void outw_be(unsigned short w, void __iomem *addr) { __asm__ __volatile__("stha %0, [%1] %2" : /* no outputs */ : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void __ide_outsw(unsigned long port, - void *src, - u32 count) +static inline void __ide_outsw(void __iomem *port, void *src, u32 count) { #if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ unsigned long end = (unsigned long)src + (count << 1); diff -Nru a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h --- a/include/asm-sparc64/io.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sparc64/io.h 2004-09-21 20:52:52 -07:00 @@ -3,6 +3,7 @@ #define __SPARC64_IO_H #include +#include #include #include /* IO address mapping routines need this */ @@ -99,28 +100,31 @@ #define inl_p(__addr) inl(__addr) #define outl_p(__l, __addr) outl(__l, __addr) -extern void outsb(unsigned long addr, const void *src, unsigned long count); -extern void outsw(unsigned long addr, const void *src, unsigned long count); -extern void outsl(unsigned long addr, const void *src, unsigned long count); -extern void insb(unsigned long addr, void *dst, unsigned long count); -extern void insw(unsigned long addr, void *dst, unsigned long count); -extern void insl(unsigned long addr, void *dst, unsigned long count); +extern void outsb(void __iomem *addr, const void *src, unsigned long count); +extern void outsw(void __iomem *addr, const void *src, unsigned long count); +extern void outsl(void __iomem *addr, const void *src, unsigned long count); +extern void insb(void __iomem *addr, void *dst, unsigned long count); +extern void insw(void __iomem *addr, void *dst, unsigned long count); +extern void insl(void __iomem *addr, void *dst, unsigned long count); +#define ioread8_rep(a,d,c) insb(a,d,c) +#define ioread16_rep(a,d,c) insw(a,d,c) +#define ioread32_rep(a,d,c) insl(a,d,c) +#define iowrite8_rep(a,s,c) outsb(a,s,c) +#define iowrite16_rep(a,s,c) outsw(a,s,c) +#define iowrite32_rep(a,s,c) outsl(a,s,c) /* Memory functions, same as I/O accesses on Ultra. */ -static __inline__ u8 _readb(unsigned long addr) -{ - u8 ret; +static inline u8 _readb(void __iomem *addr) +{ u8 ret; __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */" : "=r" (ret) : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); - return ret; } -static __inline__ u16 _readw(unsigned long addr) -{ - u16 ret; +static inline u16 _readw(void __iomem *addr) +{ u16 ret; __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */" : "=r" (ret) @@ -129,9 +133,8 @@ return ret; } -static __inline__ u32 _readl(unsigned long addr) -{ - u32 ret; +static inline u32 _readl(void __iomem *addr) +{ u32 ret; __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */" : "=r" (ret) @@ -140,9 +143,8 @@ return ret; } -static __inline__ u64 _readq(unsigned long addr) -{ - u64 ret; +static inline u64 _readq(void __iomem *addr) +{ u64 ret; __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */" : "=r" (ret) @@ -151,46 +153,46 @@ return ret; } -static __inline__ void _writeb(u8 b, unsigned long addr) +static inline void _writeb(u8 b, void __iomem *addr) { __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" : /* no outputs */ : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writew(u16 w, unsigned long addr) +static inline void _writew(u16 w, void __iomem *addr) { __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" : /* no outputs */ : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writel(u32 l, unsigned long addr) +static inline void _writel(u32 l, void __iomem *addr) { __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writeq(u64 q, unsigned long addr) +static inline void _writeq(u64 q, void __iomem *addr) { __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" : /* no outputs */ : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -#define readb(__addr) (_readb((unsigned long)(__addr))) -#define readw(__addr) (_readw((unsigned long)(__addr))) -#define readl(__addr) (_readl((unsigned long)(__addr))) -#define readq(__addr) (_readq((unsigned long)(__addr))) -#define readb_relaxed(a) readb(a) -#define readw_relaxed(a) readw(a) -#define readl_relaxed(a) readl(a) -#define readq_relaxed(a) readq(a) -#define writeb(__b, __addr) (_writeb((u8)(__b), (unsigned long)(__addr))) -#define writew(__w, __addr) (_writew((u16)(__w), (unsigned long)(__addr))) -#define writel(__l, __addr) (_writel((u32)(__l), (unsigned long)(__addr))) -#define writeq(__q, __addr) (_writeq((u64)(__q), (unsigned long)(__addr))) +#define readb(__addr) _readb(__addr) +#define readw(__addr) _readw(__addr) +#define readl(__addr) _readl(__addr) +#define readq(__addr) _readq(__addr) +#define readb_relaxed(__addr) _readb(__addr) +#define readw_relaxed(__addr) _readw(__addr) +#define readl_relaxed(__addr) _readl(__addr) +#define readq_relaxed(__addr) _readq(__addr) +#define writeb(__b, __addr) _writeb(__b, __addr) +#define writew(__w, __addr) _writew(__w, __addr) +#define writel(__l, __addr) _writel(__l, __addr) +#define writeq(__q, __addr) _writeq(__q, __addr) /* Now versions without byte-swapping. */ static __inline__ u8 _raw_readb(unsigned long addr) @@ -282,7 +284,7 @@ /* Now, SBUS variants, only difference from PCI is that we do * not use little-endian ASIs. */ -static __inline__ u8 _sbus_readb(unsigned long addr) +static inline u8 _sbus_readb(void __iomem *addr) { u8 ret; @@ -293,7 +295,7 @@ return ret; } -static __inline__ u16 _sbus_readw(unsigned long addr) +static inline u16 _sbus_readw(void __iomem *addr) { u16 ret; @@ -304,7 +306,7 @@ return ret; } -static __inline__ u32 _sbus_readl(unsigned long addr) +static inline u32 _sbus_readl(void __iomem *addr) { u32 ret; @@ -315,7 +317,7 @@ return ret; } -static __inline__ u64 _sbus_readq(unsigned long addr) +static inline u64 _sbus_readq(void __iomem *addr) { u64 ret; @@ -326,44 +328,45 @@ return ret; } -static __inline__ void _sbus_writeb(u8 b, unsigned long addr) +static inline void _sbus_writeb(u8 b, void __iomem *addr) { __asm__ __volatile__("stba\t%r0, [%1] %2\t/* sbus_writeb */" : /* no outputs */ : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writew(u16 w, unsigned long addr) +static inline void _sbus_writew(u16 w, void __iomem *addr) { __asm__ __volatile__("stha\t%r0, [%1] %2\t/* sbus_writew */" : /* no outputs */ : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writel(u32 l, unsigned long addr) +static inline void _sbus_writel(u32 l, void __iomem *addr) { __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* sbus_writel */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writeq(u64 l, unsigned long addr) +static inline void _sbus_writeq(u64 l, void __iomem *addr) { __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* sbus_writeq */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -#define sbus_readb(__addr) (_sbus_readb((unsigned long)(__addr))) -#define sbus_readw(__addr) (_sbus_readw((unsigned long)(__addr))) -#define sbus_readl(__addr) (_sbus_readl((unsigned long)(__addr))) -#define sbus_readq(__addr) (_sbus_readq((unsigned long)(__addr))) -#define sbus_writeb(__b, __addr) (_sbus_writeb((__b), (unsigned long)(__addr))) -#define sbus_writew(__w, __addr) (_sbus_writew((__w), (unsigned long)(__addr))) -#define sbus_writel(__l, __addr) (_sbus_writel((__l), (unsigned long)(__addr))) -#define sbus_writeq(__l, __addr) (_sbus_writeq((__l), (unsigned long)(__addr))) +#define sbus_readb(__addr) _sbus_readb(__addr) +#define sbus_readw(__addr) _sbus_readw(__addr) +#define sbus_readl(__addr) _sbus_readl(__addr) +#define sbus_readq(__addr) _sbus_readq(__addr) +#define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr) +#define sbus_writew(__w, __addr) _sbus_writew(__w, __addr) +#define sbus_writel(__l, __addr) _sbus_writel(__l, __addr) +#define sbus_writeq(__l, __addr) _sbus_writeq(__l, __addr) -static inline void *_sbus_memset_io(unsigned long dst, int c, __kernel_size_t n) +static inline void __iomem*_sbus_memset_io(void __iomem *dst, int c, + __kernel_size_t n) { while(n--) { sbus_writeb(c, dst); @@ -372,13 +375,12 @@ return (void *) dst; } -#define sbus_memset_io(d,c,sz) \ - _sbus_memset_io((unsigned long)d,(int)c,(__kernel_size_t)sz) +#define sbus_memset_io(d,c,sz) _sbus_memset_io(d,c,sz) -static inline void * -_memset_io(void *dst, int c, __kernel_size_t n) +static inline void __iomem * +_memset_io(void __iomem *dst, int c, __kernel_size_t n) { - char *d = dst; + void __iomem *d = dst; while (n--) { writeb(c, d); @@ -388,11 +390,10 @@ return dst; } -#define memset_io(d,c,sz) \ - _memset_io((void *)d,(int)c,(__kernel_size_t)sz) +#define memset_io(d,c,sz) _memset_io(d,c,sz) -static inline void * -_memcpy_fromio(void *dst, unsigned long src, __kernel_size_t n) +static inline void __iomem * +_memcpy_fromio(void *dst, void __iomem *src, __kernel_size_t n) { char *d = dst; @@ -405,25 +406,23 @@ return dst; } -#define memcpy_fromio(d,s,sz) \ - _memcpy_fromio((void *)d,(unsigned long)s,(__kernel_size_t)sz) +#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) -static inline void * -_memcpy_toio(unsigned long dst, const void *src, __kernel_size_t n) +static inline void __iomem * +_memcpy_toio(void __iomem *dst, const void *src, __kernel_size_t n) { const char *s = src; - unsigned long d = dst; + void __iomem *d = dst; while (n--) { char tmp = *s++; writeb(tmp, d); d++; } - return (void *)dst; + return dst; } -#define memcpy_toio(d,s,sz) \ - _memcpy_toio((unsigned long)d,(const void *)s,(__kernel_size_t)sz) +#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) static inline int check_signature(unsigned long io_addr, const unsigned char *signature, @@ -431,8 +430,9 @@ { int retval = 0; do { - if (readb(io_addr++) != *signature++) + if (readb((void __iomem *)io_addr) != *signature++) goto out; + io_addr++; } while (--length); retval = 1; out: @@ -444,10 +444,26 @@ /* On sparc64 we have the whole physical IO address space accessible * using physically addressed loads and stores, so this does nothing. */ -#define ioremap(__offset, __size) ((void *)(__offset)) +#define ioremap(__offset, __size) ((void __iomem *)(__offset)) #define ioremap_nocache(X,Y) ioremap((X),(Y)) #define iounmap(__addr) do { (void)(__addr); } while(0) +#define ioread8(X) readb(X) +#define ioread16(X) readw(X) +#define ioread32(X) readl(X) +#define iowrite8(val,X) writeb(val,X) +#define iowrite16(val,X) writew(val,X) +#define iowrite32(val,X) writel(val,X) + +/* Create a virtual mapping cookie for an IO port range */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); + /* Similarly for SBUS. */ #define sbus_ioremap(__res, __offset, __size, __name) \ ({ unsigned long __ret; \ @@ -455,11 +471,11 @@ __ret += (unsigned long) (__offset); \ if (! request_region((__ret), (__size), (__name))) \ __ret = 0UL; \ - __ret; \ + (void __iomem *) __ret; \ }) #define sbus_iounmap(__addr, __size) \ - release_region((__addr), (__size)) + release_region((unsigned long)(__addr), (__size)) /* Nothing to do */ diff -Nru a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h --- a/include/asm-sparc64/parport.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-sparc64/parport.h 2004-09-21 20:52:52 -07:00 @@ -126,10 +126,14 @@ if (ebus_ecpp_p(edev)) { unsigned long base = edev->resource[0].start; unsigned long config = edev->resource[1].start; + unsigned long d_base = edev->resource[2].start; + unsigned long d_len; spin_lock_init(&sparc_ebus_dmas[count].info.lock); + d_len = (edev->resource[2].end - + d_base) + 1; sparc_ebus_dmas[count].info.regs = - edev->resource[2].start; + ioremap(d_base, d_len); if (!sparc_ebus_dmas[count].info.regs) continue; sparc_ebus_dmas[count].info.flags = 0; diff -Nru a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h --- a/include/asm-um/processor-generic.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-um/processor-generic.h 2004-09-21 20:52:51 -07:00 @@ -22,7 +22,6 @@ struct thread_struct { int forking; - unsigned long kernel_stack; int nsyscalls; struct pt_regs regs; unsigned long cr2; @@ -73,7 +72,6 @@ #define INIT_THREAD \ { \ .forking = 0, \ - .kernel_stack = 0, \ .nsyscalls = 0, \ .regs = EMPTY_REGS, \ .cr2 = 0, \ diff -Nru a/include/asm-um/smp.h b/include/asm-um/smp.h --- a/include/asm-um/smp.h 2004-09-21 20:52:51 -07:00 +++ b/include/asm-um/smp.h 2004-09-21 20:52:51 -07:00 @@ -9,6 +9,8 @@ #include "linux/cpumask.h" extern cpumask_t cpu_online_map; +extern cpumask_t cpu_possible_map; + #define smp_processor_id() (current_thread->cpu) #define cpu_logical_map(n) (n) diff -Nru a/include/asm-um/spinlock.h b/include/asm-um/spinlock.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-um/spinlock.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,6 @@ +#ifndef __UM_SPINLOCK_H +#define __UM_SPINLOCK_H + +#include "asm/arch/spinlock.h" + +#endif diff -Nru a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h --- a/include/asm-x86_64/apic.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/apic.h 2004-09-21 20:52:52 -07:00 @@ -7,15 +7,29 @@ #include #include -#ifdef CONFIG_X86_LOCAL_APIC +#define Dprintk(x...) -#define APIC_DEBUG 0 +/* + * Debugging macros + */ +#define APIC_QUIET 0 +#define APIC_VERBOSE 1 +#define APIC_DEBUG 2 -#if APIC_DEBUG -#define Dprintk(x...) printk(x) -#else -#define Dprintk(x...) -#endif +extern int apic_verbosity; + +/* + * Define the default level of output to be very little + * This can be turned up by using apic=verbose for more + * information and apic=debug for _lots_ of information. + * apic_verbosity is defined in apic.c + */ +#define apic_printk(v, s, a...) do { \ + if ((v) <= apic_verbosity) \ + printk(s, ##a); \ + } while (0) + +#ifdef CONFIG_X86_LOCAL_APIC struct pt_regs; diff -Nru a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h --- a/include/asm-x86_64/atomic.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/atomic.h 2004-09-21 20:52:52 -07:00 @@ -178,6 +178,166 @@ return c; } +/* An 64bit atomic type */ + +typedef struct { volatile long counter; } atomic64_t; + +#define ATOMIC64_INIT(i) { (i) } + +/** + * atomic64_read - read atomic64 variable + * @v: pointer of type atomic64_t + * + * Atomically reads the value of @v. + * Doesn't imply a read memory barrier. + */ +#define atomic64_read(v) ((v)->counter) + +/** + * atomic64_set - set atomic64 variable + * @v: pointer to type atomic64_t + * @i: required value + * + * Atomically sets the value of @v to @i. + */ +#define atomic64_set(v,i) (((v)->counter) = (i)) + +/** + * atomic64_add - add integer to atomic64 variable + * @i: integer value to add + * @v: pointer to type atomic64_t + * + * Atomically adds @i to @v. + */ +static __inline__ void atomic64_add(long i, atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "addq %1,%0" + :"=m" (v->counter) + :"ir" (i), "m" (v->counter)); +} + +/** + * atomic64_sub - subtract the atomic64 variable + * @i: integer value to subtract + * @v: pointer to type atomic64_t + * + * Atomically subtracts @i from @v. + */ +static __inline__ void atomic64_sub(long i, atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "subq %1,%0" + :"=m" (v->counter) + :"ir" (i), "m" (v->counter)); +} + +/** + * atomic64_sub_and_test - subtract value from variable and test result + * @i: integer value to subtract + * @v: pointer to type atomic64_t + * + * Atomically subtracts @i from @v and returns + * true if the result is zero, or false for all + * other cases. + */ +static __inline__ int atomic64_sub_and_test(long i, atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "subq %2,%0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"ir" (i), "m" (v->counter) : "memory"); + return c; +} + +/** + * atomic64_inc - increment atomic64 variable + * @v: pointer to type atomic64_t + * + * Atomically increments @v by 1. + */ +static __inline__ void atomic64_inc(atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "incq %0" + :"=m" (v->counter) + :"m" (v->counter)); +} + +/** + * atomic64_dec - decrement atomic64 variable + * @v: pointer to type atomic64_t + * + * Atomically decrements @v by 1. + */ +static __inline__ void atomic64_dec(atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "decq %0" + :"=m" (v->counter) + :"m" (v->counter)); +} + +/** + * atomic64_dec_and_test - decrement and test + * @v: pointer to type atomic64_t + * + * Atomically decrements @v by 1 and + * returns true if the result is 0, or false for all other + * cases. + */ +static __inline__ int atomic64_dec_and_test(atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "decq %0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"m" (v->counter) : "memory"); + return c != 0; +} + +/** + * atomic64_inc_and_test - increment and test + * @v: pointer to type atomic64_t + * + * Atomically increments @v by 1 + * and returns true if the result is zero, or false for all + * other cases. + */ +static __inline__ int atomic64_inc_and_test(atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "incq %0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"m" (v->counter) : "memory"); + return c != 0; +} + +/** + * atomic64_add_negative - add and test if negative + * @v: pointer to atomic64_t + * @i: integer value to add + * + * Atomically adds @i to @v and returns true + * if the result is negative, or false when + * result is greater than or equal to zero. + */ +static __inline__ long atomic64_add_negative(long i, atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "addq %2,%0; sets %1" + :"=m" (v->counter), "=qm" (c) + :"ir" (i), "m" (v->counter) : "memory"); + return c; +} + /* These are x86-specific, used by some header files */ #define atomic_clear_mask(mask, addr) \ __asm__ __volatile__(LOCK "andl %0,%1" \ diff -Nru a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h --- a/include/asm-x86_64/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -7,7 +7,6 @@ */ #include -#include #include #include diff -Nru a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h --- a/include/asm-x86_64/elf.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/elf.h 2004-09-21 20:52:52 -07:00 @@ -144,6 +144,13 @@ extern void set_personality_64bit(void); #define SET_PERSONALITY(ex, ibcs2) set_personality_64bit() +/* + * An executable for which elf_read_implies_exec() returns TRUE will + * have the READ_IMPLIES_EXEC personality flag set automatically. + */ +#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) \ + (!(have_pt_gnu_stack)) + extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h --- a/include/asm-x86_64/ia32.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/ia32.h 2004-09-21 20:52:52 -07:00 @@ -115,7 +115,6 @@ int _status; /* exit code */ compat_clock_t _utime; compat_clock_t _stime; - struct compat_rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h --- a/include/asm-x86_64/processor.h 2004-09-21 20:52:52 -07:00 +++ b/include/asm-x86_64/processor.h 2004-09-21 20:52:52 -07:00 @@ -18,6 +18,7 @@ #include #include #include +#include #include #define TF_MASK 0x00000100 @@ -77,9 +78,6 @@ #define X86_VENDOR_NUM 8 #define X86_VENDOR_UNKNOWN 0xff -extern struct cpuinfo_x86 boot_cpu_data; -extern struct tss_struct init_tss[NR_CPUS]; - #ifdef CONFIG_SMP extern struct cpuinfo_x86 cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] @@ -229,6 +227,9 @@ unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; } __attribute__((packed)) ____cacheline_aligned; +extern struct cpuinfo_x86 boot_cpu_data; +DECLARE_PER_CPU(struct tss_struct,init_tss); + #define ARCH_MIN_TASKALIGN 16 struct thread_struct { @@ -253,6 +254,7 @@ switch faster for a limited number of ioperm using tasks. -AK */ int ioperm; unsigned long *io_bitmap_ptr; + unsigned io_bitmap_max; /* cached TLS descriptors. */ u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; } __attribute__((aligned(16))); diff -Nru a/include/linux/affs_fs.h b/include/linux/affs_fs.h --- a/include/linux/affs_fs.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/affs_fs.h 2004-09-21 20:52:51 -07:00 @@ -62,7 +62,7 @@ extern void affs_delete_inode(struct inode *inode); extern void affs_clear_inode(struct inode *inode); extern void affs_read_inode(struct inode *inode); -extern void affs_write_inode(struct inode *inode, int); +extern int affs_write_inode(struct inode *inode, int); extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type); /* super.c */ diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h --- a/include/linux/blkdev.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/blkdev.h 2004-09-21 20:52:51 -07:00 @@ -344,6 +344,7 @@ unsigned int nr_congestion_off; unsigned short max_sectors; + unsigned short max_hw_sectors; unsigned short max_phys_segments; unsigned short max_hw_segments; unsigned short hardsect_size; diff -Nru a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h --- a/include/linux/compat_ioctl.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/compat_ioctl.h 2004-09-21 20:52:52 -07:00 @@ -735,3 +735,20 @@ COMPATIBLE_IOCTL(SIOCGIWRETRY) COMPATIBLE_IOCTL(SIOCSIWPOWER) COMPATIBLE_IOCTL(SIOCGIWPOWER) +/* hiddev */ +COMPATIBLE_IOCTL(HIDIOCGVERSION) +COMPATIBLE_IOCTL(HIDIOCAPPLICATION) +COMPATIBLE_IOCTL(HIDIOCGDEVINFO) +COMPATIBLE_IOCTL(HIDIOCGSTRING) +COMPATIBLE_IOCTL(HIDIOCINITREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORT) +COMPATIBLE_IOCTL(HIDIOCSREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) +COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) +COMPATIBLE_IOCTL(HIDIOCGUSAGE) +COMPATIBLE_IOCTL(HIDIOCSUSAGE) +COMPATIBLE_IOCTL(HIDIOCGUCODE) +COMPATIBLE_IOCTL(HIDIOCGFLAG) +COMPATIBLE_IOCTL(HIDIOCSFLAG) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) diff -Nru a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h --- a/include/linux/dma-mapping.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/dma-mapping.h 2004-09-21 20:52:52 -07:00 @@ -1,6 +1,7 @@ #ifndef _ASM_LINUX_DMA_MAPPING_H #define _ASM_LINUX_DMA_MAPPING_H +#include #include /* These definitions mirror those in pci.h, so they can be used diff -Nru a/include/linux/elf.h b/include/linux/elf.h --- a/include/linux/elf.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/elf.h 2004-09-21 20:52:51 -07:00 @@ -88,7 +88,9 @@ #define EM_V850 87 /* NEC v850 */ -#define EM_H8_300 46 /* Hitachi H8/300,300H,H8S */ +#define EM_M32R 88 /* Renesas M32R */ + +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ /* * This is an interim value that we will use until the committee comes @@ -98,6 +100,9 @@ /* Bogus old v850 magic number, used by old tools. */ #define EM_CYGNUS_V850 0x9080 + +/* Bogus old m32r magic number, used by old tools. */ +#define EM_CYGNUS_M32R 0x9041 /* * This is the old interim value for S/390 architecture diff -Nru a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h --- a/include/linux/ext3_fs.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/ext3_fs.h 2004-09-21 20:52:52 -07:00 @@ -724,7 +724,7 @@ extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); extern void ext3_read_inode (struct inode *); -extern void ext3_write_inode (struct inode *, int); +extern int ext3_write_inode (struct inode *, int); extern int ext3_setattr (struct dentry *, struct iattr *); extern void ext3_put_inode (struct inode *); extern void ext3_delete_inode (struct inode *); diff -Nru a/include/linux/fs.h b/include/linux/fs.h --- a/include/linux/fs.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/fs.h 2004-09-21 20:52:51 -07:00 @@ -960,7 +960,7 @@ void (*read_inode) (struct inode *); void (*dirty_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h --- a/include/linux/genhd.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/genhd.h 2004-09-21 20:52:51 -07:00 @@ -249,7 +249,7 @@ /* check against BSD src/sys/sys/disklabel.h for consistency */ #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ -#define BSD_MAXPARTITIONS 8 +#define BSD_MAXPARTITIONS 16 #define OPENBSD_MAXPARTITIONS 16 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ struct bsd_disklabel { diff -Nru a/include/linux/ghash.h b/include/linux/ghash.h --- a/include/linux/ghash.h 2004-09-21 20:52:52 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,236 +0,0 @@ -/* - * include/linux/ghash.h -- generic hashing with fuzzy retrieval - * - * (C) 1997 Thomas Schoebel-Theuer - * - * The algorithms implemented here seem to be a completely new invention, - * and I'll publish the fundamentals in a paper. - */ - -#ifndef _GHASH_H -#define _GHASH_H -/* HASHSIZE _must_ be a power of two!!! */ - - -#define DEF_HASH_FUZZY_STRUCTS(NAME,HASHSIZE,TYPE) \ -\ -struct NAME##_table {\ - TYPE * hashtable[HASHSIZE];\ - TYPE * sorted_list;\ - int nr_entries;\ -};\ -\ -struct NAME##_ptrs {\ - TYPE * next_hash;\ - TYPE * prev_hash;\ - TYPE * next_sorted;\ - TYPE * prev_sorted;\ -}; - -#define DEF_HASH_FUZZY(LINKAGE,NAME,HASHSIZE,TYPE,PTRS,KEYTYPE,KEY,KEYCMP,KEYEQ,HASHFN)\ -\ -LINKAGE void insert_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - int ix = HASHFN(elem->KEY);\ - TYPE ** base = &tbl->hashtable[ix];\ - TYPE * ptr = *base;\ - TYPE * prev = NULL;\ -\ - tbl->nr_entries++;\ - while(ptr && KEYCMP(ptr->KEY, elem->KEY)) {\ - base = &ptr->PTRS.next_hash;\ - prev = ptr;\ - ptr = *base;\ - }\ - elem->PTRS.next_hash = ptr;\ - elem->PTRS.prev_hash = prev;\ - if(ptr) {\ - ptr->PTRS.prev_hash = elem;\ - }\ - *base = elem;\ -\ - ptr = prev;\ - if(!ptr) {\ - ptr = tbl->sorted_list;\ - prev = NULL;\ - } else {\ - prev = ptr->PTRS.prev_sorted;\ - }\ - while(ptr) {\ - TYPE * next = ptr->PTRS.next_hash;\ - if(next && KEYCMP(next->KEY, elem->KEY)) {\ - prev = ptr;\ - ptr = next;\ - } else if(KEYCMP(ptr->KEY, elem->KEY)) {\ - prev = ptr;\ - ptr = ptr->PTRS.next_sorted;\ - } else\ - break;\ - }\ - elem->PTRS.next_sorted = ptr;\ - elem->PTRS.prev_sorted = prev;\ - if(ptr) {\ - ptr->PTRS.prev_sorted = elem;\ - }\ - if(prev) {\ - prev->PTRS.next_sorted = elem;\ - } else {\ - tbl->sorted_list = elem;\ - }\ -}\ -\ -LINKAGE void remove_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - TYPE * next = elem->PTRS.next_hash;\ - TYPE * prev = elem->PTRS.prev_hash;\ -\ - tbl->nr_entries--;\ - if(next)\ - next->PTRS.prev_hash = prev;\ - if(prev)\ - prev->PTRS.next_hash = next;\ - else {\ - int ix = HASHFN(elem->KEY);\ - tbl->hashtable[ix] = next;\ - }\ -\ - next = elem->PTRS.next_sorted;\ - prev = elem->PTRS.prev_sorted;\ - if(next)\ - next->PTRS.prev_sorted = prev;\ - if(prev)\ - prev->PTRS.next_sorted = next;\ - else\ - tbl->sorted_list = next;\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix = hashfn(pos);\ - TYPE * ptr = tbl->hashtable[ix];\ - while(ptr && KEYCMP(ptr->KEY, pos))\ - ptr = ptr->PTRS.next_hash;\ - if(ptr && !KEYEQ(ptr->KEY, pos))\ - ptr = NULL;\ - return ptr;\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash_fuzzy(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix;\ - int offset;\ - TYPE * ptr;\ - TYPE * next;\ -\ - ptr = tbl->sorted_list;\ - if(!ptr || KEYCMP(pos, ptr->KEY))\ - return NULL;\ - ix = HASHFN(pos);\ - offset = HASHSIZE;\ - do {\ - offset >>= 1;\ - next = tbl->hashtable[(ix+offset) & ((HASHSIZE)-1)];\ - if(next && (KEYCMP(next->KEY, pos) || KEYEQ(next->KEY, pos))\ - && KEYCMP(ptr->KEY, next->KEY))\ - ptr = next;\ - } while(offset);\ -\ - for(;;) {\ - next = ptr->PTRS.next_hash;\ - if(next) {\ - if(KEYCMP(next->KEY, pos)) {\ - ptr = next;\ - continue;\ - }\ - }\ - next = ptr->PTRS.next_sorted;\ - if(next && KEYCMP(next->KEY, pos)) {\ - ptr = next;\ - continue;\ - }\ - return ptr;\ - }\ - return NULL;\ -} - -/* LINKAGE - empty or "static", depending on whether you want the definitions to - * be public or not - * NAME - a string to stick in names to make this hash table type distinct from - * any others - * HASHSIZE - number of buckets - * TYPE - type of data contained in the buckets - must be a structure, one - * field is of type NAME_ptrs, another is the hash key - * PTRS - TYPE must contain a field of type NAME_ptrs, PTRS is the name of that - * field - * KEYTYPE - type of the key field within TYPE - * KEY - name of the key field within TYPE - * KEYCMP - pointer to function that compares KEYTYPEs to each other - the - * prototype is int KEYCMP(KEYTYPE, KEYTYPE), it returns zero for equal, - * non-zero for not equal - * HASHFN - the hash function - the prototype is int HASHFN(KEYTYPE), - * it returns a number in the range 0 ... HASHSIZE - 1 - * Call DEF_HASH_STRUCTS, define your hash table as a NAME_table, then call - * DEF_HASH. - */ - -#define DEF_HASH_STRUCTS(NAME,HASHSIZE,TYPE) \ -\ -struct NAME##_table {\ - TYPE * hashtable[HASHSIZE];\ - int nr_entries;\ -};\ -\ -struct NAME##_ptrs {\ - TYPE * next_hash;\ - TYPE * prev_hash;\ -}; - -#define DEF_HASH(LINKAGE,NAME,TYPE,PTRS,KEYTYPE,KEY,KEYCMP,HASHFN)\ -\ -LINKAGE void insert_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - int ix = HASHFN(elem->KEY);\ - TYPE ** base = &tbl->hashtable[ix];\ - TYPE * ptr = *base;\ - TYPE * prev = NULL;\ -\ - tbl->nr_entries++;\ - while(ptr && KEYCMP(ptr->KEY, elem->KEY)) {\ - base = &ptr->PTRS.next_hash;\ - prev = ptr;\ - ptr = *base;\ - }\ - elem->PTRS.next_hash = ptr;\ - elem->PTRS.prev_hash = prev;\ - if(ptr) {\ - ptr->PTRS.prev_hash = elem;\ - }\ - *base = elem;\ -}\ -\ -LINKAGE void remove_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - TYPE * next = elem->PTRS.next_hash;\ - TYPE * prev = elem->PTRS.prev_hash;\ -\ - tbl->nr_entries--;\ - if(next)\ - next->PTRS.prev_hash = prev;\ - if(prev)\ - prev->PTRS.next_hash = next;\ - else {\ - int ix = HASHFN(elem->KEY);\ - tbl->hashtable[ix] = next;\ - }\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix = HASHFN(pos);\ - TYPE * ptr = tbl->hashtable[ix];\ - while(ptr && KEYCMP(ptr->KEY, pos))\ - ptr = ptr->PTRS.next_hash;\ - return ptr;\ -} - -#endif diff -Nru a/include/linux/hardirq.h b/include/linux/hardirq.h --- a/include/linux/hardirq.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/hardirq.h 2004-09-21 20:52:51 -07:00 @@ -2,9 +2,7 @@ #define LINUX_HARDIRQ_H #include -#ifdef CONFIG_PREEPT #include -#endif #include #define __IRQ_MASK(x) ((1UL << (x))-1) @@ -28,9 +26,6 @@ #define in_irq() (hardirq_count()) #define in_softirq() (softirq_count()) #define in_interrupt() (irq_count()) - -#define hardirq_trylock() (!in_interrupt()) -#define hardirq_endlock() do { } while (0) #ifdef CONFIG_PREEMPT # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) diff -Nru a/include/linux/if_ether.h b/include/linux/if_ether.h --- a/include/linux/if_ether.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/if_ether.h 2004-09-21 20:52:52 -07:00 @@ -59,6 +59,8 @@ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol + * defined in draft-wilson-wrec-wccp-v2-00.txt */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ diff -Nru a/include/linux/input.h b/include/linux/input.h --- a/include/linux/input.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/input.h 2004-09-21 20:52:51 -07:00 @@ -527,6 +527,8 @@ #define MSC_SERIAL 0x00 #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 +#define MSC_RAW 0x03 +#define MSC_SCAN 0x04 #define MSC_MAX 0x07 /* diff -Nru a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h --- a/include/linux/ip6_tunnel.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/ip6_tunnel.h 2004-09-21 20:52:51 -07:00 @@ -16,6 +16,8 @@ #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 /* being used for Mobile IPv6 */ #define IP6_TNL_F_MIP6_DEV 0x8 +/* copy DSCP from the outer packet */ +#define IP6_TNL_F_RCV_DSCP_COPY 0x10 struct ip6_tnl_parm { char name[IFNAMSIZ]; /* name of tunnel device */ diff -Nru a/include/linux/ipv6.h b/include/linux/ipv6.h --- a/include/linux/ipv6.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/ipv6.h 2004-09-21 20:52:52 -07:00 @@ -282,6 +282,10 @@ return &((struct raw6_sock *)__sk)->raw6; } +struct ipv6_sk_offset { + int offset; +}; + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) diff -Nru a/include/linux/libata.h b/include/linux/libata.h --- a/include/linux/libata.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/libata.h 2004-09-21 20:52:51 -07:00 @@ -320,6 +320,7 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); u8 (*check_status)(struct ata_port *ap); + void (*dev_select)(struct ata_port *ap, unsigned int device); void (*phy_reset) (struct ata_port *ap); void (*post_set_mode) (struct ata_port *ap); @@ -362,6 +363,7 @@ }; extern void ata_port_probe(struct ata_port *); +extern void __sata_phy_reset(struct ata_port *ap); extern void sata_phy_reset(struct ata_port *ap); extern void ata_bus_reset(struct ata_port *ap); extern void ata_port_disable(struct ata_port *); @@ -379,31 +381,32 @@ /* * 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 void ata_noop_dev_select (struct ata_port *ap, unsigned int device); +extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); +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, unsigned int buflen); extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, unsigned int n_elem); +extern unsigned int ata_dev_classify(struct ata_taskfile *tf); 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); diff -Nru a/include/linux/miscdevice.h b/include/linux/miscdevice.h --- a/include/linux/miscdevice.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/miscdevice.h 2004-09-21 20:52:52 -07:00 @@ -19,6 +19,7 @@ #define SUN_OPENPROM_MINOR 139 #define DMAPI_MINOR 140 /* DMAPI */ #define NVRAM_MINOR 144 +#define SGI_MMTIMER 153 #define STORE_QUEUE_MINOR 155 #define I2O_MINOR 166 #define MICROCODE_MINOR 184 diff -Nru a/include/linux/mmc/card.h b/include/linux/mmc/card.h --- a/include/linux/mmc/card.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/mmc/card.h 2004-09-21 20:52:52 -07:00 @@ -14,16 +14,17 @@ struct mmc_cid { unsigned int manfid; - unsigned int serial; char prod_name[8]; + unsigned int serial; + unsigned short oemid; + unsigned short year; unsigned char hwrev; unsigned char fwrev; unsigned char month; - unsigned char year; }; struct mmc_csd { - unsigned char mmc_prot; + unsigned char mmca_vsn; unsigned short cmdclass; unsigned short tacc_clks; unsigned int tacc_ns; @@ -43,14 +44,22 @@ struct device dev; /* the device */ unsigned int rca; /* relative card address of device */ unsigned int state; /* (our) card state */ -#define MMC_STATE_PRESENT (1<<0) -#define MMC_STATE_DEAD (1<<1) +#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ +#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ +#define MMC_STATE_BAD (1<<2) /* unrecognised device */ + u32 raw_cid[4]; /* raw card CID */ + u32 raw_csd[4]; /* raw card CSD */ struct mmc_cid cid; /* card identification */ struct mmc_csd csd; /* card specific */ }; -#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) +#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) +#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) + +#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) +#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) +#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) ((c)->dev.bus_id) diff -Nru a/include/linux/mmtimer.h b/include/linux/mmtimer.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/linux/mmtimer.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,140 @@ +/* + * Intel Multimedia Timer device interface + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved. + * + * This file should define an interface compatible with the IA-PC Multimedia + * Timers Draft Specification (rev. 0.97) from Intel. Note that some + * hardware may not be able to safely export its registers to userspace, + * so the ioctl interface should support all necessary functionality. + * + * 11/01/01 - jbarnes - initial revision + * 9/10/04 - Christoph Lameter - remove interrupt support + */ + +#ifndef _LINUX_MMTIMER_H +#define _LINUX_MMTIMER_H + +/* name of the device, usually in /dev */ +#define MMTIMER_NAME "mmtimer" +#define MMTIMER_FULLNAME "/dev/mmtimer" +#define MMTIMER_DESC "IA-PC Multimedia Timer" +#define MMTIMER_VERSION "1.0" + +/* + * Breakdown of the ioctl's available. An 'optional' next to the command + * indicates that supporting this command is optional, while 'required' + * commands must be implemented if conformance is desired. + * + * MMTIMER_GETOFFSET - optional + * Should return the offset (relative to the start of the page where the + * registers are mapped) for the counter in question. + * + * MMTIMER_GETRES - required + * The resolution of the clock in femto (10^-15) seconds + * + * MMTIMER_GETFREQ - required + * Frequency of the clock in Hz + * + * MMTIMER_GETBITS - required + * Number of bits in the clock's counter + * + * MMTIMER_MMAPAVAIL - required + * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise + * + * MMTIMER_GETCOUNTER - required + * Gets the current value in the counter + */ +#define MMTIMER_IOCTL_BASE 'm' + +#define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) +#define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) +#define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) +#define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) +#define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) +#define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) + +/* + * An mmtimer verification program. WARNINGs are ok, but ERRORs indicate + * that the device doesn't fully support the interface defined here. + */ +#ifdef _MMTIMER_TEST_PROGRAM + +#include +#include +#include +#include +#include +#include + +#include + +#include "mmtimer.h" + +int main(int argc, char *argv[]) +{ + int result, fd; + unsigned long val = 0; + unsigned long i; + + if((fd = open("/dev/"MMTIMER_NAME, O_RDONLY)) == -1) { + printf("failed to open /dev/%s", MMTIMER_NAME); + return 1; + } + + /* + * Can we mmap in the counter? + */ + if((result = ioctl(fd, MMTIMER_MMAPAVAIL, 0)) == 1) { + printf("mmap available\n"); + /* ... so try getting the offset for each clock */ + if((result = ioctl(fd, MMTIMER_GETOFFSET, 0)) != -ENOSYS) + printf("offset: %d\n", result); + else + printf("WARNING: offset unavailable for clock\n"); + } + else + printf("WARNING: mmap unavailable\n"); + + /* + * Get the resolution in femtoseconds + */ + if((result = ioctl(fd, MMTIMER_GETRES, &val)) != -ENOSYS) + printf("resolution: %ld femtoseconds\n", val); + else + printf("ERROR: failed to get resolution\n"); + + /* + * Get the frequency in Hz + */ + if((result = ioctl(fd, MMTIMER_GETFREQ, &val)) != -ENOSYS) + if(val < 10000000) /* less than 10 MHz? */ + printf("ERROR: frequency only %ld MHz, should be >= 10 MHz\n", val/1000000); + else + printf("frequency: %ld MHz\n", val/1000000); + else + printf("ERROR: failed to get frequency\n"); + + /* + * How many bits in the counter? + */ + if((result = ioctl(fd, MMTIMER_GETBITS, 0)) != -ENOSYS) + printf("bits in counter: %d\n", result); + else + printf("ERROR: can't get number of bits in counter\n"); + + if((result = ioctl(fd, MMTIMER_GETCOUNTER, &val)) != -ENOSYS) + printf("counter value: %ld\n", val); + else + printf("ERROR: can't get counter value\n"); + + return 0; +} + +#endif /* _MMTIMER_TEST_PROGRM */ + +#endif /* _LINUX_MMTIMER_H */ diff -Nru a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h --- a/include/linux/msdos_fs.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/msdos_fs.h 2004-09-21 20:52:52 -07:00 @@ -276,7 +276,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, struct inode_operations *fs_dir_inode_ops, int isvfat); extern int fat_statfs(struct super_block *sb, struct kstatfs *buf); -extern void fat_write_inode(struct inode *inode, int wait); +extern int fat_write_inode(struct inode *inode, int wait); extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); /* fat/misc.c */ diff -Nru a/include/linux/net.h b/include/linux/net.h --- a/include/linux/net.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/net.h 2004-09-21 20:52:51 -07:00 @@ -21,6 +21,7 @@ #include #include #include +#include struct poll_table_struct; struct inode; @@ -61,8 +62,13 @@ #define SOCK_ASYNC_WAITDATA 1 #define SOCK_NOSPACE 2 +#ifndef ARCH_HAS_SOCKET_TYPES /** sock_type - Socket types - * + * + * When adding some new socket type please + * grep ARCH_HAS_SOCKET_TYPE include/asm-* /socket.h, at least MIPS + * overrides this enum for binary compat reasons. + * * @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket * @SOCK_RAW - raw socket @@ -81,6 +87,8 @@ }; #define SOCK_MAX (SOCK_PACKET + 1) + +#endif /* ARCH_HAS_SOCKET_TYPES */ /** * struct socket - general BSD socket diff -Nru a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/linux/netfilter_ipv6/ip6t_physdev.h 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,24 @@ +#ifndef _IP6T_PHYSDEV_H +#define _IP6T_PHYSDEV_H + +#ifdef __KERNEL__ +#include +#endif + +#define IP6T_PHYSDEV_OP_IN 0x01 +#define IP6T_PHYSDEV_OP_OUT 0x02 +#define IP6T_PHYSDEV_OP_BRIDGED 0x04 +#define IP6T_PHYSDEV_OP_ISIN 0x08 +#define IP6T_PHYSDEV_OP_ISOUT 0x10 +#define IP6T_PHYSDEV_OP_MASK (0x20 - 1) + +struct ip6t_physdev_info { + char physindev[IFNAMSIZ]; + char in_mask[IFNAMSIZ]; + char physoutdev[IFNAMSIZ]; + char out_mask[IFNAMSIZ]; + u_int8_t invert; + u_int8_t bitmask; +}; + +#endif /*_IP6T_PHYSDEV_H*/ diff -Nru a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h --- a/include/linux/pfkeyv2.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/pfkeyv2.h 2004-09-21 20:52:52 -07:00 @@ -245,6 +245,7 @@ /* Security Association flags */ #define SADB_SAFLAGS_PFS 1 +#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 #define SADB_SAFLAGS_NOECN 0x80000000 /* Security Association states */ diff -Nru a/include/linux/prctl.h b/include/linux/prctl.h --- a/include/linux/prctl.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/prctl.h 2004-09-21 20:52:52 -07:00 @@ -50,4 +50,6 @@ process timing */ +#define PR_SET_NAME 15 /* Set process name */ + #endif /* _LINUX_PRCTL_H */ diff -Nru a/include/linux/quota.h b/include/linux/quota.h --- a/include/linux/quota.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/quota.h 2004-09-21 20:52:52 -07:00 @@ -45,7 +45,6 @@ typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ typedef __u64 qsize_t; /* Type in which we store sizes */ -extern spinlock_t dq_list_lock; extern spinlock_t dq_data_lock; /* Size of blocks in which are counted size limits */ diff -Nru a/include/linux/raid/md.h b/include/linux/raid/md.h --- a/include/linux/raid/md.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/raid/md.h 2004-09-21 20:52:51 -07:00 @@ -69,7 +69,6 @@ extern void md_unregister_thread (mdk_thread_t *thread); extern void md_wakeup_thread(mdk_thread_t *thread); extern void md_check_recovery(mddev_t *mddev); -extern void md_interrupt_thread (mdk_thread_t *thread); extern void md_write_start(mddev_t *mddev); extern void md_write_end(mddev_t *mddev); extern void md_handle_safemode(mddev_t *mddev); diff -Nru a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h --- a/include/linux/reiserfs_fs.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/reiserfs_fs.h 2004-09-21 20:52:52 -07:00 @@ -1945,7 +1945,7 @@ int reiserfs_find_actor(struct inode * inode, void *p) ; int reiserfs_init_locked_inode(struct inode * inode, void *p) ; void reiserfs_delete_inode (struct inode * inode); -void reiserfs_write_inode (struct inode * inode, int) ; +int reiserfs_write_inode (struct inode * inode, int) ; struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, int len, int fhtype, diff -Nru a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h --- a/include/linux/rtnetlink.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/rtnetlink.h 2004-09-21 20:52:52 -07:00 @@ -9,53 +9,89 @@ /* Types of messages */ -#define RTM_BASE 0x10 - -#define RTM_NEWLINK (RTM_BASE+0) -#define RTM_DELLINK (RTM_BASE+1) -#define RTM_GETLINK (RTM_BASE+2) -#define RTM_SETLINK (RTM_BASE+3) - -#define RTM_NEWADDR (RTM_BASE+4) -#define RTM_DELADDR (RTM_BASE+5) -#define RTM_GETADDR (RTM_BASE+6) - -#define RTM_NEWROUTE (RTM_BASE+8) -#define RTM_DELROUTE (RTM_BASE+9) -#define RTM_GETROUTE (RTM_BASE+10) - -#define RTM_NEWNEIGH (RTM_BASE+12) -#define RTM_DELNEIGH (RTM_BASE+13) -#define RTM_GETNEIGH (RTM_BASE+14) - -#define RTM_NEWRULE (RTM_BASE+16) -#define RTM_DELRULE (RTM_BASE+17) -#define RTM_GETRULE (RTM_BASE+18) - -#define RTM_NEWQDISC (RTM_BASE+20) -#define RTM_DELQDISC (RTM_BASE+21) -#define RTM_GETQDISC (RTM_BASE+22) - -#define RTM_NEWTCLASS (RTM_BASE+24) -#define RTM_DELTCLASS (RTM_BASE+25) -#define RTM_GETTCLASS (RTM_BASE+26) - -#define RTM_NEWTFILTER (RTM_BASE+28) -#define RTM_DELTFILTER (RTM_BASE+29) -#define RTM_GETTFILTER (RTM_BASE+30) - -#define RTM_NEWACTION (RTM_BASE+32) -#define RTM_DELACTION (RTM_BASE+33) -#define RTM_GETACTION (RTM_BASE+34) - -#define RTM_NEWPREFIX (RTM_BASE+36) -#define RTM_GETPREFIX (RTM_BASE+38) - -#define RTM_GETMULTICAST (RTM_BASE+42) - -#define RTM_GETANYCAST (RTM_BASE+46) - -#define RTM_MAX (RTM_BASE+47) +enum { + RTM_BASE = 16, +#define RTM_BASE RTM_BASE + + RTM_NEWLINK = 16, +#define RTM_NEWLINK RTM_NEWLINK + RTM_DELLINK, +#define RTM_DELLINK RTM_DELLINK + RTM_GETLINK, +#define RTM_GETLINK RTM_GETLINK + RTM_SETLINK, +#define RTM_SETLINK RTM_SETLINK + + RTM_NEWADDR = 20, +#define RTM_NEWADDR RTM_NEWADDR + RTM_DELADDR, +#define RTM_DELADDR RTM_DELADDR + RTM_GETADDR, +#define RTM_GETADDR RTM_GETADDR + + RTM_NEWROUTE = 24, +#define RTM_NEWROUTE RTM_NEWROUTE + RTM_DELROUTE, +#define RTM_DELROUTE RTM_DELROUTE + RTM_GETROUTE, +#define RTM_GETROUTE RTM_GETROUTE + + RTM_NEWNEIGH = 28, +#define RTM_NEWNEIGH RTM_NEWNEIGH + RTM_DELNEIGH, +#define RTM_DELNEIGH RTM_DELNEIGH + RTM_GETNEIGH, +#define RTM_GETNEIGH RTM_GETNEIGH + + RTM_NEWRULE = 32, +#define RTM_NEWRULE RTM_NEWRULE + RTM_DELRULE, +#define RTM_DELRULE RTM_DELRULE + RTM_GETRULE, +#define RTM_GETRULE RTM_GETRULE + + RTM_NEWQDISC = 36, +#define RTM_NEWQDISC RTM_NEWQDISC + RTM_DELQDISC, +#define RTM_DELQDISC RTM_DELQDISC + RTM_GETQDISC, +#define RTM_GETQDISC RTM_GETQDISC + + RTM_NEWTCLASS = 40, +#define RTM_NEWTCLASS RTM_NEWTCLASS + RTM_DELTCLASS, +#define RTM_DELTCLASS RTM_DELTCLASS + RTM_GETTCLASS, +#define RTM_GETTCLASS RTM_GETTCLASS + + RTM_NEWTFILTER = 44, +#define RTM_NEWTFILTER RTM_NEWTFILTER + RTM_DELTFILTER, +#define RTM_DELTFILTER RTM_DELTFILTER + RTM_GETTFILTER, +#define RTM_GETTFILTER RTM_GETTFILTER + + RTM_NEWACTION = 48, +#define RTM_NEWACTION RTM_NEWACTION + RTM_DELACTION, +#define RTM_DELACTION RTM_DELACTION + RTM_GETACTION, +#define RTM_GETACTION RTM_GETACTION + + RTM_NEWPREFIX = 52, +#define RTM_NEWPREFIX RTM_NEWPREFIX + RTM_GETPREFIX = 54, +#define RTM_GETPREFIX RTM_GETPREFIX + + RTM_GETMULTICAST = 58, +#define RTM_GETMULTICAST RTM_GETMULTICAST + + RTM_GETANYCAST = 62, +#define RTM_GETANYCAST RTM_GETANYCAST + + RTM_MAX, +#define RTM_MAX RTM_MAX +}; /* Generic structure for encapsulation of optional route information. diff -Nru a/include/linux/sched.h b/include/linux/sched.h --- a/include/linux/sched.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/sched.h 2004-09-21 20:52:51 -07:00 @@ -1024,6 +1024,9 @@ } #endif +extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); +extern long sched_getaffinity(pid_t pid, cpumask_t *mask); + #endif /* __KERNEL__ */ #endif diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h --- a/include/linux/serial_core.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/serial_core.h 2004-09-21 20:52:51 -07:00 @@ -176,6 +176,7 @@ #define UPIO_PORT (0) #define UPIO_HUB6 (1) #define UPIO_MEM (2) +#define UPIO_MEM32 (3) unsigned int read_status_mask; /* driver specific */ unsigned int ignore_status_mask; /* driver specific */ diff -Nru a/include/linux/serio.h b/include/linux/serio.h --- a/include/linux/serio.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/serio.h 2004-09-21 20:52:52 -07:00 @@ -17,12 +17,17 @@ #ifdef __KERNEL__ #include +#include +#include struct serio { void *private; - void *driver; - char *name; - char *phys; + void *port_data; + + char name[32]; + char phys[32]; + + unsigned int manual_bind; unsigned short idbus; unsigned short idvendor; @@ -32,31 +37,43 @@ unsigned long type; unsigned long event; + spinlock_t lock; /* protects critical sections from port's interrupt handler */ + int (*write)(struct serio *, unsigned char); int (*open)(struct serio *); void (*close)(struct serio *); - struct serio_dev *dev; + struct serio *parent, *child; + + struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock */ + + struct device dev; struct list_head node; }; +#define to_serio_port(d) container_of(d, struct serio, dev) -struct serio_dev { +struct serio_driver { void *private; - char *name; + char *description; + + unsigned int manual_bind; void (*write_wakeup)(struct serio *); irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int, struct pt_regs *); - void (*connect)(struct serio *, struct serio_dev *dev); + void (*connect)(struct serio *, struct serio_driver *drv); int (*reconnect)(struct serio *); void (*disconnect)(struct serio *); void (*cleanup)(struct serio *); + struct device_driver driver; + struct list_head node; }; +#define to_serio_driver(d) container_of(d, struct serio_driver, driver) -int serio_open(struct serio *serio, struct serio_dev *dev); +int serio_open(struct serio *serio, struct serio_driver *drv); void serio_close(struct serio *serio); void serio_rescan(struct serio *serio); void serio_reconnect(struct serio *serio); @@ -64,12 +81,11 @@ void serio_register_port(struct serio *serio); void serio_register_port_delayed(struct serio *serio); -void __serio_register_port(struct serio *serio); void serio_unregister_port(struct serio *serio); void serio_unregister_port_delayed(struct serio *serio); -void __serio_unregister_port(struct serio *serio); -void serio_register_device(struct serio_dev *dev); -void serio_unregister_device(struct serio_dev *dev); + +void serio_register_driver(struct serio_driver *drv); +void serio_unregister_driver(struct serio_driver *drv); static __inline__ int serio_write(struct serio *serio, unsigned char data) { @@ -79,17 +95,33 @@ return -1; } -static __inline__ void serio_dev_write_wakeup(struct serio *serio) +static __inline__ void serio_drv_write_wakeup(struct serio *serio) { - if (serio->dev && serio->dev->write_wakeup) - serio->dev->write_wakeup(serio); + if (serio->drv && serio->drv->write_wakeup) + serio->drv->write_wakeup(serio); } static __inline__ void serio_cleanup(struct serio *serio) { - if (serio->dev && serio->dev->cleanup) - serio->dev->cleanup(serio); + if (serio->drv && serio->drv->cleanup) + serio->drv->cleanup(serio); } + + +/* + * Use the following fucntions to protect critical sections in + * driver code from port's interrupt handler + */ +static __inline__ void serio_pause_rx(struct serio *serio) +{ + spin_lock_irq(&serio->lock); +} + +static __inline__ void serio_continue_rx(struct serio *serio) +{ + spin_unlock_irq(&serio->lock); +} + #endif diff -Nru a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h --- a/include/linux/shmem_fs.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/shmem_fs.h 2004-09-21 20:52:52 -07:00 @@ -10,14 +10,14 @@ struct shmem_inode_info { spinlock_t lock; - unsigned long next_index; - swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */ - struct page *i_indirect; /* indirect blocks */ - unsigned long alloced; /* data pages allocated to file */ - unsigned long swapped; /* subtotal assigned to swap */ unsigned long flags; - struct shared_policy policy; - struct list_head list; + unsigned long alloced; /* data pages alloced to file */ + unsigned long swapped; /* subtotal assigned to swap */ + unsigned long next_index; /* highest alloced index + 1 */ + struct shared_policy policy; /* NUMA memory alloc policy */ + struct page *i_indirect; /* top indirect blocks page */ + swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ + struct list_head swaplist; /* chain of maybes on swap */ struct inode vfs_inode; }; diff -Nru a/include/linux/slab.h b/include/linux/slab.h --- a/include/linux/slab.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/slab.h 2004-09-21 20:52:52 -07:00 @@ -55,7 +55,6 @@ /* prototypes */ extern void kmem_cache_init(void); -extern kmem_cache_t *kmem_find_general_cachep(size_t, int gfpflags); extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, void (*)(void *, kmem_cache_t *, unsigned long), void (*)(void *, kmem_cache_t *, unsigned long)); diff -Nru a/include/linux/syscalls.h b/include/linux/syscalls.h --- a/include/linux/syscalls.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/syscalls.h 2004-09-21 20:52:52 -07:00 @@ -160,11 +160,12 @@ asmlinkage long sys_exit(int error_code); asmlinkage void sys_exit_group(int error_code); -asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr, +asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, int options, struct rusage __user *ru); asmlinkage long sys_waitid(int which, pid_t pid, - struct siginfo __user *infop, int options); -asmlinkage long sys_waitpid(pid_t pid, unsigned int __user *stat_addr, int options); + struct siginfo __user *infop, + int options, struct rusage __user *ru); +asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options); asmlinkage long sys_set_tid_address(int __user *tidptr); asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, struct timespec __user *utime, u32 __user *uaddr2, diff -Nru a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h --- a/include/linux/ufs_fs.h 2004-09-21 20:52:52 -07:00 +++ b/include/linux/ufs_fs.h 2004-09-21 20:52:52 -07:00 @@ -898,7 +898,7 @@ extern u64 ufs_frag_map (struct inode *, sector_t); extern void ufs_read_inode (struct inode *); extern void ufs_put_inode (struct inode *); -extern void ufs_write_inode (struct inode *, int); +extern int ufs_write_inode (struct inode *, int); extern int ufs_sync_inode (struct inode *); extern void ufs_delete_inode (struct inode *); extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *); diff -Nru a/include/linux/xfrm.h b/include/linux/xfrm.h --- a/include/linux/xfrm.h 2004-09-21 20:52:51 -07:00 +++ b/include/linux/xfrm.h 2004-09-21 20:52:51 -07:00 @@ -190,6 +190,7 @@ __u8 replay_window; __u8 flags; #define XFRM_STATE_NOECN 1 +#define XFRM_STATE_DECAP_DSCP 2 }; struct xfrm_usersa_id { diff -Nru a/include/net/inet_ecn.h b/include/net/inet_ecn.h --- a/include/net/inet_ecn.h 2004-09-21 20:52:52 -07:00 +++ b/include/net/inet_ecn.h 2004-09-21 20:52:52 -07:00 @@ -2,6 +2,7 @@ #define _INET_ECN_H_ #include +#include enum { INET_ECN_NOT_ECT = 0, @@ -77,13 +78,17 @@ iph->tos &= ~INET_ECN_MASK; } -#define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF) +static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) +{ + u32 dscp = ipv4_get_dsfield(outer) & ~INET_ECN_MASK; + ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); +} struct ipv6hdr; static inline void IP6_ECN_set_ce(struct ipv6hdr *iph) { - if (INET_ECN_is_not_ect(ip6_get_dsfield(iph))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) return; *(u32*)iph |= htonl(INET_ECN_CE << 20); } @@ -91,6 +96,12 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph) { *(u32*)iph &= ~htonl(INET_ECN_MASK << 20); +} + +static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) +{ + u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; + ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); } #endif diff -Nru a/include/net/ip6_route.h b/include/net/ip6_route.h --- a/include/net/ip6_route.h 2004-09-21 20:52:51 -07:00 +++ b/include/net/ip6_route.h 2004-09-21 20:52:51 -07:00 @@ -89,9 +89,12 @@ extern void rt6_purge_dflt_routers(int lst_resort); +extern void rt6_reset_dflt_pointer(struct rt6_info *rt); + extern void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr, struct neighbour *neigh, + u8 *lladdr, int on_link); extern void rt6_pmtu_discovery(struct in6_addr *daddr, diff -Nru a/include/net/ip_fib.h b/include/net/ip_fib.h --- a/include/net/ip_fib.h 2004-09-21 20:52:52 -07:00 +++ b/include/net/ip_fib.h 2004-09-21 20:52:52 -07:00 @@ -23,8 +23,7 @@ /* WARNING: The ordering of these elements must match ordering * of RTA_* rtnetlink attribute numbers. */ -struct kern_rta -{ +struct kern_rta { void *rta_dst; void *rta_src; int *rta_iif; @@ -40,9 +39,12 @@ struct rta_session *rta_sess; }; -struct fib_nh -{ - struct net_device *nh_dev; +struct fib_info; + +struct fib_nh { + struct net_device *nh_dev; + struct hlist_node nh_hash; + struct fib_info *nh_parent; unsigned nh_flags; unsigned char nh_scope; #ifdef CONFIG_IP_ROUTE_MULTIPATH @@ -60,10 +62,9 @@ * This structure contains data shared by many of routes. */ -struct fib_info -{ - struct fib_info *fib_next; - struct fib_info *fib_prev; +struct fib_info { + struct hlist_node fib_hash; + struct hlist_node fib_lhash; int fib_treeref; atomic_t fib_clntref; int fib_dead; @@ -89,8 +90,7 @@ struct fib_rule; #endif -struct fib_result -{ +struct fib_result { unsigned char prefixlen; unsigned char nh_sel; unsigned char type; @@ -119,8 +119,7 @@ #define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) #define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) -struct fib_table -{ +struct fib_table { unsigned char tb_id; unsigned tb_stamp; int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); diff -Nru a/include/net/neighbour.h b/include/net/neighbour.h --- a/include/net/neighbour.h 2004-09-21 20:52:52 -07:00 +++ b/include/net/neighbour.h 2004-09-21 20:52:52 -07:00 @@ -51,7 +51,7 @@ #include #include -#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_DELAY|NUD_PROBE) +#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) @@ -179,6 +179,13 @@ struct pneigh_entry *phash_buckets[PNEIGH_HASHMASK+1]; }; +/* flags for neigh_update() */ +#define NEIGH_UPDATE_F_OVERRIDE 0x00000001 +#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 +#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004 +#define NEIGH_UPDATE_F_ISROUTER 0x40000000 +#define NEIGH_UPDATE_F_ADMIN 0x80000000 + extern void neigh_table_init(struct neigh_table *tbl); extern int neigh_table_clear(struct neigh_table *tbl); extern struct neighbour * neigh_lookup(struct neigh_table *tbl, @@ -189,7 +196,8 @@ struct net_device *dev); extern void neigh_destroy(struct neighbour *neigh); extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); -extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, int override, int arp); +extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, + u32 flags); extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); extern int neigh_resolve_output(struct sk_buff *skb); diff -Nru a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h --- a/include/net/sctp/sctp.h 2004-09-21 20:52:51 -07:00 +++ b/include/net/sctp/sctp.h 2004-09-21 20:52:51 -07:00 @@ -505,6 +505,7 @@ /* External references. */ extern struct proto sctp_prot; +extern struct proto sctpv6_prot; extern struct proc_dir_entry *proc_net_sctp; void sctp_put_port(struct sock *sk); diff -Nru a/include/net/sock.h b/include/net/sock.h --- a/include/net/sock.h 2004-09-21 20:52:52 -07:00 +++ b/include/net/sock.h 2004-09-21 20:52:52 -07:00 @@ -555,6 +555,10 @@ int *sysctl_rmem; int max_header; + kmem_cache_t *slab; + int slab_obj_size; + void *af_specific; + char name[32]; struct { @@ -562,6 +566,14 @@ u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; } stats[NR_CPUS]; }; + +extern int sk_alloc_slab(struct proto *prot, char *name); +extern void sk_free_slab(struct proto *prot); + +static inline void sk_alloc_slab_error(struct proto *proto) +{ + printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", proto->name); +} static __inline__ void sk_set_owner(struct sock *sk, struct module *owner) { diff -Nru a/include/net/tcp.h b/include/net/tcp.h --- a/include/net/tcp.h 2004-09-21 20:52:51 -07:00 +++ b/include/net/tcp.h 2004-09-21 20:52:51 -07:00 @@ -153,9 +153,6 @@ #define tcp_lhash_wait (tcp_hashinfo.__tcp_lhash_wait) #define tcp_portalloc_lock (tcp_hashinfo.__tcp_portalloc_lock) -/* SLAB cache for TCP socks */ -extern kmem_cache_t *tcp_sk_cachep; - extern kmem_cache_t *tcp_bucket_cachep; extern struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head, unsigned short snum); diff -Nru a/include/video/vga.h b/include/video/vga.h --- a/include/video/vga.h 2004-09-21 20:52:52 -07:00 +++ b/include/video/vga.h 2004-09-21 20:52:52 -07:00 @@ -203,7 +203,7 @@ #define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */ struct vgastate { - caddr_t vgabase; /* mmio base, if supported */ + void __iomem *vgabase; /* mmio base, if supported */ unsigned long membase; /* VGA window base, 0 for default - 0xA000 */ __u32 memsize; /* VGA window size, 0 for default 64K */ __u32 flags; /* what state[s] to save (see VGA_SAVE_*) */ @@ -238,23 +238,23 @@ outw(VGA_OUT16VAL (val, reg), port); } -static inline unsigned char vga_mm_r (caddr_t regbase, unsigned short port) +static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port) { return readb (regbase + port); } -static inline void vga_mm_w (caddr_t regbase, unsigned short port, unsigned char val) +static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val) { writeb (val, regbase + port); } -static inline void vga_mm_w_fast (caddr_t regbase, unsigned short port, +static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port, unsigned char reg, unsigned char val) { writew (VGA_OUT16VAL (val, reg), regbase + port); } -static inline unsigned char vga_r (caddr_t regbase, unsigned short port) +static inline unsigned char vga_r (void __iomem *regbase, unsigned short port) { if (regbase) return vga_mm_r (regbase, port); @@ -262,7 +262,7 @@ return vga_io_r (port); } -static inline void vga_w (caddr_t regbase, unsigned short port, unsigned char val) +static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val) { if (regbase) vga_mm_w (regbase, port, val); @@ -271,7 +271,7 @@ } -static inline void vga_w_fast (caddr_t regbase, unsigned short port, +static inline void vga_w_fast (void __iomem *regbase, unsigned short port, unsigned char reg, unsigned char val) { if (regbase) @@ -285,13 +285,13 @@ * VGA CRTC register read/write */ -static inline unsigned char vga_rcrt (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rcrt (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_CRT_IC, reg); return vga_r (regbase, VGA_CRT_DC); } -static inline void vga_wcrt (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_CRT_IC, reg, val); @@ -317,13 +317,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rcrt (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_CRT_IC, reg); return vga_mm_r (regbase, VGA_CRT_DC); } -static inline void vga_mm_wcrt (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_CRT_IC, reg, val); @@ -338,13 +338,13 @@ * VGA sequencer register read/write */ -static inline unsigned char vga_rseq (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rseq (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_SEQ_I, reg); return vga_r (regbase, VGA_SEQ_D); } -static inline void vga_wseq (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_SEQ_I, reg, val); @@ -370,13 +370,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rseq (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_SEQ_I, reg); return vga_mm_r (regbase, VGA_SEQ_D); } -static inline void vga_mm_wseq (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wseq (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_SEQ_I, reg, val); @@ -390,13 +390,13 @@ * VGA graphics controller register read/write */ -static inline unsigned char vga_rgfx (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rgfx (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_GFX_I, reg); return vga_r (regbase, VGA_GFX_D); } -static inline void vga_wgfx (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_GFX_I, reg, val); @@ -422,13 +422,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rgfx (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_GFX_I, reg); return vga_mm_r (regbase, VGA_GFX_D); } -static inline void vga_mm_wgfx (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_GFX_I, reg, val); @@ -443,13 +443,13 @@ * VGA attribute controller register read/write */ -static inline unsigned char vga_rattr (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rattr (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_ATT_IW, reg); return vga_r (regbase, VGA_ATT_R); } -static inline void vga_wattr (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned char val) { vga_w (regbase, VGA_ATT_IW, reg); vga_w (regbase, VGA_ATT_W, val); @@ -467,13 +467,13 @@ vga_io_w (VGA_ATT_W, val); } -static inline unsigned char vga_mm_rattr (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_ATT_IW, reg); return vga_mm_r (regbase, VGA_ATT_R); } -static inline void vga_mm_wattr (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wattr (void __iomem *regbase, unsigned char reg, unsigned char val) { vga_mm_w (regbase, VGA_ATT_IW, reg); vga_mm_w (regbase, VGA_ATT_W, val); diff -Nru a/kernel/audit.c b/kernel/audit.c --- a/kernel/audit.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/audit.c 2004-09-21 20:52:52 -07:00 @@ -810,16 +810,3 @@ audit_log_end(ab); } } - -EXPORT_SYMBOL_GPL(audit_set_rate_limit); -EXPORT_SYMBOL_GPL(audit_set_backlog_limit); -EXPORT_SYMBOL_GPL(audit_set_enabled); -EXPORT_SYMBOL_GPL(audit_set_failure); - -EXPORT_SYMBOL_GPL(audit_log_start); -EXPORT_SYMBOL_GPL(audit_log_format); -EXPORT_SYMBOL_GPL(audit_log_end_irq); -EXPORT_SYMBOL_GPL(audit_log_end_fast); -EXPORT_SYMBOL_GPL(audit_log_end); -EXPORT_SYMBOL_GPL(audit_log); -EXPORT_SYMBOL_GPL(audit_log_d_path); diff -Nru a/kernel/auditsc.c b/kernel/auditsc.c --- a/kernel/auditsc.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/auditsc.c 2004-09-21 20:52:52 -07:00 @@ -857,6 +857,7 @@ } #endif } +EXPORT_SYMBOL(audit_putname); /* Store the inode and device from a lookup. Called from * fs/namei.c:path_lookup(). */ @@ -913,11 +914,3 @@ } return 0; } - -EXPORT_SYMBOL_GPL(audit_alloc); -EXPORT_SYMBOL_GPL(audit_free); -EXPORT_SYMBOL_GPL(audit_syscall_entry); -EXPORT_SYMBOL_GPL(audit_syscall_exit); -EXPORT_SYMBOL_GPL(audit_getname); -EXPORT_SYMBOL_GPL(audit_putname); -EXPORT_SYMBOL_GPL(audit_inode); diff -Nru a/kernel/compat.c b/kernel/compat.c --- a/kernel/compat.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/compat.c 2004-09-21 20:52:52 -07:00 @@ -412,92 +412,58 @@ } } -/* - * for maximum compatability, we allow programs to use a single (compat) - * unsigned long bitmask if all cpus will fit. If not, you have to have - * at least the kernel size available. - */ -#define USE_COMPAT_ULONG_CPUMASK (NR_CPUS <= BITS_PER_COMPAT_LONG) - -asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, - unsigned int len, - compat_ulong_t __user *user_mask_ptr) +static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr, + unsigned len, cpumask_t *new_mask) { - cpumask_t kern_mask; - mm_segment_t old_fs; - int ret; + unsigned long *k; - if (USE_COMPAT_ULONG_CPUMASK) { - compat_ulong_t user_mask; + if (len < sizeof(cpumask_t)) + memset(new_mask, 0, sizeof(cpumask_t)); + else if (len > sizeof(cpumask_t)) + len = sizeof(cpumask_t); - if (len < sizeof(user_mask)) - return -EINVAL; + k = cpus_addr(*new_mask); + return compat_get_bitmap(k, user_mask_ptr, len * 8); +} - if (get_user(user_mask, user_mask_ptr)) - return -EFAULT; +asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, + unsigned int len, + compat_ulong_t __user *user_mask_ptr) +{ + cpumask_t new_mask; + int retval; - cpus_addr(kern_mask)[0] = user_mask; - } else { - unsigned long *k; - - if (len < sizeof(kern_mask)) - return -EINVAL; - - k = cpus_addr(kern_mask); - ret = compat_get_bitmap(k, user_mask_ptr, - sizeof(kern_mask) * BITS_PER_LONG); - if (ret) - return ret; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_setaffinity(pid, - sizeof(kern_mask), - (unsigned long __user *) &kern_mask); - set_fs(old_fs); + retval = compat_get_user_cpu_mask(user_mask_ptr, len, &new_mask); + if (retval) + return retval; - return ret; + return sched_setaffinity(pid, new_mask); } asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t __user *user_mask_ptr) { - cpumask_t kern_mask; - mm_segment_t old_fs; int ret; + cpumask_t mask; + unsigned long *k; + unsigned int min_length = sizeof(cpumask_t); - if (len < (USE_COMPAT_ULONG_CPUMASK ? sizeof(compat_ulong_t) - : sizeof(kern_mask))) - return -EINVAL; + if (NR_CPUS <= BITS_PER_COMPAT_LONG) + min_length = sizeof(compat_ulong_t); - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_getaffinity(pid, - sizeof(kern_mask), - (unsigned long __user *) &kern_mask); - set_fs(old_fs); + if (len < min_length) + return -EINVAL; + ret = sched_getaffinity(pid, &mask); if (ret < 0) return ret; - if (USE_COMPAT_ULONG_CPUMASK) { - if (put_user(&cpus_addr(kern_mask)[0], user_mask_ptr)) - return -EFAULT; - ret = sizeof(compat_ulong_t); - } else { - unsigned long *k; - - k = cpus_addr(kern_mask); - ret = compat_put_bitmap(user_mask_ptr, k, - sizeof(kern_mask) * BITS_PER_LONG); - if (ret) - return ret; - - ret = sizeof(kern_mask); - } + k = cpus_addr(mask); + ret = compat_put_bitmap(user_mask_ptr, k, min_length * 8); + if (ret) + return ret; - return ret; + return min_length; } static int get_compat_itimerspec(struct itimerspec *dst, diff -Nru a/kernel/exit.c b/kernel/exit.c --- a/kernel/exit.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/exit.c 2004-09-21 20:52:52 -07:00 @@ -949,9 +949,10 @@ static int wait_noreap_copyout(task_t *p, pid_t pid, uid_t uid, int why, int status, - struct siginfo __user *infop) + struct siginfo __user *infop, + struct rusage __user *rusagep) { - int retval = getrusage(p, RUSAGE_BOTH, &infop->si_rusage); + int retval = rusagep ? getrusage(p, RUSAGE_BOTH, rusagep) : 0; put_task_struct(p); if (!retval) retval = put_user(SIGCHLD, &infop->si_signo); @@ -1003,7 +1004,8 @@ why = (exit_code & 0x80) ? CLD_DUMPED : CLD_KILLED; status = exit_code & 0x7f; } - return wait_noreap_copyout(p, pid, uid, why, status, infop); + return wait_noreap_copyout(p, pid, uid, why, + status, infop, ru); } /* @@ -1161,7 +1163,7 @@ goto bail_ref; return wait_noreap_copyout(p, pid, uid, why, (exit_code << 8) | 0x7f, - infop); + infop, ru); } write_lock_irq(&tasklist_lock); @@ -1304,7 +1306,7 @@ read_unlock(&tasklist_lock); retval = wait_noreap_copyout(p, pid, uid, CLD_CONTINUED, - SIGCONT, infop); + SIGCONT, infop, ru); BUG_ON(retval == 0); goto end; } @@ -1371,7 +1373,8 @@ } asmlinkage long sys_waitid(int which, pid_t pid, - struct siginfo __user *infop, int options) + struct siginfo __user *infop, int options, + struct rusage __user *ru) { if (options & ~(WNOHANG|WNOWAIT|WEXITED|WSTOPPED|WCONTINUED)) return -EINVAL; @@ -1395,11 +1398,11 @@ return -EINVAL; } - return do_wait(pid, options, infop, NULL, &infop->si_rusage); + return do_wait(pid, options, infop, NULL, ru); } -asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr, - int options, struct rusage __user *ru) +asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, + int options, struct rusage __user *ru) { if (options & ~(WNOHANG|WUNTRACED|__WNOTHREAD|__WCLONE|__WALL)) return -EINVAL; @@ -1412,7 +1415,7 @@ * sys_waitpid() remains for compatibility. waitpid() should be * implemented by calling sys_wait4() from libc.a. */ -asmlinkage long sys_waitpid(pid_t pid, unsigned __user *stat_addr, int options) +asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options) { return sys_wait4(pid, stat_addr, options, NULL); } diff -Nru a/kernel/fork.c b/kernel/fork.c --- a/kernel/fork.c 2004-09-21 20:52:51 -07:00 +++ b/kernel/fork.c 2004-09-21 20:52:51 -07:00 @@ -483,6 +483,7 @@ mmdrop(mm); } } +EXPORT_SYMBOL_GPL(mmput); /** * get_task_mm - acquire a reference to the task's mm @@ -514,6 +515,7 @@ task_unlock(task); return mm; } +EXPORT_SYMBOL_GPL(get_task_mm); /* Please note the differences between mmput and mm_release. * mmput is called whenever we stop holding onto a mm_struct, @@ -1144,9 +1146,7 @@ bad_fork_cleanup_namespace: exit_namespace(p); bad_fork_cleanup_mm: - exit_mm(p); - if (p->active_mm) - mmdrop(p->active_mm); + mmput(p->mm); bad_fork_cleanup_signal: exit_signal(p); bad_fork_cleanup_sighand: diff -Nru a/kernel/pid.c b/kernel/pid.c --- a/kernel/pid.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/pid.c 2004-09-21 20:52:52 -07:00 @@ -278,7 +278,7 @@ for (i = 0; i < PIDTYPE_MAX; i++) { pid_hash[i] = alloc_bootmem(pidhash_size * - sizeof(struct list_head)); + sizeof(*(pid_hash[i]))); if (!pid_hash[i]) panic("Could not alloc pidhash!\n"); for (j = 0; j < pidhash_size; j++) diff -Nru a/kernel/sched.c b/kernel/sched.c --- a/kernel/sched.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/sched.c 2004-09-21 20:52:52 -07:00 @@ -1727,8 +1727,8 @@ if (tmp->flags & SD_BALANCE_EXEC) sd = tmp; - schedstat_inc(sd, sbe_attempts); if (sd) { + schedstat_inc(sd, sbe_attempts); new_cpu = find_idlest_cpu(current, this_cpu, sd); if (new_cpu != this_cpu) { schedstat_inc(sd, sbe_pushed); @@ -3362,33 +3362,10 @@ return retval; } -static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, - cpumask_t *new_mask) -{ - if (len < sizeof(cpumask_t)) { - memset(new_mask, 0, sizeof(cpumask_t)); - } else if (len > sizeof(cpumask_t)) { - len = sizeof(cpumask_t); - } - return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0; -} - -/** - * sys_sched_setaffinity - set the cpu affinity of a process - * @pid: pid of the process - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to the new cpu mask - */ -asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, - unsigned long __user *user_mask_ptr) +long sched_setaffinity(pid_t pid, cpumask_t new_mask) { - cpumask_t new_mask; - int retval; task_t *p; - - retval = get_user_cpu_mask(user_mask_ptr, len, &new_mask); - if (retval) - return retval; + int retval; lock_cpu_hotplug(); read_lock(&tasklist_lock); @@ -3421,6 +3398,36 @@ return retval; } +static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, + cpumask_t *new_mask) +{ + if (len < sizeof(cpumask_t)) { + memset(new_mask, 0, sizeof(cpumask_t)); + } else if (len > sizeof(cpumask_t)) { + len = sizeof(cpumask_t); + } + return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0; +} + +/** + * sys_sched_setaffinity - set the cpu affinity of a process + * @pid: pid of the process + * @len: length in bytes of the bitmask pointed to by user_mask_ptr + * @user_mask_ptr: user-space pointer to the new cpu mask + */ +asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, + unsigned long __user *user_mask_ptr) +{ + cpumask_t new_mask; + int retval; + + retval = get_user_cpu_mask(user_mask_ptr, len, &new_mask); + if (retval) + return retval; + + return sched_setaffinity(pid, new_mask); +} + /* * Represents all cpu's present in the system * In systems capable of hotplug, this map could dynamically grow @@ -3436,24 +3443,11 @@ cpumask_t cpu_possible_map = CPU_MASK_ALL; #endif -/** - * sys_sched_getaffinity - get the cpu affinity of a process - * @pid: pid of the process - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to hold the current cpu mask - */ -asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, - unsigned long __user *user_mask_ptr) +long sched_getaffinity(pid_t pid, cpumask_t *mask) { - unsigned int real_len; - cpumask_t mask; int retval; task_t *p; - real_len = sizeof(mask); - if (len < real_len) - return -EINVAL; - lock_cpu_hotplug(); read_lock(&tasklist_lock); @@ -3463,16 +3457,40 @@ goto out_unlock; retval = 0; - cpus_and(mask, p->cpus_allowed, cpu_possible_map); + cpus_and(*mask, p->cpus_allowed, cpu_possible_map); out_unlock: read_unlock(&tasklist_lock); unlock_cpu_hotplug(); if (retval) return retval; - if (copy_to_user(user_mask_ptr, &mask, real_len)) + + return 0; +} + +/** + * sys_sched_getaffinity - get the cpu affinity of a process + * @pid: pid of the process + * @len: length in bytes of the bitmask pointed to by user_mask_ptr + * @user_mask_ptr: user-space pointer to hold the current cpu mask + */ +asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, + unsigned long __user *user_mask_ptr) +{ + int ret; + cpumask_t mask; + + if (len < sizeof(cpumask_t)) + return -EINVAL; + + ret = sched_getaffinity(pid, &mask); + if (ret < 0) + return ret; + + if (copy_to_user(user_mask_ptr, &mask, sizeof(cpumask_t))) return -EFAULT; - return real_len; + + return sizeof(cpumask_t); } /** diff -Nru a/kernel/signal.c b/kernel/signal.c --- a/kernel/signal.c 2004-09-21 20:52:51 -07:00 +++ b/kernel/signal.c 2004-09-21 20:52:51 -07:00 @@ -1500,7 +1500,6 @@ /* FIXME: find out whether or not this is supposed to be c*time. */ info.si_utime = tsk->utime + tsk->signal->utime; info.si_stime = tsk->stime + tsk->signal->stime; - k_getrusage(tsk, RUSAGE_BOTH, &info.si_rusage); info.si_status = tsk->exit_code & 0x7f; if (tsk->exit_code & 0x80) @@ -1558,7 +1557,6 @@ /* FIXME: find out whether or not this is supposed to be c*time. */ info.si_utime = tsk->utime; info.si_stime = tsk->stime; - k_getrusage(tsk, RUSAGE_BOTH, &info.si_rusage); info.si_code = why; switch (why) { @@ -2170,8 +2168,6 @@ err |= __put_user(from->si_status, &to->si_status); err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); - err |= __copy_to_user(&to->si_rusage, &from->si_rusage, - sizeof(to->si_rusage)); break; case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_MESGQ: /* But this is */ diff -Nru a/kernel/sys.c b/kernel/sys.c --- a/kernel/sys.c 2004-09-21 20:52:51 -07:00 +++ b/kernel/sys.c 2004-09-21 20:52:51 -07:00 @@ -274,7 +274,9 @@ cond_syscall(sys_mbind) cond_syscall(sys_get_mempolicy) cond_syscall(sys_set_mempolicy) +cond_syscall(compat_mbind) cond_syscall(compat_get_mempolicy) +cond_syscall(compat_set_mempolicy) /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read) @@ -1727,6 +1729,17 @@ } current->keep_capabilities = arg2; break; + case PR_SET_NAME: { + struct task_struct *me = current; + unsigned char ncomm[sizeof(me->comm)]; + + ncomm[sizeof(me->comm)-1] = 0; + if (strncpy_from_user(ncomm, (char *)arg2, + sizeof(me->comm)-1) < 0) + return -EFAULT; + set_task_comm(me, ncomm); + return 0; + } default: error = -EINVAL; break; diff -Nru a/kernel/timer.c b/kernel/timer.c --- a/kernel/timer.c 2004-09-21 20:52:52 -07:00 +++ b/kernel/timer.c 2004-09-21 20:52:52 -07:00 @@ -1492,7 +1492,10 @@ unsigned long time_interpolator_resolution(void) { - return NSEC_PER_SEC / time_interpolator->frequency; + if (time_interpolator->frequency < NSEC_PER_SEC) + return NSEC_PER_SEC / time_interpolator->frequency; + else + return 1; } #define GET_TI_NSECS(count,i) ((((count) - i->last_counter) * i->nsec_per_cyc) >> i->shift) diff -Nru a/lib/Makefile b/lib/Makefile --- a/lib/Makefile 2004-09-21 20:52:51 -07:00 +++ b/lib/Makefile 2004-09-21 20:52:51 -07:00 @@ -10,6 +10,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o +lib-$(CONFIG_GENERIC_IOMAP) += iomap.o ifneq ($(CONFIG_HAVE_DEC_LOCK),y) lib-y += dec_and_lock.o diff -Nru a/lib/iomap.c b/lib/iomap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/lib/iomap.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,206 @@ +/* + * Implement the default iomap interfaces + */ +#include +#include +#include + +/* + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO + * access or a MMIO access, these functions don't care. The info is + * encoded in the hardware mapping set up by the mapping functions + * (or the cookie itself, depending on implementation and hw). + * + * The generic routines don't assume any hardware mappings, and just + * encode the PIO/MMIO as part of the cookie. They coldly assume that + * the MMIO IO mappings are not in the low address range. + * + * Architectures for which this is not true can't use this generic + * implementation and should do their own copy. + * + * We encode the physical PIO addresses (0-0xffff) into the + * pointer by offsetting them with a constant (0x10000) and + * assuming that all the low addresses are always PIO. That means + * we can do some sanity checks on the low bits, and don't + * need to just take things for granted. + */ +#define PIO_OFFSET 0x10000UL +#define PIO_MASK 0x0ffffUL +#define PIO_RESERVED 0x40000UL + +/* + * Ugly macros are a way of life. + */ +#define VERIFY_PIO(port) BUG_ON((port & ~PIO_MASK) != PIO_OFFSET) + +#define IO_COND(addr, is_pio, is_mmio) do { \ + unsigned long port = (unsigned long __force)addr; \ + if (port < PIO_RESERVED) { \ + VERIFY_PIO(port); \ + port &= PIO_MASK; \ + is_pio; \ + } else { \ + is_mmio; \ + } \ +} while (0) + +unsigned int fastcall ioread8(void __iomem *addr) +{ + IO_COND(addr, return inb(port), return readb(addr)); +} +unsigned int fastcall ioread16(void __iomem *addr) +{ + IO_COND(addr, return inw(port), return readw(addr)); +} +unsigned int fastcall ioread32(void __iomem *addr) +{ + IO_COND(addr, return inl(port), return readl(addr)); +} +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); + +void fastcall iowrite8(u8 val, void __iomem *addr) +{ + IO_COND(addr, outb(val,port), writeb(val, addr)); +} +void fastcall iowrite16(u16 val, void __iomem *addr) +{ + IO_COND(addr, outw(val,port), writew(val, addr)); +} +void fastcall iowrite32(u32 val, void __iomem *addr) +{ + IO_COND(addr, outl(val,port), writel(val, addr)); +} +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); + +/* + * These are the "repeat MMIO read/write" functions. + * Note the "__raw" accesses, since we don't want to + * convert to CPU byte order. We write in "IO byte + * order" (we also don't have IO barriers). + */ +static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) +{ + while (--count >= 0) { + u8 data = __raw_readb(addr); + *dst = data; + dst++; + } +} +static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) +{ + while (--count >= 0) { + u16 data = __raw_readw(addr); + *dst = data; + dst++; + } +} +static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) +{ + while (--count >= 0) { + u32 data = __raw_readl(addr); + *dst = data; + dst++; + } +} + +static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count) +{ + while (--count >= 0) { + __raw_writeb(*src, addr); + src++; + } +} +static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count) +{ + while (--count >= 0) { + __raw_writew(*src, addr); + src++; + } +} +static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) +{ + while (--count >= 0) { + __raw_writel(*src, addr); + src++; + } +} + +void fastcall ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count)); +} +void fastcall ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insw(port,dst,count), mmio_insw(addr, dst, count)); +} +void fastcall ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insl(port,dst,count), mmio_insl(addr, dst, count)); +} +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(ioread32_rep); + +void fastcall iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsb(port, src, count), mmio_outsb(addr, src, count)); +} +void fastcall iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsw(port, src, count), mmio_outsw(addr, src, count)); +} +void fastcall iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsl(port, src,count), mmio_outsl(addr, src, count)); +} +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(iowrite32_rep); + +/* Create a virtual mapping cookie for an IO port range */ +void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + if (port > PIO_MASK) + return NULL; + return (void __iomem *) (unsigned long) (port + PIO_OFFSET); +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + if (maxlen && len > maxlen) + len = maxlen; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + if (flags & IORESOURCE_CACHEABLE) + return ioremap(start, len); + return ioremap_nocache(start, len); + } + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ + IO_COND(addr, /* nothing */, iounmap(addr)); +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/mm/highmem.c b/mm/highmem.c --- a/mm/highmem.c 2004-09-21 20:52:52 -07:00 +++ b/mm/highmem.c 2004-09-21 20:52:52 -07:00 @@ -300,6 +300,7 @@ */ vfrom = page_address(fromvec->bv_page) + tovec->bv_offset; + flush_dcache_page(tovec->bv_page); bounce_copy_vec(tovec, vfrom); } } @@ -406,6 +407,7 @@ if (rw == WRITE) { char *vto, *vfrom; + flush_dcache_page(from->bv_page); vto = page_address(to->bv_page) + to->bv_offset; vfrom = kmap(from->bv_page) + from->bv_offset; memcpy(vto, vfrom, to->bv_len); diff -Nru a/mm/mempolicy.c b/mm/mempolicy.c --- a/mm/mempolicy.c 2004-09-21 20:52:52 -07:00 +++ b/mm/mempolicy.c 2004-09-21 20:52:52 -07:00 @@ -132,6 +132,7 @@ unsigned long nlongs; unsigned long endmask; + --maxnode; bitmap_zero(nodes, MAX_NUMNODES); if (maxnode == 0 || !nmask) return 0; @@ -145,6 +146,8 @@ /* When the user specified more nodes than supported just check if the non supported part is all zero. */ if (nlongs > BITS_TO_LONGS(MAX_NUMNODES)) { + if (nlongs > PAGE_SIZE/sizeof(long)) + return -EINVAL; for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) { unsigned long t; if (get_user(t, nmask + k)) @@ -557,7 +560,7 @@ asmlinkage long compat_set_mempolicy(int mode, compat_ulong_t __user *nmask, compat_ulong_t maxnode) { - long err; + long err = 0; unsigned long __user *nm = NULL; unsigned long nr_bits, alloc_size; DECLARE_BITMAP(bm, MAX_NUMNODES); @@ -581,7 +584,7 @@ compat_ulong_t mode, compat_ulong_t __user *nmask, compat_ulong_t maxnode, compat_ulong_t flags) { - long err; + long err = 0; unsigned long __user *nm = NULL; unsigned long nr_bits, alloc_size; DECLARE_BITMAP(bm, MAX_NUMNODES); diff -Nru a/mm/rmap.c b/mm/rmap.c --- a/mm/rmap.c 2004-09-21 20:52:52 -07:00 +++ b/mm/rmap.c 2004-09-21 20:52:52 -07:00 @@ -405,8 +405,9 @@ referenced += page_referenced_file(page); else if (TestSetPageLocked(page)) referenced++; - else if (page->mapping) { - referenced += page_referenced_file(page); + else { + if (page->mapping) + referenced += page_referenced_file(page); unlock_page(page); } } diff -Nru a/mm/shmem.c b/mm/shmem.c --- a/mm/shmem.c 2004-09-21 20:52:51 -07:00 +++ b/mm/shmem.c 2004-09-21 20:52:51 -07:00 @@ -6,8 +6,8 @@ * 2000-2001 Christoph Rohland * 2000-2001 SAP AG * 2002 Red Hat Inc. - * Copyright (C) 2002-2003 Hugh Dickins. - * Copyright (C) 2002-2003 VERITAS Software Corporation. + * Copyright (C) 2002-2004 Hugh Dickins. + * Copyright (C) 2002-2004 VERITAS Software Corporation. * Copyright (C) 2004 Andi Kleen, SuSE Labs * * This file is released under the GPL. @@ -179,16 +179,18 @@ .unplug_io_fn = default_unplug_io_fn, }; -static LIST_HEAD(shmem_inodes); -static spinlock_t shmem_ilock = SPIN_LOCK_UNLOCKED; +static LIST_HEAD(shmem_swaplist); +static spinlock_t shmem_swaplist_lock = SPIN_LOCK_UNLOCKED; static void shmem_free_block(struct inode *inode) { struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); - spin_lock(&sbinfo->stat_lock); - sbinfo->free_blocks++; - inode->i_blocks -= BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks++; + inode->i_blocks -= BLOCKS_PER_PAGE; + spin_unlock(&sbinfo->stat_lock); + } } /* @@ -213,11 +215,13 @@ if (freed > 0) { struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); info->alloced -= freed; - spin_lock(&sbinfo->stat_lock); - sbinfo->free_blocks += freed; - inode->i_blocks -= freed*BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); shmem_unacct_blocks(info->flags, freed); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks += freed; + inode->i_blocks -= freed*BLOCKS_PER_PAGE; + spin_unlock(&sbinfo->stat_lock); + } } } @@ -350,14 +354,16 @@ * page (and perhaps indirect index pages) yet to allocate: * a waste to allocate index if we cannot allocate data. */ - spin_lock(&sbinfo->stat_lock); - if (sbinfo->free_blocks <= 1) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (sbinfo->free_blocks <= 1) { + spin_unlock(&sbinfo->stat_lock); + return ERR_PTR(-ENOSPC); + } + sbinfo->free_blocks--; + inode->i_blocks += BLOCKS_PER_PAGE; spin_unlock(&sbinfo->stat_lock); - return ERR_PTR(-ENOSPC); } - sbinfo->free_blocks--; - inode->i_blocks += BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); spin_unlock(&info->lock); page = shmem_dir_alloc(mapping_gfp_mask(inode->i_mapping)); @@ -598,17 +604,21 @@ struct shmem_inode_info *info = SHMEM_I(inode); if (inode->i_op->truncate == shmem_truncate) { - spin_lock(&shmem_ilock); - list_del(&info->list); - spin_unlock(&shmem_ilock); shmem_unacct_size(info->flags, inode->i_size); inode->i_size = 0; shmem_truncate(inode); + if (!list_empty(&info->swaplist)) { + spin_lock(&shmem_swaplist_lock); + list_del_init(&info->swaplist); + spin_unlock(&shmem_swaplist_lock); + } + } + if (sbinfo) { + BUG_ON(inode->i_blocks); + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); } - BUG_ON(inode->i_blocks); - spin_lock(&sbinfo->stat_lock); - sbinfo->free_inodes++; - spin_unlock(&sbinfo->stat_lock); clear_inode(inode); } @@ -713,22 +723,23 @@ */ int shmem_unuse(swp_entry_t entry, struct page *page) { - struct list_head *p; + struct list_head *p, *next; struct shmem_inode_info *info; int found = 0; - spin_lock(&shmem_ilock); - list_for_each(p, &shmem_inodes) { - info = list_entry(p, struct shmem_inode_info, list); - - if (info->swapped && shmem_unuse_inode(info, entry, page)) { + spin_lock(&shmem_swaplist_lock); + list_for_each_safe(p, next, &shmem_swaplist) { + info = list_entry(p, struct shmem_inode_info, swaplist); + if (!info->swapped) + list_del_init(&info->swaplist); + else if (shmem_unuse_inode(info, entry, page)) { /* move head to start search for next from here */ - list_move_tail(&shmem_inodes, &info->list); + list_move_tail(&shmem_swaplist, &info->swaplist); found = 1; break; } } - spin_unlock(&shmem_ilock); + spin_unlock(&shmem_swaplist_lock); return found; } @@ -770,6 +781,12 @@ shmem_swp_set(info, entry, swap.val); shmem_swp_unmap(entry); spin_unlock(&info->lock); + if (list_empty(&info->swaplist)) { + spin_lock(&shmem_swaplist_lock); + /* move instead of add in case we're racing */ + list_move_tail(&info->swaplist, &shmem_swaplist); + spin_unlock(&shmem_swaplist_lock); + } unlock_page(page); return 0; } @@ -868,7 +885,7 @@ struct page *swappage; swp_entry_t *entry; swp_entry_t swap; - int error, majmin = VM_FAULT_MINOR; + int error; if (idx >= SHMEM_MAX_INDEX) return -EFBIG; @@ -906,9 +923,10 @@ shmem_swp_unmap(entry); spin_unlock(&info->lock); /* here we actually do the io */ - if (majmin == VM_FAULT_MINOR && type) + if (type && *type == VM_FAULT_MINOR) { inc_page_state(pgmajfault); - majmin = VM_FAULT_MAJOR; + *type = VM_FAULT_MAJOR; + } swappage = shmem_swapin(info, swap, idx); if (!swappage) { spin_lock(&info->lock); @@ -1001,16 +1019,23 @@ } else { shmem_swp_unmap(entry); sbinfo = SHMEM_SB(inode->i_sb); - spin_lock(&sbinfo->stat_lock); - if (sbinfo->free_blocks == 0 || shmem_acct_block(info->flags)) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (sbinfo->free_blocks == 0 || + shmem_acct_block(info->flags)) { + spin_unlock(&sbinfo->stat_lock); + spin_unlock(&info->lock); + error = -ENOSPC; + goto failed; + } + sbinfo->free_blocks--; + inode->i_blocks += BLOCKS_PER_PAGE; spin_unlock(&sbinfo->stat_lock); + } else if (shmem_acct_block(info->flags)) { spin_unlock(&info->lock); error = -ENOSPC; goto failed; } - sbinfo->free_blocks--; - inode->i_blocks += BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); if (!filepage) { spin_unlock(&info->lock); @@ -1053,15 +1078,10 @@ SetPageUptodate(filepage); } done: - if (!*pagep) { - if (filepage) { - unlock_page(filepage); - *pagep = filepage; - } else - *pagep = ZERO_PAGE(0); + if (*pagep != filepage) { + unlock_page(filepage); + *pagep = filepage; } - if (type) - *type = majmin; return 0; failed: @@ -1187,13 +1207,15 @@ struct shmem_inode_info *info; struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - spin_lock(&sbinfo->stat_lock); - if (!sbinfo->free_inodes) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (!sbinfo->free_inodes) { + spin_unlock(&sbinfo->stat_lock); + return NULL; + } + sbinfo->free_inodes--; spin_unlock(&sbinfo->stat_lock); - return NULL; } - sbinfo->free_inodes--; - spin_unlock(&sbinfo->stat_lock); inode = new_inode(sb); if (inode) { @@ -1209,6 +1231,8 @@ memset(info, 0, (char *)inode - (char *)info); spin_lock_init(&info->lock); mpol_shared_policy_init(&info->policy); + INIT_LIST_HEAD(&info->swaplist); + switch (mode & S_IFMT) { default: init_special_inode(inode, mode, dev); @@ -1216,9 +1240,6 @@ case S_IFREG: inode->i_op = &shmem_inode_operations; inode->i_fop = &shmem_file_operations; - spin_lock(&shmem_ilock); - list_add_tail(&info->list, &shmem_inodes); - spin_unlock(&shmem_ilock); break; case S_IFDIR: inode->i_nlink++; @@ -1234,32 +1255,32 @@ return inode; } -static int shmem_set_size(struct shmem_sb_info *info, +#ifdef CONFIG_TMPFS + +static int shmem_set_size(struct shmem_sb_info *sbinfo, unsigned long max_blocks, unsigned long max_inodes) { int error; unsigned long blocks, inodes; - spin_lock(&info->stat_lock); - blocks = info->max_blocks - info->free_blocks; - inodes = info->max_inodes - info->free_inodes; + spin_lock(&sbinfo->stat_lock); + blocks = sbinfo->max_blocks - sbinfo->free_blocks; + inodes = sbinfo->max_inodes - sbinfo->free_inodes; error = -EINVAL; if (max_blocks < blocks) goto out; if (max_inodes < inodes) goto out; error = 0; - info->max_blocks = max_blocks; - info->free_blocks = max_blocks - blocks; - info->max_inodes = max_inodes; - info->free_inodes = max_inodes - inodes; + sbinfo->max_blocks = max_blocks; + sbinfo->free_blocks = max_blocks - blocks; + sbinfo->max_inodes = max_inodes; + sbinfo->free_inodes = max_inodes - inodes; out: - spin_unlock(&info->stat_lock); + spin_unlock(&sbinfo->stat_lock); return error; } -#ifdef CONFIG_TMPFS - static struct inode_operations shmem_symlink_inode_operations; static struct inode_operations shmem_symlink_inline_operations; @@ -1280,7 +1301,7 @@ struct inode *inode = file->f_dentry->d_inode; loff_t pos; unsigned long written; - int err; + ssize_t err; if ((ssize_t) count < 0) return -EINVAL; @@ -1417,13 +1438,14 @@ if (index == end_index) { nr = i_size & ~PAGE_CACHE_MASK; if (nr <= offset) { - page_cache_release(page); + if (page) + page_cache_release(page); break; } } nr -= offset; - if (page != ZERO_PAGE(0)) { + if (page) { /* * If users can be writing to this page using arbitrary * virtual addresses, take care about potential aliasing @@ -1436,7 +1458,8 @@ */ if (!offset) mark_page_accessed(page); - } + } else + page = ZERO_PAGE(0); /* * Ok, we have the page, and it's up-to-date, so @@ -1511,13 +1534,16 @@ buf->f_type = TMPFS_MAGIC; buf->f_bsize = PAGE_CACHE_SIZE; - spin_lock(&sbinfo->stat_lock); - buf->f_blocks = sbinfo->max_blocks; - buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; - buf->f_files = sbinfo->max_inodes; - buf->f_ffree = sbinfo->free_inodes; - spin_unlock(&sbinfo->stat_lock); buf->f_namelen = NAME_MAX; + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + buf->f_blocks = sbinfo->max_blocks; + buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; + buf->f_files = sbinfo->max_inodes; + buf->f_ffree = sbinfo->free_inodes; + spin_unlock(&sbinfo->stat_lock); + } + /* else leave those fields 0 like simple_statfs */ return 0; } @@ -1567,6 +1593,22 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { struct inode *inode = old_dentry->d_inode; + struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); + + /* + * No ordinary (disk based) filesystem counts links as inodes; + * but each new link needs a new dentry, pinning lowmem, and + * tmpfs dentries cannot be pruned until they are unlinked. + */ + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (!sbinfo->free_inodes) { + spin_unlock(&sbinfo->stat_lock); + return -ENOSPC; + } + sbinfo->free_inodes--; + spin_unlock(&sbinfo->stat_lock); + } dir->i_size += BOGO_DIRENT_SIZE; inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; @@ -1581,6 +1623,15 @@ { struct inode *inode = dentry->d_inode; + if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) { + struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); + } + } + dir->i_size -= BOGO_DIRENT_SIZE; inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; inode->i_nlink--; @@ -1658,9 +1709,6 @@ return error; } inode->i_op = &shmem_symlink_inode_operations; - spin_lock(&shmem_ilock); - list_add_tail(&info->list, &shmem_inodes); - spin_unlock(&shmem_ilock); kaddr = kmap_atomic(page, KM_USER0); memcpy(kaddr, symname, len); kunmap_atomic(kaddr, KM_USER0); @@ -1789,53 +1837,75 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - unsigned long max_blocks = sbinfo->max_blocks; - unsigned long max_inodes = sbinfo->max_inodes; + unsigned long max_blocks = 0; + unsigned long max_inodes = 0; + if (sbinfo) { + max_blocks = sbinfo->max_blocks; + max_inodes = sbinfo->max_inodes; + } if (shmem_parse_options(data, NULL, NULL, NULL, &max_blocks, &max_inodes)) return -EINVAL; + /* Keep it simple: disallow limited <-> unlimited remount */ + if ((max_blocks || max_inodes) == !sbinfo) + return -EINVAL; + /* But allow the pointless unlimited -> unlimited remount */ + if (!sbinfo) + return 0; return shmem_set_size(sbinfo, max_blocks, max_inodes); } #endif +static void shmem_put_super(struct super_block *sb) +{ + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; +} + static int shmem_fill_super(struct super_block *sb, void *data, int silent) { struct inode *inode; struct dentry *root; - unsigned long blocks, inodes; int mode = S_IRWXUGO | S_ISVTX; uid_t uid = current->fsuid; gid_t gid = current->fsgid; - struct shmem_sb_info *sbinfo; int err = -ENOMEM; - sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL); - if (!sbinfo) - return -ENOMEM; - sb->s_fs_info = sbinfo; - memset(sbinfo, 0, sizeof(struct shmem_sb_info)); +#ifdef CONFIG_TMPFS + unsigned long blocks = 0; + unsigned long inodes = 0; /* * Per default we only allow half of the physical ram per - * tmpfs instance + * tmpfs instance, limiting inodes to one per page of lowmem; + * but the internal instance is left unlimited. */ - blocks = inodes = totalram_pages / 2; - -#ifdef CONFIG_TMPFS - if (shmem_parse_options(data, &mode, &uid, &gid, &blocks, &inodes)) { - err = -EINVAL; - goto failed; + if (!(sb->s_flags & MS_NOUSER)) { + blocks = totalram_pages / 2; + inodes = totalram_pages - totalhigh_pages; + if (inodes > blocks) + inodes = blocks; + + if (shmem_parse_options(data, &mode, + &uid, &gid, &blocks, &inodes)) + return -EINVAL; + } + + if (blocks || inodes) { + struct shmem_sb_info *sbinfo; + sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL); + if (!sbinfo) + return -ENOMEM; + sb->s_fs_info = sbinfo; + spin_lock_init(&sbinfo->stat_lock); + sbinfo->max_blocks = blocks; + sbinfo->free_blocks = blocks; + sbinfo->max_inodes = inodes; + sbinfo->free_inodes = inodes; } -#else - sb->s_flags |= MS_NOUSER; #endif - spin_lock_init(&sbinfo->stat_lock); - sbinfo->max_blocks = blocks; - sbinfo->free_blocks = blocks; - sbinfo->max_inodes = inodes; - sbinfo->free_inodes = inodes; sb->s_maxbytes = SHMEM_MAX_BYTES; sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; @@ -1855,17 +1925,10 @@ failed_iput: iput(inode); failed: - kfree(sbinfo); - sb->s_fs_info = NULL; + shmem_put_super(sb); return err; } -static void shmem_put_super(struct super_block *sb) -{ - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; -} - static kmem_cache_t *shmem_inode_cachep; static struct inode *shmem_alloc_inode(struct super_block *sb) @@ -1897,8 +1960,7 @@ { shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", sizeof(struct shmem_inode_info), - 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, - init_once, NULL); + 0, 0, init_once, NULL); if (shmem_inode_cachep == NULL) return -ENOMEM; return 0; @@ -2000,15 +2062,13 @@ #ifdef CONFIG_TMPFS devfs_mk_dir("shm"); #endif - shm_mnt = kern_mount(&tmpfs_fs_type); + shm_mnt = do_kern_mount(tmpfs_fs_type.name, MS_NOUSER, + tmpfs_fs_type.name, NULL); if (IS_ERR(shm_mnt)) { error = PTR_ERR(shm_mnt); printk(KERN_ERR "Could not kern_mount tmpfs\n"); goto out1; } - - /* The internal instance should not do size checking */ - shmem_set_size(SHMEM_SB(shm_mnt->mnt_sb), ULONG_MAX, ULONG_MAX); return 0; out1: @@ -2039,7 +2099,7 @@ if (IS_ERR(shm_mnt)) return (void *)shm_mnt; - if (size > SHMEM_MAX_BYTES) + if (size < 0 || size > SHMEM_MAX_BYTES) return ERR_PTR(-EINVAL); if (shmem_acct_size(flags, size)) @@ -2073,7 +2133,7 @@ file->f_mapping = inode->i_mapping; file->f_op = &shmem_file_operations; file->f_mode = FMODE_WRITE | FMODE_READ; - return(file); + return file; close_file: put_filp(file); diff -Nru a/mm/slab.c b/mm/slab.c --- a/mm/slab.c 2004-09-21 20:52:52 -07:00 +++ b/mm/slab.c 2004-09-21 20:52:52 -07:00 @@ -562,6 +562,22 @@ return cachep->array[smp_processor_id()]; } +static kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags) +{ + struct cache_sizes *csizep = malloc_sizes; + + /* This function could be moved to the header file, and + * made inline so consumers can quickly determine what + * cache pointer they require. + */ + for ( ; csizep->cs_size; csizep++) { + if (size > csizep->cs_size) + continue; + break; + } + return (gfpflags & GFP_DMA) ? csizep->cs_dmacachep : csizep->cs_cachep; +} + /* Cal the num objs, wastage, and bytes left over for a given slab size. */ static void cache_estimate (unsigned long gfporder, size_t size, size_t align, int flags, size_t *left_over, unsigned int *num) @@ -2554,24 +2570,6 @@ } EXPORT_SYMBOL(kmem_cache_size); - -kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags) -{ - struct cache_sizes *csizep = malloc_sizes; - - /* This function could be moved to the header file, and - * made inline so consumers can quickly determine what - * cache pointer they require. - */ - for ( ; csizep->cs_size; csizep++) { - if (size > csizep->cs_size) - continue; - break; - } - return (gfpflags & GFP_DMA) ? csizep->cs_dmacachep : csizep->cs_cachep; -} - -EXPORT_SYMBOL(kmem_find_general_cachep); struct ccupdate_struct { kmem_cache_t *cachep; diff -Nru a/mm/vmalloc.c b/mm/vmalloc.c --- a/mm/vmalloc.c 2004-09-21 20:52:52 -07:00 +++ b/mm/vmalloc.c 2004-09-21 20:52:52 -07:00 @@ -247,6 +247,8 @@ out: write_unlock(&vmlist_lock); kfree(area); + if (printk_ratelimit()) + printk(KERN_WARNING "allocation failed: out of vmalloc space - use vmalloc= to increase size.\n"); return NULL; } diff -Nru a/net/atm/clip.c b/net/atm/clip.c --- a/net/atm/clip.c 2004-09-21 20:52:52 -07:00 +++ b/net/atm/clip.c 2004-09-21 20:52:52 -07:00 @@ -110,7 +110,8 @@ goto out; entry->expires = jiffies-1; /* force resolution or expiration */ - error = neigh_update(entry->neigh,NULL,NUD_NONE,0,0); + error = neigh_update(entry->neigh, NULL, NUD_NONE, + NEIGH_UPDATE_F_ADMIN); if (error) printk(KERN_CRIT "unlink_clip_vcc: " "neigh_update failed with %d\n",error); @@ -570,7 +571,8 @@ } link_vcc(clip_vcc,entry); } - error = neigh_update(neigh,llc_oui,NUD_PERMANENT,1,0); + error = neigh_update(neigh, llc_oui, NUD_PERMANENT, + NEIGH_UPDATE_F_OVERRIDE|NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); return error; } diff -Nru a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c --- a/net/bluetooth/bnep/core.c 2004-09-21 20:52:52 -07:00 +++ b/net/bluetooth/bnep/core.c 2004-09-21 20:52:52 -07:00 @@ -384,7 +384,7 @@ s->stats.rx_packets++; nskb->dev = dev; - nskb->ip_summed = CHECKSUM_UNNECESSARY; + nskb->ip_summed = CHECKSUM_NONE; nskb->protocol = eth_type_trans(nskb, dev); netif_rx_ni(nskb); return 0; diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c --- a/net/bluetooth/l2cap.c 2004-09-21 20:52:52 -07:00 +++ b/net/bluetooth/l2cap.c 2004-09-21 20:52:52 -07:00 @@ -57,7 +57,7 @@ #define BT_DBG(D...) #endif -#define VERSION "2.3" +#define VERSION "2.4" static struct proto_ops l2cap_sock_ops; @@ -1453,7 +1453,7 @@ BT_DBG("dcid 0x%4.4x scid 0x%4.4x result 0x%2.2x status 0x%2.2x", dcid, scid, result, status); if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) - return -ENOENT; + return 0; switch (result) { case L2CAP_CR_SUCCESS: @@ -1527,7 +1527,6 @@ struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data; u16 scid, flags, result; struct sock *sk; - int err = 0; scid = __le16_to_cpu(rsp->scid); flags = __le16_to_cpu(rsp->flags); @@ -1536,7 +1535,7 @@ BT_DBG("scid 0x%4.4x flags 0x%2.2x result 0x%2.2x", scid, flags, result); if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) - return -ENOENT; + return 0; switch (result) { case L2CAP_CONF_SUCCESS: @@ -1581,7 +1580,7 @@ done: bh_unlock_sock(sk); - return err; + return 0; } static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) @@ -1625,6 +1624,7 @@ if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) return 0; + l2cap_chan_del(sk, 0); bh_unlock_sock(sk); @@ -1632,7 +1632,7 @@ return 0; } -static inline int l2cap_info_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) +static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_info_req *req = (struct l2cap_info_req *) data; struct l2cap_info_rsp rsp; @@ -1645,10 +1645,11 @@ rsp.type = __cpu_to_le16(type); rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP); l2cap_send_rsp(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp); + return 0; } -static inline int l2cap_info_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) +static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data; u16 type, result; @@ -1721,11 +1722,11 @@ break; case L2CAP_INFO_REQ: - err = l2cap_info_req(conn, &cmd, data); + err = l2cap_information_req(conn, &cmd, data); break; case L2CAP_INFO_RSP: - err = l2cap_info_rsp(conn, &cmd, data); + err = l2cap_information_rsp(conn, &cmd, data); break; default: diff -Nru a/net/core/neighbour.c b/net/core/neighbour.c --- a/net/core/neighbour.c 2004-09-21 20:52:51 -07:00 +++ b/net/core/neighbour.c 2004-09-21 20:52:51 -07:00 @@ -133,7 +133,7 @@ if (atomic_read(&n->refcnt) == 1 && !(n->nud_state & NUD_PERMANENT) && (n->nud_state != NUD_INCOMPLETE || - jiffies - n->used > n->parms->retrans_time)) { + time_after(jiffies, n->used + n->parms->retrans_time))) { *np = n->next; n->dead = 1; shrunk = 1; @@ -255,7 +255,7 @@ if (tbl->entries > tbl->gc_thresh3 || (tbl->entries > tbl->gc_thresh2 && - now - tbl->last_flush > 5 * HZ)) { + time_after(now, tbl->last_flush + 5 * HZ))) { if (!neigh_forced_gc(tbl) && tbl->entries > tbl->gc_thresh3) goto out; @@ -542,40 +542,6 @@ hh->hh_output = neigh->ops->hh_output; } -/* - Transitions NUD_STALE <-> NUD_REACHABLE do not occur - when fast path is built: we have no timers associated with - these states, we do not have time to check state when sending. - neigh_periodic_timer check periodically neigh->confirmed - time and moves NUD_REACHABLE -> NUD_STALE. - - If a routine wants to know TRUE entry state, it calls - neigh_sync before checking state. - - Called with write_locked neigh. - */ - -static void neigh_sync(struct neighbour *n) -{ - unsigned long now = jiffies; - u8 state = n->nud_state; - - if (state & (NUD_NOARP | NUD_PERMANENT)) - return; - if (state & NUD_REACHABLE) { - if (now - n->confirmed > n->parms->reachable_time) { - n->nud_state = NUD_STALE; - neigh_suspect(n); - } - } else if (state & NUD_VALID) { - if (now - n->confirmed < n->parms->reachable_time) { - neigh_del_timer(n); - n->nud_state = NUD_REACHABLE; - neigh_connect(n); - } - } -} - static void neigh_periodic_timer(unsigned long arg) { struct neigh_table *tbl = (struct neigh_table *)arg; @@ -589,7 +555,7 @@ * periodically recompute ReachableTime from random function */ - if (now - tbl->last_rand > 300 * HZ) { + if (time_after(now, tbl->last_rand + 300 * HZ)) { struct neigh_parms *p; tbl->last_rand = now; for (p = &tbl->parms; p; p = p->next) @@ -612,24 +578,18 @@ goto next_elt; } - if ((long)(n->used - n->confirmed) < 0) + if (time_before(n->used, n->confirmed)) n->used = n->confirmed; if (atomic_read(&n->refcnt) == 1 && (state == NUD_FAILED || - now - n->used > n->parms->gc_staletime)) { + time_after(now, n->used + n->parms->gc_staletime))) { *np = n->next; n->dead = 1; write_unlock(&n->lock); neigh_release(n); continue; } - - if (n->nud_state & NUD_REACHABLE && - now - n->confirmed > n->parms->reachable_time) { - n->nud_state = NUD_STALE; - neigh_suspect(n); - } write_unlock(&n->lock); next_elt: @@ -654,7 +614,7 @@ static void neigh_timer_handler(unsigned long arg) { - unsigned long now = jiffies; + unsigned long now, next; struct neighbour *neigh = (struct neighbour *)arg; unsigned state; int notify = 0; @@ -662,6 +622,8 @@ write_lock(&neigh->lock); state = neigh->nud_state; + now = jiffies; + next = now + HZ; if (!(state & NUD_IN_TIMER)) { #ifndef CONFIG_SMP @@ -670,20 +632,42 @@ goto out; } - if ((state & NUD_VALID) && - now - neigh->confirmed < neigh->parms->reachable_time) { - neigh->nud_state = NUD_REACHABLE; - NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); - neigh_connect(neigh); - goto out; - } - if (state == NUD_DELAY) { - NEIGH_PRINTK2("neigh %p is probed.\n", neigh); - neigh->nud_state = NUD_PROBE; - atomic_set(&neigh->probes, 0); + if (state & NUD_REACHABLE) { + if (time_before_eq(now, + neigh->confirmed + neigh->parms->reachable_time)) { + NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); + next = neigh->confirmed + neigh->parms->reachable_time; + } else if (time_before_eq(now, + neigh->used + neigh->parms->delay_probe_time)) { + NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); + neigh->nud_state = NUD_DELAY; + neigh_suspect(neigh); + next = now + neigh->parms->delay_probe_time; + } else { + NEIGH_PRINTK2("neigh %p is suspected.\n", neigh); + neigh->nud_state = NUD_STALE; + neigh_suspect(neigh); + } + } else if (state & NUD_DELAY) { + if (time_before_eq(now, + neigh->confirmed + neigh->parms->delay_probe_time)) { + NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); + neigh->nud_state = NUD_REACHABLE; + neigh_connect(neigh); + next = neigh->confirmed + neigh->parms->reachable_time; + } else { + NEIGH_PRINTK2("neigh %p is probed.\n", neigh); + neigh->nud_state = NUD_PROBE; + atomic_set(&neigh->probes, 0); + next = now + neigh->parms->retrans_time; + } + } else { + /* NUD_PROBE|NUD_INCOMPLETE */ + next = now + neigh->parms->retrans_time; } - if (atomic_read(&neigh->probes) >= neigh_max_probes(neigh)) { + if ((neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) && + atomic_read(&neigh->probes) >= neigh_max_probes(neigh)) { struct sk_buff *skb; neigh->nud_state = NUD_FAILED; @@ -703,19 +687,24 @@ write_lock(&neigh->lock); } skb_queue_purge(&neigh->arp_queue); - goto out; } - neigh->timer.expires = now + neigh->parms->retrans_time; - add_timer(&neigh->timer); - write_unlock(&neigh->lock); - - neigh->ops->solicit(neigh, skb_peek(&neigh->arp_queue)); - atomic_inc(&neigh->probes); - return; - + if (neigh->nud_state & NUD_IN_TIMER) { + neigh_hold(neigh); + if (time_before(next, jiffies + HZ/2)) + next = jiffies + HZ/2; + neigh->timer.expires = next; + add_timer(&neigh->timer); + } + if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { + write_unlock(&neigh->lock); + neigh->ops->solicit(neigh, skb_peek(&neigh->arp_queue)); + atomic_inc(&neigh->probes); + } else { out: - write_unlock(&neigh->lock); + write_unlock(&neigh->lock); + } + #ifdef CONFIG_ARPD if (notify && neigh->parms->app_probes) neigh_app_notify(neigh); @@ -726,6 +715,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) { int rc; + unsigned long now; write_lock_bh(&neigh->lock); @@ -733,18 +723,15 @@ if (neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE)) goto out_unlock_bh; + now = jiffies; + if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { if (neigh->parms->mcast_probes + neigh->parms->app_probes) { atomic_set(&neigh->probes, neigh->parms->ucast_probes); neigh->nud_state = NUD_INCOMPLETE; neigh_hold(neigh); - neigh->timer.expires = jiffies + - neigh->parms->retrans_time; + neigh->timer.expires = now + 1; add_timer(&neigh->timer); - write_unlock_bh(&neigh->lock); - neigh->ops->solicit(neigh, skb); - atomic_inc(&neigh->probes); - write_lock_bh(&neigh->lock); } else { neigh->nud_state = NUD_FAILED; write_unlock_bh(&neigh->lock); @@ -753,6 +740,12 @@ kfree_skb(skb); return 1; } + } else if (neigh->nud_state & NUD_STALE) { + NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); + neigh_hold(neigh); + neigh->nud_state = NUD_DELAY; + neigh->timer.expires = jiffies + neigh->parms->delay_probe_time; + add_timer(&neigh->timer); } if (neigh->nud_state == NUD_INCOMPLETE) { @@ -767,13 +760,6 @@ __skb_queue_tail(&neigh->arp_queue, skb); } rc = 1; - } else if (neigh->nud_state == NUD_STALE) { - NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); - neigh_hold(neigh); - neigh->nud_state = NUD_DELAY; - neigh->timer.expires = jiffies + neigh->parms->delay_probe_time; - add_timer(&neigh->timer); - rc = 0; } out_unlock_bh: write_unlock_bh(&neigh->lock); @@ -800,14 +786,26 @@ /* Generic update routine. -- lladdr is new lladdr or NULL, if it is not supplied. -- new is new state. - -- override == 1 allows to override existing lladdr, if it is different. - -- arp == 0 means that the change is administrative. + -- flags + NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, + if it is different. + NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" + lladdr instead of overriding it + if it is different. + It also allows to retain current state + if lladdr is unchanged. + NEIGH_UPDATE_F_ADMIN means that the change is administrative. + + NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing + NTF_ROUTER flag. + NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as + a router. Caller MUST hold reference count on the entry. */ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, - int override, int arp) + u32 flags) { u8 old; int err; @@ -815,6 +813,7 @@ int notify = 0; #endif struct net_device *dev; + int update_isrouter = 0; write_lock_bh(&neigh->lock); @@ -822,7 +821,8 @@ old = neigh->nud_state; err = -EPERM; - if (arp && (old & (NUD_NOARP | NUD_PERMANENT))) + if (!(flags & NEIGH_UPDATE_F_ADMIN) && + (old & (NUD_NOARP | NUD_PERMANENT))) goto out; if (!(new & NUD_VALID)) { @@ -847,12 +847,9 @@ - compare new & old - if they are different, check override flag */ - if (old & NUD_VALID) { - if (!memcmp(lladdr, neigh->ha, dev->addr_len)) - lladdr = neigh->ha; - else if (!override) - goto out; - } + if ((old & NUD_VALID) && + !memcmp(lladdr, neigh->ha, dev->addr_len)) + lladdr = neigh->ha; } else { /* No address is supplied; if we know something, use it, otherwise discard the request. @@ -863,8 +860,6 @@ lladdr = neigh->ha; } - neigh_sync(neigh); - old = neigh->nud_state; if (new & NUD_CONNECTED) neigh->confirmed = jiffies; neigh->updated = jiffies; @@ -873,12 +868,37 @@ do not change entry state, if new one is STALE. */ err = 0; - if ((old & NUD_VALID) && lladdr == neigh->ha && - (new == old || (new == NUD_STALE && (old & NUD_CONNECTED)))) - goto out; + update_isrouter = flags & NEIGH_UPDATE_F_OVERRIDE_ISROUTER; + if (old & NUD_VALID) { + if (lladdr != neigh->ha && !(flags & NEIGH_UPDATE_F_OVERRIDE)) { + update_isrouter = 0; + if ((flags & NEIGH_UPDATE_F_WEAK_OVERRIDE) && + (old & NUD_CONNECTED)) { + lladdr = neigh->ha; + new = NUD_STALE; + } else + goto out; + } else { + if (lladdr == neigh->ha && new == NUD_STALE && + ((flags & NEIGH_UPDATE_F_WEAK_OVERRIDE) || + (old & NUD_CONNECTED)) + ) + new = old; + } + } + + if (new != old) { + neigh_del_timer(neigh); + if (new & NUD_IN_TIMER) { + neigh_hold(neigh); + neigh->timer.expires = jiffies + + ((new & NUD_REACHABLE) ? + neigh->parms->reachable_time : 0); + add_timer(&neigh->timer); + } + neigh->nud_state = new; + } - neigh_del_timer(neigh); - neigh->nud_state = new; if (lladdr != neigh->ha) { memcpy(&neigh->ha, lladdr, dev->addr_len); neigh_update_hhs(neigh); @@ -913,6 +933,11 @@ skb_queue_purge(&neigh->arp_queue); } out: + if (update_isrouter) { + neigh->flags = (flags & NEIGH_UPDATE_F_ISROUTER) ? + (neigh->flags | NTF_ROUTER) : + (neigh->flags & ~NTF_ROUTER); + } write_unlock_bh(&neigh->lock); #ifdef CONFIG_ARPD if (notify && neigh->parms->app_probes) @@ -928,7 +953,8 @@ struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, lladdr || !dev->addr_len); if (neigh) - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_OVERRIDE); return neigh; } @@ -1094,26 +1120,25 @@ struct sk_buff *skb) { unsigned long now = jiffies; - long sched_next = net_random() % p->proxy_delay; + unsigned long sched_next = now + (net_random() % p->proxy_delay); if (tbl->proxy_queue.qlen > p->proxy_qlen) { kfree_skb(skb); return; } skb->stamp.tv_sec = LOCALLY_ENQUEUED; - skb->stamp.tv_usec = now + sched_next; + skb->stamp.tv_usec = sched_next; spin_lock(&tbl->proxy_queue.lock); if (del_timer(&tbl->proxy_timer)) { - long tval = tbl->proxy_timer.expires - now; - if (tval < sched_next) - sched_next = tval; + if (time_before(tbl->proxy_timer.expires, sched_next)) + sched_next = tbl->proxy_timer.expires; } dst_release(skb->dst); skb->dst = NULL; dev_hold(skb->dev); __skb_queue_tail(&tbl->proxy_queue, skb); - mod_timer(&tbl->proxy_timer, now + sched_next); + mod_timer(&tbl->proxy_timer, sched_next); spin_unlock(&tbl->proxy_queue.lock); } @@ -1274,7 +1299,9 @@ n = neigh_lookup(tbl, RTA_DATA(nda[NDA_DST - 1]), dev); if (n) { - err = neigh_update(n, NULL, NUD_FAILED, 1, 0); + err = neigh_update(n, NULL, NUD_FAILED, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(n); } goto out_dev_put; @@ -1347,7 +1374,8 @@ RTA_DATA(nda[NDA_LLADDR - 1]) : NULL, ndm->ndm_state, - override, 0); + (override ? NEIGH_UPDATE_F_OVERRIDE : 0) | + NEIGH_UPDATE_F_ADMIN); } if (n) neigh_release(n); diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c --- a/net/core/netpoll.c 2004-09-21 20:52:52 -07:00 +++ b/net/core/netpoll.c 2004-09-21 20:52:52 -07:00 @@ -242,9 +242,9 @@ iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); /* iph->version = 4; iph->ihl = 5; */ - put_unaligned(0x54, (unsigned char *)iph); + put_unaligned(0x45, (unsigned char *)iph); iph->tos = 0; - put_unaligned(htonl(ip_len), &(iph->tot_len)); + put_unaligned(htons(ip_len), &(iph->tot_len)); iph->id = 0; iph->frag_off = 0; iph->ttl = 64; diff -Nru a/net/core/sock.c b/net/core/sock.c --- a/net/core/sock.c 2004-09-21 20:52:52 -07:00 +++ b/net/core/sock.c 2004-09-21 20:52:52 -07:00 @@ -1343,6 +1343,27 @@ EXPORT_SYMBOL(sk_common_release); +int sk_alloc_slab(struct proto *prot, char *name) +{ + prot->slab = kmem_cache_create(name, + prot->slab_obj_size, 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + + return prot->slab != NULL ? 0 : -ENOBUFS; +} + +EXPORT_SYMBOL(sk_alloc_slab); + +void sk_free_slab(struct proto *prot) +{ + if (prot->slab != NULL) { + kmem_cache_destroy(prot->slab); + prot->slab = NULL; + } +} + +EXPORT_SYMBOL(sk_free_slab); + EXPORT_SYMBOL(__lock_sock); EXPORT_SYMBOL(__release_sock); EXPORT_SYMBOL(sk_alloc); diff -Nru a/net/ipv4/Kconfig b/net/ipv4/Kconfig --- a/net/ipv4/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/Kconfig 2004-09-21 20:52:52 -07:00 @@ -94,16 +94,6 @@ equal "cost" and chooses one of them in a non-deterministic fashion if a matching packet arrives. -config IP_ROUTE_TOS - bool "IP: use TOS value as routing key" - depends on IP_ADVANCED_ROUTER - help - The header of every IP packet carries a TOS (Type Of Service) value - with which the packet requests a certain treatment, e.g. low - latency (for interactive traffic), high throughput, or high - reliability. If you say Y here, you will be able to specify - different routes for packets with different TOS values. - config IP_ROUTE_VERBOSE bool "IP: verbose route monitoring" depends on IP_ADVANCED_ROUTER diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c --- a/net/ipv4/af_inet.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/af_inet.c 2004-09-21 20:52:51 -07:00 @@ -121,11 +121,6 @@ extern void ip_mc_drop_socket(struct sock *sk); -/* Per protocol sock slabcache */ -kmem_cache_t *tcp_sk_cachep; -static kmem_cache_t *udp_sk_cachep; -static kmem_cache_t *raw4_sk_cachep; - /* The inetsw table contains everything that inet_create needs to * build a new socket. */ @@ -228,28 +223,6 @@ return err; } -static __inline__ kmem_cache_t *inet_sk_slab(int protocol) -{ - kmem_cache_t* rc = tcp_sk_cachep; - - if (protocol == IPPROTO_UDP) - rc = udp_sk_cachep; - else if (protocol == IPPROTO_RAW) - rc = raw4_sk_cachep; - return rc; -} - -static __inline__ int inet_sk_size(int protocol) -{ - int rc = sizeof(struct tcp_sock); - - if (protocol == IPPROTO_UDP) - rc = sizeof(struct udp_sock); - else if (protocol == IPPROTO_RAW) - rc = sizeof(struct raw_sock); - return rc; -} - /* * Create an inet socket. */ @@ -260,13 +233,12 @@ struct list_head *p; struct inet_protosw *answer; struct inet_opt *inet; - int err = -ENOBUFS; + struct proto *answer_prot; + unsigned char answer_flags; + char answer_no_check; + int err; sock->state = SS_UNCONNECTED; - sk = sk_alloc(PF_INET, GFP_KERNEL, inet_sk_size(protocol), - inet_sk_slab(protocol)); - if (!sk) - goto out; /* Look for the requested type/protocol pair. */ answer = NULL; @@ -292,21 +264,35 @@ err = -ESOCKTNOSUPPORT; if (!answer) - goto out_sk_free; + goto out_rcu_unlock; err = -EPERM; if (answer->capability > 0 && !capable(answer->capability)) - goto out_sk_free; + goto out_rcu_unlock; err = -EPROTONOSUPPORT; if (!protocol) - goto out_sk_free; - err = 0; + goto out_rcu_unlock; + sock->ops = answer->ops; - sk->sk_prot = answer->prot; - sk->sk_no_check = answer->no_check; - if (INET_PROTOSW_REUSE & answer->flags) - sk->sk_reuse = 1; + answer_prot = answer->prot; + answer_no_check = answer->no_check; + answer_flags = answer->flags; rcu_read_unlock(); + BUG_TRAP(answer_prot->slab != NULL); + + err = -ENOBUFS; + sk = sk_alloc(PF_INET, GFP_KERNEL, + answer_prot->slab_obj_size, + answer_prot->slab); + if (sk == NULL) + goto out; + + err = 0; + sk->sk_prot = answer_prot; + sk->sk_no_check = answer_no_check; + if (INET_PROTOSW_REUSE & answer_flags) + sk->sk_reuse = 1; + inet = inet_sk(sk); if (SOCK_RAW == sock->type) { @@ -359,9 +345,8 @@ } out: return err; -out_sk_free: +out_rcu_unlock: rcu_read_unlock(); - sk_free(sk); goto out; } @@ -1010,24 +995,29 @@ struct sk_buff *dummy_skb; struct inet_protosw *q; struct list_head *r; + int rc = -EINVAL; if (sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "%s: panic\n", __FUNCTION__); - return -EINVAL; + goto out; + } + + rc = sk_alloc_slab(&tcp_prot, "tcp_sock"); + if (rc) { + sk_alloc_slab_error(&tcp_prot); + goto out; + } + rc = sk_alloc_slab(&udp_prot, "udp_sock"); + if (rc) { + sk_alloc_slab_error(&udp_prot); + goto out_tcp_free_slab; + } + rc = sk_alloc_slab(&raw_prot, "raw_sock"); + if (rc) { + sk_alloc_slab_error(&raw_prot); + goto out_udp_free_slab; } - tcp_sk_cachep = kmem_cache_create("tcp_sock", - sizeof(struct tcp_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - udp_sk_cachep = kmem_cache_create("udp_sock", - sizeof(struct udp_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - raw4_sk_cachep = kmem_cache_create("raw4_sock", - sizeof(struct raw_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if (!tcp_sk_cachep || !udp_sk_cachep || !raw4_sk_cachep) - printk(KERN_CRIT - "inet_init: Can't create protocol sock SLAB caches!\n"); /* * Tell SOCKET that we are alive... */ @@ -1097,7 +1087,14 @@ ipfrag_init(); - return 0; + rc = 0; +out: + return rc; +out_tcp_free_slab: + sk_free_slab(&tcp_prot); +out_udp_free_slab: + sk_free_slab(&udp_prot); + goto out; } module_init(inet_init); diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c --- a/net/ipv4/arp.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/arp.c 2004-09-21 20:52:52 -07:00 @@ -914,7 +914,7 @@ if (arp->ar_op != htons(ARPOP_REPLY) || skb->pkt_type != PACKET_HOST) state = NUD_STALE; - neigh_update(n, sha, state, override, 1); + neigh_update(n, sha, state, override ? NEIGH_UPDATE_F_OVERRIDE : 0); neigh_release(n); } @@ -1021,7 +1021,9 @@ if (r->arp_flags & ATF_PERM) state = NUD_PERMANENT; err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? - r->arp_ha.sa_data : NULL, state, 1, 0); + r->arp_ha.sa_data : NULL, state, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); } return err; @@ -1101,7 +1103,9 @@ neigh = neigh_lookup(&arp_tbl, &ip, dev); if (neigh) { if (neigh->nud_state&~NUD_NOARP) - err = neigh_update(neigh, NULL, NUD_FAILED, 1, 0); + err = neigh_update(neigh, NULL, NUD_FAILED, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); } return err; diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c --- a/net/ipv4/fib_hash.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/fib_hash.c 2004-09-21 20:52:52 -07:00 @@ -43,159 +43,114 @@ #include #include -#define FTprint(a...) -/* - printk(KERN_DEBUG a) - */ - -static kmem_cache_t * fn_hash_kmem; - -/* - These bizarre types are just to force strict type checking. - When I reversed order of bytes and changed to natural mask lengths, - I forgot to make fixes in several places. Now I am lazy to return - it back. - */ +static kmem_cache_t *fn_hash_kmem; +static kmem_cache_t *fn_alias_kmem; -typedef struct { - u32 datum; -} fn_key_t; - -typedef struct { - u32 datum; -} fn_hash_idx_t; - -struct fib_node -{ - struct fib_node *fn_next; - struct fib_info *fn_info; -#define FIB_INFO(f) ((f)->fn_info) - fn_key_t fn_key; - u8 fn_tos; - u8 fn_type; - u8 fn_scope; - u8 fn_state; +struct fib_node { + struct hlist_node fn_hash; + struct list_head fn_alias; + u32 fn_key; }; -#define FN_S_ZOMBIE 1 -#define FN_S_ACCESSED 2 - -static int fib_hash_zombies; - -struct fn_zone -{ - struct fn_zone *fz_next; /* Next not empty zone */ - struct fib_node **fz_hash; /* Hash table pointer */ - int fz_nent; /* Number of entries */ +struct fib_alias { + struct list_head fa_list; + struct fib_info *fa_info; + u8 fa_tos; + u8 fa_type; + u8 fa_scope; + u8 fa_state; +}; - int fz_divisor; /* Hash divisor */ - u32 fz_hashmask; /* (fz_divisor - 1) */ -#define FZ_HASHMASK(fz) ((fz)->fz_hashmask) +#define FN_S_ACCESSED 1 - int fz_order; /* Zone order */ - u32 fz_mask; -#define FZ_MASK(fz) ((fz)->fz_mask) +struct fn_zone { + struct fn_zone *fz_next; /* Next not empty zone */ + struct hlist_head *fz_hash; /* Hash table pointer */ + int fz_nent; /* Number of entries */ + + int fz_divisor; /* Hash divisor */ + u32 fz_hashmask; /* (fz_divisor - 1) */ +#define FZ_HASHMASK(fz) ((fz)->fz_hashmask) + + int fz_order; /* Zone order */ + u32 fz_mask; +#define FZ_MASK(fz) ((fz)->fz_mask) }; /* NOTE. On fast computers evaluation of fz_hashmask and fz_mask - can be cheaper than memory lookup, so that FZ_* macros are used. + * can be cheaper than memory lookup, so that FZ_* macros are used. */ -struct fn_hash -{ +struct fn_hash { struct fn_zone *fn_zones[33]; struct fn_zone *fn_zone_list; }; -static __inline__ fn_hash_idx_t fn_hash(fn_key_t key, struct fn_zone *fz) +static inline u32 fn_hash(u32 key, struct fn_zone *fz) { - u32 h = ntohl(key.datum)>>(32 - fz->fz_order); + u32 h = ntohl(key)>>(32 - fz->fz_order); h ^= (h>>20); h ^= (h>>10); h ^= (h>>5); h &= FZ_HASHMASK(fz); - return *(fn_hash_idx_t*)&h; -} - -#define fz_key_0(key) ((key).datum = 0) -#define fz_prefix(key,fz) ((key).datum) - -static __inline__ fn_key_t fz_key(u32 dst, struct fn_zone *fz) -{ - fn_key_t k; - k.datum = dst & FZ_MASK(fz); - return k; -} - -static __inline__ struct fib_node ** fz_chain_p(fn_key_t key, struct fn_zone *fz) -{ - return &fz->fz_hash[fn_hash(key, fz).datum]; -} - -static __inline__ struct fib_node * fz_chain(fn_key_t key, struct fn_zone *fz) -{ - return fz->fz_hash[fn_hash(key, fz).datum]; -} - -static __inline__ int fn_key_eq(fn_key_t a, fn_key_t b) -{ - return a.datum == b.datum; + return h; } -static __inline__ int fn_key_leq(fn_key_t a, fn_key_t b) +static inline u32 fz_key(u32 dst, struct fn_zone *fz) { - return a.datum <= b.datum; + return dst & FZ_MASK(fz); } static rwlock_t fib_hash_lock = RW_LOCK_UNLOCKED; -#define FZ_MAX_DIVISOR ((PAGE_SIZE<fn_next; - for (fp = fz_chain_p(f->fn_key, fz); - *fp && fn_key_leq((*fp)->fn_key, f->fn_key); - fp = &(*fp)->fn_next) - /* NONE */; - f->fn_next = *fp; - *fp = f; + for (i = 0; i < old_divisor; i++) { + struct hlist_node *node, *n; + struct fib_node *f; + + hlist_for_each_entry_safe(f, node, n, &old_ht[i], fn_hash) { + struct hlist_head *new_head; + + hlist_del(&f->fn_hash); + + new_head = &fz->fz_hash[fn_hash(f->fn_key, fz)]; + hlist_add_head(&f->fn_hash, new_head); } } } -static void fz_hash_free(struct fib_node **hash, int divisor) +static void fz_hash_free(struct hlist_head *hash, int divisor) { if (divisor <= 1024) kfree(hash); else free_pages((unsigned long) hash, - get_order(divisor * sizeof(struct fib_node *))); + get_order(divisor * sizeof(struct hlist_head))); } static void fn_rehash_zone(struct fn_zone *fz) { - struct fib_node **ht, **old_ht; + struct hlist_head *ht, *old_ht; int old_divisor, new_divisor; u32 new_hashmask; @@ -226,7 +181,7 @@ ht = fz_hash_alloc(new_divisor); if (ht) { - memset(ht, 0, new_divisor*sizeof(struct fib_node*)); + memset(ht, 0, new_divisor * sizeof(struct hlist_head)); write_lock_bh(&fib_hash_lock); old_ht = fz->fz_hash; @@ -240,12 +195,16 @@ } } -static void fn_free_node(struct fib_node * f) +static inline void fn_free_node(struct fib_node * f) { - fib_release_info(FIB_INFO(f)); kmem_cache_free(fn_hash_kmem, f); } +static inline void fn_free_alias(struct fib_alias *fa) +{ + fib_release_info(fa->fa_info); + kmem_cache_free(fn_alias_kmem, fa); +} static struct fn_zone * fn_new_zone(struct fn_hash *table, int z) @@ -267,7 +226,7 @@ kfree(fz); return NULL; } - memset(fz->fz_hash, 0, fz->fz_divisor*sizeof(struct fib_node*)); + memset(fz->fz_hash, 0, fz->fz_divisor * sizeof(struct hlist_head *)); fz->fz_order = z; fz->fz_mask = inet_make_mask(z); @@ -298,36 +257,39 @@ read_lock(&fib_hash_lock); for (fz = t->fn_zone_list; fz; fz = fz->fz_next) { + struct hlist_head *head; + struct hlist_node *node; struct fib_node *f; - fn_key_t k = fz_key(flp->fl4_dst, fz); + u32 k = fz_key(flp->fl4_dst, fz); - for (f = fz_chain(k, fz); f; f = f->fn_next) { - if (!fn_key_eq(k, f->fn_key)) { - if (fn_key_leq(k, f->fn_key)) - break; - else - continue; - } -#ifdef CONFIG_IP_ROUTE_TOS - if (f->fn_tos && f->fn_tos != flp->fl4_tos) - continue; -#endif - f->fn_state |= FN_S_ACCESSED; + head = &fz->fz_hash[fn_hash(k, fz)]; + hlist_for_each_entry(f, node, head, fn_hash) { + struct fib_alias *fa; - if (f->fn_state&FN_S_ZOMBIE) - continue; - if (f->fn_scope < flp->fl4_scope) + if (f->fn_key != k) continue; - err = fib_semantic_match(f->fn_type, FIB_INFO(f), flp, res); - if (err == 0) { - res->type = f->fn_type; - res->scope = f->fn_scope; - res->prefixlen = fz->fz_order; - goto out; + list_for_each_entry(fa, &f->fn_alias, fa_list) { + if (fa->fa_tos && + fa->fa_tos != flp->fl4_tos) + continue; + if (fa->fa_scope < flp->fl4_scope) + continue; + + fa->fa_state |= FN_S_ACCESSED; + + err = fib_semantic_match(fa->fa_type, + fa->fa_info, + flp, res); + if (err == 0) { + res->type = fa->fa_type; + res->scope = fa->fa_scope; + res->prefixlen = fz->fz_order; + goto out; + } + if (err < 0) + goto out; } - if (err < 0) - goto out; } } err = 1; @@ -365,6 +327,7 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) { int order, last_idx; + struct hlist_node *node; struct fib_node *f; struct fib_info *fi = NULL; struct fib_info *last_resort; @@ -379,36 +342,41 @@ order = -1; read_lock(&fib_hash_lock); - for (f = fz->fz_hash[0]; f; f = f->fn_next) { - struct fib_info *next_fi = FIB_INFO(f); + hlist_for_each_entry(f, node, &fz->fz_hash[0], fn_hash) { + struct fib_alias *fa; - if ((f->fn_state&FN_S_ZOMBIE) || - f->fn_scope != res->scope || - f->fn_type != RTN_UNICAST) - continue; + list_for_each_entry(fa, &f->fn_alias, fa_list) { + struct fib_info *next_fi = fa->fa_info; - if (next_fi->fib_priority > res->fi->fib_priority) - break; - if (!next_fi->fib_nh[0].nh_gw || next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK) - continue; - f->fn_state |= FN_S_ACCESSED; + if (fa->fa_scope != res->scope || + fa->fa_type != RTN_UNICAST) + continue; - if (fi == NULL) { - if (next_fi != res->fi) + if (next_fi->fib_priority > res->fi->fib_priority) break; - } else if (!fib_detect_death(fi, order, &last_resort, &last_idx)) { - if (res->fi) - fib_info_put(res->fi); - res->fi = fi; - atomic_inc(&fi->fib_clntref); - fn_hash_last_dflt = order; - goto out; + if (!next_fi->fib_nh[0].nh_gw || + next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK) + continue; + fa->fa_state |= FN_S_ACCESSED; + + if (fi == NULL) { + if (next_fi != res->fi) + break; + } else if (!fib_detect_death(fi, order, &last_resort, + &last_idx)) { + if (res->fi) + fib_info_put(res->fi); + res->fi = fi; + atomic_inc(&fi->fib_clntref); + fn_hash_last_dflt = order; + goto out; + } + fi = next_fi; + order++; } - fi = next_fi; - order++; } - if (order<=0 || fi==NULL) { + if (order <= 0 || fi == NULL) { fn_hash_last_dflt = -1; goto out; } @@ -434,52 +402,78 @@ read_unlock(&fib_hash_lock); } -#define FIB_SCAN(f, fp) \ -for ( ; ((f) = *(fp)) != NULL; (fp) = &(f)->fn_next) +static void rtmsg_fib(int, struct fib_node *, struct fib_alias *, + int, int, + struct nlmsghdr *n, + struct netlink_skb_parms *); -#define FIB_SCAN_KEY(f, fp, key) \ -for ( ; ((f) = *(fp)) != NULL && fn_key_eq((f)->fn_key, (key)); (fp) = &(f)->fn_next) +/* Insert node F to FZ. */ +static inline void fib_insert_node(struct fn_zone *fz, struct fib_node *f) +{ + struct hlist_head *head = &fz->fz_hash[fn_hash(f->fn_key, fz)]; -#ifndef CONFIG_IP_ROUTE_TOS -#define FIB_SCAN_TOS(f, fp, key, tos) FIB_SCAN_KEY(f, fp, key) -#else -#define FIB_SCAN_TOS(f, fp, key, tos) \ -for ( ; ((f) = *(fp)) != NULL && fn_key_eq((f)->fn_key, (key)) && \ - (f)->fn_tos == (tos) ; (fp) = &(f)->fn_next) -#endif + hlist_add_head(&f->fn_hash, head); +} +/* Return the node in FZ matching KEY. */ +static struct fib_node *fib_find_node(struct fn_zone *fz, u32 key) +{ + struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; + struct hlist_node *node; + struct fib_node *f; -static void rtmsg_fib(int, struct fib_node*, int, int, - struct nlmsghdr *n, - struct netlink_skb_parms *); + hlist_for_each_entry(f, node, head, fn_hash) { + if (f->fn_key == key) + return f; + } + + return NULL; +} + +/* Return the first fib alias matching TOS with + * priority less than or equal to PRIO. + */ +static struct fib_alias *fib_find_alias(struct fib_node *fn, u8 tos, u32 prio) +{ + if (fn) { + struct list_head *head = &fn->fn_alias; + struct fib_alias *fa, *prev_fa; + + prev_fa = NULL; + list_for_each_entry(fa, head, fa_list) { + if (fa->fa_tos != tos) + continue; + prev_fa = fa; + if (prio <= fa->fa_info->fib_priority) + break; + } + return fa; + } + return NULL; +} static int fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, - struct nlmsghdr *n, struct netlink_skb_parms *req) + struct nlmsghdr *n, struct netlink_skb_parms *req) { - struct fn_hash *table = (struct fn_hash*)tb->tb_data; - struct fib_node *new_f, *f, **fp, **del_fp; + struct fn_hash *table = (struct fn_hash *) tb->tb_data; + struct fib_node *new_f, *f; + struct fib_alias *fa, *new_fa; struct fn_zone *fz; struct fib_info *fi; - int z = r->rtm_dst_len; int type = r->rtm_type; -#ifdef CONFIG_IP_ROUTE_TOS u8 tos = r->rtm_tos; -#endif - fn_key_t key; + u32 key; int err; -FTprint("tb(%d)_insert: %d %08x/%d %d %08x\n", tb->tb_id, r->rtm_type, rta->rta_dst ? -*(u32*)rta->rta_dst : 0, z, rta->rta_oif ? *rta->rta_oif : -1, -rta->rta_prefsrc ? *(u32*)rta->rta_prefsrc : 0); if (z > 32) return -EINVAL; fz = table->fn_zones[z]; if (!fz && !(fz = fn_new_zone(table, z))) return -ENOBUFS; - fz_key_0(key); + key = 0; if (rta->rta_dst) { u32 dst; memcpy(&dst, rta->rta_dst, 4); @@ -496,136 +490,111 @@ (z==32 || (1< fz->fz_divisor)) fn_rehash_zone(fz); - fp = fz_chain_p(key, fz); - + f = fib_find_node(fz, key); + fa = fib_find_alias(f, tos, fi->fib_priority); - /* - * Scan list to find the first route with the same destination - */ - FIB_SCAN(f, fp) { - if (fn_key_leq(key,f->fn_key)) - break; - } - -#ifdef CONFIG_IP_ROUTE_TOS - /* - * Find route with the same destination and tos. + /* Now fa, if non-NULL, points to the first fib alias + * with the same keys [prefix,tos,priority], if such key already + * exists or to the node before which we will insert new one. + * + * If fa is NULL, we will need to allocate a new one and + * insert to the head of f. + * + * If f is NULL, no fib node matched the destination key + * and we need to allocate a new one of those as well. */ - FIB_SCAN_KEY(f, fp, key) { - if (f->fn_tos <= tos) - break; - } -#endif - del_fp = NULL; - - if (f && (f->fn_state&FN_S_ZOMBIE) && -#ifdef CONFIG_IP_ROUTE_TOS - f->fn_tos == tos && -#endif - fn_key_eq(f->fn_key, key)) { - del_fp = fp; - fp = &f->fn_next; - f = *fp; - goto create; - } - - FIB_SCAN_TOS(f, fp, key, tos) { - if (fi->fib_priority <= FIB_INFO(f)->fib_priority) - break; - } - - /* Now f==*fp points to the first node with the same - keys [prefix,tos,priority], if such key already - exists or to the node, before which we will insert new one. - */ - - if (f && -#ifdef CONFIG_IP_ROUTE_TOS - f->fn_tos == tos && -#endif - fn_key_eq(f->fn_key, key) && - fi->fib_priority == FIB_INFO(f)->fib_priority) { - struct fib_node **ins_fp; + if (fa && + fa->fa_info->fib_priority == fi->fib_priority) { + struct fib_alias *fa_orig; err = -EEXIST; - if (n->nlmsg_flags&NLM_F_EXCL) + if (n->nlmsg_flags & NLM_F_EXCL) goto out; - if (n->nlmsg_flags&NLM_F_REPLACE) { - del_fp = fp; - fp = &f->fn_next; - f = *fp; - goto replace; - } + if (n->nlmsg_flags & NLM_F_REPLACE) { + struct fib_info *fi_drop; + u8 state; - ins_fp = fp; - err = -EEXIST; + write_lock_bh(&fib_hash_lock); + fi_drop = fa->fa_info; + fa->fa_info = fi; + fa->fa_type = type; + fa->fa_scope = r->rtm_scope; + state = fa->fa_state; + fa->fa_state &= ~FN_S_ACCESSED; + write_unlock_bh(&fib_hash_lock); - FIB_SCAN_TOS(f, fp, key, tos) { - if (fi->fib_priority != FIB_INFO(f)->fib_priority) - break; - if (f->fn_type == type && f->fn_scope == r->rtm_scope - && FIB_INFO(f) == fi) - goto out; + fib_release_info(fi_drop); + if (state & FN_S_ACCESSED) + rt_cache_flush(-1); + return 0; } - if (!(n->nlmsg_flags&NLM_F_APPEND)) { - fp = ins_fp; - f = *fp; + /* Error if we find a perfect match which + * uses the same scope, type, and nexthop + * information. + */ + fa_orig = fa; + list_for_each_entry(fa, fa->fa_list.prev, fa_list) { + if (fa->fa_info->fib_priority != fi->fib_priority) + break; + if (fa->fa_type == type && + fa->fa_scope == r->rtm_scope && + fa->fa_info == fi) + goto out; } + if (!(n->nlmsg_flags & NLM_F_APPEND)) + fa = fa_orig; } -create: err = -ENOENT; if (!(n->nlmsg_flags&NLM_F_CREATE)) goto out; -replace: err = -ENOBUFS; - new_f = kmem_cache_alloc(fn_hash_kmem, SLAB_KERNEL); - if (new_f == NULL) + new_fa = kmem_cache_alloc(fn_alias_kmem, SLAB_KERNEL); + if (new_fa == NULL) goto out; - memset(new_f, 0, sizeof(struct fib_node)); - - new_f->fn_key = key; -#ifdef CONFIG_IP_ROUTE_TOS - new_f->fn_tos = tos; -#endif - new_f->fn_type = type; - new_f->fn_scope = r->rtm_scope; - FIB_INFO(new_f) = fi; + new_f = NULL; + if (!f) { + new_f = kmem_cache_alloc(fn_hash_kmem, SLAB_KERNEL); + if (new_f == NULL) + goto out_free_new_fa; + + INIT_HLIST_NODE(&new_f->fn_hash); + INIT_LIST_HEAD(&new_f->fn_alias); + new_f->fn_key = key; + f = new_f; + } + + new_fa->fa_info = fi; + new_fa->fa_tos = tos; + new_fa->fa_type = type; + new_fa->fa_scope = r->rtm_scope; + new_fa->fa_state = 0; /* * Insert new entry to the list. */ - new_f->fn_next = f; write_lock_bh(&fib_hash_lock); - *fp = new_f; + if (new_f) + fib_insert_node(fz, new_f); + list_add(&new_fa->fa_list, + (fa ? &fa->fa_list : &f->fn_alias)); write_unlock_bh(&fib_hash_lock); - fz->fz_nent++; - if (del_fp) { - f = *del_fp; - /* Unlink replaced node */ - write_lock_bh(&fib_hash_lock); - *del_fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + if (new_f) + fz->fz_nent++; + rt_cache_flush(-1); - if (!(f->fn_state&FN_S_ZOMBIE)) - rtmsg_fib(RTM_DELROUTE, f, z, tb->tb_id, n, req); - if (f->fn_state&FN_S_ACCESSED) - rt_cache_flush(-1); - fn_free_node(f); - fz->fz_nent--; - } else { - rt_cache_flush(-1); - } - rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->tb_id, n, req); + rtmsg_fib(RTM_NEWROUTE, f, new_fa, z, tb->tb_id, n, req); return 0; +out_free_new_fa: + kmem_cache_free(fn_alias_kmem, new_fa); out: fib_release_info(fi); return err; @@ -634,26 +603,22 @@ static int fn_hash_delete(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, - struct nlmsghdr *n, struct netlink_skb_parms *req) + struct nlmsghdr *n, struct netlink_skb_parms *req) { struct fn_hash *table = (struct fn_hash*)tb->tb_data; - struct fib_node **fp, **del_fp, *f; + struct fib_node *f; + struct fib_alias *fa, *fa_to_delete; int z = r->rtm_dst_len; struct fn_zone *fz; - fn_key_t key; - int matched; -#ifdef CONFIG_IP_ROUTE_TOS + u32 key; u8 tos = r->rtm_tos; -#endif -FTprint("tb(%d)_delete: %d %08x/%d %d\n", tb->tb_id, r->rtm_type, rta->rta_dst ? - *(u32*)rta->rta_dst : 0, z, rta->rta_oif ? *rta->rta_oif : -1); if (z > 32) return -EINVAL; if ((fz = table->fn_zones[z]) == NULL) return -ESRCH; - fz_key_0(key); + key = 0; if (rta->rta_dst) { u32 dst; memcpy(&dst, rta->rta_dst, 4); @@ -662,62 +627,48 @@ key = fz_key(dst, fz); } - fp = fz_chain_p(key, fz); - + f = fib_find_node(fz, key); + fa = fib_find_alias(f, tos, 0); + if (!fa) + return -ESRCH; - FIB_SCAN(f, fp) { - if (fn_key_eq(f->fn_key, key)) + fa_to_delete = NULL; + list_for_each_entry(fa, fa->fa_list.prev, fa_list) { + struct fib_info *fi = fa->fa_info; + + if ((!r->rtm_type || + fa->fa_type == r->rtm_type) && + (r->rtm_scope == RT_SCOPE_NOWHERE || + fa->fa_scope == r->rtm_scope) && + (!r->rtm_protocol || + fi->fib_protocol == r->rtm_protocol) && + fib_nh_match(r, n, rta, fi) == 0) { + fa_to_delete = fa; break; - if (fn_key_leq(key, f->fn_key)) { - return -ESRCH; } } -#ifdef CONFIG_IP_ROUTE_TOS - FIB_SCAN_KEY(f, fp, key) { - if (f->fn_tos == tos) - break; - } -#endif - matched = 0; - del_fp = NULL; - FIB_SCAN_TOS(f, fp, key, tos) { - struct fib_info * fi = FIB_INFO(f); + if (fa_to_delete) { + int kill_fn; - if (f->fn_state&FN_S_ZOMBIE) { - return -ESRCH; - } - matched++; - - if (del_fp == NULL && - (!r->rtm_type || f->fn_type == r->rtm_type) && - (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) && - (!r->rtm_protocol || fi->fib_protocol == r->rtm_protocol) && - fib_nh_match(r, n, rta, fi) == 0) - del_fp = fp; - } + fa = fa_to_delete; + rtmsg_fib(RTM_DELROUTE, f, fa, z, tb->tb_id, n, req); - if (del_fp) { - f = *del_fp; - rtmsg_fib(RTM_DELROUTE, f, z, tb->tb_id, n, req); - - if (matched != 1) { - write_lock_bh(&fib_hash_lock); - *del_fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + kill_fn = 0; + write_lock_bh(&fib_hash_lock); + list_del(&fa->fa_list); + if (list_empty(&f->fn_alias)) { + hlist_del(&f->fn_hash); + kill_fn = 1; + } + write_unlock_bh(&fib_hash_lock); - if (f->fn_state&FN_S_ACCESSED) - rt_cache_flush(-1); + if (fa->fa_state & FN_S_ACCESSED) + rt_cache_flush(-1); + fn_free_alias(fa); + if (kill_fn) { fn_free_node(f); fz->fz_nent--; - } else { - f->fn_state |= FN_S_ZOMBIE; - if (f->fn_state&FN_S_ACCESSED) { - f->fn_state &= ~FN_S_ACCESSED; - rt_cache_flush(-1); - } - if (++fib_hash_zombies > 128) - fib_flush(); } return 0; @@ -725,74 +676,99 @@ return -ESRCH; } -static __inline__ int -fn_flush_list(struct fib_node ** fp, int z, struct fn_hash *table) +static int fn_flush_list(struct fn_zone *fz, int idx) { - int found = 0; + struct hlist_head *head = &fz->fz_hash[idx]; + struct hlist_node *node, *n; struct fib_node *f; + int found = 0; - while ((f = *fp) != NULL) { - struct fib_info *fi = FIB_INFO(f); - - if (fi && ((f->fn_state&FN_S_ZOMBIE) || (fi->fib_flags&RTNH_F_DEAD))) { - write_lock_bh(&fib_hash_lock); - *fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + hlist_for_each_entry_safe(f, node, n, head, fn_hash) { + struct fib_alias *fa, *fa_node; + int kill_f; + + kill_f = 0; + list_for_each_entry_safe(fa, fa_node, &f->fn_alias, fa_list) { + struct fib_info *fi = fa->fa_info; + + if (fi && (fi->fib_flags&RTNH_F_DEAD)) { + write_lock_bh(&fib_hash_lock); + list_del(&fa->fa_list); + if (list_empty(&f->fn_alias)) { + hlist_del(&f->fn_hash); + kill_f = 1; + } + write_unlock_bh(&fib_hash_lock); + fn_free_alias(fa); + found++; + } + } + if (kill_f) { fn_free_node(f); - found++; - continue; + fz->fz_nent--; } - fp = &f->fn_next; } return found; } static int fn_hash_flush(struct fib_table *tb) { - struct fn_hash *table = (struct fn_hash*)tb->tb_data; + struct fn_hash *table = (struct fn_hash *) tb->tb_data; struct fn_zone *fz; int found = 0; - fib_hash_zombies = 0; for (fz = table->fn_zone_list; fz; fz = fz->fz_next) { int i; - int tmp = 0; - for (i=fz->fz_divisor-1; i>=0; i--) - tmp += fn_flush_list(&fz->fz_hash[i], fz->fz_order, table); - fz->fz_nent -= tmp; - found += tmp; + + for (i = fz->fz_divisor - 1; i >= 0; i--) + found += fn_flush_list(fz, i); } return found; } -static __inline__ int +static inline int fn_hash_dump_bucket(struct sk_buff *skb, struct netlink_callback *cb, struct fib_table *tb, struct fn_zone *fz, - struct fib_node *f) + struct hlist_head *head) { + struct hlist_node *node; + struct fib_node *f; int i, s_i; s_i = cb->args[3]; - for (i=0; f; i++, f=f->fn_next) { - if (i < s_i) continue; - if (f->fn_state&FN_S_ZOMBIE) continue; - if (fib_dump_info(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, - RTM_NEWROUTE, - tb->tb_id, (f->fn_state&FN_S_ZOMBIE) ? 0 : f->fn_type, f->fn_scope, - &f->fn_key, fz->fz_order, f->fn_tos, - f->fn_info) < 0) { - cb->args[3] = i; - return -1; + i = 0; + hlist_for_each_entry(f, node, head, fn_hash) { + struct fib_alias *fa; + + list_for_each_entry(fa, &f->fn_alias, fa_list) { + if (i < s_i) + continue; + + if (fib_dump_info(skb, NETLINK_CB(cb->skb).pid, + cb->nlh->nlmsg_seq, + RTM_NEWROUTE, + tb->tb_id, + fa->fa_type, + fa->fa_scope, + &f->fn_key, + fz->fz_order, + fa->fa_tos, + fa->fa_info) < 0) { + cb->args[3] = i; + return -1; + } + + i++; } } cb->args[3] = i; return skb->len; } -static __inline__ int +static inline int fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb, struct fib_table *tb, struct fn_zone *fz) @@ -803,10 +779,12 @@ for (h=0; h < fz->fz_divisor; h++) { if (h < s_h) continue; if (h > s_h) - memset(&cb->args[3], 0, sizeof(cb->args) - 3*sizeof(cb->args[0])); - if (fz->fz_hash == NULL || fz->fz_hash[h] == NULL) + memset(&cb->args[3], 0, + sizeof(cb->args) - 3*sizeof(cb->args[0])); + if (fz->fz_hash == NULL || + hlist_empty(&fz->fz_hash[h])) continue; - if (fn_hash_dump_bucket(skb, cb, tb, fz, fz->fz_hash[h]) < 0) { + if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { cb->args[2] = h; return -1; } @@ -826,7 +804,8 @@ for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { if (m < s_m) continue; if (m > s_m) - memset(&cb->args[2], 0, sizeof(cb->args) - 2*sizeof(cb->args[0])); + memset(&cb->args[2], 0, + sizeof(cb->args) - 2*sizeof(cb->args[0])); if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { cb->args[1] = m; read_unlock(&fib_hash_lock); @@ -838,7 +817,8 @@ return skb->len; } -static void rtmsg_fib(int event, struct fib_node* f, int z, int tb_id, +static void rtmsg_fib(int event, struct fib_node *f, struct fib_alias *fa, + int z, int tb_id, struct nlmsghdr *n, struct netlink_skb_parms *req) { struct sk_buff *skb; @@ -850,8 +830,9 @@ return; if (fib_dump_info(skb, pid, n->nlmsg_seq, event, tb_id, - f->fn_type, f->fn_scope, &f->fn_key, z, f->fn_tos, - FIB_INFO(f)) < 0) { + fa->fa_type, fa->fa_scope, &f->fn_key, z, + fa->fa_tos, + fa->fa_info) < 0) { kfree_skb(skb); return; } @@ -877,7 +858,14 @@ 0, SLAB_HWCACHE_ALIGN, NULL, NULL); - tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL); + if (fn_alias_kmem == NULL) + fn_alias_kmem = kmem_cache_create("ip_fib_alias", + sizeof(struct fib_alias), + 0, SLAB_HWCACHE_ALIGN, + NULL, NULL); + + tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), + GFP_KERNEL); if (tb == NULL) return NULL; @@ -898,64 +886,105 @@ struct fib_iter_state { struct fn_zone *zone; int bucket; - struct fib_node **hash; - struct fib_node *node; + struct hlist_head *hash_head; + struct fib_node *fn; + struct fib_alias *fa; }; -static __inline__ struct fib_node *fib_get_first(struct seq_file *seq) +static struct fib_alias *fib_get_first(struct seq_file *seq) { - struct fib_iter_state* iter = seq->private; - struct fn_hash *table = (struct fn_hash *)ip_fib_main_table->tb_data; + struct fib_iter_state *iter = seq->private; + struct fn_hash *table = (struct fn_hash *) ip_fib_main_table->tb_data; - iter->bucket = 0; - iter->hash = NULL; - iter->node = NULL; + iter->bucket = 0; + iter->hash_head = NULL; + iter->fn = NULL; + iter->fa = NULL; for (iter->zone = table->fn_zone_list; iter->zone; iter->zone = iter->zone->fz_next) { int maxslot; - if (!iter->zone->fz_next) + if (!iter->zone->fz_nent) continue; - iter->hash = iter->zone->fz_hash; + iter->hash_head = iter->zone->fz_hash; maxslot = iter->zone->fz_divisor; for (iter->bucket = 0; iter->bucket < maxslot; - ++iter->bucket, ++iter->hash) { - iter->node = *iter->hash; - - if (iter->node) - goto out; + ++iter->bucket, ++iter->hash_head) { + struct hlist_node *node; + struct fib_node *fn; + + hlist_for_each_entry(fn,node,iter->hash_head,fn_hash) { + struct fib_alias *fa; + + list_for_each_entry(fa,&fn->fn_alias,fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } } out: - return iter->node; + return iter->fa; } -static __inline__ struct fib_node *fib_get_next(struct seq_file *seq) +static struct fib_alias *fib_get_next(struct seq_file *seq) { - struct fib_iter_state* iter = seq->private; + struct fib_iter_state *iter = seq->private; + struct fib_node *fn; + struct fib_alias *fa; + + /* Advance FA, if any. */ + fn = iter->fn; + fa = iter->fa; + if (fa) { + BUG_ON(!fn); + list_for_each_entry_continue(fa, &fn->fn_alias, fa_list) { + iter->fa = fa; + goto out; + } + } - if (iter->node) - iter->node = iter->node->fn_next; + fa = iter->fa = NULL; - if (iter->node) - goto out; + /* Advance FN. */ + if (fn) { + struct hlist_node *node = &fn->fn_hash; + hlist_for_each_entry_continue(fn, node, fn_hash) { + iter->fn = fn; + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fa = fa; + goto out; + } + } + } + + fn = iter->fn = NULL; + + /* Advance hash chain. */ if (!iter->zone) goto out; for (;;) { + struct hlist_node *node; int maxslot; maxslot = iter->zone->fz_divisor; while (++iter->bucket < maxslot) { - iter->node = *++iter->hash; + iter->hash_head++; - if (iter->node) - goto out; + hlist_for_each_entry(fn, node, iter->hash_head, fn_hash) { + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } iter->zone = iter->zone->fz_next; @@ -963,14 +992,19 @@ if (!iter->zone) goto out; - iter->hash = iter->zone->fz_hash; iter->bucket = 0; - iter->node = *iter->hash; - if (iter->node) - break; + iter->hash_head = iter->zone->fz_hash; + + hlist_for_each_entry(fn, node, iter->hash_head, fn_hash) { + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } out: - return iter->node; + return fa; } static void *fib_seq_start(struct seq_file *seq, loff_t *pos) @@ -994,7 +1028,7 @@ read_unlock(&fib_hash_lock); } -static unsigned fib_flag_trans(int type, int dead, u32 mask, struct fib_info *fi) +static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) { static unsigned type2flags[RTN_MAX + 1] = { [7] = RTF_REJECT, [8] = RTF_REJECT, @@ -1005,8 +1039,7 @@ flags |= RTF_GATEWAY; if (mask == 0xFFFFFFFF) flags |= RTF_HOST; - if (!dead) - flags |= RTF_UP; + flags |= RTF_UP; return flags; } @@ -1018,11 +1051,12 @@ */ static int fib_seq_show(struct seq_file *seq, void *v) { - struct fib_iter_state* iter; + struct fib_iter_state *iter; char bf[128]; u32 prefix, mask; unsigned flags; struct fib_node *f; + struct fib_alias *fa; struct fib_info *fi; if (v == SEQ_START_TOKEN) { @@ -1032,13 +1066,13 @@ goto out; } - f = v; - fi = FIB_INFO(f); iter = seq->private; - prefix = fz_prefix(f->fn_key, iter->zone); + f = iter->fn; + fa = iter->fa; + fi = fa->fa_info; + prefix = f->fn_key; mask = FZ_MASK(iter->zone); - flags = fib_flag_trans(f->fn_type, f->fn_state & FN_S_ZOMBIE, - mask, fi); + flags = fib_flag_trans(fa->fa_type, mask, fi); if (fi) snprintf(bf, sizeof(bf), "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u", diff -Nru a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c --- a/net/ipv4/fib_rules.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/fib_rules.c 2004-09-21 20:52:52 -07:00 @@ -302,9 +302,7 @@ for (r = fib_rules; r; r=r->r_next) { if (((saddr^r->r_src) & r->r_srcmask) || ((daddr^r->r_dst) & r->r_dstmask) || -#ifdef CONFIG_IP_ROUTE_TOS (r->r_tos && r->r_tos != flp->fl4_tos) || -#endif #ifdef CONFIG_IP_ROUTE_FWMARK (r->r_fwmark && r->r_fwmark != flp->fl4_fwmark) || #endif diff -Nru a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c --- a/net/ipv4/fib_semantics.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/fib_semantics.c 2004-09-21 20:52:51 -07:00 @@ -45,14 +45,15 @@ #define FSprintk(a...) -static struct fib_info *fib_info_list; static rwlock_t fib_info_lock = RW_LOCK_UNLOCKED; -int fib_info_cnt; - -#define for_fib_info() { struct fib_info *fi; \ - for (fi = fib_info_list; fi; fi = fi->fib_next) - -#define endfor_fib_info() } +static struct hlist_head *fib_info_hash; +static struct hlist_head *fib_info_laddrhash; +static unsigned int fib_hash_size; +static unsigned int fib_info_cnt; + +#define DEVINDEX_HASHBITS 8 +#define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS) +static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE]; #ifdef CONFIG_IP_ROUTE_MULTIPATH @@ -156,12 +157,12 @@ { write_lock(&fib_info_lock); if (fi && --fi->fib_treeref == 0) { - if (fi->fib_next) - fi->fib_next->fib_prev = fi->fib_prev; - if (fi->fib_prev) - fi->fib_prev->fib_next = fi->fib_next; - if (fi == fib_info_list) - fib_info_list = fi->fib_next; + hlist_del(&fi->fib_hash); + if (fi->fib_prefsrc) + hlist_del(&fi->fib_lhash); + change_nexthops(fi) { + hlist_del(&nh->nh_hash); + } endfor_nexthops(fi) fi->fib_dead = 1; fib_info_put(fi); } @@ -189,42 +190,79 @@ return 0; } -static __inline__ struct fib_info * fib_find_info(const struct fib_info *nfi) +static inline unsigned int fib_info_hashfn(const struct fib_info *fi) { - for_fib_info() { + unsigned int mask = (fib_hash_size - 1); + unsigned int val = fi->fib_nhs; + + val ^= fi->fib_protocol; + val ^= fi->fib_prefsrc; + val ^= fi->fib_priority; + + return (val ^ (val >> 7) ^ (val >> 12)) & mask; +} + +static struct fib_info *fib_find_info(const struct fib_info *nfi) +{ + struct hlist_head *head; + struct hlist_node *node; + struct fib_info *fi; + unsigned int hash; + + hash = fib_info_hashfn(nfi); + head = &fib_info_hash[hash]; + + hlist_for_each_entry(fi, node, head, fib_hash) { if (fi->fib_nhs != nfi->fib_nhs) continue; if (nfi->fib_protocol == fi->fib_protocol && nfi->fib_prefsrc == fi->fib_prefsrc && nfi->fib_priority == fi->fib_priority && - memcmp(nfi->fib_metrics, fi->fib_metrics, sizeof(fi->fib_metrics)) == 0 && + memcmp(nfi->fib_metrics, fi->fib_metrics, + sizeof(fi->fib_metrics)) == 0 && ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_DEAD) == 0 && (nfi->fib_nhs == 0 || nh_comp(fi, nfi) == 0)) return fi; - } endfor_fib_info(); + } + return NULL; } +static inline unsigned int fib_devindex_hashfn(unsigned int val) +{ + unsigned int mask = DEVINDEX_HASHSIZE - 1; + + return (val ^ + (val >> DEVINDEX_HASHBITS) ^ + (val >> (DEVINDEX_HASHBITS * 2))) & mask; +} + /* Check, that the gateway is already configured. Used only by redirect accept routine. */ int ip_fib_check_default(u32 gw, struct net_device *dev) { + struct hlist_head *head; + struct hlist_node *node; + struct fib_nh *nh; + unsigned int hash; + read_lock(&fib_info_lock); - for_fib_info() { - if (fi->fib_flags & RTNH_F_DEAD) - continue; - for_nexthops(fi) { - if (nh->nh_dev == dev && nh->nh_gw == gw && - nh->nh_scope == RT_SCOPE_LINK && - !(nh->nh_flags&RTNH_F_DEAD)) { - read_unlock(&fib_info_lock); - return 0; - } - } endfor_nexthops(fi); - } endfor_fib_info(); + + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; + hlist_for_each_entry(nh, node, head, nh_hash) { + if (nh->nh_dev == dev && + nh->nh_gw == gw && + !(nh->nh_flags&RTNH_F_DEAD)) { + read_unlock(&fib_info_lock); + return 0; + } + } + read_unlock(&fib_info_lock); + return -1; } @@ -451,6 +489,82 @@ return 0; } +static inline unsigned int fib_laddr_hashfn(u32 val) +{ + unsigned int mask = (fib_hash_size - 1); + + return (val ^ (val >> 7) ^ (val >> 14)) & mask; +} + +static struct hlist_head *fib_hash_alloc(int bytes) +{ + if (bytes <= PAGE_SIZE) + return kmalloc(bytes, GFP_KERNEL); + else + return (struct hlist_head *) + __get_free_pages(GFP_KERNEL, get_order(bytes)); +} + +static void fib_hash_free(struct hlist_head *hash, int bytes) +{ + if (!hash) + return; + + if (bytes <= PAGE_SIZE) + kfree(hash); + else + free_pages((unsigned long) hash, get_order(bytes)); +} + +static void fib_hash_move(struct hlist_head *new_info_hash, + struct hlist_head *new_laddrhash, + unsigned int new_size) +{ + unsigned int old_size = fib_hash_size; + unsigned int i; + + write_lock(&fib_info_lock); + fib_hash_size = new_size; + + for (i = 0; i < old_size; i++) { + struct hlist_head *head = &fib_info_hash[i]; + struct hlist_node *node, *n; + struct fib_info *fi; + + hlist_for_each_entry_safe(fi, node, n, head, fib_hash) { + struct hlist_head *dest; + unsigned int new_hash; + + hlist_del(&fi->fib_hash); + + new_hash = fib_info_hashfn(fi); + dest = &new_info_hash[new_hash]; + hlist_add_head(&fi->fib_hash, dest); + } + } + fib_info_hash = new_info_hash; + + for (i = 0; i < old_size; i++) { + struct hlist_head *lhead = &fib_info_laddrhash[i]; + struct hlist_node *node, *n; + struct fib_info *fi; + + hlist_for_each_entry_safe(fi, node, n, lhead, fib_lhash) { + struct hlist_head *ldest; + unsigned int new_hash; + + hlist_del(&fi->fib_lhash); + + new_hash = fib_laddr_hashfn(fi->fib_prefsrc); + ldest = &new_laddrhash[new_hash]; + hlist_add_head(&fi->fib_lhash, ldest); + } + } + fib_info_laddrhash = new_laddrhash; + + write_unlock(&fib_info_lock); +} + struct fib_info * fib_create_info(const struct rtmsg *r, struct kern_rta *rta, const struct nlmsghdr *nlh, int *errp) @@ -476,15 +590,45 @@ } #endif - fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); err = -ENOBUFS; + if (fib_info_cnt >= fib_hash_size) { + unsigned int new_size = fib_hash_size << 1; + struct hlist_head *new_info_hash; + struct hlist_head *new_laddrhash; + unsigned int bytes; + + if (!new_size) + new_size = 1; + bytes = new_size * sizeof(struct hlist_head *); + new_info_hash = fib_hash_alloc(bytes); + new_laddrhash = fib_hash_alloc(bytes); + if (!new_info_hash || !new_laddrhash) { + fib_hash_free(new_info_hash, bytes); + fib_hash_free(new_laddrhash, bytes); + } else { + memset(new_info_hash, 0, bytes); + memset(new_laddrhash, 0, bytes); + + fib_hash_move(new_info_hash, new_laddrhash, new_size); + } + + if (!fib_hash_size) + goto failure; + } + + fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); if (fi == NULL) goto failure; fib_info_cnt++; memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct fib_nh)); fi->fib_protocol = r->rtm_protocol; + fi->fib_nhs = nhs; + change_nexthops(fi) { + nh->nh_parent = fi; + } endfor_nexthops(fi) + fi->fib_flags = r->rtm_flags; if (rta->rta_priority) fi->fib_priority = *rta->rta_priority; @@ -581,11 +725,24 @@ fi->fib_treeref++; atomic_inc(&fi->fib_clntref); write_lock(&fib_info_lock); - fi->fib_next = fib_info_list; - fi->fib_prev = NULL; - if (fib_info_list) - fib_info_list->fib_prev = fi; - fib_info_list = fi; + hlist_add_head(&fi->fib_hash, + &fib_info_hash[fib_info_hashfn(fi)]); + if (fi->fib_prefsrc) { + struct hlist_head *head; + + head = &fib_info_laddrhash[fib_laddr_hashfn(fi->fib_prefsrc)]; + hlist_add_head(&fi->fib_lhash, head); + } + change_nexthops(fi) { + struct hlist_head *head; + unsigned int hash; + + if (!nh->nh_dev) + continue; + hash = fib_devindex_hashfn(nh->nh_dev->ifindex); + head = &fib_info_devhash[hash]; + hlist_add_head(&nh->nh_hash, head); + } endfor_nexthops(fi) write_unlock(&fib_info_lock); return fi; @@ -884,13 +1041,36 @@ if (force) scope = -1; - for_fib_info() { - if (local && fi->fib_prefsrc == local) { - fi->fib_flags |= RTNH_F_DEAD; - ret++; - } else if (dev && fi->fib_nhs) { - int dead = 0; + if (local && fib_info_laddrhash) { + unsigned int hash = fib_laddr_hashfn(local); + struct hlist_head *head = &fib_info_laddrhash[hash]; + struct hlist_node *node; + struct fib_info *fi; + hlist_for_each_entry(fi, node, head, fib_lhash) { + if (fi->fib_prefsrc == local) { + fi->fib_flags |= RTNH_F_DEAD; + ret++; + } + } + } + + if (dev) { + struct fib_info *prev_fi = NULL; + unsigned int hash = fib_devindex_hashfn(dev->ifindex); + struct hlist_head *head = &fib_info_devhash[hash]; + struct hlist_node *node; + struct fib_nh *nh; + + hlist_for_each_entry(nh, node, head, nh_hash) { + struct fib_info *fi = nh->nh_parent; + int dead; + + BUG_ON(!fi->fib_nhs); + if (nh->nh_dev != dev || fi == prev_fi) + continue; + prev_fi = fi; + dead = 0; change_nexthops(fi) { if (nh->nh_flags&RTNH_F_DEAD) dead++; @@ -917,7 +1097,8 @@ ret++; } } - } endfor_fib_info(); + } + return ret; } @@ -930,14 +1111,31 @@ int fib_sync_up(struct net_device *dev) { - int ret = 0; + struct fib_info *prev_fi; + unsigned int hash; + struct hlist_head *head; + struct hlist_node *node; + struct fib_nh *nh; + int ret; if (!(dev->flags&IFF_UP)) return 0; - for_fib_info() { - int alive = 0; + prev_fi = NULL; + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; + ret = 0; + + hlist_for_each_entry(nh, node, head, nh_hash) { + struct fib_info *fi = nh->nh_parent; + int alive; + + BUG_ON(!fi->fib_nhs); + if (nh->nh_dev != dev || fi == prev_fi) + continue; + prev_fi = fi; + alive = 0; change_nexthops(fi) { if (!(nh->nh_flags&RTNH_F_DEAD)) { alive++; @@ -958,7 +1156,8 @@ fi->fib_flags &= ~RTNH_F_DEAD; ret++; } - } endfor_fib_info(); + } + return ret; } diff -Nru a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c --- a/net/ipv4/ip_gre.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/ip_gre.c 2004-09-21 20:52:52 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -547,7 +548,7 @@ if (skb->protocol == htons(ETH_P_IP)) inner = old_iph->tos; else if (skb->protocol == htons(ETH_P_IPV6)) - inner = ip6_get_dsfield((struct ipv6hdr*)old_iph); + inner = ipv6_get_dsfield((struct ipv6hdr *)old_iph); return INET_ECN_encapsulate(tos, inner); } @@ -603,13 +604,24 @@ if ((tunnel = ipgre_tunnel_lookup(iph->saddr, iph->daddr, key)) != NULL) { secpath_reset(skb); + skb->protocol = *(u16*)(h + 2); + /* WCCP version 1 and 2 protocol decoding. + * - Change protocol to IP + * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header + */ + if (flags == 0 && + skb->protocol == __constant_htons(ETH_P_WCCP)) { + skb->protocol = __constant_htons(ETH_P_IP); + if ((*(h + offset) & 0xF0) != 0x40) + offset += 4; + } + skb->mac.raw = skb->nh.raw; skb->nh.raw = __pskb_pull(skb, offset); memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); if (skb->ip_summed == CHECKSUM_HW) skb->csum = csum_sub(skb->csum, csum_partial(skb->mac.raw, skb->nh.raw-skb->mac.raw, 0)); - skb->protocol = *(u16*)(h + 2); skb->pkt_type = PACKET_HOST; #ifdef CONFIG_NET_IPGRE_BROADCAST if (MULTICAST(iph->daddr)) { diff -Nru a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c --- a/net/ipv4/netfilter/ip_conntrack_standalone.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c 2004-09-21 20:52:51 -07:00 @@ -241,8 +241,9 @@ seq_printf(s, "use=%u proto=%u ", atomic_read(&expect->use), expect->tuple.dst.protonum); - return print_tuple(s, &expect->tuple, - __ip_ct_find_proto(expect->tuple.dst.protonum)); + print_tuple(s, &expect->tuple, + __ip_ct_find_proto(expect->tuple.dst.protonum)); + return seq_putc(s, '\n'); } static struct seq_operations exp_seq_ops = { diff -Nru a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c --- a/net/ipv4/netfilter/ip_nat_ftp.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/netfilter/ip_nat_ftp.c 2004-09-21 20:52:52 -07:00 @@ -297,7 +297,7 @@ char *tmpname; if (ports_c == 0) - ports[ports_c] = FTP_PORT; + ports[ports_c++] = FTP_PORT; for (i = 0; i < ports_c; i++) { ftp[i].tuple.dst.protonum = IPPROTO_TCP; diff -Nru a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c --- a/net/ipv4/netfilter/ip_tables.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/netfilter/ip_tables.c 2004-09-21 20:52:51 -07:00 @@ -1464,8 +1464,11 @@ unsigned int i; duprintf("tcp_match: finding option\n"); + + if (!optlen) + return invert; + /* If we don't have the whole header, drop packet. */ - BUG_ON(!optlen); op = skb_header_pointer(skb, skb->nh.iph->ihl*4 + sizeof(struct tcphdr), optlen, _opt); diff -Nru a/net/ipv4/netfilter/ipchains_core.c b/net/ipv4/netfilter/ipchains_core.c --- a/net/ipv4/netfilter/ipchains_core.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/netfilter/ipchains_core.c 2004-09-21 20:52:52 -07:00 @@ -1,3 +1,5 @@ +#warning ipchains is obsolete, and will be removed soon. + /* Minor modifications to fit on compatibility framework: Rusty.Russell@rustcorp.com.au */ diff -Nru a/net/ipv4/netfilter/ipfwadm_core.c b/net/ipv4/netfilter/ipfwadm_core.c --- a/net/ipv4/netfilter/ipfwadm_core.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/netfilter/ipfwadm_core.c 2004-09-21 20:52:51 -07:00 @@ -1,3 +1,5 @@ +#warning ipfwadm is obsolete, and will be removed soon. + /* Minor modifications to fit on compatibility framework: Rusty.Russell@rustcorp.com.au */ diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c --- a/net/ipv4/raw.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/raw.c 2004-09-21 20:52:52 -07:00 @@ -719,6 +719,7 @@ .backlog_rcv = raw_rcv_skb, .hash = raw_v4_hash, .unhash = raw_v4_unhash, + .slab_obj_size = sizeof(struct raw_sock), }; #ifdef CONFIG_PROC_FS diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c --- a/net/ipv4/route.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/route.c 2004-09-21 20:52:52 -07:00 @@ -2206,22 +2206,27 @@ return ip_route_output_slow(rp, flp); } -int ip_route_output_key(struct rtable **rp, struct flowi *flp) +int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) { int err; if ((err = __ip_route_output_key(rp, flp)) != 0) return err; - return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0; + + if (flp->proto) { + if (!flp->fl4_src) + flp->fl4_src = (*rp)->rt_src; + if (!flp->fl4_dst) + flp->fl4_dst = (*rp)->rt_dst; + return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags); + } + + return 0; } -int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) +int ip_route_output_key(struct rtable **rp, struct flowi *flp) { - int err; - - if ((err = __ip_route_output_key(rp, flp)) != 0) - return err; - return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0; + return ip_route_output_flow(rp, flp, NULL, 0); } static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c --- a/net/ipv4/tcp_ipv4.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/tcp_ipv4.c 2004-09-21 20:52:51 -07:00 @@ -1033,11 +1033,7 @@ switch (type) { case ICMP_SOURCE_QUENCH: - /* This is deprecated, but if someone generated it, - * we have no reasons to ignore it. - */ - if (!sock_owned_by_user(sk)) - tcp_enter_cwr(tp); + /* Just silently ignore these. */ goto out; case ICMP_PARAMETERPROB: err = EPROTO; @@ -2617,6 +2613,7 @@ .sysctl_wmem = sysctl_tcp_wmem, .sysctl_rmem = sysctl_tcp_rmem, .max_header = MAX_TCP_HEADER, + .slab_obj_size = sizeof(struct tcp_sock), }; diff -Nru a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c --- a/net/ipv4/tcp_minisocks.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/tcp_minisocks.c 2004-09-21 20:52:52 -07:00 @@ -687,7 +687,7 @@ /* allocate the newsk from the same slab of the master sock, * if not, at sk_free time we'll try to free it from the wrong * slabcache (i.e. is it TCPv4 or v6?) -acme */ - struct sock *newsk = sk_alloc(PF_INET, GFP_ATOMIC, 0, sk->sk_slab); + struct sock *newsk = sk_alloc(PF_INET, GFP_ATOMIC, 0, sk->sk_prot->slab); if(newsk != NULL) { struct tcp_opt *newtp; diff -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c --- a/net/ipv4/tcp_output.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv4/tcp_output.c 2004-09-21 20:52:52 -07:00 @@ -991,7 +991,7 @@ /* New SKB created, account for it. */ new_factor = TCP_SKB_CB(skb)->tso_factor; tcp_dec_pcount_explicit(&tp->packets_out, - new_factor - old_factor); + old_factor - new_factor); tcp_inc_pcount(&tp->packets_out, skb->next); } diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c --- a/net/ipv4/udp.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/udp.c 2004-09-21 20:52:51 -07:00 @@ -1320,6 +1320,7 @@ .hash = udp_v4_hash, .unhash = udp_v4_unhash, .get_port = udp_v4_get_port, + .slab_obj_size = sizeof(struct udp_sock), }; /* ------------------------------------------------------------------------ */ diff -Nru a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c --- a/net/ipv4/xfrm4_input.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv4/xfrm4_input.c 2004-09-21 20:52:51 -07:00 @@ -101,6 +101,8 @@ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) goto drop; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + ipv4_copy_dscp(iph, skb->h.ipiph); if (!(x->props.flags & XFRM_STATE_NOECN)) ipip_ecn_decapsulate(skb); skb->mac.raw = memmove(skb->data - skb->mac_len, diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c --- a/net/ipv6/af_inet6.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/af_inet6.c 2004-09-21 20:52:52 -07:00 @@ -90,11 +90,6 @@ atomic_t inet6_sock_nr; #endif -/* Per protocol sock slabcache */ -kmem_cache_t *tcp6_sk_cachep; -kmem_cache_t *udp6_sk_cachep; -kmem_cache_t *raw6_sk_cachep; - /* The inetsw table contains everything that inet_create needs to * build a new socket. */ @@ -110,37 +105,11 @@ #endif } -static __inline__ kmem_cache_t *inet6_sk_slab(int protocol) -{ - kmem_cache_t* rc = tcp6_sk_cachep; - - if (protocol == IPPROTO_UDP) - rc = udp6_sk_cachep; - else if (protocol == IPPROTO_RAW) - rc = raw6_sk_cachep; - return rc; -} - -static __inline__ int inet6_sk_size(int protocol) -{ - int rc = sizeof(struct tcp6_sock); - - if (protocol == IPPROTO_UDP) - rc = sizeof(struct udp6_sock); - else if (protocol == IPPROTO_RAW) - rc = sizeof(struct raw6_sock); - return rc; -} - static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk) { - struct ipv6_pinfo *rc = (&((struct tcp6_sock *)sk)->inet6); + const struct ipv6_sk_offset *offset = sk->sk_prot->af_specific; - if (sk->sk_protocol == IPPROTO_UDP) - rc = (&((struct udp6_sock *)sk)->inet6); - else if (sk->sk_protocol == IPPROTO_RAW) - rc = (&((struct raw6_sock *)sk)->inet6); - return rc; + return (struct ipv6_pinfo *)(((u8 *)sk) + offset->offset); } static int inet6_create(struct socket *sock, int protocol) @@ -151,11 +120,10 @@ struct tcp6_sock* tcp6sk; struct list_head *p; struct inet_protosw *answer; - - sk = sk_alloc(PF_INET6, GFP_KERNEL, inet6_sk_size(protocol), - inet6_sk_slab(protocol)); - if (sk == NULL) - goto do_oom; + struct proto *answer_prot; + unsigned char answer_flags; + char answer_no_check; + int rc; /* Look for the requested type/protocol pair. */ answer = NULL; @@ -179,22 +147,40 @@ answer = NULL; } + rc = -ESOCKTNOSUPPORT; if (!answer) - goto free_and_badtype; + goto out_rcu_unlock; + rc = -EPERM; if (answer->capability > 0 && !capable(answer->capability)) - goto free_and_badperm; + goto out_rcu_unlock; + rc = -EPROTONOSUPPORT; if (!protocol) - goto free_and_noproto; + goto out_rcu_unlock; sock->ops = answer->ops; + + answer_prot = answer->prot; + answer_no_check = answer->no_check; + answer_flags = answer->flags; + rcu_read_unlock(); + + BUG_TRAP(answer_prot->slab != NULL); + + rc = -ENOBUFS; + sk = sk_alloc(PF_INET6, GFP_KERNEL, + answer_prot->slab_obj_size, + answer_prot->slab); + if (sk == NULL) + goto out; + sock_init_data(sock, sk); sk_set_owner(sk, THIS_MODULE); - sk->sk_prot = answer->prot; - sk->sk_no_check = answer->no_check; - if (INET_PROTOSW_REUSE & answer->flags) + rc = 0; + sk->sk_prot = answer_prot; + sk->sk_no_check = answer_no_check; + if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse = 1; - rcu_read_unlock(); inet = inet_sk(sk); @@ -248,28 +234,17 @@ sk->sk_prot->hash(sk); } if (sk->sk_prot->init) { - int err = sk->sk_prot->init(sk); - if (err != 0) { + rc = sk->sk_prot->init(sk); + if (rc) { sk_common_release(sk); - return err; + goto out; } } - return 0; - -free_and_badtype: - rcu_read_unlock(); - sk_free(sk); - return -ESOCKTNOSUPPORT; -free_and_badperm: - rcu_read_unlock(); - sk_free(sk); - return -EPERM; -free_and_noproto: +out: + return rc; +out_rcu_unlock: rcu_read_unlock(); - sk_free(sk); - return -EPROTONOSUPPORT; -do_oom: - return -ENOBUFS; + goto out; } @@ -709,24 +684,26 @@ #endif #endif - if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) - { + if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "inet6_proto_init: size fault\n"); return -EINVAL; } - /* allocate our sock slab caches */ - tcp6_sk_cachep = kmem_cache_create("tcp6_sock", - sizeof(struct tcp6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - udp6_sk_cachep = kmem_cache_create("udp6_sock", - sizeof(struct udp6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - raw6_sk_cachep = kmem_cache_create("raw6_sock", - sizeof(struct raw6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if (!tcp6_sk_cachep || !udp6_sk_cachep || !raw6_sk_cachep) - printk(KERN_CRIT "%s: Can't create protocol sock SLAB " - "caches!\n", __FUNCTION__); + + err = sk_alloc_slab(&tcpv6_prot, "tcpv6_sock"); + if (err) { + sk_alloc_slab_error(&tcpv6_prot); + goto out; + } + err = sk_alloc_slab(&udpv6_prot, "udpv6_sock"); + if (err) { + sk_alloc_slab_error(&udpv6_prot); + goto out_tcp_free_slab; + } + err = sk_alloc_slab(&rawv6_prot, "rawv6_sock"); + if (err) { + sk_alloc_slab_error(&rawv6_prot); + goto out_udp_free_slab; + } /* Register the socket-side information for inet6_create. */ for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) @@ -745,7 +722,7 @@ /* Initialise ipv6 mibs */ err = init_ipv6_mibs(); if (err) - goto init_mib_fail; + goto out_raw_free_slab; /* * ipngwg API draft makes clear that the correct semantics @@ -798,8 +775,9 @@ /* Init v6 transport protocols. */ udpv6_init(); tcpv6_init(); - - return 0; + err = 0; +out: + return err; #ifdef CONFIG_PROC_FS proc_if6_fail: @@ -824,8 +802,13 @@ ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); -init_mib_fail: - return err; +out_raw_free_slab: + sk_free_slab(&rawv6_prot); +out_udp_free_slab: + sk_free_slab(&udpv6_prot); +out_tcp_free_slab: + sk_free_slab(&tcpv6_prot); + goto out; } module_init(inet6_init); @@ -854,9 +837,9 @@ ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); - kmem_cache_destroy(tcp6_sk_cachep); - kmem_cache_destroy(udp6_sk_cachep); - kmem_cache_destroy(raw6_sk_cachep); + sk_free_slab(&rawv6_prot); + sk_free_slab(&udpv6_prot); + sk_free_slab(&tcpv6_prot); } module_exit(inet6_exit); diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c --- a/net/ipv6/icmp.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv6/icmp.c 2004-09-21 20:52:51 -07:00 @@ -372,6 +372,8 @@ err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; + if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) + goto out_dst_release; if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl.fl6_dst)) @@ -458,6 +460,8 @@ err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; + if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) + goto out_dst_release; if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl.fl6_dst)) @@ -489,6 +493,7 @@ out_put: if (likely(idev != NULL)) in6_dev_put(idev); +out_dst_release: dst_release(dst); out: icmpv6_xmit_unlock(); diff -Nru a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c --- a/net/ipv6/ip6_fib.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/ip6_fib.c 2004-09-21 20:52:52 -07:00 @@ -1184,6 +1184,7 @@ if (rt->rt6i_flags&RTF_EXPIRES && rt->rt6i_expires) { if (time_after(now, rt->rt6i_expires)) { RT6_TRACE("expiring %p\n", rt); + rt6_reset_dflt_pointer(rt); return -1; } gc_args.more++; @@ -1191,6 +1192,11 @@ if (atomic_read(&rt->u.dst.__refcnt) == 0 && time_after_eq(now, rt->u.dst.lastuse + gc_args.timeout)) { RT6_TRACE("aging clone %p\n", rt); + return -1; + } else if ((rt->rt6i_flags & RTF_GATEWAY) && + (!(rt->rt6i_nexthop->flags & NTF_ROUTER))) { + RT6_TRACE("purging route %p via non-router but gateway\n", + rt); return -1; } gc_args.more++; diff -Nru a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c --- a/net/ipv6/ip6_tunnel.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv6/ip6_tunnel.c 2004-09-21 20:52:51 -07:00 @@ -542,6 +542,8 @@ skb->dev = t->dev; dst_release(skb->dst); skb->dst = NULL; + if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) + ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); ip6ip6_ecn_decapsulate(ipv6h, skb); t->stat.rx_packets++; t->stat.rx_bytes += skb->len; diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c --- a/net/ipv6/ndisc.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/ndisc.c 2004-09-21 20:52:52 -07:00 @@ -810,8 +810,12 @@ * update / create cache entry * for the source address */ - neigh = neigh_event_ns(&nd_tbl, lladdr, saddr, dev); - + neigh = __neigh_lookup(&nd_tbl, saddr, dev, + !inc || lladdr || !dev->addr_len); + if (neigh) + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE); if (neigh || !dev->hard_header) { ndisc_send_na(dev, neigh, saddr, &msg->target, idev->cnf.forwarding, @@ -894,24 +898,25 @@ neigh = neigh_lookup(&nd_tbl, &msg->target, dev); if (neigh) { - if (neigh->flags & NTF_ROUTER) { - if (msg->icmph.icmp6_router == 0) { - /* - * Change: router to host - */ - struct rt6_info *rt; - rt = rt6_get_dflt_router(saddr, dev); - if (rt) - ip6_del_rt(rt, NULL, NULL); - } - } else { - if (msg->icmph.icmp6_router) - neigh->flags |= NTF_ROUTER; - } + u8 old_flags = neigh->flags; neigh_update(neigh, lladdr, msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE, - msg->icmph.icmp6_override, 1); + NEIGH_UPDATE_F_WEAK_OVERRIDE| + (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)| + NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0)); + + if ((old_flags & ~neigh->flags) & NTF_ROUTER) { + /* + * Change: router to host + */ + struct rt6_info *rt; + rt = rt6_get_dflt_router(saddr, dev); + if (rt) + ip6_del_rt(rt, NULL, NULL); + } + neigh_release(neigh); } } @@ -1079,7 +1084,11 @@ goto out; } } - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + NEIGH_UPDATE_F_ISROUTER); } if (ndopts.nd_opts_pi) { @@ -1196,19 +1205,11 @@ return; } } - /* passed validation tests */ - - /* - We install redirect only if nexthop state is valid. - */ neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1); if (neigh) { - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); - if (neigh->nud_state&NUD_VALID) - rt6_redirect(dest, &skb->nh.ipv6h->saddr, neigh, on_link); - else - __neigh_event_send(neigh, NULL); + rt6_redirect(dest, &skb->nh.ipv6h->saddr, neigh, lladdr, + on_link); neigh_release(neigh); } in6_dev_put(in6_dev); diff -Nru a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig --- a/net/ipv6/netfilter/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/netfilter/Kconfig 2004-09-21 20:52:52 -07:00 @@ -158,6 +158,15 @@ To compile it as a module, choose M here. If unsure, say N. +config IP6_NF_MATCH_PHYSDEV + tristate "Physdev match support" + depends on IP6_NF_IPTABLES && BRIDGE_NETFILTER + help + Physdev packet matching matches against the physical bridge ports + the IP packet arrived on or will leave by. + + To compile it as a module, choose M here. If unsure, say N. + # dep_tristate ' Multiple port match support' CONFIG_IP6_NF_MATCH_MULTIPORT $CONFIG_IP6_NF_IPTABLES # dep_tristate ' TOS match support' CONFIG_IP6_NF_MATCH_TOS $CONFIG_IP6_NF_IPTABLES # if [ "$CONFIG_IP6_NF_CONNTRACK" != "n" ]; then diff -Nru a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile --- a/net/ipv6/netfilter/Makefile 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/netfilter/Makefile 2004-09-21 20:52:52 -07:00 @@ -16,6 +16,7 @@ obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o +obj-$(CONFIG_IP6_NF_MATCH_PHYSDEV) += ip6t_physdev.o obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o diff -Nru a/net/ipv6/netfilter/ip6t_physdev.c b/net/ipv6/netfilter/ip6t_physdev.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/net/ipv6/netfilter/ip6t_physdev.c 2004-09-21 20:52:53 -07:00 @@ -0,0 +1,136 @@ +/* Kernel module to match the bridge port in and + * out device for IP packets coming into contact with a bridge. */ + +/* (C) 2001-2003 Bart De Schuymer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#define MATCH 1 +#define NOMATCH 0 + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Bart De Schuymer "); +MODULE_DESCRIPTION("iptables bridge physical device match module"); + +static int +match(const struct sk_buff *skb, + const struct net_device *in, + const struct net_device *out, + const void *matchinfo, + int offset, + const void *hdr, + u_int16_t datalen, + int *hotdrop) +{ + int i; + static const char nulldevname[IFNAMSIZ]; + const struct ip6t_physdev_info *info = matchinfo; + unsigned int ret; + const char *indev, *outdev; + struct nf_bridge_info *nf_bridge; + + /* Not a bridged IP packet or no info available yet: + * LOCAL_OUT/mangle and LOCAL_OUT/nat don't know if + * the destination device will be a bridge. */ + if (!(nf_bridge = skb->nf_bridge)) { + /* Return MATCH if the invert flags of the used options are on */ + if ((info->bitmask & IP6T_PHYSDEV_OP_BRIDGED) && + !(info->invert & IP6T_PHYSDEV_OP_BRIDGED)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_ISIN) && + !(info->invert & IP6T_PHYSDEV_OP_ISIN)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_ISOUT) && + !(info->invert & IP6T_PHYSDEV_OP_ISOUT)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_IN) && + !(info->invert & IP6T_PHYSDEV_OP_IN)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_OUT) && + !(info->invert & IP6T_PHYSDEV_OP_OUT)) + return NOMATCH; + return MATCH; + } + + /* This only makes sense in the FORWARD and POSTROUTING chains */ + if ((info->bitmask & IP6T_PHYSDEV_OP_BRIDGED) && + (!!(nf_bridge->mask & BRNF_BRIDGED) ^ + !(info->invert & IP6T_PHYSDEV_OP_BRIDGED))) + return NOMATCH; + + if ((info->bitmask & IP6T_PHYSDEV_OP_ISIN && + (!nf_bridge->physindev ^ !!(info->invert & IP6T_PHYSDEV_OP_ISIN))) || + (info->bitmask & IP6T_PHYSDEV_OP_ISOUT && + (!nf_bridge->physoutdev ^ !!(info->invert & IP6T_PHYSDEV_OP_ISOUT)))) + return NOMATCH; + + if (!(info->bitmask & IP6T_PHYSDEV_OP_IN)) + goto match_outdev; + indev = nf_bridge->physindev ? nf_bridge->physindev->name : nulldevname; + for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) { + ret |= (((const unsigned int *)indev)[i] + ^ ((const unsigned int *)info->physindev)[i]) + & ((const unsigned int *)info->in_mask)[i]; + } + + if ((ret == 0) ^ !(info->invert & IP6T_PHYSDEV_OP_IN)) + return NOMATCH; + +match_outdev: + if (!(info->bitmask & IP6T_PHYSDEV_OP_OUT)) + return MATCH; + outdev = nf_bridge->physoutdev ? + nf_bridge->physoutdev->name : nulldevname; + for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) { + ret |= (((const unsigned int *)outdev)[i] + ^ ((const unsigned int *)info->physoutdev)[i]) + & ((const unsigned int *)info->out_mask)[i]; + } + + return (ret != 0) ^ !(info->invert & IP6T_PHYSDEV_OP_OUT); +} + +static int +checkentry(const char *tablename, + const struct ip6t_ip6 *ip, + void *matchinfo, + unsigned int matchsize, + unsigned int hook_mask) +{ + const struct ip6t_physdev_info *info = matchinfo; + + if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_physdev_info))) + return 0; + if (!(info->bitmask & IP6T_PHYSDEV_OP_MASK) || + info->bitmask & ~IP6T_PHYSDEV_OP_MASK) + return 0; + return 1; +} + +static struct ip6t_match physdev_match = { + .name = "physdev", + .match = &match, + .checkentry = &checkentry, + .me = THIS_MODULE, +}; + +static int __init init(void) +{ + return ip6t_register_match(&physdev_match); +} + +static void __exit fini(void) +{ + ip6t_unregister_match(&physdev_match); +} + +module_init(init); +module_exit(fini); diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c --- a/net/ipv6/raw.c 2004-09-21 20:52:51 -07:00 +++ b/net/ipv6/raw.c 2004-09-21 20:52:51 -07:00 @@ -973,6 +973,10 @@ return(0); } +struct ipv6_sk_offset raw_sock_offset = { + .offset = offsetof(struct raw6_sock, inet6), +}; + struct proto rawv6_prot = { .name = "RAW", .close = rawv6_close, @@ -989,6 +993,8 @@ .backlog_rcv = rawv6_rcv_skb, .hash = raw_v6_hash, .unhash = raw_v6_unhash, + .slab_obj_size = sizeof(struct raw6_sock), + .af_specific = &raw_sock_offset, }; #ifdef CONFIG_PROC_FS diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c --- a/net/ipv6/route.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/route.c 2004-09-21 20:52:52 -07:00 @@ -208,8 +208,18 @@ /* * pointer to the last default router chosen. BH is disabled locally. */ -static struct rt6_info *rt6_dflt_pointer; -static spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; +struct rt6_info *rt6_dflt_pointer; +spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; + +void rt6_reset_dflt_pointer(struct rt6_info *rt) +{ + spin_lock_bh(&rt6_dflt_lock); + if (rt == NULL || rt == rt6_dflt_pointer) { + RT6_TRACE("reset default router: %p->NULL\n", rt6_dflt_pointer); + rt6_dflt_pointer = NULL; + } + spin_unlock_bh(&rt6_dflt_lock); +} /* Default Router Selection (RFC 2461 6.3.6) */ static struct rt6_info *rt6_best_dflt(struct rt6_info *rt, int oif) @@ -227,6 +237,10 @@ sprt->rt6i_dev->ifindex == oif)) m += 8; + if ((sprt->rt6i_flags & RTF_EXPIRES) && + time_after(jiffies, sprt->rt6i_expires)) + continue; + if (sprt == rt6_dflt_pointer) m += 4; @@ -956,9 +970,7 @@ write_lock_bh(&rt6_lock); - spin_lock_bh(&rt6_dflt_lock); - rt6_dflt_pointer = NULL; - spin_unlock_bh(&rt6_dflt_lock); + rt6_reset_dflt_pointer(NULL); dst_release(&rt->u.dst); @@ -1007,7 +1019,7 @@ * Handle redirects */ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr, - struct neighbour *neigh, int on_link) + struct neighbour *neigh, u8 *lladdr, int on_link) { struct rt6_info *rt, *nrt; @@ -1020,22 +1032,13 @@ if (neigh->dev != rt->rt6i_dev) goto out; - /* Redirect received -> path was valid. - Look, redirects are sent only in response to data packets, - so that this nexthop apparently is reachable. --ANK - */ - dst_confirm(&rt->u.dst); - - /* Duplicate redirect: silently ignore. */ - if (neigh == rt->u.dst.neighbour) - goto out; - - /* Current route is on-link; redirect is always invalid. - - Seems, previous statement is not true. It could - be node, which looks for us as on-link (f.e. proxy ndisc) - But then router serving it might decide, that we should - know truth 8)8) --ANK (980726). + /* + * Current route is on-link; redirect is always invalid. + * + * Seems, previous statement is not true. It could + * be node, which looks for us as on-link (f.e. proxy ndisc) + * But then router serving it might decide, that we should + * know truth 8)8) --ANK (980726). */ if (!(rt->rt6i_flags&RTF_GATEWAY)) goto out; @@ -1047,7 +1050,6 @@ * is a bit fuzzy and one might need to check all default * routers. */ - if (ipv6_addr_cmp(saddr, &rt->rt6i_gateway)) { if (rt->rt6i_flags & RTF_DEFAULT) { struct rt6_info *rt1; @@ -1076,6 +1078,24 @@ * We have finally decided to accept it. */ + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE| + (on_link ? 0 : (NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + NEIGH_UPDATE_F_ISROUTER)) + ); + + /* + * Redirect received -> path was valid. + * Look, redirects are sent only in response to data packets, + * so that this nexthop apparently is reachable. --ANK + */ + dst_confirm(&rt->u.dst); + + /* Duplicate redirect: silently ignore. */ + if (neigh == rt->u.dst.neighbour) + goto out; + nrt = ip6_rt_copy(rt); if (nrt == NULL) goto out; @@ -1253,7 +1273,7 @@ rtmsg.rtmsg_type = RTMSG_NEWROUTE; ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr); rtmsg.rtmsg_metric = 1024; - rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP; + rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES; rtmsg.rtmsg_ifindex = dev->ifindex; @@ -1277,9 +1297,7 @@ if (rt->rt6i_flags & flags) { dst_hold(&rt->u.dst); - spin_lock_bh(&rt6_dflt_lock); - rt6_dflt_pointer = NULL; - spin_unlock_bh(&rt6_dflt_lock); + rt6_reset_dflt_pointer(NULL); read_unlock_bh(&rt6_lock); diff -Nru a/net/ipv6/sit.c b/net/ipv6/sit.c --- a/net/ipv6/sit.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/sit.c 2004-09-21 20:52:52 -07:00 @@ -50,6 +50,7 @@ #include #include #include +#include /* This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c @@ -566,7 +567,7 @@ iph->frag_off = 0; iph->protocol = IPPROTO_IPV6; - iph->tos = INET_ECN_encapsulate(tos, ip6_get_dsfield(iph6)); + iph->tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); iph->daddr = rt->rt_dst; iph->saddr = rt->rt_src; diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c --- a/net/ipv6/tcp_ipv6.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/tcp_ipv6.c 2004-09-21 20:52:52 -07:00 @@ -57,6 +57,7 @@ #include #include #include +#include #include @@ -1646,7 +1647,7 @@ skb->len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); TCP_SKB_CB(skb)->when = 0; - TCP_SKB_CB(skb)->flags = ip6_get_dsfield(skb->nh.ipv6h); + TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h); TCP_SKB_CB(skb)->sacked = 0; sk = __tcp_v6_lookup(&skb->nh.ipv6h->saddr, th->source, @@ -2119,6 +2120,10 @@ } #endif +struct ipv6_sk_offset tcp_sock_offset = { + .offset = offsetof(struct tcp6_sock, inet6), +}; + struct proto tcpv6_prot = { .name = "TCPv6", .close = tcp_close, @@ -2145,6 +2150,8 @@ .sysctl_wmem = sysctl_tcp_wmem, .sysctl_rmem = sysctl_tcp_rmem, .max_header = MAX_TCP_HEADER, + .slab_obj_size = sizeof(struct tcp6_sock), + .af_specific = &tcp_sock_offset, }; static struct inet6_protocol tcpv6_protocol = { diff -Nru a/net/ipv6/udp.c b/net/ipv6/udp.c --- a/net/ipv6/udp.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/udp.c 2004-09-21 20:52:52 -07:00 @@ -1031,6 +1031,10 @@ /* ------------------------------------------------------------------------ */ +struct ipv6_sk_offset udp_sock_offset = { + .offset = offsetof(struct udp6_sock, inet6), +}; + struct proto udpv6_prot = { .name = "UDP", .close = udpv6_close, @@ -1046,6 +1050,8 @@ .hash = udp_v6_hash, .unhash = udp_v6_unhash, .get_port = udp_v6_get_port, + .slab_obj_size = sizeof(struct udp6_sock), + .af_specific = &udp_sock_offset, }; extern struct proto_ops inet6_dgram_ops; diff -Nru a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c --- a/net/ipv6/xfrm6_input.c 2004-09-21 20:52:52 -07:00 +++ b/net/ipv6/xfrm6_input.c 2004-09-21 20:52:52 -07:00 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,7 @@ struct ipv6hdr *outer_iph = skb->nh.ipv6h; struct ipv6hdr *inner_iph = skb->h.ipv6h; - if (INET_ECN_is_ce(ip6_get_dsfield(outer_iph))) + if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) IP6_ECN_set_ce(inner_iph); } @@ -87,6 +88,8 @@ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) goto drop; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h); if (!(x->props.flags & XFRM_STATE_NOECN)) ipip6_ecn_decapsulate(skb); skb->mac.raw = memmove(skb->data - skb->mac_len, diff -Nru a/net/key/af_key.c b/net/key/af_key.c --- a/net/key/af_key.c 2004-09-21 20:52:52 -07:00 +++ b/net/key/af_key.c 2004-09-21 20:52:52 -07:00 @@ -683,6 +683,8 @@ sa->sadb_sa_flags = 0; if (x->props.flags & XFRM_STATE_NOECN) sa->sadb_sa_flags |= SADB_SAFLAGS_NOECN; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + sa->sadb_sa_flags |= SADB_SAFLAGS_DECAP_DSCP; /* hard time */ if (hsc & 2) { @@ -965,6 +967,8 @@ x->props.replay_window = sa->sadb_sa_replay; if (sa->sadb_sa_flags & SADB_SAFLAGS_NOECN) x->props.flags |= XFRM_STATE_NOECN; + if (sa->sadb_sa_flags & SADB_SAFLAGS_DECAP_DSCP) + x->props.flags |= XFRM_STATE_DECAP_DSCP; lifetime = (struct sadb_lifetime*) ext_hdrs[SADB_EXT_LIFETIME_HARD-1]; if (lifetime != NULL) { diff -Nru a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c --- a/net/sched/sch_cbq.c 2004-09-21 20:52:51 -07:00 +++ b/net/sched/sch_cbq.c 2004-09-21 20:52:51 -07:00 @@ -1770,10 +1770,6 @@ #ifdef CONFIG_NET_CLS_POLICE q->rx_class = NULL; #endif - for (h = 0; h < 16; h++) { - for (cl = q->classes[h]; cl; cl = cl->next) - cbq_destroy_filters(cl); - } for (h = 0; h < 16; h++) { struct cbq_class *next; @@ -1783,8 +1779,6 @@ cbq_destroy_class(sch, cl); } } - - qdisc_put_rtab(q->link.R_tab); } static void cbq_put(struct Qdisc *sch, unsigned long arg) diff -Nru a/net/sched/sch_generic.c b/net/sched/sch_generic.c --- a/net/sched/sch_generic.c 2004-09-21 20:52:51 -07:00 +++ b/net/sched/sch_generic.c 2004-09-21 20:52:51 -07:00 @@ -148,8 +148,10 @@ spin_lock(&dev->queue_lock); return -1; } - if (ret == NETDEV_TX_LOCKED && nolock) + if (ret == NETDEV_TX_LOCKED && nolock) { + spin_lock(&dev->queue_lock); goto collision; + } } /* NETDEV_TX_BUSY - we need to requeue */ diff -Nru a/net/sched/sch_red.c b/net/sched/sch_red.c --- a/net/sched/sch_red.c 2004-09-21 20:52:52 -07:00 +++ b/net/sched/sch_red.c 2004-09-21 20:52:52 -07:00 @@ -40,6 +40,7 @@ #include #include #include +#include /* Random Early Detection (RED) algorithm. @@ -167,7 +168,7 @@ IP_ECN_set_ce(skb->nh.iph); return 1; case __constant_htons(ETH_P_IPV6): - if (INET_ECN_is_not_ect(ip6_get_dsfield(skb->nh.ipv6h))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(skb->nh.ipv6h))) return 0; IP6_ECN_set_ce(skb->nh.ipv6h); return 1; diff -Nru a/net/sctp/ipv6.c b/net/sctp/ipv6.c --- a/net/sctp/ipv6.c 2004-09-21 20:52:52 -07:00 +++ b/net/sctp/ipv6.c 2004-09-21 20:52:52 -07:00 @@ -583,8 +583,8 @@ struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct sctp6_sock *newsctp6sk; - newsk = sk_alloc(PF_INET6, GFP_KERNEL, sizeof(struct sctp6_sock), - sk->sk_slab); + newsk = sk_alloc(PF_INET6, GFP_KERNEL, sk->sk_prot->slab_obj_size, + sk->sk_prot->slab); if (!newsk) goto out; @@ -892,7 +892,7 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { .type = SOCK_SEQPACKET, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -901,7 +901,7 @@ static struct inet_protosw sctpv6_stream_protosw = { .type = SOCK_STREAM, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -963,9 +963,14 @@ /* Initialize IPv6 support and register with inet6 stack. */ int sctp_v6_init(void) { + int rc = sk_alloc_slab(&sctpv6_prot, "sctpv6_sock"); + + if (rc) + goto out; /* Register inet6 protocol. */ + rc = -EAGAIN; if (inet6_add_protocol(&sctpv6_protocol, IPPROTO_SCTP) < 0) - return -EAGAIN; + goto out_sctp_free_slab; /* Add SCTPv6(UDP and TCP style) to inetsw6 linked list. */ inet6_register_protosw(&sctpv6_seqpacket_protosw); @@ -979,8 +984,12 @@ /* Register notifier for inet6 address additions/deletions. */ register_inet6addr_notifier(&sctp_inetaddr_notifier); - - return 0; + rc = 0; +out: + return rc; +out_sctp_free_slab: + sk_free_slab(&sctpv6_prot); + goto out; } /* IPv6 specific exit support. */ @@ -991,4 +1000,5 @@ inet6_unregister_protosw(&sctpv6_seqpacket_protosw); inet6_unregister_protosw(&sctpv6_stream_protosw); unregister_inet6addr_notifier(&sctp_inetaddr_notifier); + sk_free_slab(&sctpv6_prot); } diff -Nru a/net/sctp/protocol.c b/net/sctp/protocol.c --- a/net/sctp/protocol.c 2004-09-21 20:52:52 -07:00 +++ b/net/sctp/protocol.c 2004-09-21 20:52:52 -07:00 @@ -554,8 +554,8 @@ struct inet_opt *inet = inet_sk(sk); struct inet_opt *newinet; - newsk = sk_alloc(PF_INET, GFP_KERNEL, sizeof(struct sctp_sock), - sk->sk_slab); + newsk = sk_alloc(PF_INET, GFP_KERNEL, sk->sk_prot->slab_obj_size, + sk->sk_prot->slab); if (!newsk) goto out; @@ -962,23 +962,29 @@ __init int sctp_init(void) { int i; - int status = 0; + int status = -EINVAL; unsigned long goal; int order; /* SCTP_DEBUG sanity check. */ if (!sctp_sanity_check()) - return -EINVAL; + goto out; + + status = sk_alloc_slab(&sctp_prot, "sctp_sock"); + if (status) + goto out; /* Add SCTP to inet_protos hash table. */ + status = -EAGAIN; if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) - return -EAGAIN; + goto err_add_protocol; /* Add SCTP(TCP and UDP style) to inetsw linked list. */ inet_register_protosw(&sctp_seqpacket_protosw); inet_register_protosw(&sctp_stream_protosw); /* Allocate a cache pools. */ + status = -ENOBUFS; sctp_bucket_cachep = kmem_cache_create("sctp_bind_bucket", sizeof(struct sctp_bind_bucket), 0, SLAB_HWCACHE_ALIGN, @@ -1154,8 +1160,11 @@ sctp_get_local_addr_list(); __unsafe(THIS_MODULE); - return 0; - + status = 0; +out: + return status; +err_add_protocol: + sk_free_slab(&sctp_prot); err_ctl_sock_init: sctp_v6_exit(); err_v6_init: @@ -1183,7 +1192,7 @@ inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); inet_unregister_protosw(&sctp_seqpacket_protosw); inet_unregister_protosw(&sctp_stream_protosw); - return status; + goto out; } /* Exit handler for the SCTP protocol. */ @@ -1224,6 +1233,7 @@ inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); inet_unregister_protosw(&sctp_seqpacket_protosw); inet_unregister_protosw(&sctp_stream_protosw); + sk_free_slab(&sctp_prot); } module_init(sctp_init); diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c --- a/net/sctp/socket.c 2004-09-21 20:52:52 -07:00 +++ b/net/sctp/socket.c 2004-09-21 20:52:52 -07:00 @@ -4622,4 +4622,34 @@ .hash = sctp_hash, .unhash = sctp_unhash, .get_port = sctp_get_port, + .slab_obj_size = sizeof(struct sctp_sock), }; + +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) +struct ipv6_sk_offset sctp_sock_offset = { + .offset = offsetof(struct sctp6_sock, inet6), +}; + +struct proto sctpv6_prot = { + .name = "SCTPv6", + .close = sctp_close, + .connect = sctp_connect, + .disconnect = sctp_disconnect, + .accept = sctp_accept, + .ioctl = sctp_ioctl, + .init = sctp_init_sock, + .destroy = sctp_destroy_sock, + .shutdown = sctp_shutdown, + .setsockopt = sctp_setsockopt, + .getsockopt = sctp_getsockopt, + .sendmsg = sctp_sendmsg, + .recvmsg = sctp_recvmsg, + .bind = sctp_bind, + .backlog_rcv = sctp_backlog_rcv, + .hash = sctp_hash, + .unhash = sctp_unhash, + .get_port = sctp_get_port, + .slab_obj_size = sizeof(struct sctp6_sock), + .af_specific = &sctp_sock_offset, +}; +#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c --- a/net/xfrm/xfrm_policy.c 2004-09-21 20:52:52 -07:00 +++ b/net/xfrm/xfrm_policy.c 2004-09-21 20:52:52 -07:00 @@ -711,25 +711,11 @@ { struct xfrm_policy *policy; struct xfrm_state *xfrm[XFRM_MAX_DEPTH]; - struct rtable *rt = (struct rtable*)*dst_p; - struct dst_entry *dst; + struct dst_entry *dst, *dst_orig = *dst_p; int nx = 0; int err; u32 genid; - u16 family = (*dst_p)->ops->family; - - switch (family) { - case AF_INET: - if (!fl->fl4_src) - fl->fl4_src = rt->rt_src; - if (!fl->fl4_dst) - fl->fl4_dst = rt->rt_dst; - case AF_INET6: - /* Still not clear... */ - default: - /* nothing */; - } - + u16 family = dst_orig->ops->family; restart: genid = atomic_read(&flow_cache_genid); policy = NULL; @@ -738,7 +724,7 @@ if (!policy) { /* To accelerate a bit... */ - if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) + if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) return 0; policy = flow_cache_lookup(fl, family, @@ -813,7 +799,7 @@ return 0; } - dst = &rt->u.dst; + dst = dst_orig; err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family); if (unlikely(err)) { @@ -843,12 +829,12 @@ write_unlock_bh(&policy->lock); } *dst_p = dst; - ip_rt_put(rt); + dst_release(dst_orig); xfrm_pol_put(policy); return 0; error: - ip_rt_put(rt); + dst_release(dst_orig); xfrm_pol_put(policy); *dst_p = NULL; return err; diff -Nru a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h --- a/scripts/kconfig/lkc.h 2004-09-21 20:52:51 -07:00 +++ b/scripts/kconfig/lkc.h 2004-09-21 20:52:51 -07:00 @@ -59,9 +59,6 @@ struct file *file_lookup(const char *name); int file_write_dep(const char *name); -extern struct menu *current_entry; -extern struct menu *current_menu; - /* symbol.c */ void sym_init(void); void sym_clear_all_valid(void); diff -Nru a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c --- a/scripts/kconfig/mconf.c 2004-09-21 20:52:51 -07:00 +++ b/scripts/kconfig/mconf.c 2004-09-21 20:52:51 -07:00 @@ -18,6 +18,7 @@ #include #include #include +#include #define LKC_DIRECT_LINK #include "lkc.h" @@ -28,7 +29,7 @@ " selects submenus --->. " "Highlighted letters are hotkeys. " "Pressing includes, excludes, modularizes features. " - "Press to exit, for Help. " + "Press to exit, for Help, for Search. " "Legend: [*] built-in [ ] excluded module < > module capable", radiolist_instructions[] = "Use the arrow keys to navigate this window or " @@ -88,7 +89,7 @@ static int indent; static struct termios ios_org; static int rows = 0, cols = 0; -struct menu *current_menu; +static struct menu *current_menu; static int child_count; static int do_resize; static int single_menu_mode; @@ -102,6 +103,10 @@ static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); static void show_readme(void); +static void show_file(const char *filename, const char *title, int r, int c); +static void show_expr(struct menu *menu, FILE *fp); +static void search_conf(char *pattern); +static int regex_match(const char *string, regex_t *re); static void cprint_init(void); static int cprint1(const char *fmt, ...); @@ -274,6 +279,114 @@ return WEXITSTATUS(stat); } +static int regex_match(const char *string, regex_t *re) +{ + int rc; + + rc = regexec(re, string, (size_t) 0, NULL, 0); + if (rc) + return 0; + return 1; +} + +static void show_expr(struct menu *menu, FILE *fp) +{ + bool hit = false; + fprintf(fp, "Depends:\n "); + if (menu->prompt->visible.expr) { + if (!hit) + hit = true; + expr_fprint(menu->prompt->visible.expr, fp); + } + if (!hit) + fprintf(fp, "None"); + if (menu->sym) { + struct property *prop; + hit = false; + fprintf(fp, "\nSelects:\n "); + for_all_properties(menu->sym, prop, P_SELECT) { + if (!hit) + hit = true; + expr_fprint(prop->expr, fp); + } + if (!hit) + fprintf(fp, "None"); + hit = false; + fprintf(fp, "\nSelected by:\n "); + if (menu->sym->rev_dep.expr) { + hit = true; + expr_fprint(menu->sym->rev_dep.expr, fp); + } + if (!hit) + fprintf(fp, "None"); + } +} + +static void search_conf(char *pattern) +{ + struct symbol *sym = NULL; + struct menu *menu[32] = { 0 }; + struct property *prop = NULL; + FILE *fp = NULL; + bool hit = false; + int i, j, k, l; + regex_t re; + + if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB)) + return; + + fp = fopen(".search.tmp", "w"); + if (fp == NULL) { + perror("fopen"); + return; + } + for_all_symbols(i, sym) { + if (!sym->name) + continue; + if (!regex_match(sym->name, &re)) + continue; + for_all_prompts(sym, prop) { + struct menu *submenu = prop->menu; + if (!submenu) + continue; + j = 0; + hit = false; + while (submenu) { + menu[j++] = submenu; + submenu = submenu->parent; + } + if (j > 0) { + if (!hit) + hit = true; + fprintf(fp, "%s (%s)\n", prop->text, sym->name); + fprintf(fp, "Location:\n"); + } + for (k = j-2, l=1; k > 0; k--, l++) { + const char *prompt = menu_get_prompt(menu[k]); + if (menu[k]->sym) + fprintf(fp, "%*c-> %s (%s)\n", + l, ' ', + prompt, + menu[k]->sym->name); + else + fprintf(fp, "%*c-> %s\n", + l, ' ', + prompt); + } + if (hit) { + show_expr(menu[0], fp); + fprintf(fp, "\n\n\n"); + } + } + } + if (!hit) + fprintf(fp, "No matches found."); + regfree(&re); + fclose(fp); + show_file(".search.tmp", "Search Results", rows, cols); + unlink(".search.tmp"); +} + static void build_conf(struct menu *menu) { struct symbol *sym; @@ -463,6 +576,23 @@ cprint(" Save Configuration to an Alternate File"); } stat = exec_conf(); + if (stat == 26) { + char *pattern; + + if (!strlen(input_buf)) + continue; + pattern = malloc(sizeof(char)*sizeof(input_buf)); + if (pattern == NULL) { + perror("malloc"); + continue; + } + for (i = 0; input_buf[i]; i++) + pattern[i] = toupper(input_buf[i]); + pattern[i] = '\0'; + search_conf(pattern); + free(pattern); + continue; + } if (stat < 0) continue; @@ -550,17 +680,7 @@ fd = creat(".help.tmp", 0777); write(fd, text, strlen(text)); close(fd); - do { - cprint_init(); - if (title) { - cprint("--title"); - cprint("%s", title); - } - cprint("--textbox"); - cprint(".help.tmp"); - cprint("%d", r); - cprint("%d", c); - } while (exec_conf() < 0); + show_file(".help.tmp", title, r, c); unlink(".help.tmp"); } @@ -589,13 +709,22 @@ static void show_readme(void) { + show_file("scripts/README.Menuconfig", NULL, rows, cols); +} + +static void show_file(const char *filename, const char *title, int r, int c) +{ do { cprint_init(); + if (title) { + cprint("--title"); + cprint("%s", title); + } cprint("--textbox"); - cprint("scripts/README.Menuconfig"); - cprint("%d", rows); - cprint("%d", cols); - } while (exec_conf() == -1); + cprint("%s", filename); + cprint("%d", r); + cprint("%d", c); + } while (exec_conf() < 0); } static void conf_choice(struct menu *menu) diff -Nru a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c --- a/scripts/kconfig/menu.c 2004-09-21 20:52:52 -07:00 +++ b/scripts/kconfig/menu.c 2004-09-21 20:52:52 -07:00 @@ -10,7 +10,6 @@ #include "lkc.h" struct menu rootmenu; -struct menu *current_menu, *current_entry; static struct menu **last_entry_ptr; struct file *file_list; diff -Nru a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped --- a/scripts/kconfig/zconf.tab.c_shipped 2004-09-21 20:52:52 -07:00 +++ b/scripts/kconfig/zconf.tab.c_shipped 2004-09-21 20:52:52 -07:00 @@ -175,6 +175,8 @@ struct symbol *symbol_hash[257]; +static struct menu *current_menu, *current_entry; + #define YYERROR_VERBOSE diff -Nru a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y --- a/scripts/kconfig/zconf.y 2004-09-21 20:52:52 -07:00 +++ b/scripts/kconfig/zconf.y 2004-09-21 20:52:52 -07:00 @@ -25,6 +25,8 @@ struct symbol *symbol_hash[257]; +static struct menu *current_menu, *current_entry; + #define YYERROR_VERBOSE %} %expect 40 diff -Nru a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c --- a/scripts/lxdialog/menubox.c 2004-09-21 20:52:52 -07:00 +++ b/scripts/lxdialog/menubox.c 2004-09-21 20:52:52 -07:00 @@ -276,6 +276,15 @@ while (key != ESC) { key = wgetch(menu); + if ( key == '/' ) { + int ret = dialog_inputbox("Search Configuration Parameter", + "Enter Keyword", height, width, + (char *) NULL); + if (ret == 0) { + fprintf(stderr, "%s", dialog_input_result); + return 26; + } + } if (key < 256 && isalpha(key)) key = tolower(key); diff -Nru a/sound/oss/dmasound/Kconfig b/sound/oss/dmasound/Kconfig --- a/sound/oss/dmasound/Kconfig 2004-09-21 20:52:52 -07:00 +++ b/sound/oss/dmasound/Kconfig 2004-09-21 20:52:52 -07:00 @@ -14,7 +14,7 @@ config DMASOUND_PMAC tristate "PowerMac DMA sound support" - depends on PPC_PMAC && SOUND && I2C + depends on PPC32 && PPC_PMAC && SOUND && I2C select DMASOUND help If you want to use the internal audio of your PowerMac in Linux, diff -Nru a/sound/pci/atiixp.c b/sound/pci/atiixp.c --- a/sound/pci/atiixp.c 2004-09-21 20:52:52 -07:00 +++ b/sound/pci/atiixp.c 2004-09-21 20:52:52 -07:00 @@ -258,7 +258,7 @@ struct pci_dev *pci; unsigned long addr; - unsigned long remap_addr; + void __iomem *remap_addr; int irq; ac97_bus_t *ac97_bus; @@ -303,7 +303,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, unsigned int mask, unsigned int value) { - unsigned long addr = chip->remap_addr + reg; + void __iomem *addr = chip->remap_addr + reg; unsigned int data, old_data; old_data = data = readl(addr); data &= ~mask; @@ -1472,7 +1472,7 @@ if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); if (chip->remap_addr) - iounmap((void *) chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); kfree(chip); return 0; @@ -1515,7 +1515,7 @@ return err; } chip->addr = pci_resource_start(pci, 0); - chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); + chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); if (chip->remap_addr == 0) { snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_atiixp_free(chip); diff -Nru a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c --- a/sound/pci/atiixp_modem.c 2004-09-21 20:52:52 -07:00 +++ b/sound/pci/atiixp_modem.c 2004-09-21 20:52:52 -07:00 @@ -241,7 +241,7 @@ struct resource *res; /* memory i/o */ unsigned long addr; - unsigned long remap_addr; + void __iomem *remap_addr; int irq; ac97_bus_t *ac97_bus; @@ -284,7 +284,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, unsigned int mask, unsigned int value) { - unsigned long addr = chip->remap_addr + reg; + void __iomem *addr = chip->remap_addr + reg; unsigned int data, old_data; old_data = data = readl(addr); data &= ~mask; @@ -1194,7 +1194,7 @@ if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); if (chip->remap_addr) - iounmap((void *) chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); kfree(chip); return 0; @@ -1237,7 +1237,7 @@ return err; } chip->addr = pci_resource_start(pci, 0); - chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); + chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); if (chip->remap_addr == 0) { snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_atiixp_free(chip); diff -Nru a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c --- a/sound/sparc/amd7930.c 2004-09-21 20:52:51 -07:00 +++ b/sound/sparc/amd7930.c 2004-09-21 20:52:51 -07:00 @@ -314,7 +314,7 @@ typedef struct snd_amd7930 { spinlock_t lock; - unsigned long regs; + void __iomem *regs; u32 flags; #define AMD7930_FLAG_PLAYBACK 0x00000001 #define AMD7930_FLAG_CAPTURE 0x00000002 diff -Nru a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c --- a/sound/sparc/cs4231.c 2004-09-21 20:52:51 -07:00 +++ b/sound/sparc/cs4231.c 2004-09-21 20:52:51 -07:00 @@ -64,7 +64,7 @@ typedef struct snd_cs4231 { spinlock_t lock; - unsigned long port; + void __iomem *port; #ifdef EBUS_SUPPORT struct ebus_dma_info eb2c; struct ebus_dma_info eb2p; @@ -357,7 +357,7 @@ 0x00, /* 1f/31 - cbrl */ }; -static u8 __cs4231_readb(cs4231_t *cp, unsigned long reg_addr) +static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr) { #ifdef EBUS_SUPPORT if (cp->flags & CS4231_FLAG_EBUS) { @@ -372,7 +372,7 @@ #endif } -static void __cs4231_writeb(cs4231_t *cp, u8 val, unsigned long reg_addr) +static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr) { #ifdef EBUS_SUPPORT if (cp->flags & CS4231_FLAG_EBUS) { @@ -551,7 +551,7 @@ chip->mce_bit |= CS4231_MCE; timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); if (timeout == 0x80) - snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk("mce_up [%p]: serious init problem - codec still busy\n", chip->port); if (!(timeout & CS4231_MCE)) __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); spin_unlock_irqrestore(&chip->lock, flags); @@ -576,7 +576,7 @@ timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); if (timeout == 0x80) - snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk("mce_down [%p]: serious init problem - codec still busy\n", chip->port); if ((timeout & CS4231_MCE) == 0) { spin_unlock_irqrestore(&chip->lock, flags); return; @@ -2107,9 +2107,9 @@ chip->eb2p.client_cookie = chip; chip->eb2p.irq = edev->irqs[1]; - chip->port = (unsigned long) ioremap(edev->resource[0].start, 0x10); - chip->eb2p.regs = (unsigned long) ioremap(edev->resource[1].start, 0x10); - chip->eb2c.regs = (unsigned long) ioremap(edev->resource[2].start, 0x10); + chip->port = ioremap(edev->resource[0].start, 0x10); + chip->eb2p.regs = ioremap(edev->resource[1].start, 0x10); + chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10); if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) { snd_cs4231_ebus_free(chip); snd_printk("cs4231-%d: Unable to map chip registers.\n", dev);