⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patch-2.6.0-rmk2

📁 linux 2.6.0 的arm补丁 .做嵌入式的来下
💻 0-RMK2
📖 第 1 页 / 共 5 页
字号:
-		b	__armv4_cache_on-		b	__armv4_cache_off-		b	__armv4_cache_flush- 		.word	0x4401a100		@ sa110 / sa1100 		.word	0xffffffe0 		b	__armv4_cache_on@@ -523,6 +517,12 @@  		@ These match on the architecture ID +		.word	0x00020000		@ ARMv4T+		.word	0x000f0000+		b	__armv4_cache_on+		b	__armv4_cache_off+		b	__armv4_cache_flush+ 		.word	0x00050000		@ ARMv5TE 		.word	0x000f0000 		b	__armv4_cache_on@@ -585,7 +585,7 @@  * On entry,  *  r6 = processor ID  * On exit,- *  r1, r2, r3, r12 corrupted+ *  r1, r2, r3, r11, r12 corrupted  * This routine must preserve:  *  r0, r4, r5, r6, r7  */@@ -595,9 +595,25 @@ 		b	call_cache_fn  __armv4_cache_flush:-		bic	r1, pc, #31-		add	r2, r1, #65536		@ 2x the largest dcache size-1:		ldr	r3, [r1], #32		@ s/w flush D cache+		mov	r2, #64*1024		@ default: 32K dcache size (*2)+		mov	r11, #32		@ default: 32 byte line size+		mrc	p15, 0, r3, c0, c0, 1	@ read cache type+		teq	r3, r6			@ cache ID register present?+		beq	no_cache_id+		mov	r1, r3, lsr #18+		and	r1, r1, #7+		mov	r2, #1024+		mov	r2, r2, lsl r1		@ base dcache size *2+		tst	r3, #1 << 14		@ test M bit+		addne	r2, r2, r2, lsr #1	@ +1/2 size if M == 1+		mov	r3, r3, lsr #12+		and	r3, r3, #3+		mov	r11, #8+		mov	r11, r11, lsl r3	@ cache line size in bytes+no_cache_id:+		bic	r1, pc, #63		@ align to longest cache line+		add	r2, r1, r2+1:		ldr	r3, [r1], r11		@ s/w flush D cache 		teq	r1, r2 		bne	1b diff -urN orig/arch/arm/boot/compressed/misc.c linux/arch/arm/boot/compressed/misc.c--- orig/arch/arm/boot/compressed/misc.c	Sun Sep 28 09:53:47 2003+++ linux/arch/arm/boot/compressed/misc.c	Sun Sep 28 09:46:13 2003@@ -113,7 +113,7 @@  * gzip delarations  */ #define OF(args)  args-#define STATIC static+#define STATIC  typedef unsigned char  uch; typedef unsigned short ush;@@ -122,12 +122,12 @@ #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 */+unsigned char *inbuf;		/* input buffer */+unsigned char 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 */+unsigned int insize;		/* valid bytes in inbuf */+unsigned int inptr;		/* index of next byte to be processed in inbuf */+unsigned int outcnt;		/* bytes in output buffer */  /* gzip flag byte */ #define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */@@ -166,9 +166,9 @@ extern char input_data[]; extern char input_data_end[]; -static uch *output_data;-static ulg output_ptr;-static ulg bytes_out;+unsigned char *output_data;+unsigned long output_ptr;+unsigned long bytes_out;  static void *malloc(int size); static void free(void *where);@@ -179,8 +179,8 @@ static void puts(const char *);  extern int end;-static ulg free_mem_ptr;-static ulg free_mem_ptr_end;+unsigned long free_mem_ptr;+unsigned long free_mem_ptr_end;  #define HEAP_SIZE 0x2000 diff -urN orig/arch/arm/common/Makefile linux/arch/arm/common/Makefile--- orig/arch/arm/common/Makefile	Mon Jun 23 11:50:57 2003+++ linux/arch/arm/common/Makefile	Sat Sep 13 20:54:21 2003@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y				+= platform.o+obj-y				+= platform.o rtctime.o obj-$(CONFIG_ARM_AMBA)		+= amba.o obj-$(CONFIG_ICST525)		+= icst525.o obj-$(CONFIG_SA1111)		+= sa1111.o sa1111-pcibuf.o sa1111-pcipool.odiff -urN orig/arch/arm/common/amba.c linux/arch/arm/common/amba.c--- orig/arch/arm/common/amba.c	Mon Sep  8 23:36:17 2003+++ linux/arch/arm/common/amba.c	Wed Sep 24 14:04:51 2003@@ -41,6 +41,23 @@ 	return amba_lookup(pcdrv->id_table, pcdev) != NULL; } +#ifdef CONFIG_HOTPLUG+static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)+{+	struct amba_device *pcdev = to_amba_device(dev);++	if (nr_env < 2)+		return -ENOMEM;++	snprintf(buf, bufsz, "AMBA_ID=%08lx", pcdev->periphid);+	*envp++ = buf;+	*envp++ = NULL;+	return 0;+}+#else+#define amba_hotplug NULL+#endif+ static int amba_suspend(struct device *dev, u32 state) { 	struct amba_driver *drv = to_amba_driver(dev->driver);@@ -68,6 +85,7 @@ static struct bus_type amba_bustype = { 	.name		= "amba", 	.match		= amba_match,+	.hotplug	= amba_hotplug, 	.suspend	= amba_suspend, 	.resume		= amba_resume, };@@ -208,7 +226,11 @@ 		if (cid == 0xb105f00d) 			dev->periphid = pid; -		ret = device_register(&dev->dev);+		if (dev->periphid)+			ret = device_register(&dev->dev);+		else+			ret = -ENODEV;+ 		if (ret == 0) { 			device_create_file(&dev->dev, &dev_attr_id); 			device_create_file(&dev->dev, &dev_attr_irq);@@ -237,7 +259,68 @@ 	device_unregister(&dev->dev); } ++struct find_data {+	struct amba_device *dev;+	struct device *parent;+	const char *busid;+	unsigned int id;+	unsigned int mask;+};++static int amba_find_match(struct device *dev, void *data)+{+	struct find_data *d = data;+	struct amba_device *pcdev = to_amba_device(dev);+	int r;++	r = (pcdev->periphid & d->mask) == d->id;+	if (d->parent)+		r &= d->parent == dev->parent;+	if (d->busid)+		r &= strcmp(dev->bus_id, d->busid) == 0;++	if (r) {+		get_device(dev);+		d->dev = pcdev;+	}++	return r;+}++/**+ *	amba_find_device - locate an AMBA device given a bus id+ *	@busid: bus id for device (or NULL)+ *	@parent: parent device (or NULL)+ *	@id: peripheral ID (or 0)+ *	@mask: peripheral ID mask (or 0)+ *+ *	Return the AMBA device corresponding to the supplied parameters.+ *	If no device matches, returns NULL.+ *+ *	NOTE: When a valid device is found, its refcount is+ *	incremented, and must be decremented before the returned+ *	reference.+ */+struct amba_device *+amba_find_device(const char *busid, struct device *parent, unsigned int id,+		 unsigned int mask)+{+	struct find_data data;++	data.dev = NULL;+	data.parent = parent;+	data.busid = busid;+	data.id = id;+	data.mask = mask;++	bus_for_each_dev(&amba_bustype, NULL, &data, amba_find_match);++	return data.dev;+}+ EXPORT_SYMBOL(amba_driver_register); EXPORT_SYMBOL(amba_driver_unregister); EXPORT_SYMBOL(amba_device_register); EXPORT_SYMBOL(amba_device_unregister);+EXPORT_SYMBOL(amba_find_device);diff -urN orig/arch/arm/common/rtctime.c linux/arch/arm/common/rtctime.c--- orig/arch/arm/common/rtctime.c	Thu Jan  1 01:00:00 1970+++ linux/arch/arm/common/rtctime.c	Thu Oct  9 23:31:04 2003@@ -0,0 +1,482 @@+/*+ *  linux/arch/arm/common/rtctime.c+ *+ *  Copyright (C) 2003 Deep Blue Solutions Ltd.+ *  Based on sa1100-rtc.c, Nils Faerber, CIH, Nicolas Pitre.+ *  Based on rtc.c by Paul Gortmaker+ *+ * 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 <linux/module.h>+#include <linux/kernel.h>+#include <linux/time.h>+#include <linux/rtc.h>+#include <linux/poll.h>+#include <linux/proc_fs.h>+#include <linux/miscdevice.h>+#include <linux/spinlock.h>+#include <linux/device.h>++#include <asm/rtc.h>+#include <asm/semaphore.h>++static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);+static struct fasync_struct *rtc_async_queue;++/*+ * rtc_lock protects rtc_irq_data+ */+static spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;+static unsigned long rtc_irq_data;++/*+ * rtc_sem protects rtc_inuse and rtc_ops+ */+static DECLARE_MUTEX(rtc_sem);+static unsigned long rtc_inuse;+static struct rtc_ops *rtc_ops;++#define rtc_epoch 1900UL++static const unsigned char days_in_month[] = {+	31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31+};++#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)+#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))++static int month_days(unsigned int month, unsigned int year)+{+	return days_in_month[month] + (LEAP_YEAR(year) && month == 1);+}++/*+ * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.+ */+void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)+{+	int days, month, year;++	days = time / 86400;+	time -= days * 86400;++	tm->tm_wday = (days + 4) % 7;++	year = 1970 + days / 365;+	days -= (year - 1970) * 365+	        + LEAPS_THRU_END_OF(year - 1)+	        - LEAPS_THRU_END_OF(1970 - 1);+	if (days < 0) {+		year -= 1;+		days += 365 + LEAP_YEAR(year);+	}+	tm->tm_year = year - 1900;+	tm->tm_yday = days + 1;++	for (month = 0; month < 11; month++) {+		int newdays;++		newdays = days - month_days(month, year);+		if (newdays < 0)+			break;+		days = newdays;+	}+	tm->tm_mon = month;+	tm->tm_mday = days + 1;++	tm->tm_hour = time / 3600;+	time -= tm->tm_hour * 3600;+	tm->tm_min = time / 60;+	tm->tm_sec = time - tm->tm_min * 60;+}++/*+ * Convert Gregorian date to seconds since 01-01-1970 00:00:00.+ */+int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)+{+	unsigned int yrs = tm->tm_year + 1900;++	*time = 0;++	if (yrs < 1970 ||+	    tm->tm_mon >= 12 ||+	    tm->tm_mday < 1 ||+	    tm->tm_mday > month_days(tm->tm_mon, yrs) ||+	    tm->tm_hour >= 24 ||+	    tm->tm_min >= 60 ||+	    tm->tm_sec >= 60)+		return -EINVAL;++	*time = mktime(yrs, tm->tm_mon + 1, tm->tm_mday,+		       tm->tm_hour, tm->tm_min, tm->tm_sec);++	return 0;+}++/*+ * Calculate the next alarm time given the requested alarm time mask+ * and the current time.+ *+ * FIXME: for now, we just copy the alarm time because we're lazy (and+ * is therefore buggy - setting a 10am alarm at 8pm will not result in+ * the alarm triggering.)+ */+void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm)+{+	next->tm_year = now->tm_year;+	next->tm_mon = now->tm_mon;+	next->tm_mday = now->tm_mday;+	next->tm_hour = alrm->tm_hour;+	next->tm_min = alrm->tm_min;+	next->tm_sec = alrm->tm_sec;+}++static inline void rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)+{+	memset(tm, 0, sizeof(struct rtc_time));+	ops->read_time(tm);+}++static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)+{+	return ops->set_time(tm);+}++static inline void rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)+{+	memset(alrm, 0, sizeof(struct rtc_wkalrm));+	ops->read_alarm(alrm);+}++static inline int rtc_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)+{+	return ops->set_alarm(alrm);+}++void rtc_update(unsigned long num, unsigned long events)+{+	spin_lock(&rtc_lock);+	rtc_irq_data = (rtc_irq_data + (num << 8)) | events;+	spin_unlock(&rtc_lock);++	wake_up_interruptible(&rtc_wait);+	kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);+}+++static ssize_t+rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos)+{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -