From 073695fe817787eb6736816a75c355a5da73c0b9 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 21 Sep 1999 03:18:22 +0000 Subject: [PATCH] fix the command install, add some macros into netboot, fix the function set_partition_hidden_flag. --- ChangeLog | 31 +++++++++++++++++++++++++++++++ netboot/3c59x.c | 4 ++-- netboot/config.c | 8 ++++---- netboot/io.h | 40 ++++++++++++++++++++++++++++++++++++++++ netboot/pci.h | 2 ++ stage2/builtins.c | 9 +++------ stage2/disk_io.c | 25 +++++++++++-------------- 7 files changed, 93 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef6a70990..ccbdb4d86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +1999-09-20 Edmund GRIMLEY EVANS + + * netboot/3c59x.c: INCLUDE_3c59x is replaced by INCLUDE_3C59X + throughout. + * netboot/config.c: Likewise. + * netboot/io.h (__INS): New macro. + (__OUTS): Likewise. + (outl): Likewise. + (inl): Likewise. + (outl_p): Likewise. + (inl_p): Likewise. + Call __INS with the argument `b', with `w' and with `l' to + define insb, insw and insl, respectively. Likewise, Call __OUTS + with `b', with `w' and with `l' to define outsb, outw and outl, + respectively. + * netboot/pci.h (PCI_VENDOR_ID_VORTEX): New macro. + (PCI_DEVICE_ID_VORTEX_3c595): Likewise. Defined as a random + value. + +1999-09-20 Edward Killips + + * stage2/disk_io.c (set_partition_hidden_flag): Set/cleat the + hidden flag, whether the hidden flag is set or not. + +1999-09-21 OKUJI Yoshinori + + * stage2/builtins.c (install_func): Do not set DEBUG_FS at the + first read. Set it to DEBUG_FS_BLOCKLIST_FUNC when reading the + whole of Stage 2. Set FILEPOS to zero at the same time to read + from the beginning of Stage 2. Reported by Pavel Roskin. + 1999-09-20 OKUJI Yoshinori The argument ADDR for the command install is now optional. diff --git a/netboot/3c59x.c b/netboot/3c59x.c index d2cd5721a..fccdf0e39 100644 --- a/netboot/3c59x.c +++ b/netboot/3c59x.c @@ -14,7 +14,7 @@ Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771 */ -#ifdef INCLUDE_3c59x +#ifdef INCLUDE_3C59X #define lx_outb(a,b) outb(b,a) @@ -1169,4 +1169,4 @@ struct nic *VX_probe(struct nic *nic, unsigned short *probe_addrs) return 0; } -#endif /* INCLUDE_3c59x */ +#endif /* INCLUDE_3C59X */ diff --git a/netboot/config.c b/netboot/config.c index b63cecf27..ea4022be4 100644 --- a/netboot/config.c +++ b/netboot/config.c @@ -4,7 +4,7 @@ #include "netboot_config.h" #undef INCLUDE_PCI -#if defined(INCLUDE_NEPCI) || defined(INCLUDE_EEPRO100) || defined (INCLUDE_3c59x) +#if defined(INCLUDE_NEPCI) || defined(INCLUDE_EEPRO100) || defined (INCLUDE_3C59X) /* || others later */ #if defined(NETBOOT32) /* only for 32 bit machines */ #define INCLUDE_PCI @@ -33,7 +33,7 @@ struct pci_device pci_nic_list[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557, "Intel EtherExpressPro100"}, #endif -#ifdef INCLUDE_3c59x +#ifdef INCLUDE_3C59X {PCI_VENDOR_ID_VORTEX, PCI_DEVICE_ID_VORTEX_3c595, "3c595"}, #endif @@ -83,7 +83,7 @@ extern struct nic *cs89x0_probe(struct nic *, unsigned short *); extern struct nic *ne2100_probe(struct nic *, unsigned short *); #endif -#ifdef INCLUDE_3c59x +#ifdef INCLUDE_3C59X extern struct nic *VX_probe(struct nic *, unsigned short *); #endif @@ -120,7 +120,7 @@ static struct dispatch_table NIC[] = { "NE*000/PCI", nepci_probe, pci_addrs }, #endif -#ifdef INCLUDE_3c59x +#ifdef INCLUDE_3C59X {"VorTex/PCI", VX_probe, pci_addrs}, #endif diff --git a/netboot/io.h b/netboot/io.h index 5e01163f5..230a29dcb 100644 --- a/netboot/io.h +++ b/netboot/io.h @@ -34,6 +34,18 @@ __IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \ __IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ __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); \ +extern 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); \ +extern 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)); } + #define RETURN_TYPE unsigned char /* __IN(b,"b","0" (0)) */ __IN(b,"") @@ -50,6 +62,14 @@ __OUT(b,"b",char) __OUT(w,"w",short) __OUT(l,,int) +__INS(b) +__INS(w) +__INS(l) + +__OUTS(b) +__OUTS(w) +__OUTS(l) + #define outb(port,val) \ ((__builtin_constant_p((port)) && (port) < 256) ? \ __outbc((val),(port)) : \ @@ -90,4 +110,24 @@ __OUT(l,,int) __inwc_p(port) : \ __inw_p(port)) +#define outl(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc((val),(port)) : \ + __outl((val),(port))) + +#define inl(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc(port) : \ + __inl(port)) + +#define outl_p(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc_p((val),(port)) : \ + __outl_p((val),(port))) + +#define inl_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc_p(port) : \ + __inl_p(port)) + #endif diff --git a/netboot/pci.h b/netboot/pci.h index d279bec75..d4f235cd5 100644 --- a/netboot/pci.h +++ b/netboot/pci.h @@ -80,6 +80,8 @@ __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory") #define PCI_DEVICE_ID_VIA_82C926 0x0926 #define PCI_VENDOR_ID_SURECOM 0x10bd #define PCI_DEVICE_ID_SURECOM_NE34 0x0e34 +#define PCI_VENDOR_ID_VORTEX 0x1119 +#define PCI_DEVICE_ID_VORTEX_3c595 0x1234 /* Correct value unknown */ struct pci_device { unsigned short vendor, dev_id; diff --git a/stage2/builtins.c b/stage2/builtins.c index 515403633..3b040f492 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -893,20 +893,15 @@ install_func (char *arg, int flags) } installlist = BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4; - debug_fs = debug_fs_blocklist_func; /* Read the first sector of Stage 2. */ if (! grub_read ((char *) SCRATCHADDR, SECTOR_SIZE) == SECTOR_SIZE) - { - debug_fs = 0; - return 1; - } + return 1; /* Check for the version of Stage 2. */ if (*((short *) (SCRATCHADDR + STAGE2_VER_MAJ_OFFS)) != COMPAT_VERSION) { errnum = ERR_BAD_VERSION; - debug_fs = 0; return 1; } @@ -949,6 +944,8 @@ install_func (char *arg, int flags) } /* Read the whole of Stage 2. */ + filepos = 0; + debug_fs = debug_fs_blocklist_func; if (! grub_read ((char *) RAW_ADDR (0x100000), -1)) { debug_fs = 0; diff --git a/stage2/disk_io.c b/stage2/disk_io.c index c9e963d8f..fa7d6dee3 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -340,20 +340,17 @@ set_partition_hidden_flag (int hidden) if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR)) return 0; - if (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG) - { - if (hidden) - PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG; - else - PC_SLICE_TYPE (SCRATCHADDR, part) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; - - buf_track = -1; - if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom, - 0, 1, SCRATCHSEG)) - { - errnum = ERR_WRITE; - return 0; - } + if (hidden) + PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG; + else + PC_SLICE_TYPE (SCRATCHADDR, part) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; + + buf_track = -1; + if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom, + 0, 1, SCRATCHSEG)) + { + errnum = ERR_WRITE; + return 0; } }