diff options
Diffstat (limited to 'linux/src')
50 files changed, 323 insertions, 124 deletions
diff --git a/linux/src/arch/i386/kernel/bios32.c b/linux/src/arch/i386/kernel/bios32.c index b069ce46..c10cc0c0 100644 --- a/linux/src/arch/i386/kernel/bios32.c +++ b/linux/src/arch/i386/kernel/bios32.c @@ -909,6 +909,8 @@ unsigned long pcibios_init(unsigned long memory_start, unsigned long memory_end) } if (bios32_entry && check_pcibios()) access_pci = &pci_bios_access; + else + access_pci = check_direct_pci(); #endif return memory_start; } diff --git a/linux/src/drivers/block/ide-cd.c b/linux/src/drivers/block/ide-cd.c index e4548f54..020a8313 100644 --- a/linux/src/drivers/block/ide-cd.c +++ b/linux/src/drivers/block/ide-cd.c @@ -649,7 +649,7 @@ static void cdrom_end_request (int uptodate, ide_drive_t *drive) { struct request *rq = HWGROUP(drive)->rq; - if (rq->cmd == REQUEST_SENSE_COMMAND && uptodate) { + if (rq->cmd == REQUEST_SENSE_COMMAND && uptodate && !rq->quiet) { struct packet_command *pc = (struct packet_command *) rq->buffer; cdrom_analyze_sense_data (drive, @@ -727,16 +727,18 @@ static int cdrom_decode_status (ide_drive_t *drive, int good_stat, because workman constantly polls the drive with this command, and we don't want to uselessly fill up the syslog. */ - if (pc->c[0] != SCMD_READ_SUBCHANNEL) + if (pc->c[0] != SCMD_READ_SUBCHANNEL && !rq->quiet) printk ("%s : tray open or drive not ready\n", drive->name); } else if (sense_key == UNIT_ATTENTION) { /* Check for media change. */ cdrom_saw_media_change (drive); - printk ("%s: media changed\n", drive->name); + if (!rq->quiet) + printk ("%s: media changed\n", drive->name); } else { /* Otherwise, print an error. */ - ide_dump_status (drive, "packet command error", + if (!rq->quiet) + ide_dump_status (drive, "packet command error", stat); } @@ -768,7 +770,8 @@ static int cdrom_decode_status (ide_drive_t *drive, int good_stat, cdrom_saw_media_change (drive); /* Fail the request. */ - printk ("%s : tray open\n", drive->name); + if (!rq->quiet) + printk ("%s : tray open\n", drive->name); cdrom_end_request (0, drive); } else if (sense_key == UNIT_ATTENTION) { /* Media change. */ @@ -783,7 +786,8 @@ static int cdrom_decode_status (ide_drive_t *drive, int good_stat, sense_key == DATA_PROTECT) { /* No point in retrying after an illegal request or data protect error.*/ - ide_dump_status (drive, "command error", stat); + if (!rq->quiet) + ide_dump_status (drive, "command error", stat); cdrom_end_request (0, drive); } else if ((err & ~ABRT_ERR) != 0) { /* Go to the default handler @@ -1406,7 +1410,7 @@ void cdrom_sleep (int time) #endif static -int cdrom_queue_packet_command (ide_drive_t *drive, struct packet_command *pc) +int cdrom_queue_packet_command (ide_drive_t *drive, struct packet_command *pc, int quiet) { struct atapi_request_sense my_reqbuf; int retries = 10; @@ -1423,6 +1427,7 @@ int cdrom_queue_packet_command (ide_drive_t *drive, struct packet_command *pc) ide_init_drive_cmd (&req); req.cmd = PACKET_COMMAND; req.buffer = (char *)pc; + req.quiet = quiet; (void) ide_do_drive_cmd (drive, &req, ide_wait); if (pc->stat != 0) { @@ -1563,7 +1568,7 @@ cdrom_check_status (ide_drive_t *drive, pc.c[7] = CDROM_STATE_FLAGS (drive)->sanyo_slot % 3; - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 1); } @@ -1588,7 +1593,7 @@ cdrom_lockdoor (ide_drive_t *drive, int lockflag, pc.c[0] = ALLOW_MEDIUM_REMOVAL; pc.c[4] = (lockflag != 0); - stat = cdrom_queue_packet_command (drive, &pc); + stat = cdrom_queue_packet_command (drive, &pc, 0); } if (stat == 0) @@ -1622,7 +1627,7 @@ cdrom_eject (ide_drive_t *drive, int ejectflag, pc.c[0] = START_STOP; pc.c[4] = 2 + (ejectflag != 0); - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1637,7 +1642,7 @@ cdrom_pause (ide_drive_t *drive, int pauseflag, pc.c[0] = SCMD_PAUSE_RESUME; pc.c[8] = !pauseflag; - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1653,7 +1658,7 @@ cdrom_startstop (ide_drive_t *drive, int startflag, pc.c[0] = START_STOP; pc.c[1] = 1; pc.c[4] = startflag; - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1676,7 +1681,7 @@ cdrom_read_capacity (ide_drive_t *drive, unsigned *capacity, pc.buffer = (unsigned char *)&capbuf; pc.buflen = sizeof (capbuf); - stat = cdrom_queue_packet_command (drive, &pc); + stat = cdrom_queue_packet_command (drive, &pc, 1); if (stat == 0) *capacity = ntohl (capbuf.lba); @@ -1702,7 +1707,7 @@ cdrom_read_tocentry (ide_drive_t *drive, int trackno, int msf_flag, pc.c[8] = (buflen & 0xff); pc.c[9] = (format << 6); if (msf_flag) pc.c[1] = 2; - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 1); } @@ -1834,7 +1839,7 @@ cdrom_read_subchannel (ide_drive_t *drive, int format, pc.c[3] = format, pc.c[7] = (buflen >> 8); pc.c[8] = (buflen & 0xff); - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1855,7 +1860,7 @@ cdrom_mode_sense (ide_drive_t *drive, int pageno, int modeflag, pc.c[2] = pageno | (modeflag << 6); pc.c[7] = (buflen >> 8); pc.c[8] = (buflen & 0xff); - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1875,7 +1880,7 @@ cdrom_mode_select (ide_drive_t *drive, int pageno, char *buf, int buflen, pc.c[2] = pageno; pc.c[7] = (buflen >> 8); pc.c[8] = (buflen & 0xff); - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -1903,7 +1908,7 @@ cdrom_play_lba_range_1 (ide_drive_t *drive, int lba_start, int lba_end, } #endif /* not STANDARD_ATAPI */ - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } @@ -2004,7 +2009,7 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, int nblocks, else pc.c[9] = 0x10; - stat = cdrom_queue_packet_command (drive, &pc); + stat = cdrom_queue_packet_command (drive, &pc, 0); #if ! STANDARD_ATAPI /* If the drive doesn't recognize the READ CD opcode, retry the command @@ -2059,7 +2064,7 @@ cdrom_load_unload (ide_drive_t *drive, int slot, pc.c[0] = LOAD_UNLOAD; pc.c[4] = 2 + (slot >= 0); pc.c[8] = slot; - return cdrom_queue_packet_command (drive, &pc); + return cdrom_queue_packet_command (drive, &pc, 0); } } @@ -2575,7 +2580,7 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, pc.buffer = buf; } - stat = cdrom_queue_packet_command (drive, &pc); + stat = cdrom_queue_packet_command (drive, &pc, 0); if (len > 0) memcpy_tofs ((void *)arg, buf, len); @@ -2638,6 +2643,10 @@ int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive) if (stat == 0 || my_reqbuf.sense_key == UNIT_ATTENTION) { (void) cdrom_lockdoor (drive, 1, &my_reqbuf); (void) cdrom_read_toc (drive, &my_reqbuf); + } else { + /* Otherwise return as missing */ + --drive->usage; + return -ENXIO; } } diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c index 0f3fd01f..dc20fcba 100644 --- a/linux/src/drivers/block/ide.c +++ b/linux/src/drivers/block/ide.c @@ -325,7 +325,7 @@ #endif /* CONFIG_BLK_DEV_PROMISE */ static const byte ide_hwif_to_major[MAX_HWIFS] = {IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR}; -static const unsigned short default_io_base[MAX_HWIFS] = {0x1f0, 0x170, 0x1e8, 0x168}; +static unsigned short default_io_base[MAX_HWIFS] = {0x1f0, 0x170, 0x1e8, 0x168}; static const byte default_irqs[MAX_HWIFS] = {14, 15, 11, 10}; static int idebus_parameter; /* holds the "idebus=" parameter */ static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */ @@ -367,6 +367,15 @@ static void set_recovery_timer (ide_hwif_t *hwif) #endif /* DISK_RECOVERY_TIME */ +/* Called by other drivers to disable the legacy IDE driver on a given IDE base. */ +void ide_disable_base(unsigned base) +{ + unsigned i; + for (i = 0; i < MAX_HWIFS; i++) + if (default_io_base[i] == base) + default_io_base[i] = 0; +} + /* * Do not even *think* about calling this! @@ -1927,6 +1936,7 @@ void ide_init_drive_cmd (struct request *rq) rq->rq_status = RQ_ACTIVE; rq->rq_dev = ????; #endif + rq->quiet = 0; } /* @@ -2525,7 +2535,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd) drive->media = ide_tape; drive->present = 1; drive->removable = 1; - if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL) { + if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL && !drive->nodma) { if (!HWIF(drive)->dmaproc(ide_dma_check, drive)) printk(", DMA"); } @@ -2652,7 +2662,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd) if (drive->mult_req || ((id->multsect_valid & 1) && id->multsect)) drive->special.b.set_multmode = 1; } - if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL) { + if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL && !drive->nodma) { if (!(HWIF(drive)->dmaproc(ide_dma_check, drive))) { if ((id->field_valid & 4) && (id->dma_ultra & (id->dma_ultra >> 8) & 7)) printk(", UDMA"); @@ -3107,6 +3117,7 @@ static int match_parm (char *s, const char *keywords[], int vals[], int max_vals * Not fully supported by all chipset types, * and quite likely to cause trouble with * older/odd IDE drives. + * "hdx=nodma" : disallow DMA for the drive * * "idebus=xx" : inform IDE driver of VESA/PCI bus speed in Mhz, * where "xx" is between 20 and 66 inclusive, @@ -3151,7 +3162,11 @@ void ide_setup (char *s) ide_hwif_t *hwif; ide_drive_t *drive; unsigned int hw, unit; +#ifdef MACH + const char max_drive = '0' + ((MAX_HWIFS * MAX_DRIVES) - 1); +#else const char max_drive = 'a' + ((MAX_HWIFS * MAX_DRIVES) - 1); +#endif const char max_hwif = '0' + (MAX_HWIFS - 1); printk("ide_setup: %s", s); @@ -3160,11 +3175,19 @@ void ide_setup (char *s) /* * Look for drive options: "hdx=" */ +#ifdef MACH + if (s[0] == 'h' && s[1] == 'd' && s[2] >= '0' && s[2] <= max_drive) { +#else if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { +#endif const char *hd_words[] = {"none", "noprobe", "nowerr", "cdrom", "serialize", "autotune", "noautotune", - "slow", "ide-scsi", NULL}; + "slow", "ide-scsi", "nodma", NULL}; +#ifdef MACH + unit = s[2] - '0'; +#else unit = s[2] - 'a'; +#endif hw = unit / MAX_DRIVES; unit = unit % MAX_DRIVES; hwif = &ide_hwifs[hw]; @@ -3199,6 +3222,9 @@ void ide_setup (char *s) case -9: /* "ide-scsi" */ drive->ide_scsi = 1; goto done; + case -10: /* "nodma" */ + drive->nodma = 1; + goto done; case 3: /* cyl,head,sect */ drive->media = ide_disk; drive->cyl = drive->bios_cyl = vals[0]; diff --git a/linux/src/drivers/block/ide.h b/linux/src/drivers/block/ide.h index edeedc97..28e371bf 100644 --- a/linux/src/drivers/block/ide.h +++ b/linux/src/drivers/block/ide.h @@ -344,6 +344,7 @@ typedef struct ide_drive_s { unsigned nobios : 1; /* flag: do not probe bios for drive */ unsigned slow : 1; /* flag: slow data port */ unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */ + unsigned nodma : 1; /* disk should not use dma for read/write */ #if FAKE_FDISK_FOR_EZDRIVE unsigned remap_0_to_1 : 1; /* flag: partitioned with ezdrive */ #endif /* FAKE_FDISK_FOR_EZDRIVE */ diff --git a/linux/src/drivers/net/3c507.c b/linux/src/drivers/net/3c507.c index 63f85a4c..58ba2d75 100644 --- a/linux/src/drivers/net/3c507.c +++ b/linux/src/drivers/net/3c507.c @@ -354,7 +354,7 @@ int el16_probe1(struct device *dev, int ioaddr) dev = init_etherdev(0, sizeof(struct net_local)); if (net_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("%s: 3c507 at %#x,", dev->name, ioaddr); @@ -410,7 +410,7 @@ int el16_probe1(struct device *dev, int ioaddr) dev->if_port ? "ex" : "in", dev->mem_start, dev->mem_end-1); if (net_debug) - printk(version); + printk("%s", version); /* Initialize the device structure. */ dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); diff --git a/linux/src/drivers/net/3c509.c b/linux/src/drivers/net/3c509.c index f8842882..727595cd 100644 --- a/linux/src/drivers/net/3c509.c +++ b/linux/src/drivers/net/3c509.c @@ -314,7 +314,7 @@ int el3_probe(struct device *dev) el3_root_dev = dev; if (el3_debug > 0) - printk(version); + printk("%s", version); /* The EL3-specific entries in the device structure. */ dev->open = &el3_open; diff --git a/linux/src/drivers/net/3c515.c b/linux/src/drivers/net/3c515.c index fd6ec50c..52f47032 100644 --- a/linux/src/drivers/net/3c515.c +++ b/linux/src/drivers/net/3c515.c @@ -404,7 +404,7 @@ init_module(void) if (debug >= 0) vortex_debug = debug; if (vortex_debug) - printk(version); + printk("%s", version); root_vortex_dev = NULL; cards_found = vortex_scan(0); @@ -419,7 +419,7 @@ int tc515_probe(struct device *dev) cards_found = vortex_scan(dev); if (vortex_debug > 0 && cards_found) - printk(version); + printk("%s", version); return cards_found ? 0 : -ENODEV; } diff --git a/linux/src/drivers/net/ac3200.c b/linux/src/drivers/net/ac3200.c index 0337bab7..600949fa 100644 --- a/linux/src/drivers/net/ac3200.c +++ b/linux/src/drivers/net/ac3200.c @@ -208,7 +208,7 @@ static int ac_probe1(int ioaddr, struct device *dev) dev->mem_start, dev->mem_end-1); if (ei_debug > 0) - printk(version); + printk("%s", version); ei_status.reset_8390 = &ac_reset_8390; ei_status.block_input = &ac_block_input; diff --git a/linux/src/drivers/net/apricot.c b/linux/src/drivers/net/apricot.c index d106e50d..57fccafb 100644 --- a/linux/src/drivers/net/apricot.c +++ b/linux/src/drivers/net/apricot.c @@ -720,7 +720,7 @@ int apricot_probe(struct device *dev) dev->irq = 10; printk(" IRQ %d.\n", dev->irq); - if (i596_debug > 0) printk(version); + if (i596_debug > 0) printk("%s", version); /* The APRICOT-specific entries in the device structure. */ dev->open = &i596_open; diff --git a/linux/src/drivers/net/at1700.c b/linux/src/drivers/net/at1700.c index 9e42ab48..f4025f46 100644 --- a/linux/src/drivers/net/at1700.c +++ b/linux/src/drivers/net/at1700.c @@ -258,7 +258,7 @@ int at1700_probe1(struct device *dev, int ioaddr) outb(0x00, ioaddr + CONFIG_1); if (net_debug) - printk(version); + printk("%s", version); /* Initialize the device structure. */ dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); diff --git a/linux/src/drivers/net/de4x5.c b/linux/src/drivers/net/de4x5.c index a66f0564..c85bcdbf 100644 --- a/linux/src/drivers/net/de4x5.c +++ b/linux/src/drivers/net/de4x5.c @@ -1308,7 +1308,7 @@ de4x5_hw_init(struct device *dev, u_long iobase)) } if (de4x5_debug & DEBUG_VERSION) { - printk(version); + printk("%s", version); } /* The DE4X5-specific entries in the device structure. */ diff --git a/linux/src/drivers/net/de600.c b/linux/src/drivers/net/de600.c index 2488cd76..ce969422 100644 --- a/linux/src/drivers/net/de600.c +++ b/linux/src/drivers/net/de600.c @@ -644,7 +644,7 @@ de600_probe(struct device *dev) printk("%s: D-Link DE-600 pocket adapter", dev->name); /* Alpha testers must have the version number to report bugs. */ if (de600_debug > 1) - printk(version); + printk("%s", version); /* probe for adapter */ rx_page = 0; diff --git a/linux/src/drivers/net/de620.c b/linux/src/drivers/net/de620.c index ec639101..0e0c5522 100644 --- a/linux/src/drivers/net/de620.c +++ b/linux/src/drivers/net/de620.c @@ -843,7 +843,7 @@ de620_probe(struct device *dev) dev->irq = irq; if (de620_debug) - printk(version); + printk("%s", version); printk("D-Link DE-620 pocket adapter"); diff --git a/linux/src/drivers/net/depca.c b/linux/src/drivers/net/depca.c index e1b03429..2048812d 100644 --- a/linux/src/drivers/net/depca.c +++ b/linux/src/drivers/net/depca.c @@ -649,7 +649,7 @@ depca_hw_init(struct device *dev, u_long ioaddr) } if (!status) { if (depca_debug > 1) { - printk(version); + printk("%s", version); } /* The DEPCA-specific entries in the device structure. */ diff --git a/linux/src/drivers/net/e2100.c b/linux/src/drivers/net/e2100.c index 7ba12d31..be4185ab 100644 --- a/linux/src/drivers/net/e2100.c +++ b/linux/src/drivers/net/e2100.c @@ -68,7 +68,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0}; #define E21_SAPROM 0x10 /* Offset to station address data. */ #define E21_IO_EXTENT 0x20 -extern inline void mem_on(short port, volatile char *mem_base, +static inline void mem_on(short port, volatile char *mem_base, unsigned char start_page ) { /* This is a little weird: set the shared memory window by doing a @@ -78,7 +78,7 @@ extern inline void mem_on(short port, volatile char *mem_base, outb(E21_MEM_ON, port + E21_MEM_ENABLE + E21_MEM_ON); } -extern inline void mem_off(short port) +static inline void mem_off(short port) { inb(port + E21_MEM_ENABLE); outb(0x00, port + E21_MEM_ENABLE); @@ -162,7 +162,7 @@ int e21_probe1(struct device *dev, int ioaddr) outb(0, ioaddr + E21_ASIC); /* and disable the secondary interface. */ if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); /* We should have a "dev" from Space.c or the static module table. */ if (dev == NULL) { diff --git a/linux/src/drivers/net/eepro.c b/linux/src/drivers/net/eepro.c index 2c3a6b26..3d4fc578 100644 --- a/linux/src/drivers/net/eepro.c +++ b/linux/src/drivers/net/eepro.c @@ -498,7 +498,7 @@ eepro_probe1(struct device *dev, short ioaddr) } if (net_debug) - printk(version); + printk("%s", version); /* Grab the region so we can find another board if autoIRQ fails. */ request_region(ioaddr, EEPRO_IO_EXTENT, "eepro"); diff --git a/linux/src/drivers/net/eepro100.c b/linux/src/drivers/net/eepro100.c index 6909cdc4..d03462cd 100644 --- a/linux/src/drivers/net/eepro100.c +++ b/linux/src/drivers/net/eepro100.c @@ -726,7 +726,7 @@ static void *speedo_found1(struct pci_dev *pdev, void *init_dev, eeprom[8], eeprom[9]>>8, eeprom[9] & 0xff); for (i = 0; i < 4; i++) if (eeprom[5] & (1<<i)) - printk(connectors[i]); + printk("%s", connectors[i]); printk("\n"KERN_INFO" Primary interface chip %s PHY #%d.\n", phys[(eeprom[6]>>8)&15], eeprom[6] & 0x1f); if (eeprom[7] & 0x0700) diff --git a/linux/src/drivers/net/eexpress.c b/linux/src/drivers/net/eexpress.c index d7065509..9c816ee9 100644 --- a/linux/src/drivers/net/eexpress.c +++ b/linux/src/drivers/net/eexpress.c @@ -794,7 +794,7 @@ static int eexp_hw_probe(struct device *dev, unsigned short ioaddr) } if (net_debug) - printk(version); + printk("%s", version); dev->open = eexp_open; dev->stop = eexp_close; dev->hard_start_xmit = eexp_xmit; diff --git a/linux/src/drivers/net/ewrk3.c b/linux/src/drivers/net/ewrk3.c index f91315ff..07b0f13f 100644 --- a/linux/src/drivers/net/ewrk3.c +++ b/linux/src/drivers/net/ewrk3.c @@ -589,7 +589,7 @@ ewrk3_hw_init(struct device *dev, u_long iobase) if (!status) { if (ewrk3_debug > 1) { - printk(version); + printk("%s", version); } /* The EWRK3-specific entries in the device structure. */ diff --git a/linux/src/drivers/net/fmv18x.c b/linux/src/drivers/net/fmv18x.c index 121dd0bb..b29ddf00 100644 --- a/linux/src/drivers/net/fmv18x.c +++ b/linux/src/drivers/net/fmv18x.c @@ -249,7 +249,7 @@ int fmv18x_probe1(struct device *dev, short ioaddr) outb(dev->if_port, ioaddr + MODE13); if (net_debug) - printk(version); + printk("%s", version); /* Initialize the device structure. */ dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); diff --git a/linux/src/drivers/net/hp-plus.c b/linux/src/drivers/net/hp-plus.c index c8e36111..c2b71169 100644 --- a/linux/src/drivers/net/hp-plus.c +++ b/linux/src/drivers/net/hp-plus.c @@ -164,7 +164,7 @@ int hpp_probe1(struct device *dev, int ioaddr) } if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("%s: %s at %#3x,", dev->name, name, ioaddr); diff --git a/linux/src/drivers/net/hp.c b/linux/src/drivers/net/hp.c index 741924f9..6ddbfd2e 100644 --- a/linux/src/drivers/net/hp.c +++ b/linux/src/drivers/net/hp.c @@ -136,7 +136,7 @@ int hp_probe1(struct device *dev, int ioaddr) } if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr); diff --git a/linux/src/drivers/net/lance.c b/linux/src/drivers/net/lance.c index f64f0fee..fe3cf687 100644 --- a/linux/src/drivers/net/lance.c +++ b/linux/src/drivers/net/lance.c @@ -674,7 +674,7 @@ int lance_probe1(struct device *dev, int ioaddr, int irq, int options) } if (lance_debug > 0 && did_version++ == 0) - printk(version); + printk("%s", version); /* The LANCE-specific entries in the device structure. */ dev->open = lance_open; diff --git a/linux/src/drivers/net/ne.c b/linux/src/drivers/net/ne.c index 825b768e..ea2f9290 100644 --- a/linux/src/drivers/net/ne.c +++ b/linux/src/drivers/net/ne.c @@ -291,7 +291,7 @@ static int ne_probe1(struct device *dev, int ioaddr) } if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("NE*000 ethercard probe at %#3x:", ioaddr); diff --git a/linux/src/drivers/net/pci-scan.c b/linux/src/drivers/net/pci-scan.c index 60525b76..ffb7b128 100644 --- a/linux/src/drivers/net/pci-scan.c +++ b/linux/src/drivers/net/pci-scan.c @@ -31,7 +31,7 @@ static int min_pci_latency = 32; #if ! defined(__KERNEL__) #define __KERNEL__ 1 #endif -#if !defined(__OPTIMIZE__) +#if !defined(__OPTIMIZE__) && /* Mach glue, we think this is ok now: */ 0 #warning You must compile this file with the correct options! #warning See the last lines of the source file. #error You must compile this driver with the proper options, including "-O". diff --git a/linux/src/drivers/net/pcnet32.c b/linux/src/drivers/net/pcnet32.c index 02e70982..da0e8709 100644 --- a/linux/src/drivers/net/pcnet32.c +++ b/linux/src/drivers/net/pcnet32.c @@ -344,7 +344,7 @@ static int pcnet32_probe1(struct device *dev, unsigned int ioaddr, unsigned char dev->irq = irq_line; if (pcnet32_debug > 0) - printk(version); + printk("%s", version); /* The PCNET32-specific entries in the device structure. */ dev->open = &pcnet32_open; diff --git a/linux/src/drivers/net/seeq8005.c b/linux/src/drivers/net/seeq8005.c index c4d48521..4adebdea 100644 --- a/linux/src/drivers/net/seeq8005.c +++ b/linux/src/drivers/net/seeq8005.c @@ -274,7 +274,7 @@ static int seeq8005_probe1(struct device *dev, int ioaddr) dev = init_etherdev(0, sizeof(struct net_local)); if (net_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("%s: %s found at %#3x, ", dev->name, "seeq8005", ioaddr); diff --git a/linux/src/drivers/net/smc-ultra.c b/linux/src/drivers/net/smc-ultra.c index 074a235b..f593aeb6 100644 --- a/linux/src/drivers/net/smc-ultra.c +++ b/linux/src/drivers/net/smc-ultra.c @@ -156,7 +156,7 @@ int ultra_probe1(struct device *dev, int ioaddr) dev = init_etherdev(0, 0); if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); model_name = (idreg & 0xF0) == 0x20 ? "SMC Ultra" : "SMC EtherEZ"; diff --git a/linux/src/drivers/net/smc-ultra32.c b/linux/src/drivers/net/smc-ultra32.c index f616e259..6cde4c27 100644 --- a/linux/src/drivers/net/smc-ultra32.c +++ b/linux/src/drivers/net/smc-ultra32.c @@ -153,7 +153,7 @@ int ultra32_probe1(struct device *dev, int ioaddr) } if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); model_name = "SMC Ultra32"; diff --git a/linux/src/drivers/net/sundance.c b/linux/src/drivers/net/sundance.c index 47f32ebd..37231644 100644 --- a/linux/src/drivers/net/sundance.c +++ b/linux/src/drivers/net/sundance.c @@ -986,7 +986,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies; if (np->msg_level & NETIF_MSG_TX_QUEUED) { - printk(KERN_DEBUG "%s: Transmit frame #%d len %ld queued in slot %ld.\n", + printk(KERN_DEBUG "%s: Transmit frame #%d len %ld queued in slot %u.\n", dev->name, np->cur_tx, skb->len, entry); } return 0; diff --git a/linux/src/drivers/net/tlan.c b/linux/src/drivers/net/tlan.c index 11e12bbc..fedc11f3 100644 --- a/linux/src/drivers/net/tlan.c +++ b/linux/src/drivers/net/tlan.c @@ -1132,7 +1132,7 @@ u32 TLan_HandleTxEOF( struct device *dev, u16 host_int ) if ( head_list->cStat & TLAN_CSTAT_EOC ) eoc = 1; - if ( ! head_list->cStat & TLAN_CSTAT_FRM_CMP ) { + if (!(head_list->cStat & TLAN_CSTAT_FRM_CMP)) { printk( "TLAN: Received interrupt for uncompleted TX frame.\n" ); } @@ -1244,7 +1244,7 @@ u32 TLan_HandleRxEOF( struct device *dev, u16 host_int ) eoc = 1; } - if ( ! head_list->cStat & TLAN_CSTAT_FRM_CMP ) { + if (!(head_list->cStat & TLAN_CSTAT_FRM_CMP)) { printk( "TLAN: Received interrupt for uncompleted RX frame.\n" ); } else if ( bbuf ) { skb = dev_alloc_skb( head_list->frameSize + 7 ); diff --git a/linux/src/drivers/net/wd.c b/linux/src/drivers/net/wd.c index a737a01d..dd879021 100644 --- a/linux/src/drivers/net/wd.c +++ b/linux/src/drivers/net/wd.c @@ -137,7 +137,7 @@ int wd_probe1(struct device *dev, int ioaddr) } if (ei_debug && version_printed++ == 0) - printk(version); + printk("%s", version); printk("%s: WD80x3 at %#3x, ", dev->name, ioaddr); for (i = 0; i < 6; i++) diff --git a/linux/src/drivers/scsi/AM53C974.c b/linux/src/drivers/scsi/AM53C974.c index 5178ccf7..da139ced 100644 --- a/linux/src/drivers/scsi/AM53C974.c +++ b/linux/src/drivers/scsi/AM53C974.c @@ -1919,7 +1919,7 @@ if ((statreg & STATREG_PHASE) != PHASE_MSGIN) { goto EXIT_ABORT; } msg[0] = AM53C974_read_8(FFREG); -if (!msg[0] & 0x80) { +if (!(msg[0] & 0x80)) { printk("scsi%d: error: expecting IDENTIFY message, got ", instance->host_no); print_msg(msg); hostdata->aborted = 1; diff --git a/linux/src/drivers/scsi/FlashPoint.c b/linux/src/drivers/scsi/FlashPoint.c index aae35c03..8d2f1020 100644 --- a/linux/src/drivers/scsi/FlashPoint.c +++ b/linux/src/drivers/scsi/FlashPoint.c @@ -3756,17 +3756,17 @@ STATIC int SetDevSyncRate(PSCCBcard pCurrCard, PUCB p_ucb) } if(currTar_Info->TarEEValue && EE_SYNC_MASK == syncVal) return(0); - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_SYNC_MASK) + currTar_Info->TarEEValue = (!(EE_SYNC_MASK & currTar_Info->TarEEValue)) | syncVal; syncOffset = (SYNC_RATE_TBL + scsiID) / 2; temp2.tempw = utilEERead(ioPort, syncOffset); if(scsiID & 0x01) { - temp2.tempb[0] = (temp2.tempb[0] & !EE_SYNC_MASK) | syncVal; + temp2.tempb[0] = (!(EE_SYNC_MASK & temp2.tempb[0])) | syncVal; } else { - temp2.tempb[1] = (temp2.tempb[1] & !EE_SYNC_MASK) | syncVal; + temp2.tempb[1] = (!(EE_SYNC_MASK & temp2.tempb[1])) | syncVal; } utilEEWriteOnOff(ioPort, 1); utilEEWrite(ioPort, temp2.tempw, syncOffset); @@ -3845,7 +3845,7 @@ int SetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) } else { - if(!currTar_Info->TarEEValue & EE_WIDE_SCSI) + if(!(currTar_Info->TarEEValue & EE_WIDE_SCSI)) { return(0); } @@ -3854,18 +3854,18 @@ int SetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) scsiWideMode = 0; } } - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_WIDE_SCSI) + currTar_Info->TarEEValue = (!(EE_WIDE_SCSI & currTar_Info->TarEEValue)) | scsiWideMode; syncOffset = (SYNC_RATE_TBL + scsiID) / 2; temp2.tempw = utilEERead(ioPort, syncOffset); if(scsiID & 0x01) { - temp2.tempb[0] = (temp2.tempb[0] & !EE_WIDE_SCSI) | scsiWideMode; + temp2.tempb[0] = (!(EE_WIDE_SCSI & temp2.tempb[0])) | scsiWideMode; } else { - temp2.tempb[1] = (temp2.tempb[1] & !EE_WIDE_SCSI) | scsiWideMode; + temp2.tempb[1] = (!(EE_WIDE_SCSI & temp2.tempb[1])) | scsiWideMode; } utilEEWriteOnOff(ioPort, 1); utilEEWrite(ioPort, temp2.tempw, syncOffset); diff --git a/linux/src/drivers/scsi/NCR5380.c b/linux/src/drivers/scsi/NCR5380.c index 295f2ad2..4f085e9b 100644 --- a/linux/src/drivers/scsi/NCR5380.c +++ b/linux/src/drivers/scsi/NCR5380.c @@ -1949,7 +1949,7 @@ static int do_abort (struct Scsi_Host *host) { * the target sees, so we just handshake. */ - while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ); + while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ)); NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp)); @@ -2900,7 +2900,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) { NCR5380_transfer_pio(instance, &phase, &len, &data); - if (!msg[0] & 0x80) { + if (!(msg[0] & 0x80)) { printk("scsi%d : expecting IDENTIFY message, got ", instance->host_no); print_msg(msg); diff --git a/linux/src/drivers/scsi/advansys.c b/linux/src/drivers/scsi/advansys.c index ef61fac9..7aea67c8 100644 --- a/linux/src/drivers/scsi/advansys.c +++ b/linux/src/drivers/scsi/advansys.c @@ -4715,7 +4715,6 @@ advansys_detect(Scsi_Host_Template *tpnt) ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3]; ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4]; ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5]; - ep->adapter_info[6] = asc_dvc_varp->cfg->adapter_info[6]; /* * Modify board configuration. diff --git a/linux/src/drivers/scsi/t128.c b/linux/src/drivers/scsi/t128.c index d4c7452b..198e910b 100644 --- a/linux/src/drivers/scsi/t128.c +++ b/linux/src/drivers/scsi/t128.c @@ -327,7 +327,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, for (; i; --i) { while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!((instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY)) barrier(); for (; i; --i) { #endif *d++ = *reg; @@ -370,7 +370,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src for (; i; --i) { while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!((instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY)) barrier(); for (; i; --i) { #endif *reg = *s++; diff --git a/linux/src/include/asm-i386/bitops.h b/linux/src/include/asm-i386/bitops.h index fc4cf192..e2a4c14a 100644 --- a/linux/src/include/asm-i386/bitops.h +++ b/linux/src/include/asm-i386/bitops.h @@ -28,7 +28,7 @@ struct __dummy { unsigned long a[100]; }; #define ADDR (*(struct __dummy *) addr) #define CONST_ADDR (*(const struct __dummy *) addr) -extern __inline__ int set_bit(int nr, SMPVOL void * addr) +static __inline__ int set_bit(int nr, SMPVOL void * addr) { int oldbit; @@ -39,7 +39,7 @@ extern __inline__ int set_bit(int nr, SMPVOL void * addr) return oldbit; } -extern __inline__ int clear_bit(int nr, SMPVOL void * addr) +static __inline__ int clear_bit(int nr, SMPVOL void * addr) { int oldbit; @@ -50,7 +50,7 @@ extern __inline__ int clear_bit(int nr, SMPVOL void * addr) return oldbit; } -extern __inline__ int change_bit(int nr, SMPVOL void * addr) +static __inline__ int change_bit(int nr, SMPVOL void * addr) { int oldbit; @@ -61,7 +61,7 @@ extern __inline__ int change_bit(int nr, SMPVOL void * addr) return oldbit; } -extern __inline__ int test_and_set_bit(int nr, volatile void * addr) +static __inline__ int test_and_set_bit(int nr, volatile void * addr) { int oldbit; @@ -72,7 +72,7 @@ extern __inline__ int test_and_set_bit(int nr, volatile void * addr) return oldbit; } -extern __inline__ int test_and_clear_bit(int nr, volatile void * addr) +static __inline__ int test_and_clear_bit(int nr, volatile void * addr) { int oldbit; @@ -83,7 +83,7 @@ extern __inline__ int test_and_clear_bit(int nr, volatile void * addr) return oldbit; } -extern __inline__ int test_and_change_bit(int nr, volatile void * addr) +static __inline__ int test_and_change_bit(int nr, volatile void * addr) { int oldbit; @@ -98,7 +98,7 @@ extern __inline__ int test_and_change_bit(int nr, volatile void * addr) /* * This routine doesn't need to be atomic. */ -extern __inline__ int test_bit(int nr, const SMPVOL void * addr) +static __inline__ int test_bit(int nr, const SMPVOL void * addr) { return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0; } @@ -106,8 +106,9 @@ extern __inline__ int test_bit(int nr, const SMPVOL void * addr) /* * Find-bit routines.. */ -extern __inline__ int find_first_zero_bit(void * addr, unsigned size) +static __inline__ int find_first_zero_bit(void * addr, unsigned size) { + int d0, d1, d2; int res; if (!size) @@ -123,13 +124,12 @@ extern __inline__ int find_first_zero_bit(void * addr, unsigned size) "1:\tsubl %%ebx,%%edi\n\t" "shll $3,%%edi\n\t" "addl %%edi,%%edx" - :"=d" (res) - :"c" ((size + 31) >> 5), "D" (addr), "b" (addr) - :"ax", "cx", "di"); + :"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); return res; } -extern __inline__ int find_next_zero_bit (void * addr, int size, int offset) +static __inline__ int find_next_zero_bit (void * addr, int size, int offset) { unsigned long * p = ((unsigned long *) addr) + (offset >> 5); int set = 0, bit = offset & 31, res; @@ -160,7 +160,7 @@ extern __inline__ int find_next_zero_bit (void * addr, int size, int offset) * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first.. */ -extern __inline__ unsigned long ffz(unsigned long word) +static __inline__ unsigned long ffz(unsigned long word) { __asm__("bsfl %1,%0" :"=r" (word) @@ -176,7 +176,7 @@ extern __inline__ unsigned long ffz(unsigned long word) * differs in spirit from the above ffz (man ffs). */ -extern __inline__ int ffs(int x) +static __inline__ int ffs(int x) { int r; diff --git a/linux/src/include/asm-i386/io.h b/linux/src/include/asm-i386/io.h index f961f1d2..34cf105b 100644 --- a/linux/src/include/asm-i386/io.h +++ b/linux/src/include/asm-i386/io.h @@ -45,12 +45,12 @@ * make the kernel segment mapped at 0, we need to do translation * on the i386 as well) */ -extern inline unsigned long virt_to_phys(volatile void * address) +static inline unsigned long virt_to_phys(volatile void * address) { return (unsigned long) _kvtophys(address); } -extern inline void * phys_to_virt(unsigned long address) +static inline void * phys_to_virt(unsigned long address) { return (void *) phystokv(address); } @@ -90,7 +90,7 @@ extern inline void * phys_to_virt(unsigned long address) */ #define __OUT1(s,x) \ -extern inline void __out##s(unsigned x value, unsigned short port) { +static inline void __out##s(unsigned x value, unsigned short port) { #define __OUT2(s,s1,s2) \ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" @@ -102,7 +102,7 @@ __OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ __OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } #define __IN1(s) \ -extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; +static inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; #define __IN2(s,s1,s2) \ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" @@ -114,12 +114,12 @@ __IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; retu __IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } #define __INS(s) \ -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ { __asm__ __volatile__ ("cld ; rep ; ins" #s \ : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define __OUTS(s) \ -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ { __asm__ __volatile__ ("cld ; rep ; outs" #s \ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } diff --git a/linux/src/include/asm-i386/segment.h b/linux/src/include/asm-i386/segment.h index 5f8af993..d23aa173 100644 --- a/linux/src/include/asm-i386/segment.h +++ b/linux/src/include/asm-i386/segment.h @@ -60,7 +60,11 @@ static inline void __attribute__((always_inline)) __put_user(unsigned long x, vo :"ir" (x), "m" (*__sd(y))); break; default: +#ifdef __OPTIMIZE__ bad_user_access_length(); +#else + asm volatile("ud2"); +#endif } } @@ -85,7 +89,11 @@ static inline unsigned long __attribute__((always_inline)) __get_user(const void :"m" (*__const_sd(y))); return result; default: +#ifdef __OPTIMIZE__ return bad_user_access_length(); +#else + asm volatile("ud2"); +#endif } } diff --git a/linux/src/include/asm-i386/semaphore.h b/linux/src/include/asm-i386/semaphore.h index 1486d1c1..18e12c10 100644 --- a/linux/src/include/asm-i386/semaphore.h +++ b/linux/src/include/asm-i386/semaphore.h @@ -30,6 +30,10 @@ struct semaphore { #define MUTEX ((struct semaphore) { 1, 0, 0, NULL }) #define MUTEX_LOCKED ((struct semaphore) { 0, 0, 0, NULL }) +/* Special register calling convention: + * eax contains return address + * ecx contains semaphore address + */ asmlinkage void down_failed(void /* special register calling convention */); asmlinkage void up_wakeup(void /* special register calling convention */); @@ -41,20 +45,21 @@ extern void __up(struct semaphore * sem); * "down_failed" is a special asm handler that calls the C * routine that actually waits. See arch/i386/lib/semaphore.S */ -extern inline void down(struct semaphore * sem) +static inline void down(struct semaphore * sem) { + int d0; __asm__ __volatile__( "# atomic down operation\n\t" "movl $1f,%%eax\n\t" #ifdef __SMP__ "lock ; " #endif - "decl 0(%0)\n\t" + "decl %1\n\t" "js " SYMBOL_NAME_STR(down_failed) "\n" "1:\n" - :/* no outputs */ + :"=&a" (d0), "=m" (sem->count) :"c" (sem) - :"ax","dx","memory"); + :"memory"); } /* @@ -81,7 +86,7 @@ asmlinkage int down_failed_interruptible(void); /* params in registers */ * process can be killed. The down_failed_interruptible routine * returns negative for signalled and zero for semaphore acquired. */ -extern inline int down_interruptible(struct semaphore * sem) +static inline int down_interruptible(struct semaphore * sem) { int ret ; @@ -91,13 +96,13 @@ extern inline int down_interruptible(struct semaphore * sem) #ifdef __SMP__ "lock ; " #endif - "decl 0(%1)\n\t" + "decl %1\n\t" "js " SYMBOL_NAME_STR(down_failed_interruptible) "\n\t" "xorl %%eax,%%eax\n" "2:\n" - :"=a" (ret) + :"=&a" (ret), "=m" (sem->count) :"c" (sem) - :"ax","dx","memory"); + :"memory"); return(ret) ; } @@ -108,20 +113,21 @@ extern inline int down_interruptible(struct semaphore * sem) * The default case (no contention) will result in NO * jumps for both down() and up(). */ -extern inline void up(struct semaphore * sem) +static inline void up(struct semaphore * sem) { + int d0; __asm__ __volatile__( "# atomic up operation\n\t" "movl $1f,%%eax\n\t" #ifdef __SMP__ "lock ; " #endif - "incl 0(%0)\n\t" + "incl %1\n\t" "jle " SYMBOL_NAME_STR(up_wakeup) "\n1:" - :/* no outputs */ + :"=&a" (d0), "=m" (sem->count) :"c" (sem) - :"ax", "dx", "memory"); + :"memory"); } #endif diff --git a/linux/src/include/asm-i386/termios.h b/linux/src/include/asm-i386/termios.h index 76551dea..9f65b4d6 100644 --- a/linux/src/include/asm-i386/termios.h +++ b/linux/src/include/asm-i386/termios.h @@ -61,7 +61,7 @@ struct termio { /* * Translate a "termio" structure into a "termios". Ugh. */ -extern inline void trans_from_termio(struct termio * termio, +static inline void trans_from_termio(struct termio * termio, struct termios * termios) { #define SET_LOW_BITS(x,y) (*(unsigned short *)(&x) = (y)) @@ -76,7 +76,7 @@ extern inline void trans_from_termio(struct termio * termio, /* * Translate a "termios" structure into a "termio". Ugh. */ -extern inline void trans_to_termio(struct termios * termios, +static inline void trans_to_termio(struct termios * termios, struct termio * termio) { termio->c_iflag = termios->c_iflag; diff --git a/linux/src/include/linux/compiler-gcc.h b/linux/src/include/linux/compiler-gcc.h index 59e4028e..b1a0be0c 100644 --- a/linux/src/include/linux/compiler-gcc.h +++ b/linux/src/include/linux/compiler-gcc.h @@ -9,7 +9,9 @@ /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ +#ifndef barrier #define barrier() __asm__ __volatile__("": : :"memory") +#endif /* barrier */ /* * This macro obfuscates arithmetic on a variable address so that gcc diff --git a/linux/src/include/linux/compiler-gcc5.h b/linux/src/include/linux/compiler-gcc5.h new file mode 100644 index 00000000..efee4937 --- /dev/null +++ b/linux/src/include/linux/compiler-gcc5.h @@ -0,0 +1,67 @@ +#ifndef __LINUX_COMPILER_H +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead." +#endif + +#define __used __attribute__((__used__)) +#define __must_check __attribute__((warn_unused_result)) +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) + +/* Mark functions as cold. gcc will assume any path leading to a call + to them will be unlikely. This means a lot of manual unlikely()s + are unnecessary now for any paths leading to the usual suspects + like BUG(), printk(), panic() etc. [but let's keep them for now for + older compilers] + + Early snapshots of gcc 4.3 don't support this and we can't detect this + in the preprocessor, but we can live with this because they're unreleased. + Maketime probing would be overkill here. + + gcc also has a __attribute__((__hot__)) to move hot functions into + a special section, but I don't see any sense in this right now in + the kernel context */ +#define __cold __attribute__((__cold__)) + +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) + +#ifndef __CHECKER__ +# define __compiletime_warning(message) __attribute__((warning(message))) +# define __compiletime_error(message) __attribute__((error(message))) +#endif /* __CHECKER__ */ + +/* + * Mark a position in code as unreachable. This can be used to + * suppress control flow warnings after asm blocks that transfer + * control elsewhere. + * + * Early snapshots of gcc 4.5 don't support this and we can't detect + * this in the preprocessor, but we can live with this because they're + * unreleased. Really, we need to have autoconf for the kernel. + */ +#define unreachable() __builtin_unreachable() + +/* Mark a function definition as prohibited from being cloned. */ +#define __noclone __attribute__((__noclone__)) + +/* + * Tell the optimizer that something else uses this function or variable. + */ +#define __visible __attribute__((externally_visible)) + +/* + * GCC 'asm goto' miscompiles certain code sequences: + * + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 + * + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. + * + * (asm goto is automatically volatile - the naming reflects this.) + */ +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) + +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +#define __HAVE_BUILTIN_BSWAP32__ +#define __HAVE_BUILTIN_BSWAP64__ +#define __HAVE_BUILTIN_BSWAP16__ +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ + +#define KASAN_ABI_VERSION 4 diff --git a/linux/src/include/linux/compiler-gcc6.h b/linux/src/include/linux/compiler-gcc6.h new file mode 100644 index 00000000..cc2e86a9 --- /dev/null +++ b/linux/src/include/linux/compiler-gcc6.h @@ -0,0 +1,67 @@ +#ifndef __LINUX_COMPILER_H +#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead." +#endif + +#define __used __attribute__((__used__)) +#define __must_check __attribute__((warn_unused_result)) +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) + +/* Mark functions as cold. gcc will assume any path leading to a call + to them will be unlikely. This means a lot of manual unlikely()s + are unnecessary now for any paths leading to the usual suspects + like BUG(), printk(), panic() etc. [but let's keep them for now for + older compilers] + + Early snapshots of gcc 4.3 don't support this and we can't detect this + in the preprocessor, but we can live with this because they're unreleased. + Maketime probing would be overkill here. + + gcc also has a __attribute__((__hot__)) to move hot functions into + a special section, but I don't see any sense in this right now in + the kernel context */ +#define __cold __attribute__((__cold__)) + +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) + +#ifndef __CHECKER__ +# define __compiletime_warning(message) __attribute__((warning(message))) +# define __compiletime_error(message) __attribute__((error(message))) +#endif /* __CHECKER__ */ + +/* + * Mark a position in code as unreachable. This can be used to + * suppress control flow warnings after asm blocks that transfer + * control elsewhere. + * + * Early snapshots of gcc 4.5 don't support this and we can't detect + * this in the preprocessor, but we can live with this because they're + * unreleased. Really, we need to have autoconf for the kernel. + */ +#define unreachable() __builtin_unreachable() + +/* Mark a function definition as prohibited from being cloned. */ +#define __noclone __attribute__((__noclone__)) + +/* + * Tell the optimizer that something else uses this function or variable. + */ +#define __visible __attribute__((externally_visible)) + +/* + * GCC 'asm goto' miscompiles certain code sequences: + * + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 + * + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. + * + * (asm goto is automatically volatile - the naming reflects this.) + */ +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) + +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +#define __HAVE_BUILTIN_BSWAP32__ +#define __HAVE_BUILTIN_BSWAP64__ +#define __HAVE_BUILTIN_BSWAP16__ +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ + +#define KASAN_ABI_VERSION 4 diff --git a/linux/src/include/linux/compiler.h b/linux/src/include/linux/compiler.h index 320d6c94..eb3dd949 100644 --- a/linux/src/include/linux/compiler.h +++ b/linux/src/include/linux/compiler.h @@ -143,8 +143,12 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); #endif /* CONFIG_PROFILE_ALL_BRANCHES */ #else -# define likely(x) __builtin_expect(!!(x), 1) -# define unlikely(x) __builtin_expect(!!(x), 0) +# ifndef likely +# define likely(x) __builtin_expect(!!(x), 1) +# endif /* likely */ +# ifndef unlikely +# define unlikely(x) __builtin_expect(!!(x), 0) +# endif /* unlikely */ #endif /* Optimization barrier */ diff --git a/linux/src/include/linux/interrupt.h b/linux/src/include/linux/interrupt.h index 5765260d..02244756 100644 --- a/linux/src/include/linux/interrupt.h +++ b/linux/src/include/linux/interrupt.h @@ -43,14 +43,14 @@ enum { ISICOM_BH }; -extern inline void init_bh(int nr, void (*routine)(void)) +static inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; bh_mask_count[nr] = 0; bh_mask |= 1 << nr; } -extern inline void mark_bh(int nr) +static inline void mark_bh(int nr) { set_bit(nr, &bh_active); } @@ -59,13 +59,13 @@ extern inline void mark_bh(int nr) * These use a mask count to correctly handle * nested disable/enable calls */ -extern inline void disable_bh(int nr) +static inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); bh_mask_count[nr]++; } -extern inline void enable_bh(int nr) +static inline void enable_bh(int nr) { if (!--bh_mask_count[nr]) bh_mask |= 1 << nr; @@ -75,13 +75,13 @@ extern inline void enable_bh(int nr) * start_bh_atomic/end_bh_atomic also nest * naturally by using a counter */ -extern inline void start_bh_atomic(void) +static inline void start_bh_atomic(void) { intr_count++; barrier(); } -extern inline void end_bh_atomic(void) +static inline void end_bh_atomic(void) { barrier(); intr_count--; diff --git a/linux/src/include/linux/string.h b/linux/src/include/linux/string.h index 214503c2..62ff8802 100644 --- a/linux/src/include/linux/string.h +++ b/linux/src/include/linux/string.h @@ -12,25 +12,33 @@ extern "C" { #endif extern char * ___strtok; +#if 0 extern char * strcpy(char *,const char *); extern char * strncpy(char *,const char *, __kernel_size_t); extern char * strcat(char *, const char *); extern char * strncat(char *, const char *, __kernel_size_t); extern char * strchr(const char *,int); extern char * strrchr(const char *,int); +#endif extern char * strpbrk(const char *,const char *); extern char * strtok(char *,const char *); extern char * strstr(const char *,const char *); +#if 0 extern __kernel_size_t strlen(const char *); extern __kernel_size_t strnlen(const char *,__kernel_size_t); +#endif extern __kernel_size_t strspn(const char *,const char *); +#if 0 extern int strcmp(const char *,const char *); extern int strncmp(const char *,const char *,__kernel_size_t); +#endif extern void * memset(void *,int,__kernel_size_t); extern void * memcpy(void *,const void *,__kernel_size_t); +#if 0 extern void * memmove(void *,const void *,__kernel_size_t); extern void * memscan(void *,int,__kernel_size_t); +#endif extern int memcmp(const void *,const void *,__kernel_size_t); /* diff --git a/linux/src/include/net/route.h b/linux/src/include/net/route.h index 7bf32d0a..2af1a419 100644 --- a/linux/src/include/net/route.h +++ b/linux/src/include/net/route.h @@ -105,30 +105,30 @@ extern unsigned ip_rt_bh_mask; extern struct rtable *ip_rt_hash_table[RT_HASH_DIVISOR]; extern void rt_free(struct rtable * rt); -extern __inline__ void ip_rt_fast_lock(void) +static __inline__ void ip_rt_fast_lock(void) { atomic_inc(&ip_rt_lock); } -extern __inline__ void ip_rt_fast_unlock(void) +static __inline__ void ip_rt_fast_unlock(void) { atomic_dec(&ip_rt_lock); } -extern __inline__ void ip_rt_unlock(void) +static __inline__ void ip_rt_unlock(void) { if (atomic_dec_and_test(&ip_rt_lock) && ip_rt_bh_mask) ip_rt_run_bh(); } -extern __inline__ unsigned ip_rt_hash_code(__u32 addr) +static __inline__ unsigned ip_rt_hash_code(__u32 addr) { unsigned tmp = addr + (addr>>16); return (tmp + (tmp>>8)) & 0xFF; } -extern __inline__ void ip_rt_put(struct rtable * rt) +static __inline__ void ip_rt_put(struct rtable * rt) #ifndef MODULE { /* If this rtable entry is not in the cache, we'd better free @@ -142,9 +142,9 @@ extern __inline__ void ip_rt_put(struct rtable * rt) #endif #ifdef CONFIG_KERNELD -extern struct rtable * ip_rt_route(__u32 daddr, int local, struct device *dev); +static struct rtable * ip_rt_route(__u32 daddr, int local, struct device *dev); #else -extern __inline__ struct rtable * ip_rt_route(__u32 daddr, int local, struct device *dev) +static __inline__ struct rtable * ip_rt_route(__u32 daddr, int local, struct device *dev) #ifndef MODULE { struct rtable * rth; @@ -170,7 +170,7 @@ extern __inline__ struct rtable * ip_rt_route(__u32 daddr, int local, struct dev #endif #endif -extern __inline__ struct rtable * ip_check_route(struct rtable ** rp, __u32 daddr, +static __inline__ struct rtable * ip_check_route(struct rtable ** rp, __u32 daddr, int local, struct device *dev) { struct rtable * rt = *rp; diff --git a/linux/src/include/net/sock.h b/linux/src/include/net/sock.h index 7a3ec03f..25a90444 100644 --- a/linux/src/include/net/sock.h +++ b/linux/src/include/net/sock.h @@ -559,7 +559,7 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *skb, * packet ever received. */ -extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) +static __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { if (sk->rmem_alloc + skb->truesize >= sk->rcvbuf) return -ENOMEM; @@ -571,7 +571,7 @@ extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) return 0; } -extern __inline__ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) +static __inline__ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { if (sk->rmem_alloc + skb->truesize >= sk->rcvbuf) return -ENOMEM; @@ -587,7 +587,7 @@ extern __inline__ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) * Recover an error report and clear atomically */ -extern __inline__ int sock_error(struct sock *sk) +static __inline__ int sock_error(struct sock *sk) { int err=xchg(&sk->err,0); return -err; |