Re: 2.6 kernel on aranym?

2006-12-11 Thread Geert Uytterhoeven
On Mon, 11 Dec 2006, Michael Schmitz wrote:
 Well, I've spent a little time to update my Atari patches to 2.6.19-m68k.
 There's two details I'd need some advice on - lockdep for the case where
 CONFIG_GENERIC_HARDIRQS is not set, and a small fix for scsi_lib. First
 lockdep:
 
 drivers/net/8390.c calls disable_irq_nosync_lockdep_irqsave and
 enable_irq_lockdep_irqrestore in 2.6.19 now. The EtherNEC driver uses

Yeah, I noticed these, too. Apparently we're the only arch with
CONFIG_GENERIC_HARDIRQS=n using 8390.c.

 8390.c so we need these functions on m68k now. I've just added dummy

Be careful with 8390 anyway, as Al Viro rewrote it, cfr. the current git tree
and 2.6.20-rc1 soon.

 declarations to make them behave as their non-lockdep counterparts for
 now. Can m68k set CONFIG_GENERIC_HARDIRQS?

I don't know, I haven't looked into it yet...

 The second item concerns a warning given for each SCSI target scanned on
 the Falcon, where sg_tablesize is set to SG_NONE (aka zero). The
 blk_queue_max_hw_segments() call should set a minimum size of one
 regardless of the sg_tablesize value (blk_queue_max_hw_segments() corrects
 this and gives a warning).
 
 --- drivers/scsi/scsi_lib.c.ms-maxhwseg.org   2006-12-09 16:49:29.0 
 +0100
 +++ drivers/scsi/scsi_lib.c   2006-12-09 16:49:29.0 +0100
 @@ -1559,7 +1559,7 @@
 
   blk_queue_prep_rq(q, scsi_prep_fn);
 
 - blk_queue_max_hw_segments(q, shost-sg_tablesize);
 + blk_queue_max_hw_segments(q, (shost-sg_tablesize ? shost-sg_tablesize 
 : 1));
   blk_queue_max_phys_segments(q, SCSI_MAX_PHYS_SEGMENTS);
   blk_queue_max_sectors(q, shost-max_sectors);
   blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 
 This one should go directly upstream, I think.

Then please ask/tell linux-scsi and jejb.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [EMAIL PROTECTED]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] 2.6.19 m68k Atari: Falcon IDE support

2006-12-11 Thread Michael Schmitz
Hi,

starting the Atari patch bomb on a light note: attached is the (minimal)
patch required to get Falcon IDE working. Tested under ARAnyM, may require
a slightly different solution once I get to testing SCSI properly (this
patch lets the IDE interrupt register on top of stdma_int which really
handles dispatching the appropriate interrupt handler; a different
approach would be to allow interrupt registration to fail, either
explicitly in ide-probe.c or by passing a SA_MAYFAIL flag :-), this would
help to prevent entering the handler twice for each interrupt which may
currently be the case).

The patch (and the rest of my patches) is relative to m68k CVS. Geert's
patch queue already has this one.

Signed-Off-By: /me, who else :-)

Michael--- linux-2.6.19-m68k-cvs/arch/m68k/atari/config.c  2006-12-02 
00:16:50.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/config.c  2006-12-08 18:49:02.0 
+0100
@@ -32,6 +32,10 @@
 #include linux/ioport.h
 #include linux/vt_kern.h
 
+#ifdef CONFIG_NATFEAT
+#include natfeat.h
+#endif
+
 #include asm/bootinfo.h
 #include asm/setup.h
 #include asm/atarihw.h
@@ -207,6 +211,12 @@
 }
 }
 
+void atari_poweroff(void)
+{
+#ifdef CONFIG_NATFEAT
+nf_shutdown();
+#endif
+}
 
 /*
  *  Setup the Atari configuration info
@@ -218,6 +228,10 @@
 
 memset(atari_hw_present, 0, sizeof(atari_hw_present));
 
+#ifdef CONFIG_NATFEAT
+nf_init();
+#endif
+
 atari_debug_init();
 
 ioport_resource.end  = 0x;  /* Change size of I/O space from 64KB
@@ -229,6 +243,8 @@
 mach_get_hardware_list = atari_get_hardware_list;
 mach_gettimeoffset   = atari_gettimeoffset;
 mach_reset   = atari_reset;
+mach_halt= atari_poweroff;
+mach_power_off   = atari_poweroff;
 mach_max_dma_address = 0xff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
 mach_beep  = atari_mksound;
@@ -614,6 +630,11 @@
 
 static void atari_get_model(char *model)
 {
+#ifdef CONFIG_NATFEAT
+if (nf_name1(model, 80)) { // char model[80] defined in kernel/setup.c
+   return;
+}
+#endif
 strcpy(model, Atari );
 switch (atari_mch_cookie  16) {
case ATARI_MCH_ST:
--- linux-2.6.19-m68k-cvs/arch/m68k/atari/Makefile  2003-02-10 
20:34:25.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/Makefile  2006-12-08 18:49:02.0 
+0100
@@ -3,8 +3,12 @@
 #
 
 obj-y  := config.o time.o debug.o ataints.o stdma.o \
-   atasound.o stram.o atari_ksyms.o
+   atakeyb.o atasound.o stram.o atari_ksyms.o
 
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_HADES)+= hades-pci.o
 endif
+
+ifeq ($(CONFIG_NATFEAT),y)
+obj-$(CONFIG_NATFEAT)  += natfeat.o
+endif
--- linux-2.6.19-m68k-cvs/arch/m68k/atari/natfeat.h 2006-12-08 
18:49:02.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/natfeat.h 2006-12-08 18:49:02.0 
+0100
@@ -0,0 +1,35 @@
+/*
+ * ARAnyM hardware support via Native Features (natfeats)
+ *
+ * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#ifndef _natfeat_h
+#define _natfeat_h
+
+struct nf_ops
+{
+   long (*get_id)(const char *);
+   long (*call)(long id, ...);
+   long res[3];
+};
+
+struct nf_ops *nf_init(void);
+
+int nf_name(char *buf, int bufsize);
+int nf_debug(const char *msg);
+int nf_shutdown(void);
+
+int nf_ethernet_check_version(char *errmsg, int errmsglen);
+int nf_ethernet_get_irq(void);
+int nf_ethernet_get_hw_addr(int ethX, char *buffer, int bufsize);
+int nf_ethernet_interrupt(int bit);
+int nf_ethernet_read_packet_len(int ethX);
+void nf_ethernet_read_block(int ethX, char *buffer, int len);
+void nf_ethernet_write_block(int ethX, char *buffer, int len);
+void nf_ethernet_xif_start(int ethX);
+void nf_ethernet_xif_stop(int ethX);
+# endif /* _natfeat_h */
--- linux-2.6.19-m68k-cvs/arch/m68k/atari/ethernet_nfapi.h  2006-12-08 
18:49:02.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/ethernet_nfapi.h  2006-12-08 
18:49:02.0 +0100
@@ -0,0 +1,56 @@
+/*
+ * ARAnyM ethernet driver - header file.
+ *
+ * Copyright (c) 2002-2004 Standa and Petr of ARAnyM dev team (see AUTHORS)
+ * 
+ * This file is part of the ARAnyM project which builds a new and powerful
+ * TOS/FreeMiNT compatible virtual machine running on almost any hardware.
+ *
+ * ARAnyM 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.
+ *
+ * ARAnyM 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 

[PATCH] 2.6.19 m68k Atari: Keyboard/mouse support

2006-12-11 Thread Michael Schmitz
Hi,

Second part: Atari keyboard and mouse support.

Signed-Off-By: [EMAIL PROTECTED]

Michael--- linux-2.6.19-m68k-cvs/arch/m68k/atari/atakeyb.c 2006-12-08 
18:49:13.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/atakeyb.c 2006-12-08 18:52:32.0 
+0100
@@ -0,0 +1,747 @@
+/*
+ * linux/atari/atakeyb.c
+ *
+ * Atari Keyboard driver for 680x0 Linux
+ *
+ * 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.
+ */
+
+/*
+ * Atari support by Robert de Vries
+ * enhanced by Bjoern Brauel and Roman Hodek
+ */
+
+#include linux/sched.h
+#include linux/kernel.h
+#include linux/interrupt.h
+#include linux/errno.h
+#include linux/keyboard.h
+#include linux/delay.h
+#include linux/timer.h
+#include linux/kd.h
+#include linux/random.h
+#include linux/init.h
+#include linux/kbd_kern.h
+
+#include asm/atariints.h
+#include asm/atarihw.h
+#include asm/atarikb.h
+#include asm/atari_joystick.h
+#include asm/irq.h
+
+static void atakeyb_rep( unsigned long ignore );
+extern unsigned int keymap_count;
+
+/* Hook for MIDI serial driver */
+void (*atari_MIDI_interrupt_hook) (void);
+/* Hook for mouse driver */
+void (*atari_mouse_interrupt_hook) (char *);
+/* Hook for keyboard inputdev  driver */
+void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
+/* Hook for mouse inputdev  driver */
+void (*atari_input_mouse_interrupt_hook) (char *);
+
+/* variables for IKBD self test: */
+
+/* state: 0: off; 0: in progress; 1: 0xf1 received */
+static volatile int ikbd_self_test;
+/* timestamp when last received a char */
+static volatile unsigned long self_test_last_rcv;
+/* bitmap of keys reported as broken */
+static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
+
+#define BREAK_MASK (0x80)
+
+/*
+ * ++roman: The following changes were applied manually:
+ *
+ *  - The Alt (= Meta) key works in combination with Shift and
+ *Control, e.g. Alt+Shift+a sends Meta-A (0xc1), Alt+Control+A sends
+ *Meta-Ctrl-A (0x81) ...
+ *
+ *  - The parentheses on the keypad send '(' and ')' with all
+ *modifiers (as would do e.g. keypad '+'), but they cannot be used as
+ *application keys (i.e. sending Esc O c).
+ *
+ *  - HELP and UNDO are mapped to be F21 and F24, resp, that send the
+ *codes \E[M and \E[P. (This is better than the old mapping to
+ *F11 and F12, because these codes are on Shift+F1/2 anyway.) This
+ *way, applications that allow their own keyboard mappings
+ *(e.g. tcsh, X Windows) can be configured to use them in the way
+ *the label suggests (providing help or undoing).
+ *
+ *  - Console switching is done with Alt+Fx (consoles 1..10) and
+ *Shift+Alt+Fx (consoles 11..20).
+ *
+ *  - The misc. special function implemented in the kernel are mapped
+ *to the following key combinations:
+ *
+ *  ClrHome  - Home/Find
+ *  Shift + ClrHome  - End/Select
+ *  Shift + Up   - Page Up
+ *  Shift + Down - Page Down
+ *  Alt + Help   - show system status
+ *  Shift + Help - show memory info
+ *  Ctrl + Help  - show registers
+ *  Ctrl + Alt + Del - Reboot
+ *  Alt + Undo   - switch to last console
+ *  Shift + Undo - send interrupt
+ *  Alt + Insert - stop/start output (same as ^S/^Q)
+ *  Alt + Up - Scroll back console (if implemented)
+ *  Alt + Down   - Scroll forward console (if implemented)
+ *  Alt + CapsLock   - NumLock
+ *
+ * ++Andreas:
+ *
+ *  - Help mapped to K_HELP
+ *  - Undo mapped to K_UNDO (= K_F246)
+ *  - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
+ */
+
+static u_short ataplain_map[NR_KEYS] __initdata = {
+   0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+   0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
+   0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+   0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+   0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+   0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+   0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
+   0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+   0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
+   0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
+   0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
+   0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+   0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
+   0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
+   0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+   0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
+};
+
+typedef enum kb_state_t
+{
+KEYBOARD, 

[PATCH] 2.6.19 m68k Atari: Falcon IDE support

2006-12-11 Thread Michael Schmitz
Hi,

once again, I messed up. _This_ one is the IDE patch (already in Linus'
tree as Geert told me). The other one was ARAnyM; please ignore.

Michael--- linux-2.6.19-m68k-cvs/arch/m68k/atari/stdma.c   2006-12-02 
00:16:51.0 +0100
+++ linux-2.6.19-m68k/arch/m68k/atari/stdma.c   2006-12-08 18:49:23.0 
+0100
@@ -174,7 +174,7 @@
 void __init stdma_init(void)
 {
stdma_isr = NULL;
-   request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW,
+   request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW | SA_SHIRQ,
ST-DMA: floppy/ACSI/IDE/Falcon-SCSI, stdma_int);
 }
 


Re: [PATCH] 2.6.19 m68k Atari: ARAnyM support

2006-12-11 Thread Petr Stehlik

Roman Zippel wrote:
While looking over this, I'm playing with the idea to move this to its own 
directory. This stuff is rather generic and it seems the API is intended 
to be used by various emulators.


that is correct.

It may also be possible at some point to 
have a kernel without Atari support and just use the emulator API to 
communicate with the outside world.


This is also correct. We can access graphics, sound and disk directly 
via the NatFeats. What remains is keyboard/mouse input - then we would 
not use any Atari specific HW (well apart from the MFP interrupts which 
are tied to CPU closely, anyway).


Petr

-
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html